chiark / gitweb /
dgit.1: drop remark about sbuild not building arch-independent
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 6f240ab0517de64ad24ff7abe29de44e8382ef5e..145fa9bb044be29d383f8849f7766ff0a72f2eab 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -36,6 +36,7 @@ use File::Path;
 use File::Spec;
 use File::Temp qw(tempdir);
 use File::Basename;
+use File::Copy ();
 use Dpkg::Version;
 use Dpkg::Compression;
 use Dpkg::Compression::Process;
@@ -102,6 +103,7 @@ our %forceopts = map { $_=>0 }
     qw(unrepresentable unsupported-source-format
        dsc-changes-mismatch changes-origs-exactly
        uploading-binaries uploading-source-only
+       reusing-version
        import-gitapply-absurd
        import-gitapply-no-absurd
        import-dsc-with-dgit-field);
@@ -1209,6 +1211,7 @@ sub url_fetch ($;@) {
     };
 
     my $response_body = '';
+    $setopt->(CURLOPT_FOLLOWLOCATION,  1);
     $setopt->(CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS|CURLPROTO_HTTP);
     $setopt->(CURLOPT_URL,             $url);
     $setopt->(CURLOPT_NOSIGNAL,        1);
@@ -1753,7 +1756,7 @@ sub get_archive_dsc () {
     foreach my $vinfo (@vsns) {
        my ($vsn,$vsn_dscurl,$digester,$digest) = @$vinfo;
        $dscurl = $vsn_dscurl;
-       $dscdata = url_fetch($dscurl);
+       $dscdata = url_fetch($dscurl, Ok404 => 1 );
        if (!$dscdata) {
            $skew_warning_vsn = $vsn if !defined $skew_warning_vsn;
            next;
@@ -2657,6 +2660,8 @@ END
                chomp $@;
                progress "warning: $@";
                $path = "$absurdity:$path";
+               open T, ">../../absurd-apply-warnings" or die $!;
+               close T or die $!;
                progress f_ "%s: trying slow absurd-git-apply...", $us;
                rename "../../gbp-pq-output","../../gbp-pq-output.0"
                    or $!==ENOENT
@@ -2691,6 +2696,11 @@ gbp-pq import and dpkg-source disagree!
  dpkg-source --before-build gave tree %s
 END
                $rawimport_hash = $gapplied;
+
+               if ($use_absurd) {
+                   File::Copy::copy("../../absurd-apply-warnings", \*STDERR)
+                         or die $!;
+               }
            };
            last unless $@;
        }
@@ -3598,7 +3608,7 @@ sub is_gitattrs_setup () {
     #     0: there is a dgit-defuse-attrs but it needs fixing
     #     undef: there is none
     my $gai = open_main_gitattrs();
-    return 0 unless $gai;
+    return undef unless $gai;
     while (<$gai>) {
        next unless m{$gitattrs_ourmacro_re};
        return 1 if m{\s-working-tree-encoding\s};
@@ -4594,13 +4604,27 @@ END
                " of the archive's version.\n".
                "To overwrite the archive's contents,".
                " pass --overwrite[=VERSION].\n".
-               "To rewind history, if permitted by the archive,".
+               "To rewrite history, if permitted by the archive,".
                " use --deliberately-not-fast-forward.";
        }
     }
 
     confess unless !!$made_split_brain == do_split_brain();
 
+    my $tagname = debiantag_new $cversion, access_nomdistro();
+    if (!(forceing[qw(reusing-version)]) && git_get_ref "refs/tags/$tagname") {
+       supplementary_message '';
+       print STDERR f_ <<END, $cversion;
+
+Version %s has already been tagged (pushed?)
+If this was a failed (or incomplete or rejected) upload by you, just
+add a new changelog stanza for a new version number and try again.
+END
+       fail f_ <<END, $tagname;
+Tag %s already exists.
+END
+    }
+
     changedir $playground;
     progress f_ "checking that %s corresponds to HEAD", $dscfn;
     runcmd qw(dpkg-source -x --),