# CALLER MUST PREVENT MULTIPLE CONCURRENT RUNS IN SAME CWD
# If we fail (exit nonzero), caller should capture our stderr,
# and retry some bounded number of times in some appropriate way
+ # Uses whatever ambient gpg key is available
@ARGV==2 or die;
my $url;
my $tagref = "refs/tags/$tagval";
rmtree $work;
+ rmtree 'bpd';
mkdir $work or die $!;
+ mkdir 'bpd' or die $!;
+ unlink <*.orig*>;
+ dif $! if <*.orig*>;
changedir $work;
runcmd qw(git init -q);
runcmd qw(git remote add origin), $url;
# quick and dirty check, will check properly later
m/^\[dgit[^"]* please-upload(?:\]| )/m or
- $quit->("tag missing please-upload request $_");
+ $quit->("tag missing please-upload request");
m/^tagger (.*) \d+ [-+]\d+$/m or
$quit->("failed to fish tagger out of tag");
# This is for us. From now on, we will capture errors to
# be emailed to the tagger.
- # TODO: failures to git fetch from salsa will burn a version
open H, ">>dgit-tmp/tagupl.email" or die $!;
print H <<END or die $!;
-f$ENV{DGIT_DRS_EMAIL_NOREPLY} \\
<tagupl.email
END
- exit 0;
+ $quit->("failed, emailed");
}
open STDERR, ">&L" or die $!;
open STDOUT, ">&STDERR" or die $!;
open DEBUG, ">&STDERR" if $debuglevel;
- die "$tagmversion != $version " unless $tagmversion eq $version;
+ reject "version mismatch $tagmversion != $version "
+ unless $tagmversion eq $version;
my %need = map { $_ => 1 } qw(please-upload split);
my ($upstreamc, $upstreamt);
my $quilt;
my $distro_ok;
+ confess if defined $upstreamt;
+
parsetag_general sub {
if (m/^(\S+) / && exists $need{$1}) {
$_ = $';
$distro_ok ||= $gotdistro eq $distro;
};
- $quit->("other distro") unless $distro_ok;
+ $quit->("not for this distro") unless $distro_ok;
reject "missing \"$_\"" foreach keys %need;
+ verifytag();
+
reject "upstream tag and not commitish, or v-v"
unless defined $upstreamt == defined $upstreamc;
- verifytag();
-
my @dgit;
push @dgit, $ENV{DGIT_DRS_DGIT} // 'dgit';
push @dgit, '-wn';
push @dgit, "-p$package";
+ push @dgit, '--build-products-dir=../bpd';
changedir "..";
runcmd (@dgit, qw(setup-gitattributes));
my @fetch = qw(git fetch origin --unshallow);
if (defined $upstreamt) {
- runcmd qw(git check-ref-format), "refs/tags/$upstreamt";
runcmd qw(git check-ref-format), "refs/tags/$upstreamt";
my $utagref = "refs/tags/$upstreamt";
push @fetch, "$utagref:$utagref";
}
runcmd @fetch;
- $upstreamc eq git_rev_parse "refs/tags/$upstreamt" or die;
-
runcmd qw(git checkout -q), "refs/tags/$tagval";
+ my $clogp = parsechangelog();
+ my $clogf = sub {
+ my ($f, $exp) = @_;
+ my $got = getfield $clogp, $f;
+ return if $got eq $exp;
+ reject "mismatch: changelog $f $got != $exp";
+ };
+ $clogf->('Version', $version);
+ $clogf->('Source', $package);
+
@fetch = (@dgit, qw(fetch), $suite);
debugcmd "+",@_;
$!=0; $?=-1;
failedcmd @fetch unless $? == 4*256;
}
# this is just to get the orig, so we don't really care about the ref
- runcmd qw(git deborig), "$upstreamc";
+ if (defined $upstreamc) {
+ my $need_upstreamc = git_rev_parse "refs/tags/$upstreamt";
+ $upstreamc eq $need_upstreamc or reject
+ "upstream-commitish=$upstreamc but tag refers to $need_upstreamc";
+ runcmd qw(git deborig), "$upstreamc";
+ }
my @dgitcmd;
push @dgitcmd, @dgit;
}
}
push @dgitcmd, qw(push-source --new --overwrite), $suite;
- # xxx what about the key to use?
runcmd @dgitcmd;