mini_buildd.api module

API arguments and calls

>>> Setup.from_command_line("--save --update --archives-from-proxy --sources bullseye --sources-from-origin-with-lts Debian --chroots-from-sources --repositories test/test").command_line()
'--save --update --archives-from-proxy --sources bullseye --sources-from-origin-with-lts Debian --chroots-from-sources --repositories test/test'
>>> Setup.from_sloppy_args(save=True, archives_from_proxy=True, archives_from_apt_sources=False).command_line()
'--save --archives-from-proxy'
class mini_buildd.api.Argument(id_list, doc='Undocumented', default=None, choices=None, header=None)

Bases: object

Generic Argument Class

value() always provides a non-None value of the specific type, either the default or a given value.

strvalue() always provides a non-None str value.

The default value is given in the constructor. For server-specific defaults, this may be function – then the default value will be computed only at run time on the server.

A given value can be provided via special set() method:
  • Empty str, list or false bool will yield None.

  • Non-empty str will be converted to the specific type.

  • Other given values will be used as is.

Type

value() type

svalue() ex.

HTML GET

argparse

Str

str

“string”

key=string

–key “string”

Url

str

http://..”

key=string

–key “string”

MultilineStr

str

“long”

key=string

–key “string”

Choice

str

“c0”

key=string

–key “string”

Int

int

“17”

key=string

–key “int”

Bool

bool

“True”

key=True

–key

List

list of str

“v0,v1,..”

key=v0,v1..

–key “v0” “v1”..

VALUE_TYPE

Validate that values are actually of that type

alias of str

SERVER_DEFAULT = '<server_default>'

Magic string value to use as value when a default callable on the server should be used.

classmethod s2v(str_value)

Convert string to value

classmethod v2s(value)

Convert value to string

required()
needs_value()

If user input is no_value

choices()
default()
strdefault()
value()
strvalue()
strgiven()
icommand_line_given()
set(given)
argparse_kvsargs()

Python ‘argparse’ support

class mini_buildd.api.StrArgument(id_list, doc='Undocumented', default=None, choices=None, header=None)

Bases: Argument

HTML_TYPE = 'text'
argparse_kvsargs()

Python ‘argparse’ support

class mini_buildd.api.UrlArgument(id_list, doc='Undocumented', default=None, choices=None, header=None)

Bases: StrArgument

HTML_TYPE = 'url'
class mini_buildd.api.MultilineStrArgument(id_list, doc='Undocumented', default=None, choices=None, header=None)

Bases: StrArgument

HTML_TYPE = 'textarea'
class mini_buildd.api.ChoiceArgument(id_list, doc='Undocumented', default=None, choices=None, header=None)

Bases: Argument

HTML_TYPE = 'select'
value()
argparse_kvsargs()

Python ‘argparse’ support

class mini_buildd.api.IntArgument(id_list, doc='Undocumented', default=None, choices=None, header=None)

Bases: StrArgument

VALUE_TYPE

alias of int

HTML_TYPE = 'number'
argparse_kvsargs()

Python ‘argparse’ support

class mini_buildd.api.BoolArgument(*args, **kwargs)

Bases: ChoiceArgument

VALUE_TYPE

alias of bool

HTML_TYPE = 'checkbox'
classmethod s2v(str_value)

Convert string to value

icommand_line_given()

Empty generator – bools are just command line options like --with-foo

argparse_kvsargs()

Python ‘argparse’ support

class mini_buildd.api.ListArgument(id_list, doc='Undocumented', default=None, choices=None, header=None)

Bases: StrArgument

VALUE_TYPE

alias of list

SEPARATOR = ','
classmethod s2v(str_value)

Convert string to value

classmethod v2s(value)

Convert value to string

icommand_line_given()
argparse_kvsargs()

Python ‘argparse’ support

class mini_buildd.api.Repository(id_list, **kwargs)

Bases: StrArgument

object()
class mini_buildd.api.Repositories(id_list, **kwargs)

Bases: ListArgument

objects()
class mini_buildd.api.Codenames(id_list, **kwargs)

Bases: ListArgument

mini_buildd.api.diststr2repository(diststr)
class mini_buildd.api.Distribution(id_list, choices=Name.ACTIVE_DISTRIBUTIONS, extra_doc='', **kwargs)

Bases: StrArgument

dist()
class mini_buildd.api.Distributions(id_list, choices=Name.ACTIVE_DISTRIBUTIONS, **kwargs)

Bases: ListArgument

class mini_buildd.api.Source(id_list, extra_doc='', **kwargs)

Bases: StrArgument

class mini_buildd.api.UploadOptions(id_list, **kwargs)

Bases: StrArgument

class mini_buildd.api.Output

Bases: ChoiceArgument

Meta API call option ‘output’

class mini_buildd.api.Rollbacks(id_list, extra_doc='', **kwargs)

Bases: IntArgument

range(suite)

Get valid range for this suite

class mini_buildd.api.Call(**kwargs)

Bases: object

