bpo.repo package¶
Submodules¶
bpo.repo.bootstrap module¶
- bpo.repo.bootstrap.init(session, payload, arch, branch, dir_name='/')¶
Add a new entry to the repo_bootstrap table, if it is needed for the current branch, and if there is no entry yet.
- Parameters:
payload – from the get_depends api call e.g.: [ { “pkgname”: “hello-world”, “repo”: “main”, # pmaports directory “version”: “1-r4”, “depends”: []}, … ]
- Returns:
True if a new entry was added to the table, False otherwise
- bpo.repo.bootstrap.is_needed(payload)¶
Check if repo_bootstrap is needed for the current pmaports branch. It is needed if any of the packages in the branch are inside a directory that needs bootstrap (systemd dir).
- Parameters:
payload – from the get_depends api call e.g.: [ { “pkgname”: “hello-world”, “repo”: “main”, # pmaports directory “version”: “1-r4”, “depends”: []}, … ]
- Returns:
True if repo_bootstrap is needed, False otherwise
- bpo.repo.bootstrap.update_to_published(arch, branch, dir_name='/')¶
Set the RepoStaging DB entries to published, if they are currently in built state. This gets called from job_callback.sign_index. The callback has set the status of the packages built by repo_bootstrap to built (update_from_symlink_repo -> fix_db_vs_disk). Afterwards, trigger the build of packages again.
- Returns:
True if the status was changed, False otherwise
bpo.repo.final module¶
- bpo.repo.final.copy_new_apkindex(arch, branch)¶
- bpo.repo.final.copy_new_apks(arch, branch)¶
- bpo.repo.final.delete_outdated_apks(arch, branch)¶
- bpo.repo.final.get_path(arch, branch)¶
- bpo.repo.final.publish(arch, branch)¶
- bpo.repo.final.update_from_symlink_repo(arch, branch)¶
bpo.repo.staging module¶
- bpo.repo.staging.branch_split(branch)¶
Split a staging branch name in its components. :param branch: the full branch name, e.g. “master_staging_lomiri” “v22.12_staging_sp2” :returns: * None if it isn’t a valid staging branch * (branch_orig, name) * branch_orig: the original branch as in the config(e.g. “master”) * name: e.g. “hi_there” (branch “master_staging_hi_there”)
- bpo.repo.staging.get_branches_with_staging()¶
- Returns:
a copy of bpo.config.const.branches, with staging branches added. All staging branches have ignore_errors set.
- bpo.repo.staging.init(branch)¶
If the staging repository does not exist yet, create the directory structure with a README file. The repository will be filled later on, when sync_with_orig_repo gets called for the first time. :param branch: staging branch name
- bpo.repo.staging.remove(branch)¶
Remove a staging branch. :param branch: which branch to remove, e.g. master_staging_testbranch
- bpo.repo.staging.sync_with_orig_repo(branch_staging, arch)¶
For all packages that are the same in the staging repo and the original repository, create a hardlink to the package and update the copy of the package with the staging branch in the database. This function gets called right before calculating the next package to build from the staging branch.
The hardlinks are created in the WIP repository of the staging branch. (After potentially building any missing packages, the WIP repository gets published, not part of this function.)
- Parameters:
branch_staging – name of the staging branch
arch – architecture
- Returns stats:
see below
bpo.repo.status module¶
- bpo.repo.status.fix(limit_arch=None, limit_branch=None)¶
“ Fix all inconsistencies between the database, the apk files on diskand the running jobs. :param limit_arch: architecture, e.g. “x86_64” (default: all) :param limit_branch: pmaports.git branch, e.g. “master” (default: all)
- bpo.repo.status.fix_db_vs_disk(arch, branch)¶
Iterate over packages in db, fix status of packages that are marked as built/published but are missing on disk. :param arch: architecture, e.g. “x86_64” :param branch: pmaports.git branch, e.g. “master”
- bpo.repo.status.fix_disk_vs_db(arch, branch, path, status, is_wip=False, job_id=None)¶
Iterate over apks on disk, fix package status if it is not set to built/published but binary packages exist in the wip/final repo. Also remove obsolete packages from the wip repo. (Obsolete packages from the final repo get removed as the final repo gets updated, it does not make sense to delete them beforehand.) :param arch: architecture, e.g. “x86_64” :param branch: pmaports.git branch, e.g. “master” :param path: wip or final repo path, as returned by bpo.repo.{wip,final}.get_path() :param status: the package should have when the related apk file exists e.g. bpo.db.PackageStatus.built :param is_wip: set to True when looking at the wip repo, False when looking at the final repo. :param job_id: set the job_id for packages that were updated (used by repo_bootstrap callback) :returns: (count of removed pkgs, count of updated pkgs)
- bpo.repo.status.is_apk_broken(metadata)¶
- bpo.repo.status.remove_broken_apk(session, pkgname, version, arch, branch, apk_path)¶
bpo.repo.symlink module¶
- bpo.repo.symlink.clean(arch, branch)¶
- bpo.repo.symlink.create(arch, branch, force=False)¶
- bpo.repo.symlink.find_apk(wip, final, package)¶
- Parameters:
wip – path to WIP repository
final – path to final repository
package – bpo.db.Package object
- bpo.repo.symlink.get_path(arch, branch)¶
- bpo.repo.symlink.link_to_all_packages(arch, branch, force=False)¶
Create symlinks to new packages from WIP repo and to up-to-date packages from final repo.
- bpo.repo.symlink.sign(arch, branch)¶
bpo.repo.tools module¶
- bpo.repo.tools.extract_tool_apk(pkgname, paths)¶
- bpo.repo.tools.index(arch, branch, repo_name, cwd)¶
Sign a repository. :param cwd: path to the repository
- bpo.repo.tools.init()¶
- bpo.repo.tools.run(arch, branch, repo_name, cwd, cmd)¶
Run a tool with a nice log message and a proper PATH. :param cwd: current working dir, where cmd should get executed :param cmd: the command to execute
All other parameters (arch, branch, repo_name) are just for printing a nice log message.
- bpo.repo.tools.temp_path_prepare()¶
bpo.repo.wip module¶
- bpo.repo.wip.clean(arch, branch)¶
Delete all apks from WIP repo, that are either in final repo or not in the db anymore (pmaport updated or deleted), and update the APKINDEX of the WIP repo.
- bpo.repo.wip.do_keygen()¶
Generate key for signing the APKINDEX of the WIP repository locally.
- bpo.repo.wip.get_path(arch, branch)¶
- bpo.repo.wip.sign(arch, branch)¶
- bpo.repo.wip.update_apkindex(arch, branch)¶
Module contents¶
- bpo.repo.build(force_repo_update_branch=None, no_repo_update=False)¶
Run build() with a threading.Condition(), so it runs at most in one thread at once. Otherwise it will lead to corrupt indexes being generated. See _build() for parameter description.
- bpo.repo.build_arch_branch(session, slots_available, arch, branch, force_repo_update=False, no_repo_update=False)¶
- Returns:
amount of jobs that were started
- Parameters:
force_repo_update – rebuild the symlink and final repo, even if no new packages were built. Set this to True after deleting packages in the database, so the apks get removed from the final repo.
no_repo_update – never update symlink and final repo (used from the images timer thread, see #98)
- bpo.repo.build_images_branch(session, slots_available, branch)¶
- Returns:
amount of jobs that were started
- bpo.repo.count_running_builds(session)¶
- bpo.repo.count_running_builds_images(session)¶
- bpo.repo.count_running_builds_packages(session)¶
- bpo.repo.count_running_builds_repo_bootstrap(session)¶
- bpo.repo.count_unpublished_packages(session, branch, arch=None)¶
- bpo.repo.get_apks(cwd)¶
Get a sorted list of all apks in a repository. :param cwd: path to the repository
- bpo.repo.has_unfinished_builds(session, arch, branch)¶
- bpo.repo.is_apk_origin_in_db(session, arch, branch, apk_path)¶
- Parameters:
apk_path – full path to the apk file
- Returns:
origin pkgname if the origin is in db and has same version, False otherwise
- bpo.repo.next_image_to_build(session, branch)¶
- Returns:
image db object
- bpo.repo.next_package_to_build(session, arch, branch)¶
- Returns:
pkgname
- bpo.repo.repo_bootstrap_attempt(session, rb)¶
Start a repo_bootstrap job, if it makes sense depending on the status and the failed retry attempts.
- Returns:
True if a repo_bootstrap job was started
False if it was not started
- bpo.repo.set_stuck(arch, branch)¶
No more packages can be built, because all remaining packages in the queue have already failed, or depend on packages that have failed. This is an extra function, so we can hook it in the tests.