chiark / gitweb /
Merge tag dgit/2.14 into `defence in dgit-repos-server' branch
[dgit.git] / Debian / Dgit.pm
index a3c27539c719cb547e7f6fcebaac155356255b23..e9921d6a33435c5c34164eca3f2dc2174bf1e4ef 100644 (file)
@@ -54,7 +54,7 @@ BEGIN {
                       $debugprefix *debuglevel *DEBUG
                       shellquote printcmd messagequote);
     # implicitly uses $main::us
-    %EXPORT_TAGS = ( policyflags => [qw(NOFFCHECK FRESHREPO)] );
+    %EXPORT_TAGS = ( policyflags => [qw(NOFFCHECK FRESHREPO NOCOMMITCHECK)] );
     @EXPORT_OK   = @{ $EXPORT_TAGS{policyflags} };
 }
 
@@ -71,6 +71,7 @@ our $branchprefix = 'dgit';
 # dynamic loader, runtime, etc., failures, which report 127 or 255
 sub NOFFCHECK () { return 0x2; }
 sub FRESHREPO () { return 0x4; }
+sub NOCOMMITCHECK () { return 0x8; }
 
 our $debugprefix;
 our $debuglevel = 0;
@@ -147,8 +148,9 @@ sub debugcmd {
 
 sub dep14_version_mangle ($) {
     my ($v) = @_;
-    # DEP-14 2014-11-05 "Version Mangling"
+    # DEP-14 patch proposed 2016-11-09  "Version Mangling"
     $v =~ y/~:/_%/;
+    $v =~ s/\.(?=\.|$|lock$)/.#/g;
     return $v;
 }
 
@@ -288,7 +290,9 @@ sub link_ltarget ($$) {
     if (-l _) {
        $old = cmdoutput qw(realpath  --), $old;
     }
-    link $old, $new or die "link $old $new: $!";
+    my $r = link $old, $new;
+    $r = symlink $old, $new if !$r && $!==EXDEV;
+    $r or die "(sym)link $old $new: $!";
 }
 
 sub hashfile ($) {