AUTH = <mini_buildd.config.Auth object>
NEEDS_RUNNING_DAEMON = False
CONFIRM = False
CUSTOM_HTML_SNIPPET = None
classmethod name()
classmethod doc()
classmethod doc_title()
classmethod doc_body()
CATEGORIES = ['Consumer', 'Developer', 'Administrator']
classmethod category()
classmethod uri()
classmethod iarguments()
classmethod from_sloppy_args(**kwargs)

Construct ignoring any unknown arguments given

classmethod from_command_line(command_line)
set_request(request)
classmethod get_plain(result, force_json=False)

Get str result (non-str results get json pretty-formatted)

plain(force_json=False)
json_pretty()

For (arg-less) use in templates only

classmethod parse_command_line(command_line)
icommand_line(full=False, with_user=False, user=None)
command_line(full=False, with_user=False, user=None)
command_line_full()
http_args(with_confirm=False, with_output=None)
url()
abstract run()
class mini_buildd.api.Status(**kwargs)

Bases: Call

Get the status of this instance

JSON Result:

  • version : mini-buildd’s version.

  • identity : Instance identity.

  • url : Instance URL (HTTP).

  • incoming_url: Incoming URL (currently FTP).

  • load : Instance’s (0 =< load <= 1). If negative, the instance is not powered on.

  • chroots : Active chroots.

  • remotes : Active or auto-reactivatable remotes.

  • [repositories: Simplified structural representation of all repositories]

Authorization: NONE

classmethod iarguments()
run()
class mini_buildd.api.PubKey(**kwargs)

Bases: Call

Get public key

Get ASCII-armored GnuPG public key of this instance.

Used to sign the apt repositories (apt key) and for authorization across instances.

Authorization: NONE

run()
class mini_buildd.api.DputConf(**kwargs)

Bases: Call

Get recommended dput config snippet

Usually, this is for integration in your personal ~/.dput.cf.

Tip

Can I add a custom dput config snippet?

Just put your custom snippet in ~mini-buildd/etc/dput.cf. If that file exists, it will be added to the output of API call ‘dput_conf’.

Authorization: NONE

run()
class mini_buildd.api.SourcesList(**kwargs)

Bases: Call

Get sources.list (apt lines)

Usually, this output is put to a file like ‘/etc/sources.list.d/mini-buildd-xyz.list’.

Authorization: NONE

classmethod iarguments()
run()
class mini_buildd.api.Ls(**kwargs)

Bases: Call

List source package

Authorization: NONE

classmethod iarguments()
run()
class mini_buildd.api.Show(**kwargs)

Bases: Ls

Show source package

Authorization: NONE

run()
class mini_buildd.api.Debdiff(**kwargs)

Bases: Call

Compare two internal source packages

classmethod iarguments()
run()
class mini_buildd.api.Migrate(**kwargs)

Bases: _Staff, _Confirm, Call

Migrate source package

Migrates a source package along with all its binary packages. If run for a rollback distribution, this will perform a rollback restore.

Authorization: STAFF

classmethod iarguments()
run()
class mini_buildd.api.Remove(**kwargs)

Bases: _Admin, _Confirm, Call

Remove source package

Removes a source package along with all its binary packages.

Authorization: ADMIN

classmethod iarguments()
run()
class mini_buildd.api.Port(**kwargs)

Bases: _Staff, _Running, _Confirm, Call

Port internal source package

An internal ‘port’ is a no-changes (i.e., only the changelog will be adapted) rebuild of the given locally-installed package.

When from-distribution equals to_distribution, a rebuild will be done.

JSON Result (dict):

list of dicts of all items uploaded

Authorization: STAFF

classmethod iarguments()
run()
class mini_buildd.api.PortExt(**kwargs)

Bases: _Staff, _Running, _Confirm, Call

Port external source package

An external ‘port’ is a no-changes (i.e., only the changelog will be adapted) rebuild of any given source package.

JSON Result (dict):

list of dicts of all items uploaded

Authorization: STAFF

classmethod iarguments()
run()
class mini_buildd.api.Retry(**kwargs)

Bases: _Staff, _Running, _Confirm, Call

Retry a previously failed source package

JSON Result:

  • changes: Changes file that has been re-uploaded.

Authorization: STAFF

BKEY_FORMAT = '<source>/<version>/<timecode>/source[ <arch>]'
BKEY_REGEX = re.compile('[^/]+/[^/]+/[^/]+/[^/]+')
classmethod iarguments()
run()
class mini_buildd.api.Cancel(**kwargs)

Bases: _Staff, _Running, _Confirm, Call

Cancel an ongoing package build Authorization: STAFF

classmethod iarguments()
run()
class mini_buildd.api.SetUserKey(**kwargs)

Bases: _Login, _Confirm, Call

Set a user’s GnuPG public key

Authorization: LOGIN

classmethod category()
classmethod iarguments()
run()
class mini_buildd.api.Subscribe(**kwargs)

Bases: _Login, Call

Subscribe to (email) notifications

