]> err.no Git - dpkg/commitdiff
Dpkg::Source::Package::V2_0: removes conflicting subdirectories
authorRaphael Hertzog <hertzog@debian.org>
Fri, 29 Feb 2008 20:01:56 +0000 (21:01 +0100)
committerRaphael Hertzog <hertzog@debian.org>
Sat, 1 Mar 2008 08:55:08 +0000 (09:55 +0100)
* 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.

scripts/Dpkg/Source/Package/V2_0.pm
scripts/Makefile.am

index 309bb7d48e6e1ad12ca8e61dd4b25d4db9cc3f6b..66a962cfbc4df397204b04fdade54998963c5d88 100644 (file)
@@ -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
index debd19950c3d4033a50017ac8c6e87ebb04a1cb4..59cd221e7dd1593848e6d8b1ffd4b5d5ab58d7a4 100644 (file)
@@ -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