From: Raphael Hertzog Date: Fri, 29 Feb 2008 20:01:56 +0000 (+0100) Subject: Dpkg::Source::Package::V2_0: removes conflicting subdirectories X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c527e7fc0c86487696898a6356b66a4d582d860;p=dpkg 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. --- diff --git a/scripts/Dpkg/Source/Package/V2_0.pm b/scripts/Dpkg/Source/Package/V2_0.pm index 309bb7d4..66a962cf 100644 --- a/scripts/Dpkg/Source/Package/V2_0.pm +++ b/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 diff --git a/scripts/Makefile.am b/scripts/Makefile.am index debd1995..59cd221e 100644 --- a/scripts/Makefile.am +++ b/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