use POSIX;
our $isuite = 'unstable';
+our $idistro;
our $package;
our $sign = 1;
sub lref () { return "refs/heads/".lbranch(); }
sub lrref () { return "refs/remotes/$remotename/$csuite"; }
sub rrref () { return "refs/$branchprefix/$csuite"; }
-sub debiantag ($) { return "debian/$_[0]"; }
+sub debiantag ($) {
+ my ($v) = @_;
+ $v =~ y/~:/_%/;
+ return "debian/$v";
+}
sub dscfn ($) { return "${package}_$_[0].dsc"; }
-c<name>=<value> set git config option (used directly by dgit too)
END
+our $later_warning_msg = <<END;
+Perhaps the upload is stuck in incoming. Using the version from git.
+END
+
sub badusage {
print STDERR "$us: @_\n", $helpmsg or die $!;
exit 8;
'dgit.default.username' => '',
'dgit.default.archive-query-default-component' => 'main',
'dgit.default.ssh' => 'ssh',
- 'dgit-distro.debian.git-host' => 'dgit.debian.net',
+ 'dgit-distro.debian.git-host' => 'git.debian.org',
'dgit-distro.debian.git-proto' => 'git+ssh://',
'dgit-distro.debian.git-path' => '/git/dgit-repos',
'dgit-distro.debian.git-check' => 'ssh-cmd',
sub access_cfg (@) {
my (@keys) = @_;
- my $distro = access_distro();
+ my $distro = $idistro || access_distro();
my $value = cfg(map { ("dgit-distro.$distro.$_",
"dgit.default.$_") } @keys);
return $value;
$outputhash = make_commit qw(../commit2.tmp);
} elsif ($vcmp > 0) {
print STDERR <<END or die $!;
+
Version actually in archive: $cversion (older)
Last allegedly pushed/uploaded: $oversion (newer or same)
-Perhaps the upload is stuck in incoming. Using the version from git.
+$later_warning_msg
END
$outputhash = $upload_hash;
} elsif ($outputhash ne $upload_hash) {
unless $upload_hash;
$hash = $dsc_hash;
ensure_we_have_orig();
+ if (is_fast_fwd($dsc_hash,$upload_hash)) {
+ print STDERR <<END or die $!;
+
+Git commit in archive is behind the last version allegedly pushed/uploaded.
+Commit referred to by archive: $dsc_hash
+Last allegedly pushed/uploaded: $upload_hash
+$later_warning_msg
+END
+ $hash = $upload_hash;
+ }
} else {
$hash = generate_commit_from_dsc();
}
}
sub check_not_dirty () {
- runcmd @git, qw(diff --quiet HEAD);
+ my @cmd = (@git, qw(diff --quiet HEAD));
+ printcmd(\*DEBUG,"+",@cmd) if $debug>0;
+ $!=0; $?=0; system @cmd;
+ return if !$! && !$?;
+ if (!$! && $?==256) {
+ fail "working tree is dirty (does not match HEAD)";
+ } else {
+ failedcmd @cmd;
+ }
}
sub commit_quilty_patch ($) {
print "[new .dsc left in $dscfn.tmp]\n";
}
if ($sign) {
+ if (!defined $keyid) {
+ $keyid = access_cfg('keyid','RETURN-UNDEF');
+ }
my @tag_cmd = (@git, qw(tag -s -m),
"Release $dversion for $csuite [dgit]");
push @tag_cmd, qw(-u),$keyid if defined $keyid;
if (fetch_from_archive()) {
is_fast_fwd(lrref(), 'HEAD') or die;
} else {
- fail "package appears to be new in this suite;".
- " if this is intentional, use --new";
+ $new_package or
+ fail "package appears to be new in this suite;".
+ " if this is intentional, use --new";
}
dopush();
}
push @$om, $2;
} elsif (m/^--existing-package=(.*)/s) {
$existing_package = $1;
+ } elsif (m/^--distro=(.*)/s) {
+ $idistro = $1;
} else {
badusage "unknown long option \`$_'";
}
$new_package=1;
} elsif (s/^-c(.*=.*)//s) {
push @git, '-c', $1;
+ } elsif (s/^-d(.*)//s) {
+ $idistro = $1;
} elsif (s/^-C(.*)//s) {
$changesfile = $1;
} elsif (s/^-k(.*)//s) {