Your message dated Fri, 28 Apr 2017 10:01:19 +0200
with message-id <[email protected]>
and subject line Re: Bug#458428: Please update the patch
has caused the Debian Bug report #458428,
regarding Option to omit importing upstream files
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
458428: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=458428
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Source: git-buildpackage
Severity: wishlist
Tags: patch

Please allow an option to omit importing the upstream files from a
package and track just the debian directory. I've attached a patch
that provides git-import-dsc with an 'omit-upstream' option that does
this.

-- 
Regards,
Andres Mejia
--- git-import-dsc.bak  2007-12-31 03:09:23.000000000 -0500
+++ git-import-dsc      2007-12-31 03:10:01.000000000 -0500
@@ -115,6 +115,33 @@
     return True
 
 
+def import_without_upstream(src, dirs):
+    """
+    Create a git repository that will hold just the debian patch
+    """
+    diffgz = "%s_%s-%s.diff.gz" % (src.pkg, src.upstream_version, 
src.debian_version)
+    diffgz_path = os.path.abspath(diffgz)
+    os.chdir(dirs['tmp'])
+    try:
+        package = "%s-%s" % (src.pkg, src.upstream_version)
+        os.mkdir(package)
+        dirs['git'] = os.path.abspath(package)
+        gbpc.CopyFile(diffgz_path, '.')()
+        gbpc.GunzipDiffGz(diffgz)()
+        diff = "%s_%s-%s.diff" % (src.pkg, src.upstream_version, 
src.debian_version)
+        gbpc.ApplyDebianDiff(diff)()
+        os.chdir(dirs['git'])
+        gbpc.GitInitDB()()
+        gbpc.GitAdd()(['.'])
+        gbpc.GitCommitAll()(
+             msg="Imported debian directory only for %s version %s-%s" % 
(src.pkg, src.upstream_version, src.debian_version))
+    except gbpc.CommandExecFailed:
+        print >>sys.stderr, "Creation of git repository failed"
+        gbpc.RemoveTree(dirs['tmp'])
+        return False
+    return True
+
+
 def apply_debian_patch(src, dirs, options, tagger, filter):
     """apply the debian patch and tag appropriately"""
     try:
@@ -189,6 +216,8 @@
                       help="Format string for upstream tags, default is 
'%(upstream-tag)s'")
     parser.add_config_file_option(option_name="filter", dest="filter",
                       help="files to filter out during import")
+    parser.add_config_file_option(option_name="omit-upstream", 
dest="omit_upstream",
+                      help="omit importing files from upstream", 
action="store_true")
     (options, args) = parser.parse_args(argv[1:])
 
     if options.verbose:
@@ -206,10 +235,14 @@
                 raise GbpError
 
             dirs['tmp'] = os.path.abspath(tempfile.mkdtemp(dir='.'))
-            if not import_initial(src, dirs, options, gitTag, options.filter):
-                raise GbpError
+            if options.omit_upstream:
+                if not import_without_upstream(src, dirs):
+                    raise GbpError
+            else:
+                if not import_initial(src, dirs, options, gitTag, 
options.filter):
+                     raise GbpError
             os.chdir(dirs['top'])
-            if not src.native:
+            if not src.native and not options.omit_upstream:
                 dirs['unpack'] = os.path.join(dirs['tmp'], 'unpack')
                 os.mkdir(dirs['unpack'])
                 dirs['dpkg-src'] = os.path.join(dirs['unpack'],
--- gbp/command_wrappers.py.bak 2007-12-31 03:09:28.000000000 -0500
+++ gbp/command_wrappers.py     2007-12-31 03:10:50.000000000 -0500
@@ -113,6 +113,33 @@
         self.run_error = "Couldn't extract %s" % dsc
         Command.__call__(self, [dsc, output_dir])

+class GunzipDiffGz(Command):
+    """
+    Extract diff.gz to get patch file
+    """
+    def __init__(self, file):
+        self.file = file
+        Command.__init__(self, 'gunzip', [ file ])
+        self.run_error = "Couldn't extract %s" % file
+
+class CopyFile(Command):
+    """
+    Copy a file
+    """
+    def __init__(self, file, dest):
+        self.file = file
+        self.dest = dest
+        Command.__init__(self, 'cp', [ file, dest ])
+        self.run_error = "Couldn't copy %s to %s" % (file, dest)
+
+class ApplyDebianDiff(Command):
+    """
+    Applies the Debian diff that's included in a non-native package
+    """
+    def __init__(self, diff):
+        self.diff = diff
+        Command.__init__(self, 'patch', [ '-p0', '-f', '-s', '-t', '-i', diff 
])
+        self.run_error = "Couldn't apply Debian diff %s" % diff

 class GitCommand(Command):
     "Mother/Father of all git commands"
--- gbp/config.py.bak   2007-12-31 03:09:32.000000000 -0500
+++ gbp/config.py       2007-12-31 03:10:10.000000000 -0500
@@ -38,6 +38,7 @@
                  'git-log'         : '--no-merges',
                  'export-dir'      : '',
                  'tarball-dir'     : '',
+                 'omit-upstream'   : '',      # empty means False
              }
     config_files = [ '/etc/git-buildpackage/gbp.conf',
                      os.path.expanduser('~/.gbp.conf'),

--- End Message ---
--- Begin Message ---
Hi Andres,
On Wed, Mar 05, 2008 at 09:59:19PM +0100, Guido Günther wrote:
> Hi Andres,
> could you update the patch as suggested? Sorry I'm a bit picky here but
> this is something that's used rarely (pristine-tar is much more powerful
> than not importing the orig) so I want this to be unintrusive.

Since there was no feedback since some years I'm closing this bug. In
case there's still interest getting this merged please repopen.
Cheers,
 -- Guido

--- End Message ---

Reply via email to