From 1b8ad8400b3e39c17e843356f565c6c28fff4916 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Sat, 23 Feb 2019 08:43:15 +0100 Subject: [PATCH] add --logfile option --- coverage.sh | 22 ++++++++++++++++++++++ mmdebstrap | 17 +++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/coverage.sh b/coverage.sh index 5b23b7d..c87b8f9 100755 --- a/coverage.sh +++ b/coverage.sh @@ -672,6 +672,28 @@ else ./run_null.sh SUDO fi +print_header "mode=root,variant=apt: --logfile" +cat << END > shared/test.sh +#!/bin/sh +set -eu +export LC_ALL=C.UTF-8 +$CMD --mode=root --variant=apt --logfile=log unstable /tmp/debian-unstable $mirror +tar -C /tmp/debian-unstable --one-file-system -c . | tar -t | sort > tar2.txt +grep --quiet "I: running apt-get update..." log +grep --quiet "I: downloading packages with apt..." log +grep --quiet "I: extracting archives..." log +grep --quiet "I: installing packages..." log +grep --quiet "I: cleaning package lists and apt cache..." log +diff -u tar1.txt tar2.txt +rm -r /tmp/debian-unstable +rm log +END +if [ "$HAVE_QEMU" = "yes" ]; then + ./run_qemu.sh +else + ./run_null.sh SUDO +fi + # test all variants for variant in essential apt required minbase buildd important debootstrap - standard; do diff --git a/mmdebstrap b/mmdebstrap index cd1a6ca..559bd9a 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -1695,6 +1695,7 @@ sub main() { customize_hook => [], }; chomp ($options->{architectures} = `dpkg --print-architecture`); + my $logfile = undef; Getopt::Long::Configure ('default', 'bundling', 'auto_abbrev', 'ignore_case_always'); GetOptions( 'h|help' => sub { pod2usage(-exitval => 0, -verbose => 2) }, @@ -1709,6 +1710,7 @@ sub main() { 'q|quiet' => sub { $verbosity_level = 0; }, 'v|verbose' => sub { $verbosity_level = 2; }, 'd|debug' => sub { $verbosity_level = 3; }, + 'logfile=s' => \$logfile, # no-op options so that mmdebstrap can be used with # sbuild-createchroot --debootstrap=mmdebstrap 'resolve-deps' => sub { push @{$options->{noop}}, 'resolve-deps'; }, @@ -1720,6 +1722,10 @@ sub main() { 'customize-hook=s@' => \$options->{customize_hook}, ) or pod2usage(-exitval => 2, -verbose => 1); + if (defined($logfile)) { + open(STDERR, '>', $logfile) or error "cannot open $logfile: $!"; + } + foreach my $arg (@{$options->{noop}}) { info "The option --$arg is a no-op. It only exists for compatibility with some debootstrap wrappers."; } @@ -2419,6 +2425,13 @@ then a single I C<-> is added and thus the information of the desired suite has to come from standard input as part of a valid apt sources.list file. +All status output is printed to standard error unless B<--logfile> is used to +redirect it to a file or B<--quiet> or B<--silent> is used to suppress any +output on standard error. Help and version information will be printed to +standard error with the B<--help> and B<--version> options, respectively. +Otherwise, an uncompressed tarball might be sent to standard output if +I is C<-> or if no I was specified. + =head1 OPTIONS Options are case insensitive. Short options may be bundled. Long options @@ -2578,6 +2591,10 @@ In addition to the output produced by B<--verbose>, write detailed debugging information to standard error. Errors will print a backtrace. If used together with B<--quiet> or B<--verbose>, only the last option will take effect. +=item B<--logfile>=I + +Instead of writing status information to standard error, write it into the +file given by I. =back