示例#1
0
    def checkout(self, package, version, comp_type, output_dir, component=None,
                 quiet=False, signature=False):
        """
        Checkout the orig tarball for package I{package} of I{version} and
        compression type I{comp_type} to I{output_dir}

        @param package: the package to generate the orig tarball for
        @type package: C{str}
        @param version: the version to check generate the orig tarball for
        @type version: C{str}
        @param comp_type: the compression type of the tarball
        @type comp_type: C{str}
        @param output_dir: the directory to put the tarball into
        @type output_dir: C{str}
        """
        signaturefile = None
        name = DebianPkgPolicy.build_tarball_name(package,
                                                  version,
                                                  comp_type,
                                                  output_dir,
                                                  component=component)
        if signature:
            signaturefile = DebianPkgPolicy.build_signature_name(package,
                                                                 version,
                                                                 comp_type,
                                                                 output_dir,
                                                                 component=component)
        super(DebianPristineTar, self).checkout(name,
                                                quiet=quiet,
                                                signaturefile=signaturefile)
示例#2
0
    def checkout(self,
                 package,
                 version,
                 comp_type,
                 output_dir,
                 subtarball=None):
        """
        Checkout the orig tarball for package I{package} of I{version} and
        compression type I{comp_type} to I{output_dir}

        @param package: the package to generate the orig tarball for
        @type package: C{str}
        @param version: the version to check generate the orig tarball for
        @type version: C{str}
        @param comp_type: the compression type of the tarball
        @type comp_type: C{str}
        @param output_dir: the directory to put the tarball into
        @type output_dir: C{str}
        """
        name = DebianPkgPolicy.build_tarball_name(package,
                                                  version,
                                                  comp_type,
                                                  output_dir,
                                                  subtarball=subtarball)
        super(DebianPristineTar, self).checkout(name)
示例#3
0
 def test_has_orig_multiple_true(self):
     for ext in ['', '-foo', '-bar']:
         open(self.tmpdir.join('source_1.2.orig%s.tar.gz' % ext),
              "w").close()
     orig_files = [self.source.upstream_tarball_name('gzip')] + \
                  [self.source.upstream_tarball_name('gzip', sub) for sub in ['foo', 'bar']]
     self.assertTrue(DebianPkgPolicy.has_origs(orig_files,
                                               str(self.tmpdir)))
示例#4
0
    def upstream_tarball_name(self, compression, component=None):
        """
        Possible upstream tarball name for this source package

        Gives the name of the main tarball if component is None
        """
        if self.is_native():
            return None
        return Policy.build_tarball_name(self.name,
                                         self.upstream_version,
                                         compression=compression,
                                         component=component)
示例#5
0
    def upstream_tarball_name(self, compression, component=None):
        """
        Possible upstream tarball name for this source package

        Gives the name of the main tarball if component is None
        """
        if self.is_native():
            return None
        return Policy.build_tarball_name(self.name,
                                         self.upstream_version,
                                         compression=compression,
                                         component=component)
示例#6
0
def get_component_tarballs(name, version, tarball, components):
    """
    Figure out the paths to the component tarballs based on the main
    tarball.
    """
    tarballs = []
    (_, _, comp_type) = Archive.parse_filename(tarball)
    for component in components:
        cname = DebianPkgPolicy.build_tarball_name(name, version, comp_type,
                                                   os.path.dirname(tarball),
                                                   component)
        tarballs.append(DebianAdditionalTarball(cname, component))
        if not os.path.exists(cname):
            raise GbpError("Can not find component tarball %s" % cname)
    return tarballs
示例#7
0
    def checkout(self, package, version, comp_type, output_dir):
        """
        Checkout the orig tarball for package I{package} of I{version} and
        compression type I{comp_type} to I{output_dir}

        @param package: the package to generate the orig tarball for
        @type package: C{str}
        @param version: the version to check generate the orig tarball for
        @type version: C{str}
        @param comp_type: the compression type of the tarball
        @type comp_type: C{str}
        @param output_dir: the directory to put the tarball into
        @type output_dir: C{str}
        """
        name = DebianPkgPolicy.build_tarball_name(package, version, comp_type, output_dir)
        super(DebianPristineTar, self).checkout(name)
示例#8
0
def get_component_tarballs(name, version, tarball, components):
    """
    Figure out the paths to the component tarballs based on the main
    tarball.
    """
    tarballs = []
    (_, _, comp_type) = Archive.parse_filename(tarball)
    for component in components:
        cname = DebianPkgPolicy.build_tarball_name(name,
                                                   version,
                                                   comp_type,
                                                   os.path.dirname(tarball),
                                                   component)
        tarballs.append((component, cname))
        if not os.path.exists(cname):
            raise GbpError("Can not find component tarball %s" % cname)
    return tarballs
