bpo.ui package

Submodules

bpo.ui.images module

bpo.ui.images.file_entry_add_checksums(entry, path)

Find checksum files generated by the sha256sum/sha512sum tools, and if they exist, add them to the “entry” dict.

Parameters:
  • entry – dict where the checksum will be added

  • path – to the file, with {path}.sha256 and {path}.sha512 files in the same dir

bpo.ui.images.get_entries(path, reverse=False)

Get a sorted list of entries (files, directories) in a given path.

Parameters:

reverse – order in reverse

Returns:

list of entries

bpo.ui.images.get_file_size_human(path)

Get human readable size of path

bpo.ui.images.parse_files_from_disk()

Iterate through images on disk and generate an intermediate format using the path info

bpo.ui.images.write_index(path, template, **context)

Write an index.html in the specified path based on the supplied template

Parameters:
  • path – full path to the directory for the index.html

  • template – template filename

  • context – arguments for the template

bpo.ui.images.write_index_all()
bpo.ui.images.write_index_file_list(path, template)

Write the index.html for the file list of one build. Each file in the directory gets metadata attached as it gets passed to the template (file size, checksums).

Parameters:
  • path – full path to the directory for the index.html

  • template – template filename

bpo.ui.images.write_index_html()

For each directory in the images dir (recursively), write the HTML files. The files are always overwritten.

bpo.ui.images.write_index_json()

Write an index.json file, which can be used by a desktop installer to list and download available images.

Module contents

bpo.ui.copy_static()

Copy the static dir to _html_out, as much in an atomic operation as possible.

bpo.ui.format_retry_count(retry_count)
bpo.ui.init()
bpo.ui.log(*args, **kwargs)

Write one log message and update the output. Do this after making meaningful changes to the database, e.g. after a job callback was executed. See bpo.db.Log.__init__() for the list of parameters.

NOTE: Make sure that you have committed all changes to any open

sessions (run session.commit() after doing changes), otherwise you will get a “database is locked” error.

bpo.ui.log_entries_by_day(session)
Returns:

{“2019-01-01”: [a, b, …], “2019-01-02”: [c, d, …], … } a, b, c, d: bpo.db.Log objects

bpo.ui.log_image(image, action)

Convenience wrapper

Parameters:

image – bpo.db.Image object

bpo.ui.log_package(package, action, depend_pkgname=None, commit=None)

Convenience wrapper

Parameters:

package – bpo.db.Package object

bpo.ui.log_repo_bootstrap(rb, action)
bpo.ui.update(session)

Update everything in html_out

bpo.ui.update_badge(session, pkgs, imgs)

Update html_out/badge.svg

Parameters:
  • session – return value of bpo.db.session()

  • pkgs – return value of bpo.db.get_recent_packages_by_status()

  • imgs – return value of bpo.db.get_recent_images_by_status()

Returns:

one of: “up-to-date”, “failed”, “building”

bpo.ui.update_index(session, pkgs, imgs, badge_name)

Update html_out/index.html

Parameters:
  • session – return value of bpo.db.session()

  • pkgs – return value of bpo.db.get_recent_packages_by_status()

  • imgs – return value of bpo.db.get_recent_images_by_status()

  • badge_name – return value of update_badge()

bpo.ui.update_monitoring_txt(session, pkgs, imgs, add_footer=True, list_count_max=10)

Update html_out/monitoring.txt. The postmarketOS infrastructure monitoring will parse this file and send a message into a matrix room when there are failures.

Parameters:
  • session – return value of bpo.db.session()

  • pkgs – return value of bpo.db.get_recent_packages_by_status()

  • imgs – return value of bpo.db.get_recent_images_by_status()

  • add_footer – if NOK, add footer with links to related issues/MRs

  • list_count_max – how many entries to display with log links