From: Ian Jackson Date: Sat, 30 Jul 2016 14:32:28 +0000 (+0100) Subject: Split tags: Introduce $mktag in push_mktag X-Git-Tag: archive/debian/2.0~228 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=496685d614bba3670ba89fda0802750b8ac54a9d;ds=inline 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 --- diff --git a/dgit b/dgit index a2771c5c..4aefa085 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 <', $tfn->('.tmp') or die $!; + print TO <('.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',