tags 700411 patch
thanks

On 12/02/13 14:37, Raphaël Hertzog wrote:
> 
> git-import-orig will happily import upstream tarballs that contain a
> debian directory and when the upstream debian dir changes, git-import-orig
> will try to merge those changes in the real debian packaging available on
> the master branch.
> 
> In the best case, it fails, in the worst case it leads to indesirable
> changes.
> 
> I tried to work-around this problem with --filter='debian/*' but there's
> no safe pattern to use... because this one will also strip
> "src/plugins/debian" from the upstream tarball and we don't really want
> this by default.
> 
> So I would suggest that git-import-orig should automatically remove the
> top-level "debian" directory when it does its work.
> 
> I'm not sure how git-import-dsc behaves in the same situation but it
> should probably adjust its behaviour depending on the source format.
> With 3.0 (quilt), you want this behaviour since the debian directory
> is always coming from a separate tarball and thus both debian directories
> are entirely unrelated. With "3.0 (native)" you want to keep the debian
> directory because it only exists in the upstream tarball. With "1.0" it
> depends...
> 

Hi!

I have been also affected by this issue.

I have cooked a patch to fix this. It checks if the unpacked upstream
tarball contains a "debian/" directory, then it checks if the current
package is native or not. If it's not native, then it wipes the debian/
directory from the unpacked upstream tarball before doing the import.

The patch attached is against git-buildpackage=0.6.0~git20130414
--- a/gbp/scripts/import_orig.py
+++ b/gbp/scripts/import_orig.py
@@ -21,11 +21,13 @@
 import os
 import sys
 import tempfile
+import shutil
 import gbp.command_wrappers as gbpc
 from gbp.deb import (DebianPkgPolicy, parse_changelog_repo)
 from gbp.deb.uscan import (Uscan, UscanError)
 from gbp.deb.changelog import ChangeLog, NoChangeLogError
 from gbp.deb.git import (GitRepositoryError, DebianGitRepository)
+from gbp.deb.source import DebianSource
 from gbp.config import GbpOptionParserDebian, GbpOptionGroup, no_upstream_branch_msg
 from gbp.errors import GbpError
 import gbp.log
@@ -283,6 +285,13 @@
             tmpdir = tempfile.mkdtemp(dir='../')
             source.unpack(tmpdir, options.filters)
             gbp.log.debug("Unpacked '%s' to '%s'" % (source.path, source.unpacked))
+            if os.path.isdir("%s" %(os.path.join(source.unpacked,"debian"))):
+                try:
+                    if not DebianSource('.').is_native():
+                        shutil.rmtree("%s" %(os.path.join(source.unpacked,"debian")))
+                        gbp.log.info("Deleted 'debian/' directory from unpacked upstream tarball before import")
+                except Exception as e:
+                    raise GbpError("Can't determine package type: %s" % e)
 
         if source.needs_repack(options):
             gbp.log.debug("Filter pristine-tar: repacking '%s' from '%s'" % (source.path, source.unpacked))

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to