tag 700411 +patch
thanks

On 06/05/13 18:20, Guido Günther wrote:
> 
> It's a great start but before applying it we should also make sure
> git-import-dsc behaves consistently and also not do it for 1.0 packages
> since these are expected to have a patch that applies against the
> upstream tarball.
> Cheers,
>  -- Guido
> 

I'm attaching a rebased patch that checks for the source format of the
package and only wipes the debian/ directory from upstream tarball if
the source format is 3.0 (quilt).


I'm not sure if for the other 3.0 type of packages (git,bzr,custom)
deleting the debian/ directory is expected. If this was the case, then
is a simple matter of changing on the patch:

-                    if source_format.version == "3.0" and source_format.type 
== "quilt":
+                    if source_format.version == "3.0" and source_format.type 
!= "native":



Regards!
From 440f2066001fafa2668848980602baaaf0cb1ea4 Mon Sep 17 00:00:00 2001
From: Carlos Alberto Lopez Perez <clo...@igalia.com>
Date: Sat, 15 Feb 2014 18:57:52 +0100
Subject: [PATCH] Filter upstream debian directory on packages 3.0 (quilt)
 (#700411)

---
 gbp/scripts/import_orig.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py
index aae93fa..8036bd3 100644
--- a/gbp/scripts/import_orig.py
+++ b/gbp/scripts/import_orig.py
@@ -21,11 +21,13 @@ import ConfigParser
 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.format import DebianSourceFormat
 from gbp.config import GbpOptionParserDebian, GbpOptionGroup, no_upstream_branch_msg
 from gbp.errors import GbpError
 import gbp.log
@@ -292,6 +294,15 @@ def main(argv):
             tmpdir = tempfile.mkdtemp(dir='../')
             source.unpack(tmpdir, options.filters)
             gbp.log.debug("Unpacked '%s' to '%s'" % (source.path, source.unpacked))
+            # wipe upstream "debian/" if package is 3.0 (quilt)
+            if os.path.isfile(DebianSourceFormat.format_file) and os.path.isdir("%s" %(os.path.join(source.unpacked,"debian"))):
+                try:
+                    source_format = DebianSourceFormat.parse_file(DebianSourceFormat.format_file)
+                    if source_format.version == "3.0" and source_format.type == "quilt":
+                        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))
-- 
1.8.5.3

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to