From 919fe7a3a19d79dcbc92050325f46d7a7eb50ebc Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 4 Apr 2014 00:46:47 -0600 Subject: [PATCH] Remove the old Travis-specific files that are no longer necessary Docker-DCO-1.1-Signed-off-by: Andrew Page (github: tianon) --- .travis.yml | 2 -- hack/travis/dco.py | 54 -------------------------------------------- hack/travis/env.py | 21 ----------------- hack/travis/gofmt.py | 31 ------------------------- 4 files changed, 108 deletions(-) delete mode 100755 hack/travis/dco.py delete mode 100644 hack/travis/env.py delete mode 100755 hack/travis/gofmt.py diff --git a/.travis.yml b/.travis.yml index 85aaec13f50da..832a8dd477a23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,6 @@ install: true before_script: - env | sort - - sudo apt-get update -qq - - sudo apt-get install -qq python-yaml - sudo pip install -r docs/requirements.txt script: diff --git a/hack/travis/dco.py b/hack/travis/dco.py deleted file mode 100755 index f873940815c41..0000000000000 --- a/hack/travis/dco.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python -import re -import subprocess -import yaml - -from env import commit_range - -commit_format = '-%n hash: "%h"%n author: %aN <%aE>%n message: |%n%w(0,2,2).%B' - -gitlog = subprocess.check_output([ - 'git', 'log', '--reverse', - '--format=format:'+commit_format, - '..'.join(commit_range), '--', -]) - -commits = yaml.load(gitlog) -if not commits: - exit(0) # what? how can we have no commits? - -DCO = 'Docker-DCO-1.1-Signed-off-by:' - -p = re.compile(r'^{0} ([^<]+) <([^<>@]+@[^<>]+)> \(github: (\S+)\)$'.format(re.escape(DCO)), re.MULTILINE|re.UNICODE) - -failed_commits = 0 - -for commit in commits: - commit['message'] = commit['message'][1:] - # trim off our '.' that exists just to prevent fun YAML parsing issues - # see https://github.com/dotcloud/docker/pull/3836#issuecomment-33723094 - # and https://travis-ci.org/dotcloud/docker/builds/17926783 - - commit['stat'] = subprocess.check_output([ - 'git', 'log', '--format=format:', '--max-count=1', - '--name-status', commit['hash'], '--', - ]) - if commit['stat'] == '': - print 'Commit {0} has no actual changed content, skipping.'.format(commit['hash']) - continue - - m = p.search(commit['message']) - if not m: - print 'Commit {1} does not have a properly formatted "{0}" marker.'.format(DCO, commit['hash']) - failed_commits += 1 - continue # print ALL the commits that don't have a proper DCO - - (name, email, github) = m.groups() - - # TODO verify that "github" is the person who actually made this commit via the GitHub API - -if failed_commits > 0: - exit(failed_commits) - -print 'All commits have a valid "{0}" marker.'.format(DCO) -exit(0) diff --git a/hack/travis/env.py b/hack/travis/env.py deleted file mode 100644 index 9830b8df34c7f..0000000000000 --- a/hack/travis/env.py +++ /dev/null @@ -1,21 +0,0 @@ -import os -import subprocess - -if 'TRAVIS' not in os.environ: - print 'TRAVIS is not defined; this should run in TRAVIS. Sorry.' - exit(127) - -if os.environ['TRAVIS_PULL_REQUEST'] != 'false': - commit_range = ['upstream/' + os.environ['TRAVIS_BRANCH'], 'FETCH_HEAD'] -else: - try: - subprocess.check_call([ - 'git', 'log', '-1', '--format=format:', - os.environ['TRAVIS_COMMIT_RANGE'], '--', - ]) - commit_range = os.environ['TRAVIS_COMMIT_RANGE'].split('...') - if len(commit_range) == 1: # if it didn't split, it must have been separated by '..' instead - commit_range = commit_range[0].split('..') - except subprocess.CalledProcessError: - print 'TRAVIS_COMMIT_RANGE is invalid. This seems to be a force push. We will just assume it must be against upstream master and compare all commits in between.' - commit_range = ['upstream/master', 'HEAD'] diff --git a/hack/travis/gofmt.py b/hack/travis/gofmt.py deleted file mode 100755 index dc724bc90ec8a..0000000000000 --- a/hack/travis/gofmt.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python -import subprocess - -from env import commit_range - -files = subprocess.check_output([ - 'git', 'diff', '--diff-filter=ACMR', - '--name-only', '...'.join(commit_range), '--', -]) - -exit_status = 0 - -for filename in files.split('\n'): - if filename.startswith('vendor/'): - continue # we can't be changing our upstream vendors for gofmt, so don't even check them - - if filename.endswith('.go'): - try: - out = subprocess.check_output(['gofmt', '-s', '-l', filename]) - if out != '': - print out, - exit_status = 1 - except subprocess.CalledProcessError: - exit_status = 1 - -if exit_status != 0: - print 'Reformat the files listed above with "gofmt -s -w" and try again.' - exit(exit_status) - -print 'All files pass gofmt.' -exit(0)