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"; }
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;
}
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;
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) {