fdroidserver.checkupdates module¶
- fdroidserver.checkupdates.check_http(app: App) tuple[Optional[str], Optional[int]] ¶
Check for a new version by looking at a document retrieved via HTTP.
The app’s UpdateCheckData field is used to provide the information required.
- Parameters:
- app
The App instance to check for updates for.
- Returns:
- version
The found versionName or None if the versionName should be ignored according to UpdateCheckIgnore.
- vercode
The found versionCode or None if the versionCode should be ignored according to UpdateCheckIgnore.
- Raises:
FDroidException
If UpdateCheckData is missing or is an invalid URL or if there is no match for the provided versionName or versionCode regex.
- fdroidserver.checkupdates.check_repomanifest(app: App, branch: Optional[str] = None) tuple[str, int] ¶
Check for a new version by looking at the AndroidManifest.xml at the HEAD of the source repo.
Whether this can be used reliably or not depends on the development procedures used by the project’s developers. Use it with caution, because it’s inappropriate for many projects.
- Parameters:
- app
The App instance to check for updates for.
- branch
The VCS branch where to search for versionCode, versionName.
- Returns:
- versionName
The highest found versionName.
- versionCode
The highest found versionCode.
- Raises:
FDroidException
If no package id or no version information could be found.
- fdroidserver.checkupdates.check_tags(app: App, pattern: str) tuple[str, int, str] ¶
Check for a new version by looking at the tags in the source repo.
Whether this can be used reliably or not depends on the development procedures used by the project’s developers. Use it with caution, because it’s inappropriate for many projects.
- Parameters:
- app
The App instance to check for updates for.
- pattern
The pattern a tag needs to match to be considered.
- Returns:
- versionName
The highest found versionName.
- versionCode
The highest found versionCode.
- ref
The Git reference, commit hash or tag name, of the highest found versionName, versionCode.
- Raises:
MetaDataException
If this function is not suitable for the RepoType of the app or information is missing to perform this type of check.
FDroidException
If no matching tags or no information whatsoever could be found.
- fdroidserver.checkupdates.checkupdates_app(app: App) None ¶
Check for new versions and updated name of a single app.
Also write back changes to the metadata file and create a Git commit if requested.
- Parameters:
- app
The app to check for updates for.
- Raises:
MetaDataException
If the app has an invalid UpdateCheckMode or AutoUpdateMode.
FDroidException
If no version information could be found, the current version is newer than the found version, auto-update was requested but an app has no CurrentVersionCode or (Git) commiting the changes failed.
- fdroidserver.checkupdates.dirs_with_manifest(startdir: str)¶
Find directories containing a manifest file.
Yield all directories under startdir that contain any of the manifest files, and thus are probably an Android project.
- Parameters:
- startdir
Directory to be walked down for search
- Yields:
- path
pathlib.Path
or None A directory that contains a manifest file of an Android project, None if no directory could be found
- path
- fdroidserver.checkupdates.fetch_autoname(app: App, tag: str) Optional[str] ¶
Fetch AutoName.
Get the to be displayed name of an app from the source code and adjust the App instance in case it is different name has been found.
- Parameters:
- app
The App instance to get the AutoName for.
- tag
Tag to fetch AutoName at.
- Returns:
- commitmsg
Commit message about the name change. None in case checking for the name is disabled, a VCSException occured or no name could be found.
- fdroidserver.checkupdates.get_last_build_from_app(app: App) Build ¶
Get the last build entry of an app.
- fdroidserver.checkupdates.main()¶
Check for updates for one or more apps.
The behaviour of this function is influenced by the configuration file as well as command line parameters.
- fdroidserver.checkupdates.operate_vercode(operation: str, vercode: int) int ¶
Calculate a new versionCode from a mathematical operation.
- Parameters:
- operation
The operation to execute to get the new versionCode.
- vercode
The versionCode for replacing “%c” in the operation.
- Returns:
- vercode
The new versionCode obtained by executing the operation.
- Raises:
MetaDataException
If the operation is invalid.
- fdroidserver.checkupdates.possible_subdirs(app: App)¶
Try to find a new subdir starting from the root build_dir.
Yields said subdir relative to the build dir if found, None otherwise.
- Parameters:
- app
The app to check for subdirs
- Yields:
- subdir
pathlib.Path
or None A possible subdir, None if no subdir could be found
- subdir
- fdroidserver.checkupdates.status_update_json(processed: list, failed: dict) None ¶
Output a JSON file with metadata about this run.
- fdroidserver.checkupdates.try_init_submodules(app: App, last_build: Build, vcs: vcs)¶
Try to init submodules if the last build entry uses them.
They might have been removed from the app’s repo in the meantime, so if we can’t find any submodules we continue with the updates check. If there is any other error in initializing them then we stop the check.