Prechádzať zdrojové kódy

move tardir creation into the prep_tar function

It was annoying that the tardir was created even if the build failed due
to uncommitted changes, this avoids that problem.
Joey Hess 19 rokov pred
rodič
commit
c0cf5584b0
2 zmenil súbory, kde vykonal 4 pridanie a 5 odobranie
  1. 3 1
      scripts/Dpkg/Source/VCS/git.pm
  2. 1 4
      scripts/dpkg-source.pl

+ 3 - 1
scripts/Dpkg/Source/VCS/git.pm

@@ -135,7 +135,9 @@ sub prep_tar {
 
 
 	# TODO support for creating a shallow clone for those cases where
 	# TODO support for creating a shallow clone for those cases where
 	# uploading the whole repo history is not desired
 	# uploading the whole repo history is not desired
-	
+
+	mkdir($tardir,0755) ||
+            &syserr(sprintf(_g("unable to create `%s'"), $tardir));
 	system("cp -a $srcdir/.git $tardir");
 	system("cp -a $srcdir/.git $tardir");
 	$? && main::subprocerr("cp -a $srcdir/.git $tardir");
 	$? && main::subprocerr("cp -a $srcdir/.git $tardir");
 
 

+ 1 - 4
scripts/dpkg-source.pl

@@ -478,14 +478,11 @@ if ($opmode eq 'build') {
 	$tarname="$basenamerev.$vcs.tar.gz";
 	$tarname="$basenamerev.$vcs.tar.gz";
         $tardirbase= $dirbase; $tardirname= "$tarname.tmp";
         $tardirbase= $dirbase; $tardirname= "$tarname.tmp";
 
 
-        mkdir($tardirname,0755) ||
-            &syserr(sprintf(_g("unable to create `%s'"), $tardirname));
-	push @exit_handlers, sub { erasedir($tardirname) };
-        
 	eval qq{Dpkg::Source::VCS::${vcs}::prep_tar(\$dir, \$tardirname)};
 	eval qq{Dpkg::Source::VCS::${vcs}::prep_tar(\$dir, \$tardirname)};
 	if ($@) {
 	if ($@) {
             &syserr($@);
             &syserr($@);
 	}
 	}
+	push @exit_handlers, sub { erasedir($tardirname) };
     }
     }
     elsif ($sourcestyle ne 'n') {
     elsif ($sourcestyle ne 'n') {
 	my $origdirbase = $origdir;
 	my $origdirbase = $origdir;