Kaynağa Gözat

Dpkg::Source::Package::V2_0: removes conflicting subdirectories

* scripts/Dpkg/Source/Package/V2_0.pm: When extracting additional
tarballs, removes the destination directory in case it existed in
the main tarball. Same goes for the debian subdirectory.
* scripts/Makefile.am: Add the module above.
Raphael Hertzog 18 yıl önce
ebeveyn
işleme
1c527e7fc0
2 değiştirilmiş dosya ile 10 ekleme ve 3 silme
  1. 9 3
      scripts/Dpkg/Source/Package/V2_0.pm
  2. 1 0
      scripts/Makefile.am

+ 9 - 3
scripts/Dpkg/Source/Package/V2_0.pm

@@ -78,12 +78,18 @@ sub do_extract {
     # Extract additional orig tarballs
     foreach my $subdir (keys %origtar) {
         my $file = $origtar{$subdir};
-	info(_g("unpacking %s"), $file);
+        info(_g("unpacking %s"), $file);
+        if (-e "$newdirectory/$subdir") {
+            warning(_g("required removal of `%s' installed by original tarball"), $subdir);
+            erasedir("$newdirectory/$subdir");
+        }
         $tar = Dpkg::Source::Archive->new(filename => "$dscdir$file");
         $tar->extract("$newdirectory/$subdir");
     }
 
-    # Extract debian tarball
+    # Extract debian tarball after removing the debian directory
+    info(_g("%s: unpacking %s"), $debianfile);
+    erasedir("$newdirectory/debian");
     $tar = Dpkg::Source::Archive->new(filename => "$dscdir$debianfile");
     $tar->extract("$newdirectory/debian");
 
@@ -187,7 +193,7 @@ sub do_build {
     }
 
     # Copy over the debian directory
-    system("cp", "-a", "$dir/debian", "$tmp/");
+    system("cp", "-a", "--", "$dir/debian", "$tmp/");
     subprocerr(_g("copy of the debian directory")) if $?;
 
     # Apply all patches except the last automatic one

+ 1 - 0
scripts/Makefile.am

@@ -112,6 +112,7 @@ nobase_dist_perllib_DATA = \
 	Dpkg/Source/Functions.pm \
 	Dpkg/Source/Package.pm \
 	Dpkg/Source/Package/V1_0.pm \
+	Dpkg/Source/Package/V2_0.pm \
 	Dpkg/Source/Patch.pm \
 	Dpkg/Source/VCS/git.pm \
 	Dpkg.pm