summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2016-07-30 15:32:28 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2016-09-05 13:41:09 +0100
commit496685d614bba3670ba89fda0802750b8ac54a9d (patch)
treed05dcf6d3da246d0fd5dacfc01f148bd12f370f5
parent46f49961006d814869d975d5d982cd7d3c107b0b (diff)
Split tags: Introduce $mktag in push_mktag
push_mktag is going to want to become push_mktags, and make perhaps two tags. For now, break the actual tag-making out into a subref. Rename the arguments to push_mktag to ensure we caught all the references in $mktag. push_mktag now wants to return an array; make sure that the call sites all give it array context. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xdgit68
1 files changed, 38 insertions, 30 deletions
diff --git a/dgit b/dgit
index a2771c5..4aefa08 100755
--- a/dgit
+++ b/dgit
@@ -1941,12 +1941,12 @@ sub push_parse_dsc ($$$) {
}
sub push_mktag ($$$$$$$) {
- my ($head,$clogp,$tag,
+ my ($dgithead,$clogp,$dgittag,
$dscfn,
$changesfile,$changesfilewhat,
- $tfn) = @_;
+ $tfnbase) = @_;
- $dsc->{$ourdscfield[0]} = $head;
+ $dsc->{$ourdscfield[0]} = $dgithead;
$dsc->save("$dscfn.tmp") or die $!;
my $changes = parsecontrol($changesfile,$changesfilewhat);
@@ -1964,8 +1964,12 @@ sub push_mktag ($$$$$$$) {
my $authline = clogp_authline $clogp;
my $delibs = join(" ", "",@deliberatelies);
my $declaredistro = access_basedistro();
- open TO, '>', $tfn->('.tmp') or die $!;
- print TO <<END or die $!;
+
+ my $mktag = sub {
+ my ($tfn, $head, $tag) = @_;
+
+ open TO, '>', $tfn->('.tmp') or die $!;
+ print TO <<END or die $!;
object $head
type commit
tag $tag
@@ -1974,35 +1978,39 @@ tagger $authline
$package release $cversion for $clogsuite ($csuite) [dgit]
[dgit distro=$declaredistro$delibs]
END
- foreach my $ref (sort keys %previously) {
- print TO <<END or die $!;
+ foreach my $ref (sort keys %previously) {
+ print TO <<END or die $!;
[dgit previously:$ref=$previously{$ref}]
END
- }
+ }
- close TO or die $!;
+ close TO or die $!;
- my $tagobjfn = $tfn->('.tmp');
- if ($sign) {
- if (!defined $keyid) {
- $keyid = access_cfg('keyid','RETURN-UNDEF');
- }
- if (!defined $keyid) {
- $keyid = getfield $clogp, 'Maintainer';
- }
- unlink $tfn->('.tmp.asc') or $!==&ENOENT or die $!;
- my @sign_cmd = (@gpg, qw(--detach-sign --armor));
- push @sign_cmd, qw(-u),$keyid if defined $keyid;
- push @sign_cmd, $tfn->('.tmp');
- runcmd_ordryrun @sign_cmd;
- if (act_scary()) {
- $tagobjfn = $tfn->('.signed.tmp');
- runcmd shell_cmd "exec >$tagobjfn", qw(cat --),
- $tfn->('.tmp'), $tfn->('.tmp.asc');
+ my $tagobjfn = $tfn->('.tmp');
+ if ($sign) {
+ if (!defined $keyid) {
+ $keyid = access_cfg('keyid','RETURN-UNDEF');
+ }
+ if (!defined $keyid) {
+ $keyid = getfield $clogp, 'Maintainer';
+ }
+ unlink $tfn->('.tmp.asc') or $!==&ENOENT or die $!;
+ my @sign_cmd = (@gpg, qw(--detach-sign --armor));
+ push @sign_cmd, qw(-u),$keyid if defined $keyid;
+ push @sign_cmd, $tfn->('.tmp');
+ runcmd_ordryrun @sign_cmd;
+ if (act_scary()) {
+ $tagobjfn = $tfn->('.signed.tmp');
+ runcmd shell_cmd "exec >$tagobjfn", qw(cat --),
+ $tfn->('.tmp'), $tfn->('.tmp.asc');
+ }
}
- }
+ return $tagobjfn;
+ };
- return ($tagobjfn);
+ my @r;
+ push @r, $mktag->($tfnbase, $dgithead, $dgittag);
+ return @r;
}
sub sign_changes ($) {
@@ -2133,7 +2141,7 @@ END
$tagobjfn = $tfn->('.signed.tmp');
responder_receive_files('signed-tag', $tagobjfn);
} else {
- $tagobjfn =
+ ($tagobjfn) =
push_mktag($head,$clogp,$tag,
$dscpath,
$changesfile,$changesfile,
@@ -2567,7 +2575,7 @@ sub i_want_signed_tag {
$csuite = $&;
push_parse_dsc $i_dscfn, 'remote dsc', $i_version;
- my $tagobjfn =
+ my ($tagobjfn) =
push_mktag $head, $i_clogp, $i_tag,
$i_dscfn,
$i_changesfn, 'remote changes',