diff options
-rwxr-xr-x | check | 5 | ||||
-rw-r--r-- | distbuild/build_controller.py | 10 | ||||
-rwxr-xr-x | morphlib/exts/virtualbox-ssh.write | 4 | ||||
-rwxr-xr-x | scripts/check-copyright-year | 23 | ||||
-rwxr-xr-x | scripts/check-silliness | 6 |
5 files changed, 30 insertions, 18 deletions
@@ -96,12 +96,13 @@ errors=0 if "$run_style" && [ -d .git ]; then echo "Checking copyright statements" - if ! (git ls-files -z | xargs -0r scripts/check-copyright-year); then + if ! (git ls-files --cached -z | + xargs -0r scripts/check-copyright-year); then errors=1 fi echo 'Checking source code for silliness' - if ! (git ls-files | + if ! (git ls-files --cached | grep -v '\.gz$' | grep -Ev 'tests[^/]*/.*\.std(out|err)' | grep -vF 'tests.build/build-system-autotools.script' | diff --git a/distbuild/build_controller.py b/distbuild/build_controller.py index f596a295..a3911586 100644 --- a/distbuild/build_controller.py +++ b/distbuild/build_controller.py @@ -321,12 +321,6 @@ class BuildController(distbuild.StateMachine): notify_success(artifact) - def _artifact_filename(self, artifact): - return ('%s.%s.%s' % - (artifact.cache_key, - artifact.source.morphology['kind'], - artifact.name)) - def _start_annotating(self, event_source, event): distbuild.crash_point() @@ -336,7 +330,7 @@ class BuildController(distbuild.StateMachine): def set_state_and_append(artifact): artifact.state = UNKNOWN - artifact_names.append(self._artifact_filename(artifact)) + artifact_names.append(artifact.basename()) map_build_graph(self._artifact, set_state_and_append) @@ -356,7 +350,7 @@ class BuildController(distbuild.StateMachine): def _maybe_handle_cache_response(self, event_source, event): def set_status(artifact): - is_in_cache = cache_state[self._artifact_filename(artifact)] + is_in_cache = cache_state[artifact.basename()] artifact.state = BUILT if is_in_cache else UNBUILT if self._helper_id != event.msg['id']: diff --git a/morphlib/exts/virtualbox-ssh.write b/morphlib/exts/virtualbox-ssh.write index 2a2f3f7b..b9d53579 100755 --- a/morphlib/exts/virtualbox-ssh.write +++ b/morphlib/exts/virtualbox-ssh.write @@ -116,7 +116,7 @@ class VirtualBoxPlusSshWriteExtension(morphlib.writeexts.WriteExtension): # comparing against the major, minor and patch numbers directly self.status(msg='Checking version of remote VirtualBox') build_id = cliapp.ssh_runcmd(ssh_host, ['VBoxManage', '--version']) - version_string = re.match(r"^([0-9\.])+.*$", build_id.strip()).group(1) + version_string = re.match(r"^([0-9\.]+).*$", build_id.strip()).group(1) return tuple(int(s or '0') for s in version_string.split('.')) def create_virtualbox_guest(self, ssh_host, vm_name, vdi_path, autostart): @@ -130,7 +130,7 @@ class VirtualBoxPlusSshWriteExtension(morphlib.writeexts.WriteExtension): hostonly_iface = self.get_host_interface(ssh_host) - if self.virtualbox_version(ssh_host) < (4, 3): + if self.virtualbox_version(ssh_host) < (4, 3, 0): sataportcount_option = '--sataportcount' else: sataportcount_option = '--portcount' diff --git a/scripts/check-copyright-year b/scripts/check-copyright-year index 99a6df94..d72ddbc6 100755 --- a/scripts/check-copyright-year +++ b/scripts/check-copyright-year @@ -2,7 +2,7 @@ # # Does the copyright statement include the year of the latest git commit? # -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012, 2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,6 +18,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import datetime import re import cliapp @@ -33,23 +34,39 @@ class CheckCopyrightYear(cliapp.Application): def setup(self): self.all_ok = True + self.uncommitted = self.get_uncommitted_files() + self.this_year = datetime.datetime.now().year def cleanup(self): if not self.all_ok: raise cliapp.AppException('Some copyright years need fixing') + def get_uncommitted_files(self): + filenames = set() + status = self.runcmd(['git', 'status', '--porcelain', '-z']) + tokens = status.rstrip('\0').split('\0') + while tokens: + tok = tokens.pop(0) + filenames.add(tok[3:]) + if 'R' in tok[0:2]: + filenames.add(tokens.pop(0)) + return filenames + def process_input_line(self, filename, line): m = self.pat.match(line) if not m: return - year = self.get_git_commit_year(filename) + year = None + if filename not in self.uncommitted: + year = self.get_git_commit_year(filename) + if year is None: # git does not have a commit date for the file, which might # happen if the file isn't committed yet. This happens during # development, and it's OK. It's not quite a lumberjack, but # let's not get into gender stereotypes here. - return + year = self.this_year ok = False for start, end in self.get_copyright_years(m): diff --git a/scripts/check-silliness b/scripts/check-silliness index f956e647..597eb664 100755 --- a/scripts/check-silliness +++ b/scripts/check-silliness @@ -2,7 +2,7 @@ # # Does the file contain any of the code constructs deemed silly? # -# Copyright (C) 2013 Codethink Limited +# Copyright (C) 2013, 2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,10 +32,10 @@ for x; do # IMPLEMENTS lines of them *.yarn) ;; *) - if awk 'length > 79' "$x" | grep . > /dev/null + if awk 'length($0) > 79' "$x" | grep . > /dev/null then echo "ERROR: $x has lines longer than 79 chars" 1>&2 - awk 'length > 79 { print NR, $0 }' "$x" 1>&2 + awk 'length($0) > 79 { print NR, $0 }' "$x" 1>&2 errors=1 fi ;; |