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);
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');
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;
}
# 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);
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
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