diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-08-03 13:49:37 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-08-03 14:53:44 +0100 |
commit | 666278d3724ee2f7b3f75272a9735c5bb4176575 (patch) | |
tree | 4f8d2d8d7285a6eed7a12756b80e5d9719b13d30 /Debian | |
parent | fe63aca9ed9d55d546a8cb5cd83053bbaaafe309 (diff) |
Dgit.pm: Move is_orig_file_of_p_v and its dependencies from dgit
We want is_orig_file_of_p_v, so move it and all the things it depends
on.
NFC.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'Debian')
-rw-r--r-- | Debian/Dgit.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 0e2464d..05e4c0c 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -43,6 +43,7 @@ BEGIN { dep14_version_mangle debiantags debiantag_old debiantag_new debiantag_maintview + stripepoch source_file_leafname is_orig_file_of_p_v server_branch server_ref stat_exists link_ltarget hashfile @@ -57,6 +58,7 @@ BEGIN { git_reflog_action_msg git_update_ref_cmd $package_re $component_re $deliberately_re $distro_re $versiontag_re $series_filename_re + $orig_f_comp_re $orig_f_sig_re $orig_f_tail_re $extra_orig_namepart_re $git_null_obj $branchprefix @@ -91,6 +93,9 @@ our $versiontag_re = qr{[-+.\%_0-9a-zA-Z/]+}; our $branchprefix = 'dgit'; our $series_filename_re = qr{(?:^|\.)series(?!\n)$}s; our $extra_orig_namepart_re = qr{[-0-9a-z]+}; +our $orig_f_comp_re = qr{orig(?:-$extra_orig_namepart_re)?}; +our $orig_f_sig_re = '\\.(?:asc|gpg|pgp)'; +our $orig_f_tail_re = "$orig_f_comp_re\\.tar(?:\\.\\w+)?(?:$orig_f_sig_re)?"; our $git_null_obj = '0' x 40; our $ffq_refprefix = 'ffq-prev'; our $gdrlast_refprefix = 'debrebase-last'; @@ -220,6 +225,24 @@ sub debiantags ($$) { map { $_->($version, $distro) } (\&debiantag_new, \&debiantag_old); } +sub stripepoch ($) { + my ($vsn) = @_; + $vsn =~ s/^\d+\://; + return $vsn; +} + +sub source_file_leafname ($$$) { + my ($package,$vsn,$sfx) = @_; + return "${package}_".(stripepoch $vsn).$sfx +} + +sub is_orig_file_of_p_v ($$$) { + my ($package, $f, $upstreamvsn) = @_; + my $base = source_file_leafname $package, $upstreamvsn, ''; + return 0 unless $f =~ m/^\Q$base\E\.$orig_f_tail_re$/; + return 1; +} + sub server_branch ($) { return "$branchprefix/$_[0]"; } sub server_ref ($) { return "refs/".server_branch($_[0]); } |