示例#9
0
    def has_commit(self, package, version, comp_type=None):
        """
        Do we have a pristine-tar commit for package I{package} at version
        {version} with compression type I{comp_type}?

        @param package: the package to look for
        @type package: C{str}
        @param version: the upstream version to look for
        @type version: C{str}
        @param comp_type: the compression type
        @type comp_type: C{str}
        """

        # name_regexp = '%s_%s\.orig\.tar\.%s' % (package, version, ext)
        
        name_regexp = DebianPkgPolicy.build_tarball_name_pattern(
            package, version, comp_type)
        return super(DebianPristineTar, self).has_commit(name_regexp)
 def test_has_orig_multiple_false(self):
     orig_files = [orig_file(self.cp, 'gzip')] + \
                  [orig_file(self.cp, 'gzip', sub) for sub in ['foo', 'bar']]
     self.assertFalse(DebianPkgPolicy.has_origs(orig_files, str(self.tmpdir)))
示例#11
0
 def test_has_orig_multiple_false(self):
     orig_files = [self.source.upstream_tarball_name('gzip')] + \
                  [self.source.upstream_tarball_name('gzip', sub) for sub in ['foo', 'bar']]
     self.assertFalse(
         DebianPkgPolicy.has_origs(orig_files, str(self.tmpdir)))
示例#12
0
 def test_has_orig_single_false(self):
     self.assertFalse(
         DebianPkgPolicy.has_origs([orig_file(self.source, 'gzip')],
                                   str(self.tmpdir)))
示例#13
0
 def test_has_orig_single_false(self):
     self.assertFalse(
         DebianPkgPolicy.has_origs(
             [self.source.upstream_tarball_name('gzip')], str(self.tmpdir)))
示例#14
0
 def test_has_orig_single_true(self):
     open(self.tmpdir.join('source_1.2.orig.tar.gz'), "w").close()
     self.assertTrue(
         DebianPkgPolicy.has_origs(
             [self.source.upstream_tarball_name('gzip')], str(self.tmpdir)))
 def test_has_orig_true(self):
     open(os.path.join(self.tmpdir, 'source_1.2.orig.tar.gz'), "w").close()
     self.assertTrue(DebianPkgPolicy.has_orig(orig_file(self.cp, 'gzip'), self.tmpdir))
 def test_has_orig_single_false(self):
     self.assertFalse(DebianPkgPolicy.has_origs([self.source.upstream_tarball_name('gzip')], str(self.tmpdir)))
 def test_has_orig_single_true(self):
     open(self.tmpdir.join('source_1.2.orig.tar.gz'), "w").close()
     self.assertTrue(DebianPkgPolicy.has_origs([self.source.upstream_tarball_name('gzip')], str(self.tmpdir)))
 def test_has_orig_false(self):
     self.assertFalse(DebianPkgPolicy.has_orig(orig_file(self.cp, 'gzip'), self.tmpdir))
 def test_has_orig_false(self):
     self.assertFalse(
         DebianPkgPolicy.has_orig(orig_file(self.cp, 'gzip'),
                                  str(self.tmpdir)))
 def test_has_orig_true(self):
     open(self.tmpdir.join('source_1.2.orig.tar.gz'), "w").close()
     self.assertTrue(
         DebianPkgPolicy.has_orig(orig_file(self.cp, 'gzip'),
                                  str(self.tmpdir)))
 def test_has_orig_multiple_true(self):
     for ext in ['', '-foo', '-bar']:
         open(self.tmpdir.join('source_1.2.orig%s.tar.gz' % ext), "w").close()
     orig_files = [orig_file(self.cp, 'gzip')] + \
                  [orig_file(self.cp, 'gzip', sub) for sub in ['foo', 'bar']]
     self.assertTrue(DebianPkgPolicy.has_origs(orig_files, str(self.tmpdir)))
 def test_has_orig_multiple_false(self):
     orig_files = [self.source.upstream_tarball_name('gzip')] + \
                  [self.source.upstream_tarball_name('gzip', sub) for sub in ['foo', 'bar']]
     self.assertFalse(DebianPkgPolicy.has_origs(orig_files, str(self.tmpdir)))
 def test_has_orig_single_true(self):
     open(self.tmpdir.join('source_1.2.orig.tar.gz'), "w").close()
     self.assertTrue(DebianPkgPolicy.has_origs([orig_file(self.cp, 'gzip')], str(self.tmpdir)))
 def test_has_orig_single_false(self):
     self.assertFalse(DebianPkgPolicy.has_origs([orig_file(self.cp, 'gzip')], str(self.tmpdir)))
示例#25
0
 def test_has_orig_multiple_false(self):
     orig_files = [orig_file(self.cp, 'gzip')] + \
                  [orig_file(self.cp, 'gzip', sub) for sub in ['foo', 'bar']]
     self.assertFalse(DebianPkgPolicy.has_origs(orig_files, str(self.tmpdir)))