From: Ian Jackson Date: Thu, 5 Jul 2018 08:36:03 +0000 (+0100) Subject: FOUND X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=dcb02d1a805766569403e121d72d6c5e829ed971;p=dgit.git FOUND --- diff --git a/dgit b/dgit index 14d8097d..3ad67ef5 100755 --- a/dgit +++ b/dgit @@ -90,6 +90,7 @@ our $chase_dsc_distro=1; our %forceopts = map { $_=>0 } qw(unrepresentable unsupported-source-format dsc-changes-mismatch changes-origs-exactly + uploading-binaries uploading-source-only import-gitapply-absurd import-gitapply-no-absurd import-dsc-with-dgit-field); @@ -969,7 +970,9 @@ sub parsecontrolfh ($$;$) { my %opts = ('name' => $desc); $opts{allow_pgp}= $allowsigned || !$dpkgcontrolhash_noissigned; $c = Dpkg::Control::Hash->new(%opts); +print STDERR "DCHn\n"; $c->parse($fh,$desc) or die "parsing of $desc failed"; +print STDERR "parse\n"; last if $allowsigned; last if $dpkgcontrolhash_noissigned; my $issigned= $c->get_option('is_pgp_signed'); @@ -1368,7 +1371,7 @@ sub dummycatapi_run_in_mirror ($@) { debugcmd "-|", @cmd; open FIA, "-|", @cmd or die $!; my $r = $fn->(); - close FIA or ($!==0 && $?==141) die failedcmd @cmd; + close FIA or ($!==0 && $?==141) or die failedcmd @cmd; return $r; } @@ -4452,19 +4455,20 @@ END # Check whether this is a source only upload my $hasdebs = $changes->{Files} =~ m{\.deb$}m; - my $sourconlypolicy = access_cfg 'source-only-uploads'; - if ($sourconlypolicy eq 'ok') { - } elsif ($sourconlypolicy eq 'always') { + my $sourceonlypolicy = access_cfg 'source-only-uploads'; + if ($sourceonlypolicy eq 'ok') { + } elsif ($sourceonlypolicy eq 'always') { forceable_fail [qw(uploading-binaries)], "uploading binaries, although distroy policy is source only" if $hasdebs; - } elsif ($sourconlypolicy eq 'never') { + } elsif ($sourceonlypolicy eq 'never') { forceable_fail [qw(uploading-source-only)], "source-only upload, although distroy policy requires .debs" if !$hasdebs; - } elsif ($sourconlypolicy eq 'not-wholly-new') { + } elsif ($sourceonlypolicy eq 'not-wholly-new') { forceable_fail [qw(uploading-source-only)], - "source-only upload, even though package is entirely NEW" + "source-only upload, even though package is entirely NEW\n". + "(this is contrary to policy in ".(access_nomdistro()).")" if !$hasdebs && $new_package && !archive_query('package_not_wholly_new', $package); diff --git a/dgit.1 b/dgit.1 index e7ab454a..543d36ad 100644 --- a/dgit.1 +++ b/dgit.1 @@ -1050,6 +1050,17 @@ The result is a fresh import, discarding the git history that the person who pushed that .dsc was working with. .TP +.B --force-uploading-binaries +Carry on and +upload binaries +even though dgit thinks your distro does not permit that. +.TP +.B --force-uploading-source-only +Carry on and do a source-only upload, +without any binaries, +even though dgit thinks your distro does not permit that, +or does not permit that in this situation. +.TP .B --force-unrepresentable Carry on even if dgit thinks that your git tree contains changes diff --git a/tests/tests/sourceonlypolicy b/tests/tests/sourceonlypolicy index 9a818fab..b0569c30 100755 --- a/tests/tests/sourceonlypolicy +++ b/tests/tests/sourceonlypolicy @@ -10,68 +10,29 @@ cd $p revision=1 dgit-with-policy () { - local policy=$1 + local policy=$1; shift t-dgit -cdgit-distro.test-dummy.source-only-uploads=$policy "$@" } -t-expect-fail '' \ -t-dgit-with-policy not-wholly-new push +t-expect-fail E:'source-only.*entirely NEW' \ +dgit-with-policy not-wholly-new push-source --new -t-dgit -c dgit-distr push --new +t-expect-fail E:'source-only.*requires \.debs' \ +dgit-with-policy never push-source --new -git tag start +dgit-with-policy always push-source --new -echo DUMMY >some-file -git add some-file -git commit -m some-file -taint=`git rev-parse HEAD` -t-policy-admin taint --global $taint dummy -git reset --hard HEAD~ +t-archive-process-incoming sid -t-commit 'Make something to autotaint' -t-dgit build -t-dgit push --new +t-commit 'Now with binaries' -autotaint=`t-git-get-ref "refs/tags/$tagpfx/$v"` +t-dgit -wgf build -git reset --hard start -t-commit 'Thing which will autotaint' -t-dgit build +t-expect-fail E:'uploading binaries.*source only' \ +dgit-with-policy always push --new -fifo=$tmp/sqlite-cmds -mkfifo $fifo -exec 3<>$fifo -sqlite3 -interactive $tmp/git/policy.sqlite3 0<$fifo 3>&- & -sqlite3_pid=$! +t-commit 'Source-only not NEW' -taintsout=$tmp/sqlite3.taints-out -echo >&3 'begin;'; -echo >&3 ".output $taintsout" -echo >&3 'select * from taints;'; -echo >&3 'create table dummy (x text);' - -t-dgit build - -while ! grep $taint $taintsout; do sleep 0.1; done - -DGIT_RPD_TEST_DBLOOP_HOOK=' - print STDERR "DBLOOP HOOK $sleepy\n"; - $poldbh->sqlite_busy_timeout(2500); - if ($sleepy > 2) { - system '\'' - set -ex - echo >'"$fifo"' "rollback;" - touch '"$tmp/sqlite3.rolled-back"' - '\'' and die "$? $!"; - } -' \ -t-dgit push --deliberately-not-fast-forward - -exec 3>&- -wait $sqlite3_pid - -ls $tmp/sqlite3.rolled-back - -t-policy-admin list-taints | tee $tmp/taints-list | grep $autotaint +dgit-with-policy not-wholly-new push-source --new t-ok