# mini_buildd.package module

class mini_buildd.package.Changelog(file: bytes | str | IO[str] | Iterable[str] | Iterable[bytes] | None = None, max_blocks: int | None = None, allow_empty_author: bool = False, strict: bool = False, encoding: str = 'utf-8')

  Bases: `Changelog`

  Changelog class with some extra functions

      >>> cl = Changelog(util.fopen("test-data/changelog"), max_blocks=100)
      >>> cl.find_first_not("mini-buildd@buildd.intra")
      ('Stephan Sürken <absurd@debian.org>', '1.0.0-2')

      >>> cl = Changelog(util.fopen("test-data/changelog.ported"), max_blocks=100)
      >>> cl.find_first_not("mini-buildd@buildd.intra")
      ('Stephan Sürken <absurd@debian.org>', '1.0.0-2')

      >>> cl = Changelog(util.fopen("test-data/changelog.oneblock"), max_blocks=100)
      >>> cl.find_first_not("mini-buildd@buildd.intra")
      ('Stephan Sürken <absurd@debian.org>', '1.0.1-1~')

      >>> cl = Changelog(util.fopen("test-data/changelog.oneblock.ported"), max_blocks=100)
      >>> cl.find_first_not("mini-buildd@buildd.intra")
      ('Mini Buildd <mini-buildd@buildd.intra>', '1.0.1-1~')

  find_first_not(author)

    Find (author,version+1) of the first changelog block not by given author

class mini_buildd.package.DebianVersion(version: str | BaseVersion | None)

  Bases: `Version`

  classmethod stamp()
  classmethod stamp_regex(stamp=None)
  gen_internal_rebuild()

    Generate an ‘internal rebuild’ version

    If the version is not already a rebuild version, just append the rebuild appendix, otherwise replace the old one. For example:

        1.2.3 -> 1.2.3+rebuilt20130215100453
        1.2.3+rebuilt20130215100453 -> 1.2.3+rebuilt20130217120517

    Code samples:

        >>> regex = rf"^1\.2\.3\+rebuilt{DebianVersion.stamp_regex()}$"
        >>> bool(re.match(regex, DebianVersion("1.2.3").gen_internal_rebuild()))
        True
        >>> bool(re.match(regex, DebianVersion("1.2.3+rebuilt20130215100453").gen_internal_rebuild()))
        True

  gen_external_port(default_version)

    Generate an ‘external port’ version

    This currently just appends the given default version appendix. For example:

    1.2.3 -> 1.2.3~test60+1

  gen_internal_port(from_mandatory_version_regex, to_default_version)

    Generate an ‘internal port’ version

    Tests for the (recommended) Default layout:

        >>> sid_regex = r"~testSID\+[1-9]"
        >>> sid_default = "~testSID+1"
        >>> sid_exp_regex = r"~testSID\+0"
        >>> sid_exp_default = "~testSID+0"
        >>> wheezy_regex = r"~test70\+[1-9]"
        >>> wheezy_default = "~test70+1"
        >>> wheezy_exp_regex = r"~test70\+0"
        >>> wheezy_exp_default = "~test70+0"
        >>> squeeze_regex = r"~test60\+[1-9]"
        >>> squeeze_default = "~test60+1"
        >>> squeeze_exp_regex = r"~test60\+0"
        >>> squeeze_exp_default = "~test60+0"

    sid->wheezy ports:

        >>> DebianVersion("1.2.3-1~testSID+1").gen_internal_port(sid_regex, wheezy_default)
        '1.2.3-1~test70+1'
        >>> DebianVersion("1.2.3-1~testSID+4").gen_internal_port(sid_regex, wheezy_default)
        '1.2.3-1~test70+4'
        >>> DebianVersion("1.2.3-1~testSID+4fud15").gen_internal_port(sid_regex, wheezy_default)
        '1.2.3-1~test70+4fud15'
        >>> DebianVersion("1.2.3-1~testSID+0").gen_internal_port(sid_exp_regex, wheezy_exp_default)
        '1.2.3-1~test70+0'
        >>> DebianVersion("1.2.3-1~testSID+0exp2").gen_internal_port(sid_exp_regex, wheezy_exp_default)
        '1.2.3-1~test70+0exp2'

    wheezy->squeeze ports:

        >>> DebianVersion("1.2.3-1~test70+1").gen_internal_port(wheezy_regex, squeeze_default)
        '1.2.3-1~test60+1'
        >>> DebianVersion("1.2.3-1~test70+4").gen_internal_port(wheezy_regex, squeeze_default)
        '1.2.3-1~test60+4'
        >>> DebianVersion("1.2.3-1~test70+4fud15").gen_internal_port(wheezy_regex, squeeze_default)
        '1.2.3-1~test60+4fud15'
        >>> DebianVersion("1.2.3-1~test70+0").gen_internal_port(wheezy_exp_regex, squeeze_exp_default)
        '1.2.3-1~test60+0'
        >>> DebianVersion("1.2.3-1~test70+0exp2").gen_internal_port(wheezy_exp_regex, squeeze_exp_default)
        '1.2.3-1~test60+0exp2'

    No version restrictions: just add default version

        >>> DebianVersion("1.2.3-1").gen_internal_port(".*", "~port+1")
        '1.2.3-1~port+1'

class mini_buildd.package.TemplatePackage(template, package_version=None)

  Bases: `TmpDir`

  Copies a package template into a temporary directory (under ‘package/’)

  property dsc
  classmethod call(*args, **kwargs)

class mini_buildd.package.KeyringPackage(**kwargs)

  Bases: `TemplatePackage`

class mini_buildd.package.TestPackage(template, auto_ports=None)

  Bases: `TemplatePackage`

mini_buildd.package.port(source, from_diststr, to_diststr, version=None, options=None)

mini_buildd.package.port_ext(dsc_url, to_diststr, options=None, allow_unauthenticated=False)

mini_buildd.package.upload_template_package(template_package, diststr)

  Portext macro. Used for keyring_packages and test_packages