Authorization: LOGIN

classmethod iarguments()
run()
class mini_buildd.api.Unsubscribe(**kwargs)

Bases: Subscribe

Unsubscribe from (email) notifications

Authorization: LOGIN

run()
class mini_buildd.api.RemakeChroots(**kwargs)

Bases: _Admin, _Confirm, Call

Remake chroots

Run actions ‘remove’, ‘prepare’, ‘check’ and ‘activate’.

Daemon will be stopped while running.

Authorization: ADMIN

classmethod iarguments()
run()
class mini_buildd.api.Power(**kwargs)

Bases: _Admin, _Confirm, Call

Power Daemon on or off (toggles by default)

This essentially stops accepting incoming, and forcibly stops any possibly running builds.

This state is not persisted. Please deactivate the Daemon instance via mini-buildd’s ‘setup’ page to make the state persist over mini-buildd service restarts.

Authorization: ADMIN

classmethod iarguments()
run()
class mini_buildd.api.Wake(**kwargs)

Bases: _Admin, _Confirm, Call

Wake a remote instance

Authorization: ADMIN

classmethod iarguments()
run()
class mini_buildd.api.Handshake(**kwargs)

Bases: Call

Check if signed message matches a remote, reply our signed message on success

This is for internal use only.

Authorization: NONE

classmethod category()
classmethod iarguments()
run()
class mini_buildd.api.Cronjob(**kwargs)

Bases: _Admin, _Confirm, Call

Run a cron job now (out of schedule)

Authorization: ADMIN

classmethod iarguments()
run()
class mini_buildd.api.Uploaders(**kwargs)

Bases: _Admin, _Running, Call

Get upload permissions for repositories

Authorization: ADMIN

classmethod iarguments()
run()
class mini_buildd.api.SnapshotLs(**kwargs)

Bases: _Running, Call

Get list of repository snapshots for a distribution

JSON Result (dict):

dict: <distribution>: [snasphot,…]: List of snapshots for the given distribution.

Authorization: NONE

classmethod iarguments()
run()
class mini_buildd.api.SnapshotCreate(**kwargs)

Bases: _Admin, _Confirm, SnapshotLs

Create a repository snapshot

Authorization: ADMIN

classmethod iarguments()
run()
class mini_buildd.api.SnapshotDelete(**kwargs)

Bases: SnapshotCreate

Delete a repository snapshot

run()
class mini_buildd.api.Debmirror(**kwargs)

Bases: _Admin, _Confirm, Call

Make local partial repository mirror via Debian package ‘debmirror’

This may be useful if you plan on publishing a stripped-down (f.e., only certain repos, only stable, omit rollbacks) variant of your repo somewhere remote.

Error

debmirror (Debian Bug #819925): apt update fails on experimental suites (contents not mirrored)

This happens only on systems where APT is configured to download contents, most likely just because apt-file is installed. So, the easiest workaround is:

apt purge apt-file

Closest to an actual fix is to install debmirror variant ‘+abfixes’ from Hellfield Archive, where the “bug” has been fixed (Dec 2022: at least available for bullseye).

Authorization: ADMIN

PROGRAM = '/usr/bin/debmirror'
DEB = 'debmirror'
classmethod iarguments()
run()
class mini_buildd.api.KeyringPackages(**kwargs)

Bases: _Admin, _Running, _Confirm, Call

Build keyring packages

Tip

keyring-packages: No compat for urold (apt-key add)

Since 2.x, keyring packages will use /etc/apt/trusted.gpg.d/<foo>.gpg, not deprecated apt-key add <foo>.

In Debian, this is supported since wheezy (2013).

For distributions <= squeeze (apt versions ~<= 0.8.x), you would manually have to run apt-key add /etc/apt/trusted.gpg.d/<foo>.gpg after installation of the keyring package.

JSON Result (dict):

list of dicts of all items uploaded

Authorization: ADMIN

classmethod iarguments()
run()
class mini_buildd.api.TestPackages(**kwargs)

Bases: _Admin, _Running, _Confirm, Call

Build test packages

JSON Result (dict):

list of dicts of all items uploaded

Authorization: ADMIN

classmethod iarguments()
run()
class mini_buildd.api.Setup(**kwargs)

Bases: _Admin, _Confirm, Call

Create, update or inspect your setup

Daemon will be stopped while running, and started when finished (i.e., even if it was not running before).

Authorization: ADMIN

classmethod iarguments()
x_or_create(cls, defaults=None, **kwargs)
classmethod ilocal_archive_urls()
classmethod iapt_cacher_archive_urls()
setup_daemon()
setup_archives()
setup_sources()
setup_chroots()
setup_remotes()
setup_repositories()
run()
classmethod preset_debian(**kwargs)
classmethod preset_ubuntu(**kwargs)
classmethod preset_bootstrap(**kwargs)
classmethod preset_saved_or_bootstrap()
class mini_buildd.api.Calls

Bases: OrderedDict

Automatically collect all calls defined in this module, and make them accessible