Ejemplo n.º 1
0
def spec_source_url(source: UrlSource) -> str:
    """
    This function returns the Source string for packages built from tarballs specified by *url*.

    Arguments:
        UrlSource source:   source a Source tag will be generated for

    Returns:
        str:                Source tag in the format `Source0: $URL`
    """

    assert isinstance(source, UrlSource)

    src_str = format_tag_line("Source0", source.spkg.conf.get("url", "orig"))
    return src_str
Ejemplo n.º 2
0
    def set_version(self):
        """
        This method writes the updated version to the rpm spec file.
        """

        contents_new = str()

        for line in self.get_lines():
            assert isinstance(line, str)
            if line[0:8] != "Version:":
                contents_new += (line + "\n")
            else:
                contents_new += format_tag_line("Version", self.build_version_string())

        self.contents = contents_new
Ejemplo n.º 3
0
def spec_source_local(source: LocalSource) -> str:
    """
    This function returns the Source string for packages built from tarballs specified by a *local
    path*.

    Arguments:
        LocalSource source:     source a Source tag will be generated for

    Returns:
        str:                    Source tag in the format `Source0: $VERSION`
    """

    assert isinstance(source, LocalSource)

    src_str = format_tag_line("Source0", os.path.basename(source.spkg.conf.get("local", "orig")))
    return src_str
Ejemplo n.º 4
0
    def do_release_reset(self):
        """
        This method resets the release number to 0suffix.
        """

        old_rel = self.get_release()
        new_rel = str(0) + old_rel[1:]

        contents_new = str()

        for line in self.get_lines():
            if line[0:8] != "Release:":
                assert isinstance(line, str)
                contents_new += (line + "\n")
            else:
                contents_new += format_tag_line("Release", new_rel)

        self.contents = contents_new
Ejemplo n.º 5
0
def spec_source_bzr(source: BzrSource) -> str:
    """
    This function returns the Source tag for packages built from *bzr* repositories.

    Arguments:
        BzrSource source:   source repository a Source tag will be generated for

    Returns:
        str:                Source tag with comments
    """

    assert isinstance(source, BzrSource)

    src_str = ("# The tarball is generated from a checkout of the specified branch and\n" +
               "# by executing 'bzr export' and has the usual format\n" +
               "# ('%{name}-%{version}.tar.gz'), where %{version} contains the upstream\n" +
               "# version number with a '+bzr%{rev}' suffix specifying the bzr revision.\n" +
               format_tag_line("Source0", "%{name}-%{version}.tar.gz"))

    return src_str
Ejemplo n.º 6
0
def spec_source_git(source: GitSource) -> str:
    """
    This function returns the Source string for packages built from *git* repositories.

    Arguments:
        GitSource source:   source repository a Source tag will be generated for

    Returns:
        str:                Source tag with comments
    """

    assert isinstance(source, GitSource)

    src_str = ("# The tarball is generated from a clone of the specified branch and\n" +
               "# by executing 'git archive' and has the usual format\n" +
               "# ('%{name}-%{version}.tar.gz'), where %{version} contains the upstream\n" +
               "# version number with a '+git%{commit}.%{date}' suffix specifying the git\n"
               "# commit hash (8 characters) and the commit date and time (UTC).\n" +
               format_tag_line("Source0", "%{name}-%{version}.tar.gz"))

    return src_str