our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)");
+our $suite_re = '[-+.0-9a-z]+';
+
our (@git) = qw(git);
our (@dget) = qw(dget);
our (@dput) = qw(dput);
}
sub failedcmd {
- { local ($!); printcmd \*STDERR, "$_[0]: failed command:", @_ or die $!; };
+ { local ($!); printcmd \*STDERR, "$us: failed command:", @_ or die $!; };
if ($!) {
fail "failed to fork/exec: $!";
} elsif (!($? & 0xff)) {
'dgit.default.username' => '',
'dgit.default.archive-query-default-component' => 'main',
'dgit.default.ssh' => 'ssh',
+ 'dgit-distro.debian.git-user' => 'dgit',
'dgit-distro.debian.git-host' => 'git.debian.org',
'dgit-distro.debian.git-proto' => 'git+ssh://',
- 'dgit-distro.debian.git-path' => '/git/dgit-repos/repos',
- 'dgit-distro.debian.git-check' => 'ssh-cmd',
- 'dgit-distro.debian.git-create' => 'ssh-cmd',
+ 'dgit-distro.debian.git-path' => '/dgit-repos/',
+ 'dgit-distro.debian.git-check' => 'true',
+ 'dgit-distro.debian.git-create' => 'true',
'dgit-distro.debian.sshpsql-host' => 'coccia.debian.org',
'dgit-distro.debian.sshpsql-dbname' => 'service=projectb',
'dgit-distro.debian.upload-host' => 'ftp-master', # for dput
'dgit-distro.debian.mirror' => 'http://ftp.debian.org/debian/',
+ 'dgit-distro.debian.backports-quirk' => '%-backports*',
+ 'dgit-distro.debian-backports.mirror' => 'http://backports.debian.org/debian-backports/',
'dgit-distro.test-dummy.ssh' => "$td/ssh",
'dgit-distro.test-dummy.username' => "alice",
'dgit-distro.test-dummy.git-check' => "ssh-cmd",
sub access_quirk () {
# returns (quirk name, distro to use instead, quirk-specific info)
my $basedistro = access_basedistro();
+ my $backports_quirk = cfg("dgit-distro.$basedistro.backports-quirk",
+ 'RETURN-UNDEF');
+ if (defined $backports_quirk) {
+ my $re = $backports_quirk;
+ $re =~ s/[^-0-9a-z_\%*]/\\$&/ig;
+ $re =~ s/\*/.*/g;
+ $re =~ s/\%/([-0-9a-z_]+)/ or badcfg "backports-quirk needs \%";
+ if ($isuite =~ m/^$re$/) {
+ return ('backports',"$basedistro-backports",$1);
+ }
+ }
return ('none',$basedistro);
}
my ($method) = @_;
my $query = access_cfg('archive-query','RETURN-UNDEF');
if (!defined $query) {
- my $distro = access_distro();
+ my $distro = access_basedistro();
if ($distro eq 'debian') {
$query = "sshpsql:".
access_someuserhost('sshpsql').':'.
my $r= cmdoutput @cmd;
failedcmd @cmd unless $r =~ m/^[01]$/;
return $r+0;
+ } elsif ($how eq 'true') {
+ return 1;
} else {
badcfg "unknown git-check \`$how'";
}
(access_cfg_ssh, access_gituserhost(),
"set -e; cd ".access_cfg('git-path').";".
" cp -a _template $package.git");
+ } elsif ($how eq 'true') {
+ # nothing to do
} else {
badcfg "unknown git-create \`$how'";
}
tag $tag
tagger $authline
-$package release $cversion for $clogsuite [dgit]
+$package release $cversion for $clogsuite ($csuite) [dgit]
END
close TO or die $!;
responder_send_file('changes',$changesfile);
responder_send_command("param head $head");
+ responder_send_command("param csuite $csuite");
my $tfn = sub { ".git/dgit/tag$_[0]"; };
my $tagobjfn;
if (!check_for_git()) {
create_remote_git_repo();
}
- runcmd_ordryrun @git, qw(push),access_giturl(),"HEAD:".rrref();
+ runcmd_ordryrun @git, qw(push),access_giturl(),
+ "HEAD:".rrref(), "refs/tags/$tag";
runcmd_ordryrun @git, qw(update-ref -m), 'dgit push', lrref(), 'HEAD';
- if (!$we_are_responder) {
- if (act_local()) {
- rename "$dscpath.tmp",$dscpath or die "$dscfn $!";
- } else {
- progress "[new .dsc left in $dscpath.tmp]";
- }
- }
-
if ($we_are_responder) {
my $dryrunsuffix = act_local() ? "" : ".tmp";
responder_receive_files('signed-dsc-changes',
"$dscpath$dryrunsuffix",
"$changesfile$dryrunsuffix");
} else {
+ if (act_local()) {
+ rename "$dscpath.tmp",$dscpath or die "$dscfn $!";
+ } else {
+ progress "[new .dsc left in $dscpath.tmp]";
+ }
sign_changes $changesfile;
}
- runcmd_ordryrun @git, qw(push),access_giturl(),"refs/tags/$tag";
my $host = access_cfg('upload-host','RETURN-UNDEF');
my @hostarg = defined($host) ? ($host,) : ();
runcmd_ordryrun @dput, @hostarg, $changesfile;
sub i_want_signed_tag {
printdebug Dumper(\%i_param, $i_dscfn);
defined $i_param{'head'} && defined $i_dscfn && defined $i_clogp
+ && defined $i_param{'csuite'}
or badproto \*RO, "premature desire for signed-tag";
my $head = $i_param{'head'};
die if $head =~ m/[^0-9a-f]/ || $head !~ m/^../;
+ die unless $i_param{'csuite'} =~ m/^$suite_re$/;
+ $csuite = $&;
push_parse_dsc $i_dscfn, 'remote dsc', $i_version;
my $tagobjfn =
my @opts =@changesopts[1..$#changesopts];
if (!defined $changes_since_version) {
my @vsns = archive_query('archive_query');
+ my @quirk = access_quirk();
+ if ($quirk[0] eq 'backports') {
+ local $isuite = $quirk[2];
+ local $csuite;
+ canonicalise_suite();
+ push @vsns, archive_query('archive_query');
+ }
if (@vsns) {
@vsns = map { $_->[0] } @vsns;
@vsns = sort { -version_compare_string($a, $b) } @vsns;