From 50eb2d9039a3598be64e977a9c2d4bbcdad4a414 Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Tue, 8 Oct 2013 13:09:37 +0000 Subject: Add yarn test for autotools version guesser --- yarns/branches-workspaces.yarn | 8 ++++++++ yarns/implementations.yarn | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/yarns/branches-workspaces.yarn b/yarns/branches-workspaces.yarn index f523ebcd..cd3f7a0e 100644 --- a/yarns/branches-workspaces.yarn +++ b/yarns/branches-workspaces.yarn @@ -352,3 +352,11 @@ Petrifying also leaves null refs unmolested AND remembering all refs in foo AND petrifying foo THEN in branch foo, system test-system refs test-stratum in None + +Generating a manifest works + + SCENARIO morph generates a manifest + GIVEN a workspace + AND a system artifact + WHEN morph generates a manifest + THEN the manifest is generated diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index e35e4219..14ac685c 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -382,3 +382,38 @@ Tagging. assert_morphologies_are_petrified "$MATCH_1" temptemptemp done +Generating a manifest. + + IMPLEMENTS GIVEN a system artifact + mkdir "$DATADIR/hello_world" + + git init "$DATADIR/hello_world" + touch "$DATADIR/hello_world/configure.ac" + run_in "$DATADIR/hello_world" git add configure.ac + run_in "$DATADIR/hello_world" git commit -m 'Add configure.ac' + + mkdir "$DATADIR/baserock" + run_in "$DATADIR/hello_world" cat << EOF > "$DATADIR/baserock/hello_world.meta" + { + "artifact-name": "hello_world", + "cache-key": "ab8d00a80298a842446ce23507cea6b4d0e34c7ddfa05c67f460318b04d21308", + "kind": "chunk", + "morphology": "hello_world.morph", + "original_ref": "$(run_in "$DATADIR/hello_world" git rev-parse HEAD)", + "repo": "file://$DATADIR/hello_world", + "repo-alias": "upstream:hello_world", + "sha1": "$(run_in "$DATADIR/hello_world" git rev-parse HEAD)", + "source-name": "hello_world" + } + EOF + run_in "$DATADIR" tar -c baserock > "$DATADIR/artifact.tar" + + IMPLEMENTS WHEN morph generates a manifest + run_morph generate-manifest "$DATADIR/artifact.tar" > "$DATADIR/manifest" + + IMPLEMENTS THEN the manifest is generated + + # Generated manifest should contain the name of the repository + if ! grep -q hello_world "$DATADIR/manifest"; then + die "Output isn't what we expect" + fi -- cgit v1.2.1 From 1d9b4442eec790f1b18bc8df380a29ac0ff23e00 Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Tue, 8 Oct 2013 17:08:34 +0000 Subject: Fix bug in autotools version --- morphlib/plugins/artifact_inspection_plugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/morphlib/plugins/artifact_inspection_plugin.py b/morphlib/plugins/artifact_inspection_plugin.py index 6c321abb..9181d488 100644 --- a/morphlib/plugins/artifact_inspection_plugin.py +++ b/morphlib/plugins/artifact_inspection_plugin.py @@ -78,7 +78,8 @@ class AutotoolsVersionGuesser(ProjectVersionGuesser): break # Then, try running autoconf against the configure script - version = self._check_autoconf_package_version(filename, data) + version = self._check_autoconf_package_version( + repo, ref, filename, data) if version: self.app.status( msg='%(repo)s: Version of %(ref)s detected ' @@ -107,7 +108,7 @@ class AutotoolsVersionGuesser(ProjectVersionGuesser): return version return None - def _check_autoconf_package_version(self, filename, data): + def _check_autoconf_package_version(self, repo, ref, filename, data): tempdir = morphlib.tempdir.Tempdir(self.app.settings['tempdir']) with open(tempdir.join(filename), 'w') as f: f.write(data) -- cgit v1.2.1