UpstreamSource: implement prefix guessing
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Thu, 22 Aug 2013 13:24:13 +0000 (16:24 +0300)
committerJun Wang <junbill.wang@samsung.com>
Wed, 27 Jan 2016 10:09:55 +0000 (18:09 +0800)
Add a new attribure 'prefix', i.e. the "leading directory name" in an
archive. For example, this usually is '<name>-<version>' in release
tarballs.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ɓukasz Stelmach <l.stelmach@samsung.com>
Conflicts:
gbp/pkg/__init__.py

gbp/pkg/__init__.py

index 2ed43d0..7906798 100644 (file)
@@ -509,17 +509,6 @@ class UpstreamSource(object):
         except gbpc.CommandExecFailed:
             raise GbpError("Unpacking of %s failed" % self.path)
 
-    def _unpacked_toplevel(self, dir):
-        """unpacked archives can contain a leading directory or not"""
-        unpacked = glob.glob('%s/*' % dir)
-        unpacked.extend(glob.glob("%s/.*" % dir)) # include hidden files and folders
-        # Check that dir contains nothing but a single folder:
-        if len(unpacked) == 1 and os.path.isdir(unpacked[0]):
-            return unpacked[0]
-        else:
-            # We can determine "no prefix" from this
-            return os.path.join(dir, ".")
-
     def _unpack_tar(self, dir, filters):
         """
         Unpack a tarball to I{dir} applying a list of I{filters}. Leave the