chiark / gitweb /
FOUND
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 5 Jul 2018 08:36:03 +0000 (09:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 5 Jul 2018 08:36:03 +0000 (09:36 +0100)
dgit
dgit.1
tests/tests/sourceonlypolicy

diff --git a/dgit b/dgit
index 14d8097da82abb2efd53b3e0acec6dc3c4035ae6..3ad67ef51e46f37df221ccb7b5b38bb8d41b7869 100755 (executable)
--- 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
 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);
        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);
        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";
        $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');
        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->();
     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;
 }
 
     return $r;
 }
 
@@ -4452,19 +4455,20 @@ END
 
     # Check whether this is a source only upload
     my $hasdebs = $changes->{Files} =~ m{\.deb$}m;
 
     # 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;
        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;
        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)],
        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);
            if !$hasdebs
            && $new_package
            && !archive_query('package_not_wholly_new', $package);
diff --git a/dgit.1 b/dgit.1
index e7ab454adc1c71fb4b381a5a4b9d3e25558d702f..543d36ad48cb796a611a585c2e01dbf469310d8d 100644 (file)
--- 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
 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
 .B --force-unrepresentable
 Carry on even if
 dgit thinks that your git tree contains changes
index 9a818fab14cbb27e910468d9d56875cedce3b598..b0569c30b34deb551b45e772ef95557428dda919 100755 (executable)
@@ -10,68 +10,29 @@ cd $p
 revision=1
 
 dgit-with-policy () {
 revision=1
 
 dgit-with-policy () {
-       local policy=$1
+       local policy=$1; shift
        t-dgit -cdgit-distro.test-dummy.source-only-uploads=$policy "$@"
 }
 
        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
 
 t-ok