bpo.images package

Submodules

bpo.images.config module

bpo.images.config.get_branch_config(device, branch)

Combine the branch_config_default and images configs into a device and branch specific config.

Returns:

  • None if device/branch was not found in the config

  • the combined config, for example: {“android-recovery-zip”: False, “date-start”: “2020-12-29”, “date-interval”: “1 week”, “ui”: [“phosh”, “plasma-mobile”, “i3wm”], “kernels”: []}

bpo.images.config.get_device_branches(device)

Get the branches, for which an image should be built for a certain device. :returns: list of branch names, e.g. [“master”, “v20.05”]

bpo.images.config.get_images(now=None)

Generator that extracts one image from bpo/config/const/images.py at a time, so it can be added to the database if it does not exist yet.

The yielded “date-start” is the same as in the config, but with “date-interval” (e.g. “1 week”) added as often as possible, without having the date in the future.

Parameters:

now – current time, can be overwritten for tests

Yields:

example: {“branch”: “master”, “device”: “pine64-pinephone”, “ui”: “phosh”, “date-start”: “2020-12-29”, “keep”: 3}

bpo.images.queue module

bpo.images.queue.fill(now=None)

Add new entries to the image table, based on bpo/config/const/images.py. :param now: current time, can be overwritten for tests

bpo.images.queue.remove_not_in_config()

Remove entries from the image table, which are not in published state and are no longer mentioned in the config.

bpo.images.queue.timer_iterate(next_interval=3600, repo_build=True)

Run fill() and schedule a timer to do it again.

All functions called in this thread need to be thread safe, or else we have bugs like #79!

Parameters:
  • next_interval – when to check again (in seconds, gets passed to the next iteration)

  • repo_build – set to False to skip running bpo.repo.build() after filling the queue (does not get passed to the next iteration)

bpo.images.queue.timer_stop()

Module contents

bpo.images.branch_from_pmos_ver(pmos_ver)

Invert of pmos_ver().

bpo.images.db_obj_from_path(path)

Invert of path_db_obj(). :param path: full path to an image directory, as returned by path() (without trailing slash) :returns: bpo.db.Image object or None

bpo.images.path(branch, device, ui, dir_name)
Returns:

absolute path to where the files for a certain image are stored.

bpo.images.path_db_obj(obj)

Shortcut for path() with a suitable database object (Log, Image).

bpo.images.pmos_ver(branch)

Just like in Alpine, name the images from master branch “edge”.

bpo.images.remove_old()

Remove old images from the filesystem and database.

bpo.images.url_db_obj(obj)

Get the URL pointing to the files for a given image. :param obj: suitable database object (Log, Image) :returns: url like “https://images.postmarketos.org/bpo/edge/qemu-…”