-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New implementation of dependecy resolution for bionic packages #26910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
MrAdityaAlok
wants to merge
14
commits into
master
Choose a base branch
from
new-buildorder
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+673
−118
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d05581a
New buildorder.py
MrAdityaAlok 54f654d
Feature complete
MrAdityaAlok 78c699f
Fix unnecessary extraction of downloaded deps
MrAdityaAlok 0ea12d3
Prevent unnecessary calls to __download_repo_file
MrAdityaAlok 03a35e3
Fix command expansion
MrAdityaAlok 81694d8
Fix map creation
MrAdityaAlok 4f60b5b
Add docs
MrAdityaAlok 5b9440b
Fix graph building
MrAdityaAlok feeaa05
Complete todos
MrAdityaAlok 6763f6f
New faster implementation
MrAdityaAlok 00f5361
Seperate bionic dependency resolution
MrAdityaAlok 0230d7c
Pass `TERMUX_PACKAGES_DIRECTORIES` explicitly to the script
MrAdityaAlok c8a6c19
Fix subpackage relation logic
MrAdityaAlok 119bad4
bionic_buildorder.py: start of implementation of proper glibc package…
Maxython File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ scripts/.vagrant/ | |
| # Logs | ||
| scripts/*.log | ||
| /*.log | ||
| log/ | ||
|
|
||
| # Misc archives | ||
| /*\.deb | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Documentation for `new_buildorder.py` | ||
|
|
||
| This script is used to determine the order in which to build the dependencies of a given package. It performs a topological sort (post-order Depth First Traversal) on the dependency graph to generate a linear order. | ||
|
|
||
| --- | ||
|
|
||
| ## Concepts | ||
|
|
||
| * **`Package`**: Something which has a build script (`build.sh`) or a subpackage script (`*.subpackage.sh`). | ||
| A package can be one of two types: | ||
| * **`REAL`**: A package that compiles to an artifact when built. | ||
| * **`VIRTUAL`**: A concept package that doesn't produce any artifacts. It just acts as a placeholder or an alias to one or more `REAL` packages. For example: Metapackages, `static` packages, and subpackages (in `OFFLINE` mode). | ||
|
|
||
| * **Build Modes**: There are two modes of operation: | ||
| * **`BuildMode.OFFLINE`**: It assumes no access to pre-built packages. The package and all its dependencies are to be built from source. It considers **build-time dependencies** (`TERMUX_PKG_BUILD_DEPENDS`) in addition to runtime dependencies. | ||
| * **`BuildMode.ONLINE`**: This mode assumes pre-built packages can be downloaded. It only considers runtime dependencies (`TERMUX_PKG_DEPENDS`), as build dependencies are not needed. | ||
|
|
||
| > [!NOTE] | ||
| > The `root_pkg` is always operated in `BuildMode.OFFLINE` as it has be built from source. | ||
|
|
||
| * **`AlternativeDependency`**: Represents a choice between several possible dependencies (e.g., `libA | libB`). It holds a tuple of options and assumes the first one as the default. | ||
|
|
||
| --- | ||
|
|
||
| ## Dependency Graph | ||
|
|
||
| It is represented as a [memoized](https://docs.python.org/3/library/functools.html#functools.cache) `__get_package` function. | ||
|
|
||
| ### `__get_package(package_name)` | ||
|
|
||
| This function parses a package's build script and creates a `Package` object. `Package` creation logic differs based on the package type and build mode. | ||
|
|
||
| * **Virtual Static Packages**: If a package name ends in `-static` and has no corresponding build script, it's treated as a `VIRTUAL` package that simply depends on its parent. | ||
| * **Metapackages**: Packages with `TERMUX_PKG_METAPACKAGE="true"` are marked as `VIRTUAL`. | ||
| * **Subpackages**: | ||
| * In **`OFFLINE` mode**, a subpackage is considered `VIRTUAL`. It cannot be built separately, as it's created during the parent package's build process. Its only depends upon its parent. | ||
| * In **`ONLINE` mode**, a subpackage is considered as `REAL` because it can be downloaded independently. `TERMUX_SUBPKG_DEPENDS` are its dependencies. | ||
|
|
||
| ### `__resolve_dependencies(package)` | ||
|
|
||
| This function eliminates all the `VIRTUAL` packages from the graph. If package `A` depends upon a `VIRTUAL` package `V`, and `V` in provided by/depends upon a `REAL` packages `B`, this function ensures that the DFS sees `A`'s dependencies as `B`, not `V`. | ||
|
|
||
| It works recursively: | ||
|
|
||
| 1. If a dependency is `REAL`, it's returned as is. | ||
| 2. If a dependency is `VIRTUAL`, the function calls itself on that package's dependencies until it flattens them all back to `REAL` packages. | ||
|
|
||
| ## Refrences | ||
|
|
||
| <https://en.wikipedia.org/wiki/Tree_traversal> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the
docsfolder and this.mdfile here, maybe this should be carefully formatted to match the directory structure and markdown syntax template used by most of the files in this othersite/pages/en/projects/docsfolder PR, here?