Loading README.rst +29 −16 Original line number Diff line number Diff line Loading @@ -219,6 +219,11 @@ of names is given in the --help text for --variations. Most variations do not have parameters, and for them only the + and - operators are relevant. The variations that accept parameters are: domain_host.use_sudo An integer, whether to use sudo(1) together with unshare(1) to change the system hostname and domainname. 0 means don't use sudo; any non-zero value means to use sudo. Default is 0, however this is not recommended and make may your build fail, see "Varying the domain and host names" for details. environment.variables A semicolon-separated ordered set, specifying environment variables that reprotest should try to vary. Default is "REPROTEST_CAPTURE_ENVIRONMENT". Loading Loading @@ -266,6 +271,22 @@ means to vary home, time (the last given value for --variations), timezone, and -time (the given multiple values for --vary), i.e. home and timezone. Varying the user or group ========================= Doing this without sudo *may* result in your build failing. Failure is likely if your build must do system-related things - as opposed to only processing bits and bytes. This is because it runs in a separate namespace where your non-privileged user looks like it is "root", but this prevents the filesystem from recognising files owned by the real "root" user, amongst other things. This is a limitation of unshare(1) and it is not possible work around this in reprotest without heavy effort. Therefore, it is recommended to run this variation with use_sudo=1. To avoid password prompts, see the section "Avoid sudo(1) password prompts" below. Varying the user or group ========================= Loading @@ -280,22 +301,14 @@ There is currently no good way to do this. The following is a very brittle and unclean solution. You will have to decide for yourself if it's worth it for your use-case:: $ OTHERUSER=(YOUR OTHER USER HERE) $ a="[a-zA-Z0-9]" $ cat <<EOF | sudo tee -a /etc/sudoers.d/local-reprotest $USER ALL = ($OTHERUSER) NOPASSWD: ALL $USER ALL = NOPASSWD: /bin/chown -h -R --from=$OTHERUSER $USER /tmp/autopkgtest.$a$a$a$a$a$a/const_build_path/ $USER ALL = NOPASSWD: /bin/chown -h -R --from=$OTHERUSER $USER /tmp/autopkgtest.$a$a$a$a$a$a/build-experiment-[1-9]/ $USER ALL = NOPASSWD: /bin/chown -h -R --from=$OTHERUSER $USER /tmp/autopkgtest.$a$a$a$a$a$a/build-experiment-[1-9]-before-disorderfs/ $USER ALL = NOPASSWD: /bin/chown -h -R --from=$USER $OTHERUSER /tmp/autopkgtest.$a$a$a$a$a$a/const_build_path/ $USER ALL = NOPASSWD: /bin/chown -h -R --from=$USER $OTHERUSER /tmp/autopkgtest.$a$a$a$a$a$a/build-experiment-[1-9]/ $USER ALL = NOPASSWD: /bin/chown -h -R --from=$USER $OTHERUSER /tmp/autopkgtest.$a$a$a$a$a$a/build-experiment-[1-9]-before-disorderfs/ EOF Repeat this for each user you'd like to use. Obviously, don't pick a privileged user for this purpose, such as root. (Simplifying the above using wildcards would open up passwordless access to $ reprotest --print-sudoers \ --variations=user_group.available+=guest-builder,domain_host.use_sudo=1 \ | sudo EDITOR=tee visudo -f /etc/sudoers.d/local-reprotest Make sure you set the variations you actually want to use. Obviously, don't pick privileged users for this purpose, such as root. (Simplifying the output using wildcards, would open up passwordless access to chown anything on your system, because wildcards here match whitespace. I don't know what the sudo authors were thinking.) Loading debian/changelog +2 −0 Original line number Diff line number Diff line reprotest (0.7.4) UNRELEASED; urgency=medium * Hopefully fix the autopkgtest tests. * Add a domain_host variation. * Add a --print-sudoers feature. -- Ximin Luo <infinity0@debian.org> Fri, 20 Oct 2017 12:33:21 +0200 Loading debian/rules +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ export PYBUILD_NAME = reprotest # # To be user-friendly the user_group variation defaults to ON but is a no-op. # This causes tests to fail since they expect something to be captured. So ignore it here export REPROTEST_TEST_DONTVARY = fileordering,user_group export REPROTEST_TEST_DONTVARY = fileordering,user_group,domain_host override_dh_auto_configure: test $$(python3 setup.py --version) = $$(dpkg-parsechangelog -SVersion) Loading debian/tests/control +2 −2 Original line number Diff line number Diff line Test-Command: env REPROTEST_TEST_DONTVARY=fileordering,user_group pytest-3 -m 'not need_builddeps' Test-Command: env REPROTEST_TEST_DONTVARY=fileordering,user_group,domain_host pytest-3 -m 'not need_builddeps' Depends: @, python3-pytest, faketime, locales-all Test-Command: env REPROTEST_TEST_DONTVARY=fileordering,user_group pytest-3 -m 'need_builddeps' Test-Command: env REPROTEST_TEST_DONTVARY=fileordering,user_group,domain_host pytest-3 -m 'need_builddeps' Depends: @builddeps@ reprotest/__init__.py +18 −7 Original line number Diff line number Diff line Loading @@ -605,6 +605,9 @@ def cli_parser(): 'implemented very well and may leave cruft on your system.') group3.add_argument('--dry-run', action='store_true', default=False, help='Don\'t run the builds, just print what would happen.') group3.add_argument('--print-sudoers', action='store_true', default=False, help='Print a sudoers file for passwordless operation using the given ' '--variations, useful for user_group.available, domain_host.use_sudo.') return parser Loading Loading @@ -647,6 +650,14 @@ def command_line(parser, argv): return args def get_main_spec(parsed_args): variations = [parsed_args.variations] + parsed_args.vary if parsed_args.dont_vary: logging.warn("--dont-vary is deprecated; use --vary=-$variation instead") variations += ["-%s" % a for x in parsed_args.dont_vary for a in x.split(",")] return VariationSpec().extend(variations) def run(argv, dry_run=None): # Argparse exits with status code 2 if something goes wrong, which # is already the right status exit code for reprotest. Loading @@ -655,12 +666,17 @@ def run(argv, dry_run=None): config_args = config_to_args(parser, parsed_args.config_file) # Command-line arguments override config file settings. parsed_args = command_line(parser, config_args + argv) dry_run = parsed_args.dry_run or dry_run verbosity = parsed_args.verbosity adtlog.verbosity = verbosity - 1 logging.basicConfig(level=30-10*verbosity) logging.debug('%r', parsed_args) if not dry_run and parsed_args.print_sudoers: build.print_sudoers(get_main_spec(parsed_args)) return 0 # Decide which form of the CLI we're using build_command, source_root = None, None first_arg = parsed_args.__dict__['source_root|build_command'] Loading Loading @@ -729,12 +745,7 @@ def run(argv, dry_run=None): source_pattern = values.source_pattern + (" " + source_pattern if source_pattern else "") # Variations args variations = [parsed_args.variations] + parsed_args.vary if parsed_args.dont_vary: logging.warn("--dont-vary is deprecated; use --vary=-$variation instead") variations += ["-%s" % a for x in parsed_args.dont_vary for a in x.split(",")] spec = VariationSpec().extend(variations) specs = [spec] specs = [get_main_spec(parsed_args)] if parsed_args.auto_build: check_func = check_auto elif parsed_args.env_build: Loading Loading @@ -776,7 +787,7 @@ def run(argv, dry_run=None): source_pattern, no_clean_on_error, diffoscope_args) check_args = (test_args, testbed_args, build_variations) if parsed_args.dry_run or dry_run: if dry_run: return check_args else: try: Loading Loading
README.rst +29 −16 Original line number Diff line number Diff line Loading @@ -219,6 +219,11 @@ of names is given in the --help text for --variations. Most variations do not have parameters, and for them only the + and - operators are relevant. The variations that accept parameters are: domain_host.use_sudo An integer, whether to use sudo(1) together with unshare(1) to change the system hostname and domainname. 0 means don't use sudo; any non-zero value means to use sudo. Default is 0, however this is not recommended and make may your build fail, see "Varying the domain and host names" for details. environment.variables A semicolon-separated ordered set, specifying environment variables that reprotest should try to vary. Default is "REPROTEST_CAPTURE_ENVIRONMENT". Loading Loading @@ -266,6 +271,22 @@ means to vary home, time (the last given value for --variations), timezone, and -time (the given multiple values for --vary), i.e. home and timezone. Varying the user or group ========================= Doing this without sudo *may* result in your build failing. Failure is likely if your build must do system-related things - as opposed to only processing bits and bytes. This is because it runs in a separate namespace where your non-privileged user looks like it is "root", but this prevents the filesystem from recognising files owned by the real "root" user, amongst other things. This is a limitation of unshare(1) and it is not possible work around this in reprotest without heavy effort. Therefore, it is recommended to run this variation with use_sudo=1. To avoid password prompts, see the section "Avoid sudo(1) password prompts" below. Varying the user or group ========================= Loading @@ -280,22 +301,14 @@ There is currently no good way to do this. The following is a very brittle and unclean solution. You will have to decide for yourself if it's worth it for your use-case:: $ OTHERUSER=(YOUR OTHER USER HERE) $ a="[a-zA-Z0-9]" $ cat <<EOF | sudo tee -a /etc/sudoers.d/local-reprotest $USER ALL = ($OTHERUSER) NOPASSWD: ALL $USER ALL = NOPASSWD: /bin/chown -h -R --from=$OTHERUSER $USER /tmp/autopkgtest.$a$a$a$a$a$a/const_build_path/ $USER ALL = NOPASSWD: /bin/chown -h -R --from=$OTHERUSER $USER /tmp/autopkgtest.$a$a$a$a$a$a/build-experiment-[1-9]/ $USER ALL = NOPASSWD: /bin/chown -h -R --from=$OTHERUSER $USER /tmp/autopkgtest.$a$a$a$a$a$a/build-experiment-[1-9]-before-disorderfs/ $USER ALL = NOPASSWD: /bin/chown -h -R --from=$USER $OTHERUSER /tmp/autopkgtest.$a$a$a$a$a$a/const_build_path/ $USER ALL = NOPASSWD: /bin/chown -h -R --from=$USER $OTHERUSER /tmp/autopkgtest.$a$a$a$a$a$a/build-experiment-[1-9]/ $USER ALL = NOPASSWD: /bin/chown -h -R --from=$USER $OTHERUSER /tmp/autopkgtest.$a$a$a$a$a$a/build-experiment-[1-9]-before-disorderfs/ EOF Repeat this for each user you'd like to use. Obviously, don't pick a privileged user for this purpose, such as root. (Simplifying the above using wildcards would open up passwordless access to $ reprotest --print-sudoers \ --variations=user_group.available+=guest-builder,domain_host.use_sudo=1 \ | sudo EDITOR=tee visudo -f /etc/sudoers.d/local-reprotest Make sure you set the variations you actually want to use. Obviously, don't pick privileged users for this purpose, such as root. (Simplifying the output using wildcards, would open up passwordless access to chown anything on your system, because wildcards here match whitespace. I don't know what the sudo authors were thinking.) Loading
debian/changelog +2 −0 Original line number Diff line number Diff line reprotest (0.7.4) UNRELEASED; urgency=medium * Hopefully fix the autopkgtest tests. * Add a domain_host variation. * Add a --print-sudoers feature. -- Ximin Luo <infinity0@debian.org> Fri, 20 Oct 2017 12:33:21 +0200 Loading
debian/rules +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ export PYBUILD_NAME = reprotest # # To be user-friendly the user_group variation defaults to ON but is a no-op. # This causes tests to fail since they expect something to be captured. So ignore it here export REPROTEST_TEST_DONTVARY = fileordering,user_group export REPROTEST_TEST_DONTVARY = fileordering,user_group,domain_host override_dh_auto_configure: test $$(python3 setup.py --version) = $$(dpkg-parsechangelog -SVersion) Loading
debian/tests/control +2 −2 Original line number Diff line number Diff line Test-Command: env REPROTEST_TEST_DONTVARY=fileordering,user_group pytest-3 -m 'not need_builddeps' Test-Command: env REPROTEST_TEST_DONTVARY=fileordering,user_group,domain_host pytest-3 -m 'not need_builddeps' Depends: @, python3-pytest, faketime, locales-all Test-Command: env REPROTEST_TEST_DONTVARY=fileordering,user_group pytest-3 -m 'need_builddeps' Test-Command: env REPROTEST_TEST_DONTVARY=fileordering,user_group,domain_host pytest-3 -m 'need_builddeps' Depends: @builddeps@
reprotest/__init__.py +18 −7 Original line number Diff line number Diff line Loading @@ -605,6 +605,9 @@ def cli_parser(): 'implemented very well and may leave cruft on your system.') group3.add_argument('--dry-run', action='store_true', default=False, help='Don\'t run the builds, just print what would happen.') group3.add_argument('--print-sudoers', action='store_true', default=False, help='Print a sudoers file for passwordless operation using the given ' '--variations, useful for user_group.available, domain_host.use_sudo.') return parser Loading Loading @@ -647,6 +650,14 @@ def command_line(parser, argv): return args def get_main_spec(parsed_args): variations = [parsed_args.variations] + parsed_args.vary if parsed_args.dont_vary: logging.warn("--dont-vary is deprecated; use --vary=-$variation instead") variations += ["-%s" % a for x in parsed_args.dont_vary for a in x.split(",")] return VariationSpec().extend(variations) def run(argv, dry_run=None): # Argparse exits with status code 2 if something goes wrong, which # is already the right status exit code for reprotest. Loading @@ -655,12 +666,17 @@ def run(argv, dry_run=None): config_args = config_to_args(parser, parsed_args.config_file) # Command-line arguments override config file settings. parsed_args = command_line(parser, config_args + argv) dry_run = parsed_args.dry_run or dry_run verbosity = parsed_args.verbosity adtlog.verbosity = verbosity - 1 logging.basicConfig(level=30-10*verbosity) logging.debug('%r', parsed_args) if not dry_run and parsed_args.print_sudoers: build.print_sudoers(get_main_spec(parsed_args)) return 0 # Decide which form of the CLI we're using build_command, source_root = None, None first_arg = parsed_args.__dict__['source_root|build_command'] Loading Loading @@ -729,12 +745,7 @@ def run(argv, dry_run=None): source_pattern = values.source_pattern + (" " + source_pattern if source_pattern else "") # Variations args variations = [parsed_args.variations] + parsed_args.vary if parsed_args.dont_vary: logging.warn("--dont-vary is deprecated; use --vary=-$variation instead") variations += ["-%s" % a for x in parsed_args.dont_vary for a in x.split(",")] spec = VariationSpec().extend(variations) specs = [spec] specs = [get_main_spec(parsed_args)] if parsed_args.auto_build: check_func = check_auto elif parsed_args.env_build: Loading Loading @@ -776,7 +787,7 @@ def run(argv, dry_run=None): source_pattern, no_clean_on_error, diffoscope_args) check_args = (test_args, testbed_args, build_variations) if parsed_args.dry_run or dry_run: if dry_run: return check_args else: try: Loading