[reprotest] 01/01: More reliable build artifact pattern matching, and update docs
Ximin Luo
infinity0 at debian.org
Thu Sep 22 18:32:15 UTC 2016
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository reprotest.
commit eb4146f9af0a733bc1179a8bff086b67d7344e1a
Author: Ximin Luo <infinity0 at debian.org>
Date: Thu Sep 22 20:31:59 2016 +0200
More reliable build artifact pattern matching, and update docs
Don't try to do fancy things with the pattern, just cd into the build directory
and use it directly. Should support names-with-spaces better this way.
---
README.md | 58 ++++++++++++++++++++++++++++++++++-----------------
reprotest/__init__.py | 12 +++++------
2 files changed, 44 insertions(+), 26 deletions(-)
diff --git a/README.md b/README.md
index 78dd0db..2e2e64f 100644
--- a/README.md
+++ b/README.md
@@ -1,26 +1,46 @@
Command Line Interface
-=====================
+======================
reprotest's CLI takes two mandatory arguments, the build command to
-run and the build artifact file to test after running the build. If
-the build command or build artifact have spaces, they have to be
-passed as strings, e.g. `"debuild -b -uc -us"`. For optional
-arguments, it has `--variations`, which accepts a list of possible
-build variations to test, one or more of 'captures_environment',
-'domain_host', 'filesystem', 'home', 'kernel', 'locales', 'path',
-'shell', 'time', 'timezone', 'umask', and 'user_group' (see
+run and the build artifact file/pattern to test after running the
+build. Here are some sample invocations for running reprotest on
+itself:
+
+ reprotest 'python3 setup.py bdist' 'dist/*.tar.gz'
+ reprotest 'python3 setup.py bdist_wheel' 'dist/*.whl' qemu /path/to/qemu.img
+ reprotest 'debuild -b -uc -us' '../*.deb' schroot unstable-amd64
+ reprotest 'debuild -b -uc -us' '../*.deb' -- null -d
+
+When using reprotest from a shell:
+
+If the build command has spaces, you will need to quote them, e.g.
+`reprotest "debuild -b -uc -us" [..]`.
+
+If you want to use several build artifact patterns, you will also
+need to quote them, e.g. `reprotest [..] "*.tar.gz *.tar.xz"`.
+
+If your build artifacts have spaces in their names, you will need to
+quote these twice, e.g. `'"a file with spaces.gz"'` for a single
+artifact or `'"dir 1"/* "dir 2"/*'` for multiple patterns.
+
+For optional arguments, it has:
+
+`--variations`, which accepts a list of possible build variations to
+test, one or more of 'captures_environment', 'domain_host',
+'filesystem', 'home', 'kernel', 'locales', 'path', 'shell', 'time',
+'timezone', 'umask', and 'user_group' (see
[variations](https://tests.reproducible-builds.org/index_variations.html)
-for more information); `--dont_vary`, which makes reprotest *not* test
-any variations in the given list (the default is to run all
-variations); `--source_root`, which accepts a directory to run the
-build command in and defaults to the current working directory; and
---verbose, which will eventually enable more detailed logging. To get
-help for the CLI, run `reprotest -h` or `reprotest --help`. Here are
-some sample command-line invocations for running reprotest on itself:
-
- reprotest 'python3 setup.py bdist' dist/reprotest-0.2.linux-x86_64.tar.gz null
- reprotest 'python3 setup.py bdist_wheel' dist/reprotest-0.2-py3-none-any.whl qemu /path/to/qemu.img
- reprotest 'debuild -b -uc -us' '../reprotest_0.2_all.deb' schroot unstable-amd64
+for more information);
+
+`--dont_vary`, which makes reprotest *not* test any variations in the
+given list (the default is to run all variations);
+
+`--source_root`, which accepts a directory to run the build command
+in and defaults to the current working directory; and
+
+`--verbose`, which will eventually enable more detailed logging.
+
+To get help for the CLI, run `reprotest -h` or `reprotest --help`.
Config File
diff --git a/reprotest/__init__.py b/reprotest/__init__.py
index c28d9d8..60dc622 100644
--- a/reprotest/__init__.py
+++ b/reprotest/__init__.py
@@ -7,7 +7,6 @@ import configparser
import logging
import os
import pathlib
-import shlex
import subprocess
import sys
import tempfile
@@ -314,14 +313,13 @@ def build(script, source_root, dist_root, artifact_pattern, testbed, artifact_st
# testbed.execute(['ls', '-l', source_root])
# testbed.execute(['stat', source_root])
# testbed.execute(['stat', built_artifact])
- patterns = " ".join(os.path.join(source_root, part) for part in shlex.split(artifact_pattern))
testbed.check_exec(
- ['sh', '-ec', 'mkdir -p "%s" && cp -R -t "%s" %s && touch -d at 0 "%s" "%s"/*' %
- (dist_root, dist_root, patterns, dist_root, dist_root)])
+ ['sh', '-ec', 'mkdir -p "%s" && cd "%s" && cp -R -t "%s" %s && touch -d at 0 "%s" "%s"/*' %
+ (dist_root, source_root, dist_root, artifact_pattern, dist_root, dist_root)])
testbed.command('copyup', (dist_root, artifact_store))
-def check(build_command, artifact_name, virtual_server_args, source_root,
+def check(build_command, artifact_pattern, virtual_server_args, source_root,
no_clean_on_error, variations=VARIATIONS):
# print(virtual_server_args)
with tempfile.TemporaryDirectory() as temp_dir, \
@@ -345,12 +343,12 @@ def check(build_command, artifact_name, virtual_server_args, source_root,
# print(env)
# print(tree)
build(script.control, tree.control, dist.control,
- os.path.join(tree.control, artifact_name),
+ artifact_pattern,
testbed,
os.path.join(temp_dir, 'control_artifact/'),
env=env.control)
build(script.experiment, tree.experiment, dist.experiment,
- os.path.join(tree.experiment, artifact_name),
+ artifact_pattern,
testbed,
os.path.join(temp_dir, 'experiment_artifact/'),
env=env.experiment)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/reprotest.git
More information about the Reproducible-commits
mailing list