diff --git a/README.md b/README.md index 78dd0db998de11b7ad9865a88aca81197af17cee..2e2e64fd25aab763e54836e09949637eccfab0e5 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 c28d9d889437080992f6e303a994bdb8294e7bfb..60dc62228685c66214a396ccd1658b77a2cbee16 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@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@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)