Esempio n. 1
0
def filelists_from_spec(spec, specpath):
    res = Tree()
    for pkg in spec.packages:
        name = "%s.install.in" % mappkgname.map_package_name(pkg.header)
        res.append("debian/%s" % name,
                   files_from_pkg(spec.sourceHeader['name'], pkg, specpath))
    return res
Esempio n. 2
0
def compat_from_spec(_):
    """
    Create the contents of the debian/compat file.
    """
    res = Tree()
    res.append("debian/compat", "8")
    return res
Esempio n. 3
0
def copyright_from_spec(_):
    """
    Create the contents of the debian/copyright file.
    Currently not filled correctly.
    """
    res = Tree()
    res.append("debian/copyright", "FIXME")
    return res
Esempio n. 4
0
def format_from_spec(_, isnative):
    """
    Create the contents of the debian/format file.
    """
    res = Tree()
    fmt = "native" if isnative else "quilt"
    res.append("debian/source/format", "3.0 (%s)\n" % fmt)
    return res
Esempio n. 5
0
def conffiles_from_spec(spec, specpath):
    # Configuration files, not to be overwritten on upgrade.
    # Files in /etc are automatically marked as config files,
    # so we only need to list files here if they are in a
    # different place.
    res = Tree()
    pkgname = mappkgname.map_package_name(spec.sourceHeader)
    files = rpmextra.files_from_spec(pkgname, specpath)
    if pkgname + "-%config" in files:
        for filename in files[pkgname + "-%config"]:
            res.append('debian/conffiles', "%s\n" % filename)
    return res
Esempio n. 6
0
def patches_from_spec(spec, src_dir):
    res = Tree()
    patches = [(seq, name) for (name, seq, typ) in spec.sources
               if typ == 2]
    patches = [name for (seq, name) in sorted(patches)]
    for patch in patches:
        with open(os.path.join(src_dir, patch)) as patchfile:
            contents = patchfile.read()
            permissions = os.fstat(patchfile.fileno()).st_mode
        res.append(os.path.join("debian/patches", patch),
                   contents, permissions)
        res.append("debian/patches/series", "%s\n" % patch)
    return res
Esempio n. 7
0
def changelog_from_spec(spec, isnative):
    """Generate a Debian changelog from spec"""

    res = Tree()

    hdr = spec.sourceHeader
    log = ""
    for (name, timestamp, text) in zip(hdr['changelogname'],
                                       hdr['changelogtime'],
                                       hdr['changelogtext']):

        # A Debian package's version is defined by the version of the
        # first entry in the changelog, so we must get this right.
        # Most spec files have changelog entries starting:
        #   "First Last # <*****@*****.**> - version"
        # This seems to be the standard for Red Hat spec files.
        # Some of our changelogs only have "First Last <*****@*****.**>".
        # For these, we use the version from the spec.
        match = re.match(r"^(.+) - (\S+)$", name)
        if match:
            author = match.group(1)
            version = match.group(2)
            if isnative:
                version = re.sub('-', '.', version)
        else:
            author = name
            sep = '.' if isnative else '-'
            version = "%s%s%s" % (spec.sourceHeader['version'],
                                  sep,
                                  spec.sourceHeader['release'])
        print version

        package_name = mappkgname.map_package(hdr['name'])[0]
        log += "%s (%s) UNRELEASED; urgency=low\n" % (package_name, version)
        log += "\n"

        text = re.sub("^-", "*", text, flags=re.MULTILINE)
        text = re.sub("^", "  ", text, flags=re.MULTILINE)
        log += "%s\n" % text
        log += "\n"

        date_string = time.strftime("%a, %d %b %Y %H:%M:%S %z",
                                    time.gmtime(int(timestamp)))
        log += " -- %s  %s\n" % (author, date_string)
        log += "\n"

    res.append('debian/changelog', log)
    return res
Esempio n. 8
0
def patches_from_spec(spec, src_dir):
    """
    Create the contents of the debian/patches directory,
    which holds local patches to be applied to the pristine
    sources.
    """
    res = Tree()
    patches = [(seq, name) for (name, seq, typ) in spec.sources
               if typ == 2]
    patches = [name for (seq, name) in sorted(patches)]
    for patch in patches:
        with open(os.path.join(src_dir, patch)) as patchfile:
            contents = patchfile.read()
            permissions = os.fstat(patchfile.fileno()).st_mode
        res.append(os.path.join("debian/patches", patch),
                   contents, permissions)
        res.append("debian/patches/series", "%s\n" % patch)
    return res
Esempio n. 9
0
def copyright_from_spec(_):
    res = Tree()
    res.append("debian/copyright", "FIXME")
    return res
Esempio n. 10
0
def format_from_spec(_, isnative):
    res = Tree()
    fmt = "native" if isnative else "quilt"
    res.append("debian/source/format", "3.0 (%s)\n" % fmt)
    return res
Esempio n. 11
0
def compat_from_spec(_):
    res = Tree()
    res.append("debian/compat", "8")
    return res