Skip to content

Infra, Build Order and Build Bootstraps Improvements #24647

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
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

agnostic-apollo
Copy link
Member

@agnostic-apollo agnostic-apollo commented May 7, 2025

.

Copy link
Member

@TomJo2000 TomJo2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna just have to stop my review here.
This is 2500LOCs of wide ranging build script changes.

I have serious stylistic concerns about the scripts/utils subdirectory.
And there are a good amount of seemingly unrelated packaging changes wrapped up in this PR.

This is practically unreviewable.
I hope you've crossed your t's and dotted your i's because I cannot check your work on this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the high level goal with the entire scripts/utils directory?
This seems rather clunky and doesn't really fit the style of the rest of the build scripts.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those scripts are from my shell libraries that will be released soon in a separate org. termux-packages will use need-only functions/files from those libraries. The final changes would use some scripts/lib/<lib_name> format for external libraries.

for subpackage in $TERMUX_PKG_BUILDER_DIR/*.subpackage.sh $TERMUX_PKG_TMPDIR/*subpackage.sh; do
[[ -f "$subpackage" ]] || continue
for subpackage in "${TERMUX_PKG_SUBPACKAGES_LIST[@]}"; do
if [ ! -f "$subpackage" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this be a more concise version of that change?

Suggested change
if [ ! -f "$subpackage" ]; then
[[ -f "$subpackage" ]] || termux_error_exit "Failed to find subpackage build file \"$subpackage\" of package \"$TERMUX_PKG_NAME\""

I spent a lot of time and effort overhauling the subpackages scripts for readability.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check https://github.com/termux/termux-packages/blob/63cfe26da5f26b1e8c54a689d68bc9f7d470ad81/scripts/build/termux_validate_built_packages.sh

We need to know if deb file for package and all its subpackages actually exists in the output directory before deciding whether package should be rebuilt or not. If any deb is missing, package must be rebuilt. Currently, there are no such validations.

Copy link
Member Author

@agnostic-apollo agnostic-apollo May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, check https://github.com/termux/termux-packages/blob/63cfe26da5f26b1e8c54a689d68bc9f7d470ad81/scripts/build/termux_set_subpackages.sh

That part was moved to a separate function due to duplicated code in debian and pacman.

for subpackage in $TERMUX_PKG_BUILDER_DIR/*.subpackage.sh $TERMUX_PKG_TMPDIR/*subpackage.sh; do
[[ -f "$subpackage" ]] || continue
for subpackage in "${TERMUX_PKG_SUBPACKAGES_LIST[@]}"; do
if [ ! -f "$subpackage" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in the Apt case.

Suggested change
if [ ! -f "$subpackage" ]; then
[[ -f "$subpackage" ]] || termux_error_exit "Failed to find subpackage build file \"$subpackage\" of package \"$TERMUX_PKG_NAME\""

@agnostic-apollo
Copy link
Member Author

agnostic-apollo commented May 7, 2025

1

This PR adds draft build infrastructure changes are fixes build-bootstraps.sh to build bootstrap zips that are file-and-package-list identical (not file-size) identical to bootstrap zips built with generate-bootstraps.sh. Note that these changes are very old for utils and bootstrap scripts, and I have rewritten the bootstrap scripts from scratch, and latest changes will be pushed in coming weeks/months when they have been finalized, lot of work remains for that.

To build bootstraps with default packages, run following. It takes about 20-25min on my laptop to build bootstrap zip of one architecture. Do not pass --architectures if all architectures should be built, or pass required architectures in [aarch64, arm, x86_64, i686].

  • generate: ./scripts/generate-bootstraps.sh --architectures aarch64,x86_64 &> build.log
  • build: ./scripts/run-docker.sh and then TERMUX_PKGS__BUILD_ORDER__LOG_LEVEL=2 ./scripts/build-bootstraps.sh --no-build-unneeded-subpackages --architectures aarch64,x86_64 &> build.log

For build-bootstraps.sh, the --no-clean flag can be passed for testing or if certain package build is failing and you want to start build again from that package after applying a fix, instead of building all packages from the start again. Ideally, the final bootstraps should be created without the --no-clean flag in one go.

For build-bootstraps.sh, passing the --no-build-unneeded-subpackages is advisable as it will skip building subpackages that are not needed and so bootstraps will be compiled much faster. For example, passing it will skip building the dpkg-perl subpackage, which depends on clang (subpackage of libllvm), which takes many hours to build. The dpkg package is needed by apt package manager, but dpkg-perl is not necessary and does not need to be added to bootstrap. However, this can cause problems where an important subpackage which is a dependency of another package gets skipped, like gpgv subpackage dependency of apt, and bootstrap build will fail with the following error if required package is not found: No package file found for package '<package_name>' This should not occur for default packages, but it can happen if additional packages are passed with the --packages-*-additional arguments.
To fix this, either do not pass the --no-build-unneeded-subpackages flag so that all packages and their subpackages get built, or explicitly pass the missing subpackage to --packages-pre-additional and it will get built regardless of whether its a dependency of parent package or not.
Do not pass the subpackage in --packages-post-additional as otherwise the package will get built twice, first for the parent package as a dependency, and then as the explicit subpackage passed.

The files being added by python package under $PREFIX/local/lib/python3.12/ if building it again instead of one in repo should be looked into, in case it is not intended behaviour and is a bug.

Diff generate and build bootstraps of single arch
get_packages() { unzip -p "$1" var/lib/dpkg/status | grep '^Package: ' | sed -E 's/Package: //g' | sort; }
get_file_list() { unzip -Z -1 "$1" | sort; }
get_file_sizes() { unzip -vqq "$1" | awk '{$2=""; $3=""; $4=""; $5=""; $6=""; $7=""; $1 = sprintf("%-10s", $1); print}' | sort -k2; }

BOOTSTRAP_A=output/generate/bootstrap-aarch64.zip BOOTSTRAP_B=output/build/bootstrap-aarch64.zip
diff -y --suppress-common-lines --width=160 -t <(get_file_sizes "$BOOTSTRAP_A") <(get_file_sizes "$BOOTSTRAP_B") > diff.txt
(diff -u <(get_packages "$BOOTSTRAP_A") <(get_packages "$BOOTSTRAP_B")) > diff.txt
(diff -u <(get_file_list "$BOOTSTRAP_A") <(get_file_list "$BOOTSTRAP_B")) > diff.txt
Diff generate and build bootstraps of multiple arches and generate single markdown report
get_packages() { unzip -p "$1" var/lib/dpkg/status | grep '^Package: ' | sed -E 's/Package: //g' | sort; }
get_file_list() { unzip -Z -1 "$1" | sort; }
get_file_sizes() { unzip -vqq "$1" | awk '{$2=""; $3=""; $4=""; $5=""; $6=""; $7=""; $1 = sprintf("%-10s", $1); print}' | sort -k2; }

BOOTSTRAPS_A_DIR="output/generate"
BOOTSTRAPS_B_DIR="output/build"
DIFF_FILE="diff.md"
printf "%s\n\n" "# Bootstraps Comparison" > "$DIFF_FILE"
for arch in "aarch64" "arm" "x86_64" "i686"; do
    BOOTSTRAP_A="$BOOTSTRAPS_A_DIR/bootstrap-${arch}.zip"
    BOOTSTRAP_B="$BOOTSTRAPS_B_DIR/bootstrap-${arch}.zip"
    if [[ -f "$BOOTSTRAP_A" ]] && [[ -f "$BOOTSTRAP_B" ]]; then
        printf "%s\n\n" "## \`${BOOTSTRAP_A}\` vs \`${BOOTSTRAP_B}\`" >> "$DIFF_FILE"

        printf "%s\n\n" "## Packages Comparison" >> "$DIFF_FILE"
        printf "%s\n" '```diff' >> "$DIFF_FILE"
        (diff --label="$BOOTSTRAP_A" --label="$BOOTSTRAP_B" -u <(get_packages "$BOOTSTRAP_A") <(get_packages "$BOOTSTRAP_B")) >> "$DIFF_FILE"
        printf "%s\n" '```' >> "$DIFF_FILE"

        printf "\n\n\n%s\n\n" "## File List Comparison" >> "$DIFF_FILE"
        printf "%s\n" '```diff' >> "$DIFF_FILE"
        (diff --label="$BOOTSTRAP_A" --label="$BOOTSTRAP_B" -u <(get_file_list "$BOOTSTRAP_A") <(get_file_list "$BOOTSTRAP_B")) >> "$DIFF_FILE"
        printf "%s\n" '```' >> "$DIFF_FILE"

        printf "\n\n\n%s\n\n" "## File Size Comparison" >> "$DIFF_FILE"
        printf "%s\n" '```diff' >> "$DIFF_FILE"
        diff --label="$BOOTSTRAP_A" --label="$BOOTSTRAP_B" -y --suppress-common-lines --width=160 -t <(get_file_sizes "$BOOTSTRAP_A") <(get_file_sizes "$BOOTSTRAP_B") >> "$DIFF_FILE"
        printf "%s\n" '```' >> "$DIFF_FILE"

        printf "\n---\n\n\n\n\n" >> "$DIFF_FILE"
    fi
done

diff-generate-vs-build-bootstraps.md

@agnostic-apollo
Copy link
Member Author

2

This PR changes the target build order algorithm to use topological sorting to generate the order. This is necessary because if -i/-I is not passed, where all dependencies must be built instead of downloaded, like in the case of build-bootstraps.sh, then any cycles must be detected beforehand, otherwise building would fail eventually with legacy order.

The buildorder.py also supports the old legacy order, but primarily returns the new topological build order. However, if a cycle is found, then it will abort, unless TERMUX_PKGS__BUILD_ORDER__RETURN_LEGACY_TARGET_BUILD_ORDER_ON_CYCLE is true, in which case, it returns the legacy order. The TERMUX_PKGS__BUILD_ORDER__RETURN_LEGACY_TARGET_BUILD_ORDER_ON_CYCLE is automatically exported for -i/-I options by build-package.sh, so that current building does not break, as older versions of dependencies could be used to solve cycles.

@agnostic-apollo
Copy link
Member Author

3

The python-tkinter subpackage of python package must be moved to a separate package, as there is a cycle preventing build-bootstraps.sh from working: ['python', 'brotli', 'freetype', 'fontconfig', 'tk', 'python']

The python-tkinter subpackage depends on tk, which depends on fontconfig -> freetype -> brotli, which depends on python again.

I have temporarily removed the python-tkinter subpackage entirely for build-bootstraps.sh to work as its not in default bootstrap packages. Its dependent fetchmailconf subpackage of fetchmail package has also been removed, and python is being built without tkinter module with py_cv_module__tkinter=n/a configure option.

The build.sh of separate python-tkinter would be mostly be same as python, and patch files can be symlinked, maybe a patch sub directory could be used. I am not sure if cycle could be broken via modifying tk and its dependencies.

@agnostic-apollo
Copy link
Member Author

Build order cycle before `python-tkinter` removal with `-I`
$ TERMUX_PKGS__BUILD_ORDER__LOG_LEVEL=4 ./build-package.sh -I gpgv &> build.log
[*] Building packages for arch 'aarch64': 'gpgv'
[*] Building package 'gnupg' for subpackage 'gpgv'...
termux - building gnupg for arch aarch64...
Downloading https://packages-cf.termux.dev/apt/termux-main/dists/stable/Release
...
Running buildorder for package: /home/builder/termux-packages/packages/gnupg
p_start(gnupg) deps: libassuan,libbz2,libgcrypt,libgnutls,libgpg-error,libksba,libnpth,libsqlite,pinentry,readline,resolv-conf,zlib
p_loop(gnupg) deps: libassuan,libbz2,libgcrypt,libgnutls,libgpg-error,libksba,libnpth,libsqlite,libusb,pinentry,readline,resolv-conf,zlib
    p_start(libassuan) deps: libgpg-error
    p_loop(libassuan) deps: libgpg-error
        p_start(libgpg-error) deps: 
        p_loop(libgpg-error) deps: 
        p_end(libgpg-error) res: 
        p_add(libassuan): dep: libgpg-error: (libgpg-error -> libassuan)
    p_end(libassuan) res: libgpg-error
    p_add(gnupg): dep: libassuan: (libassuan -> gnupg)
    p_start(libbz2) deps: 
    p_loop(libbz2) deps: bzip2
        s_start(bzip2) deps: libbz2
        s_loop(bzip2) deps: libbz2
        s_end(bzip2) res: 
    p_end(libbz2) res: bzip2
    p_add(gnupg): dep: libbz2: (libbz2 -> gnupg)
    p_start(libgcrypt) deps: libgpg-error
    p_loop(libgcrypt) deps: libgpg-error
        p_readd(libgcrypt): dep: libgpg-error: (libgpg-error -> libgcrypt)
    p_end(libgcrypt) res: 
    p_add(gnupg): dep: libgcrypt: (libgcrypt -> gnupg)
    p_start(libgnutls) deps: ca-certificates,libc++,libgmp,libidn2,libnettle,libunbound,libunistring,zlib
    p_loop(libgnutls) deps: ca-certificates,gnutls,libc++,libgmp,libidn2,libnettle,libunbound,libunistring,zlib
        p_start(ca-certificates) deps: 
        p_loop(ca-certificates) deps: ca-certificates-java
            s_start(ca-certificates-java) deps: ca-certificates
            s_loop(ca-certificates-java) deps: ca-certificates
            s_end(ca-certificates-java) res: 
        p_end(ca-certificates) res: ca-certificates-java
        p_add(libgnutls): dep: ca-certificates: (ca-certificates -> libgnutls)
        s_start(gnutls) deps: libgnutls
        s_loop(gnutls) deps: libgnutls
        s_end(gnutls) res: 
        p_start(libc++) deps: 
        p_loop(libc++) deps: 
        p_end(libc++) res: 
        p_add(libgnutls): dep: libc++: (libc++ -> libgnutls)
        p_start(libgmp) deps: libc++
        p_loop(libgmp) deps: libc++
            p_readd(libgmp): dep: libc++: (libc++ -> libgmp)
        p_end(libgmp) res: 
        p_add(libgnutls): dep: libgmp: (libgmp -> libgnutls)
        p_start(libidn2) deps: libandroid-support,libiconv,libunistring
        p_loop(libidn2) deps: libandroid-support,libiconv,libunistring
            p_start(libandroid-support) deps: 
            p_loop(libandroid-support) deps: 
            p_end(libandroid-support) res: 
            p_add(libidn2): dep: libandroid-support: (libandroid-support -> libidn2)
            p_start(libiconv) deps: 
            p_loop(libiconv) deps: iconv
                s_start(iconv) deps: libiconv
                s_loop(iconv) deps: libiconv
                s_end(iconv) res: 
            p_end(libiconv) res: iconv
            p_add(libidn2): dep: libiconv: (libiconv -> libidn2)
            p_start(libunistring) deps: libandroid-support,libiconv
            p_loop(libunistring) deps: libandroid-support,libiconv
                p_readd(libunistring): dep: libandroid-support: (libandroid-support -> libunistring)
                p_readd(libunistring): dep: libiconv: (libiconv -> libunistring)
            p_end(libunistring) res: 
            p_add(libidn2): dep: libunistring: (libunistring -> libidn2)
        p_end(libidn2) res: libandroid-support,iconv,libiconv,libunistring
        p_add(libgnutls): dep: libidn2: (libidn2 -> libgnutls)
        p_start(libnettle) deps: libgmp
        p_loop(libnettle) deps: libgmp,nettle
            p_readd(libnettle): dep: libgmp: (libgmp -> libnettle)
            s_start(nettle) deps: libnettle
            s_loop(nettle) deps: libnettle
            s_end(nettle) res: 
        p_end(libnettle) res: nettle
        p_add(libgnutls): dep: libnettle: (libnettle -> libgnutls)
        p_start(libunbound) deps: libevent,libnghttp2,openssl,python,resolv-conf,swig
        p_loop(libunbound) deps: libevent,libexpat,libnghttp2,openssl,python,pyunbound,resolv-conf,swig,unbound
            p_start(libevent) deps: 
            p_loop(libevent) deps: 
            p_end(libevent) res: 
            p_add(libunbound): dep: libevent: (libevent -> libunbound)
            p_start(libexpat) deps: 
            p_loop(libexpat) deps: 
            p_end(libexpat) res: 
            p_add(libunbound): dep: libexpat: (libexpat -> libunbound)
            p_start(libnghttp2) deps: 
            p_loop(libnghttp2) deps: 
            p_end(libnghttp2) res: 
            p_add(libunbound): dep: libnghttp2: (libnghttp2 -> libunbound)
            p_start(openssl) deps: ca-certificates,zlib
            p_loop(openssl) deps: ca-certificates,openssl-tool,zlib
                p_readd(openssl): dep: ca-certificates: (ca-certificates -> openssl)
                s_start(openssl-tool) deps: openssl
                s_loop(openssl-tool) deps: openssl
                s_end(openssl-tool) res: 
                p_start(zlib) deps: 
                p_loop(zlib) deps: 
                p_end(zlib) res: 
                p_add(openssl): dep: zlib: (zlib -> openssl)
            p_end(openssl) res: openssl-tool,zlib
            p_add(libunbound): dep: openssl: (openssl -> libunbound)
            p_start(python) deps: gdbm,libandroid-posix-semaphore,libandroid-support,libbz2,libcrypt,libexpat,libffi,liblzma,libsqlite,ncurses,ncurses-ui-libs,openssl,readline,tk,zlib
            p_loop(python) deps: gdbm,libandroid-posix-semaphore,libandroid-support,libbz2,libcrypt,libexpat,libffi,liblzma,libsqlite,ncurses,ncurses-ui-libs,openssl,python-ensurepip-wheels,python-tkinter,readline,tcl,tk,zlib
                p_start(gdbm) deps: readline
                p_loop(gdbm) deps: readline
                    p_start(readline) deps: libandroid-support,ncurses
                    p_loop(readline) deps: libandroid-support,ncurses
                        p_readd(readline): dep: libandroid-support: (libandroid-support -> readline)
                        p_start(ncurses) deps: 
                        p_loop(ncurses) deps: ncurses-ui-libs,ncurses-ui-libs-static,ncurses-utils
                            s_start(ncurses-ui-libs) deps: ncurses
                            s_loop(ncurses-ui-libs) deps: ncurses
                            s_end(ncurses-ui-libs) res: 
                            s_start(ncurses-ui-libs-static) deps: ncurses,ncurses-ui-libs
                            s_loop(ncurses-ui-libs-static) deps: ncurses,ncurses-ui-libs
                            s_end(ncurses-ui-libs-static) res: 
                            s_start(ncurses-utils) deps: ncurses
                            s_loop(ncurses-utils) deps: ncurses
                            s_end(ncurses-utils) res: 
                        p_end(ncurses) res: ncurses-ui-libs,ncurses-ui-libs-static,ncurses-utils
                        p_add(readline): dep: ncurses: (ncurses -> readline)
                    p_end(readline) res: ncurses-ui-libs,ncurses-ui-libs-static,ncurses-utils,ncurses
                    p_add(gdbm): dep: readline: (readline -> gdbm)
                p_end(gdbm) res: ncurses-ui-libs,ncurses-ui-libs-static,ncurses-utils,ncurses,readline
                p_add(python): dep: gdbm: (gdbm -> python)
                p_start(libandroid-posix-semaphore) deps: 
                p_loop(libandroid-posix-semaphore) deps: 
                p_end(libandroid-posix-semaphore) res: 
                p_add(python): dep: libandroid-posix-semaphore: (libandroid-posix-semaphore -> python)
                p_readd(python): dep: libandroid-support: (libandroid-support -> python)
                p_readd(python): dep: libbz2: (libbz2 -> python)
                p_start(libcrypt) deps: openssl
                p_loop(libcrypt) deps: openssl
                    p_readd(libcrypt): dep: openssl: (openssl -> libcrypt)
                p_end(libcrypt) res: 
                p_add(python): dep: libcrypt: (libcrypt -> python)
                p_readd(python): dep: libexpat: (libexpat -> python)
                p_start(libffi) deps: 
                p_loop(libffi) deps: 
                p_end(libffi) res: 
                p_add(python): dep: libffi: (libffi -> python)
                p_start(liblzma) deps: 
                p_loop(liblzma) deps: xz-utils
                    s_start(xz-utils) deps: liblzma
                    s_loop(xz-utils) deps: liblzma
                    s_end(xz-utils) res: 
                p_end(liblzma) res: xz-utils
                p_add(python): dep: liblzma: (liblzma -> python)
                p_start(libsqlite) deps: tcl,zlib
                p_loop(libsqlite) deps: libsqlite-tcl,readline,sqlite,tcl,zlib
                    s_start(libsqlite-tcl) deps: libsqlite,tcl
                    s_loop(libsqlite-tcl) deps: libsqlite,tcl
                        p_start(tcl) deps: zlib
                        p_loop(tcl) deps: zlib
                            p_readd(tcl): dep: zlib: (zlib -> tcl)
                        p_end(tcl) res: 
                        s_add(libsqlite-tcl): dep: tcl: (tcl -> libsqlite)
                    s_end(libsqlite-tcl) res: tcl
                    p_readd(libsqlite): dep: readline: (readline -> libsqlite)
                    s_start(sqlite) deps: libsqlite,readline
                    s_loop(sqlite) deps: libsqlite,readline
                        s_readd(sqlite): dep: readline: (readline -> libsqlite)
                    s_end(sqlite) res: 
                    p_readd(libsqlite): dep: tcl: (tcl -> libsqlite)
                    p_readd(libsqlite): dep: zlib: (zlib -> libsqlite)
                p_end(libsqlite) res: tcl,libsqlite-tcl,sqlite
                p_add(python): dep: libsqlite: (libsqlite -> python)
                p_readd(python): dep: ncurses: (ncurses -> python)
                p_readd(python): dep: ncurses-ui-libs: (ncurses -> python)
                p_readd(python): dep: openssl: (openssl -> python)
                s_start(python-ensurepip-wheels) deps: python
                s_loop(python-ensurepip-wheels) deps: python
                s_end(python-ensurepip-wheels) res: 
                s_start(python-tkinter) deps: python,tcl,tk
                s_loop(python-tkinter) deps: python,tcl,tk
                    s_readd(python-tkinter): dep: tcl: (tcl -> python)
                    p_start(tk) deps: fontconfig,libx11,libxft,libxss,tcl
                    p_loop(tk) deps: fontconfig,libx11,libxft,libxss,tcl
                        p_start(fontconfig) deps: freetype,libexpat,ttf-dejavu
                        p_loop(fontconfig) deps: fontconfig-utils,freetype,libexpat,ttf-dejavu
                            s_start(fontconfig-utils) deps: fontconfig
                            s_loop(fontconfig-utils) deps: fontconfig
                            s_end(fontconfig-utils) res: 
                            p_start(freetype) deps: brotli,libbz2,libpng,zlib
                            p_loop(freetype) deps: brotli,libbz2,libpng,zlib
                                p_start(brotli) deps: python
                                p_loop(brotli) deps: python,python-brotli,python-pip
                                    p_readd(brotli): dep: python: (python -> brotli)
                                    s_start(python-brotli) deps: brotli,python,python-pip
                                    s_loop(python-brotli) deps: brotli,python,python-pip
                                        s_readd(python-brotli): dep: python: (python -> brotli)
                                        p_start(python-pip) deps: clang,make,pkg-config,python
                                        p_loop(python-pip) deps: make,pkg-config,python
                                            p_start(make) deps: 
                                            p_loop(make) deps: 
                                            p_end(make) res: 
                                            p_add(python-pip): dep: make: (make -> python-pip)
                                            p_start(pkg-config) deps: glib
                                            p_loop(pkg-config) deps: glib
                                                p_start(glib) deps: libandroid-support,libffi,libiconv,pcre2,python,resolv-conf,zlib
                                                p_loop(glib) deps: glib-cross,libandroid-support,libffi,libiconv,pcre2,python,resolv-conf,zlib
                                                    s_start(glib-cross) deps: glib
                                                    s_loop(glib-cross) deps: glib
                                                    s_end(glib-cross) res: 
                                                    p_readd(glib): dep: libandroid-support: (libandroid-support -> glib)
                                                    p_readd(glib): dep: libffi: (libffi -> glib)
                                                    p_readd(glib): dep: libiconv: (libiconv -> glib)
                                                    p_start(pcre2) deps: 
                                                    p_loop(pcre2) deps: pcre2grep
                                                        s_start(pcre2grep) deps: pcre2
                                                        s_loop(pcre2grep) deps: pcre2
                                                        s_end(pcre2grep) res: 
                                                    p_end(pcre2) res: pcre2grep
                                                    p_add(glib): dep: pcre2: (pcre2 -> glib)
                                                    p_readd(glib): dep: python: (python -> glib)
                                                    p_start(resolv-conf) deps: 
                                                    p_loop(resolv-conf) deps: 
                                                    p_end(resolv-conf) res: 
                                                    p_add(glib): dep: resolv-conf: (resolv-conf -> glib)
                                                    p_readd(glib): dep: zlib: (zlib -> glib)
                                                p_end(glib) res: glib-cross,pcre2grep,pcre2,resolv-conf
                                                p_add(pkg-config): dep: glib: (glib -> pkg-config)
                                            p_end(pkg-config) res: glib-cross,pcre2grep,pcre2,resolv-conf,glib
                                            p_add(python-pip): dep: pkg-config: (pkg-config -> python-pip)
                                            p_readd(python-pip): dep: python: (python -> python-pip)
                                        p_end(python-pip) res: make,glib-cross,pcre2grep,pcre2,resolv-conf,glib,pkg-config
                                        s_add(python-brotli): dep: python-pip: (python-pip -> brotli)
                                    s_end(python-brotli) res: make,glib-cross,pcre2grep,pcre2,resolv-conf,glib,pkg-config,python-pip
                                    p_readd(brotli): dep: python-pip: (python-pip -> brotli)
                                p_end(brotli) res: make,glib-cross,pcre2grep,pcre2,resolv-conf,glib,pkg-config,python-pip,python-brotli
                                p_add(freetype): dep: brotli: (brotli -> freetype)
                                p_readd(freetype): dep: libbz2: (libbz2 -> freetype)
                                p_start(libpng) deps: zlib
                                p_loop(libpng) deps: zlib
                                    p_readd(libpng): dep: zlib: (zlib -> libpng)
                                p_end(libpng) res: 
                                p_add(freetype): dep: libpng: (libpng -> freetype)
                                p_readd(freetype): dep: zlib: (zlib -> freetype)
                            p_end(freetype) res: make,glib-cross,pcre2grep,pcre2,resolv-conf,glib,pkg-config,python-pip,python-brotli,brotli,libpng
                            p_add(fontconfig): dep: freetype: (freetype -> fontconfig)
                            p_readd(fontconfig): dep: libexpat: (libexpat -> fontconfig)
                            p_start(ttf-dejavu) deps: 
                            p_loop(ttf-dejavu) deps: 
                            p_end(ttf-dejavu) res: 
                            p_add(fontconfig): dep: ttf-dejavu: (ttf-dejavu -> fontconfig)
                        p_end(fontconfig) res: fontconfig-utils,make,glib-cross,pcre2grep,pcre2,resolv-conf,glib,pkg-config,python-pip,python-brotli,brotli,libpng,freetype,ttf-dejavu
                        p_add(tk): dep: fontconfig: (fontconfig -> tk)
                        p_start(libx11) deps: libandroid-support,libxcb,xorg-util-macros,xorgproto,xtrans
                        p_loop(libx11) deps: libandroid-support,libxcb,xorg-util-macros,xorgproto,xtrans
                            p_readd(libx11): dep: libandroid-support: (libandroid-support -> libx11)
                            p_start(libxcb) deps: libxau,libxdmcp,xcb-proto,xorg-util-macros
                            p_loop(libxcb) deps: libxau,libxdmcp,xcb-proto,xorg-util-macros
                                p_start(libxau) deps: xorgproto
                                p_loop(libxau) deps: xorgproto
                                    p_start(xorgproto) deps: xorg-util-macros
                                    p_loop(xorgproto) deps: xorg-util-macros
                                        p_start(xorg-util-macros) deps: 
                                        p_loop(xorg-util-macros) deps: 
                                        p_end(xorg-util-macros) res: 
                                        p_add(xorgproto): dep: xorg-util-macros: (xorg-util-macros -> xorgproto)
                                    p_end(xorgproto) res: xorg-util-macros
                                    p_add(libxau): dep: xorgproto: (xorgproto -> libxau)
                                p_end(libxau) res: xorg-util-macros,xorgproto
                                p_add(libxcb): dep: libxau: (libxau -> libxcb)
                                p_start(libxdmcp) deps: xorg-util-macros,xorgproto
                                p_loop(libxdmcp) deps: xorg-util-macros,xorgproto
                                    p_readd(libxdmcp): dep: xorg-util-macros: (xorg-util-macros -> libxdmcp)
                                    p_readd(libxdmcp): dep: xorgproto: (xorgproto -> libxdmcp)
                                p_end(libxdmcp) res: 
                                p_add(libxcb): dep: libxdmcp: (libxdmcp -> libxcb)
                                p_start(xcb-proto) deps: 
                                p_loop(xcb-proto) deps: python-xcbgen
                                    s_start(python-xcbgen) deps: xcb-proto
                                    s_loop(python-xcbgen) deps: xcb-proto
                                    s_end(python-xcbgen) res: 
                                p_end(xcb-proto) res: python-xcbgen
                                p_add(libxcb): dep: xcb-proto: (xcb-proto -> libxcb)
                                p_readd(libxcb): dep: xorg-util-macros: (xorg-util-macros -> libxcb)
                            p_end(libxcb) res: xorg-util-macros,xorgproto,libxau,libxdmcp,python-xcbgen,xcb-proto
                            p_add(libx11): dep: libxcb: (libxcb -> libx11)
                            p_readd(libx11): dep: xorg-util-macros: (xorg-util-macros -> libx11)
                            p_readd(libx11): dep: xorgproto: (xorgproto -> libx11)
                            p_start(xtrans) deps: 
                            p_loop(xtrans) deps: 
                            p_end(xtrans) res: 
                            p_add(libx11): dep: xtrans: (xtrans -> libx11)
                        p_end(libx11) res: xorg-util-macros,xorgproto,libxau,libxdmcp,python-xcbgen,xcb-proto,libxcb,xtrans
                        p_add(tk): dep: libx11: (libx11 -> tk)
                        p_start(libxft) deps: fontconfig,freetype,libx11,libxrender
                        p_loop(libxft) deps: fontconfig,freetype,libx11,libxrender
                            p_readd(libxft): dep: fontconfig: (fontconfig -> libxft)
                            p_readd(libxft): dep: freetype: (freetype -> libxft)
                            p_readd(libxft): dep: libx11: (libx11 -> libxft)
                            p_start(libxrender) deps: libx11,xorgproto
                            p_loop(libxrender) deps: libx11,xorgproto
                                p_readd(libxrender): dep: libx11: (libx11 -> libxrender)
                                p_readd(libxrender): dep: xorgproto: (xorgproto -> libxrender)
                            p_end(libxrender) res: 
                            p_add(libxft): dep: libxrender: (libxrender -> libxft)
                        p_end(libxft) res: libxrender
                        p_add(tk): dep: libxft: (libxft -> tk)
                        p_start(libxss) deps: libx11,libxau,libxcb,libxdmcp,libxext,xorg-util-macros,xorgproto
                        p_loop(libxss) deps: libx11,libxau,libxcb,libxdmcp,libxext,xorg-util-macros,xorgproto
                            p_readd(libxss): dep: libx11: (libx11 -> libxss)
                            p_readd(libxss): dep: libxau: (libxau -> libxss)
                            p_readd(libxss): dep: libxcb: (libxcb -> libxss)
                            p_readd(libxss): dep: libxdmcp: (libxdmcp -> libxss)
                            p_start(libxext) deps: libx11,xorg-util-macros,xorgproto
                            p_loop(libxext) deps: libx11,xorg-util-macros,xorgproto
                                p_readd(libxext): dep: libx11: (libx11 -> libxext)
                                p_readd(libxext): dep: xorg-util-macros: (xorg-util-macros -> libxext)
                                p_readd(libxext): dep: xorgproto: (xorgproto -> libxext)
                            p_end(libxext) res: 
                            p_add(libxss): dep: libxext: (libxext -> libxss)
                            p_readd(libxss): dep: xorg-util-macros: (xorg-util-macros -> libxss)
                            p_readd(libxss): dep: xorgproto: (xorgproto -> libxss)
                        p_end(libxss) res: libxext
                        p_add(tk): dep: libxss: (libxss -> tk)
                        p_readd(tk): dep: tcl: (tcl -> tk)
                    p_end(tk) res: fontconfig-utils,make,glib-cross,pcre2grep,pcre2,resolv-conf,glib,pkg-config,python-pip,python-brotli,brotli,libpng,freetype,ttf-dejavu,fontconfig,xorg-util-macros,xorgproto,libxau,libxdmcp,python-xcbgen,xcb-proto,libxcb,xtrans,libx11,libxrender,libxft,libxext,libxss
                    s_add(python-tkinter): dep: tk: (tk -> python)
                s_end(python-tkinter) res: fontconfig-utils,make,glib-cross,pcre2grep,pcre2,resolv-conf,glib,pkg-config,python-pip,python-brotli,brotli,libpng,freetype,ttf-dejavu,fontconfig,xorg-util-macros,xorgproto,libxau,libxdmcp,python-xcbgen,xcb-proto,libxcb,xtrans,libx11,libxrender,libxft,libxext,libxss,tk
                p_readd(python): dep: readline: (readline -> python)
                p_readd(python): dep: tcl: (tcl -> python)
                p_readd(python): dep: tk: (tk -> python)
                p_readd(python): dep: zlib: (zlib -> python)
            p_end(python) res: ncurses-ui-libs,ncurses-ui-libs-static,ncurses-utils,ncurses,readline,gdbm,libandroid-posix-semaphore,libcrypt,libffi,xz-utils,liblzma,tcl,libsqlite-tcl,sqlite,libsqlite,python-ensurepip-wheels,fontconfig-utils,make,glib-cross,pcre2grep,pcre2,resolv-conf,glib,pkg-config,python-pip,python-brotli,brotli,libpng,freetype,ttf-dejavu,fontconfig,xorg-util-macros,xorgproto,libxau,libxdmcp,python-xcbgen,xcb-proto,libxcb,xtrans,libx11,libxrender,libxft,libxext,libxss,tk,python-tkinter
            p_add(libunbound): dep: python: (python -> libunbound)
            s_start(pyunbound) deps: libunbound,python
            s_loop(pyunbound) deps: libunbound,python
                s_readd(pyunbound): dep: python: (python -> libunbound)
            s_end(pyunbound) res: 
            p_readd(libunbound): dep: resolv-conf: (resolv-conf -> libunbound)
            p_start(swig) deps: libc++,pcre2,zlib
            p_loop(swig) deps: libc++,pcre2,zlib
                p_readd(swig): dep: libc++: (libc++ -> swig)
                p_readd(swig): dep: pcre2: (pcre2 -> swig)
                p_readd(swig): dep: zlib: (zlib -> swig)
            p_end(swig) res: 
            p_add(libunbound): dep: swig: (swig -> libunbound)
            s_start(unbound) deps: libexpat,libunbound
            s_loop(unbound) deps: libexpat,libunbound
                s_readd(unbound): dep: libexpat: (libexpat -> libunbound)
            s_end(unbound) res: 
        p_end(libunbound) res: libevent,libexpat,libnghttp2,openssl-tool,zlib,openssl,ncurses-ui-libs,ncurses-ui-libs-static,ncurses-utils,ncurses,readline,gdbm,libandroid-posix-semaphore,libcrypt,libffi,xz-utils,liblzma,tcl,libsqlite-tcl,sqlite,libsqlite,python-ensurepip-wheels,fontconfig-utils,make,glib-cross,pcre2grep,pcre2,resolv-conf,glib,pkg-config,python-pip,python-brotli,brotli,libpng,freetype,ttf-dejavu,fontconfig,xorg-util-macros,xorgproto,libxau,libxdmcp,python-xcbgen,xcb-proto,libxcb,xtrans,libx11,libxrender,libxft,libxext,libxss,tk,python-tkinter,python,pyunbound,swig,unbound
        p_add(libgnutls): dep: libunbound: (libunbound -> libgnutls)
        p_readd(libgnutls): dep: libunistring: (libunistring -> libgnutls)
        p_readd(libgnutls): dep: zlib: (zlib -> libgnutls)
    p_end(libgnutls) res: ca-certificates-java,ca-certificates,gnutls,libc++,libgmp,libandroid-support,iconv,libiconv,libunistring,libidn2,nettle,libnettle,libevent,libexpat,libnghttp2,openssl-tool,zlib,openssl,ncurses-ui-libs,ncurses-ui-libs-static,ncurses-utils,ncurses,readline,gdbm,libandroid-posix-semaphore,libcrypt,libffi,xz-utils,liblzma,tcl,libsqlite-tcl,sqlite,libsqlite,python-ensurepip-wheels,fontconfig-utils,make,glib-cross,pcre2grep,pcre2,resolv-conf,glib,pkg-config,python-pip,python-brotli,brotli,libpng,freetype,ttf-dejavu,fontconfig,xorg-util-macros,xorgproto,libxau,libxdmcp,python-xcbgen,xcb-proto,libxcb,xtrans,libx11,libxrender,libxft,libxext,libxss,tk,python-tkinter,python,pyunbound,swig,unbound,libunbound
    p_add(gnupg): dep: libgnutls: (libgnutls -> gnupg)
    p_readd(gnupg): dep: libgpg-error: (libgpg-error -> gnupg)
    p_start(libksba) deps: libgpg-error
    p_loop(libksba) deps: libgpg-error
        p_readd(libksba): dep: libgpg-error: (libgpg-error -> libksba)
    p_end(libksba) res: 
    p_add(gnupg): dep: libksba: (libksba -> gnupg)
    p_start(libnpth) deps: 
    p_loop(libnpth) deps: 
    p_end(libnpth) res: 
    p_add(gnupg): dep: libnpth: (libnpth -> gnupg)
    p_readd(gnupg): dep: libsqlite: (libsqlite -> gnupg)
    p_start(libusb) deps: 
    p_loop(libusb) deps: 
    p_end(libusb) res: 
    p_add(gnupg): dep: libusb: (libusb -> gnupg)
    p_start(pinentry) deps: libandroid-support,libassuan,libgpg-error,libiconv,ncurses
    p_loop(pinentry) deps: libandroid-support,libassuan,libgpg-error,libiconv,ncurses
        p_readd(pinentry): dep: libandroid-support: (libandroid-support -> pinentry)
        p_readd(pinentry): dep: libassuan: (libassuan -> pinentry)
        p_readd(pinentry): dep: libgpg-error: (libgpg-error -> pinentry)
        p_readd(pinentry): dep: libiconv: (libiconv -> pinentry)
        p_readd(pinentry): dep: ncurses: (ncurses -> pinentry)
    p_end(pinentry) res: 
    p_add(gnupg): dep: pinentry: (pinentry -> gnupg)
    p_readd(gnupg): dep: readline: (readline -> gnupg)
    p_readd(gnupg): dep: resolv-conf: (resolv-conf -> gnupg)
    p_readd(gnupg): dep: zlib: (zlib -> gnupg)
p_end(gnupg) res: libgpg-error,libassuan,bzip2,libbz2,libgcrypt,ca-certificates-java,ca-certificates,gnutls,libc++,libgmp,libandroid-support,iconv,libiconv,libunistring,libidn2,nettle,libnettle,libevent,libexpat,libnghttp2,openssl-tool,zlib,openssl,ncurses-ui-libs,ncurses-ui-libs-static,ncurses-utils,ncurses,readline,gdbm,libandroid-posix-semaphore,libcrypt,libffi,xz-utils,liblzma,tcl,libsqlite-tcl,sqlite,libsqlite,python-ensurepip-wheels,fontconfig-utils,make,glib-cross,pcre2grep,pcre2,resolv-conf,glib,pkg-config,python-pip,python-brotli,brotli,libpng,freetype,ttf-dejavu,fontconfig,xorg-util-macros,xorgproto,libxau,libxdmcp,python-xcbgen,xcb-proto,libxcb,xtrans,libx11,libxrender,libxft,libxext,libxss,tk,python-tkinter,python,pyunbound,swig,unbound,libunbound,libgnutls,libksba,libnpth,libusb,pinentry


legacy_build_order(gnupg):
libgpg-error                   packages/libgpg-error
libassuan                      packages/libassuan
bzip2                          packages/libbz2
libbz2                         packages/libbz2
libgcrypt                      packages/libgcrypt
ca-certificates-java           packages/ca-certificates
ca-certificates                packages/ca-certificates
gnutls                         packages/libgnutls
libc++                         packages/libc++
libgmp                         packages/libgmp
libandroid-support             packages/libandroid-support
iconv                          packages/libiconv
libiconv                       packages/libiconv
libunistring                   packages/libunistring
libidn2                        packages/libidn2
nettle                         packages/libnettle
libnettle                      packages/libnettle
libevent                       packages/libevent
libexpat                       packages/libexpat
libnghttp2                     packages/libnghttp2
openssl-tool                   packages/openssl
zlib                           packages/zlib
openssl                        packages/openssl
ncurses-ui-libs                packages/ncurses
ncurses-ui-libs-static         packages/ncurses
ncurses-utils                  packages/ncurses
ncurses                        packages/ncurses
readline                       packages/readline
gdbm                           packages/gdbm
libandroid-posix-semaphore     packages/libandroid-posix-semaphore
libcrypt                       packages/libcrypt
libffi                         packages/libffi
xz-utils                       packages/liblzma
liblzma                        packages/liblzma
tcl                            packages/tcl
libsqlite-tcl                  packages/libsqlite
sqlite                         packages/libsqlite
libsqlite                      packages/libsqlite
python-ensurepip-wheels        packages/python
fontconfig-utils               packages/fontconfig
make                           packages/make
glib-cross                     packages/glib
pcre2grep                      packages/pcre2
pcre2                          packages/pcre2
resolv-conf                    packages/resolv-conf
glib                           packages/glib
pkg-config                     packages/pkg-config
python-pip                     packages/python-pip
python-brotli                  packages/brotli
brotli                         packages/brotli
libpng                         packages/libpng
freetype                       packages/freetype
ttf-dejavu                     packages/ttf-dejavu
fontconfig                     packages/fontconfig
xorg-util-macros               packages/xorg-util-macros
xorgproto                      packages/xorgproto
libxau                         packages/libxau
libxdmcp                       packages/libxdmcp
python-xcbgen                  packages/xcb-proto
xcb-proto                      packages/xcb-proto
libxcb                         packages/libxcb
xtrans                         packages/xtrans
libx11                         packages/libx11
libxrender                     packages/libxrender
libxft                         packages/libxft
libxext                        packages/libxext
libxss                         packages/libxss
tk                             packages/tk
python-tkinter                 packages/python
python                         packages/python
pyunbound                      packages/libunbound
swig                           packages/swig
unbound                        packages/libunbound
libunbound                     packages/libunbound
libgnutls                      packages/libgnutls
libksba                        packages/libksba
libnpth                        packages/libnpth
libusb                         packages/libusb
pinentry                       packages/pinentry


topological_build_order(gnupg):
Failed to generate target build order as cycle found: ('nodes are in a cycle', ['python', 'brotli', 'freetype', 'fontconfig', 'tk', 'python'])
Returning legacy_build_order(gnupg): ['libgpg-error', 'libassuan', 'bzip2', 'libbz2', 'libgcrypt', 'ca-certificates-java', 'ca-certificates', 'gnutls', 'libc++', 'libgmp', 'libandroid-support', 'iconv', 'libiconv', 'libunistring', 'libidn2', 'nettle', 'libnettle', 'libevent', 'libexpat', 'libnghttp2', 'openssl-tool', 'zlib', 'openssl', 'ncurses-ui-libs', 'ncurses-ui-libs-static', 'ncurses-utils', 'ncurses', 'readline', 'gdbm', 'libandroid-posix-semaphore', 'libcrypt', 'libffi', 'xz-utils', 'liblzma', 'tcl', 'libsqlite-tcl', 'sqlite', 'libsqlite', 'python-ensurepip-wheels', 'fontconfig-utils', 'make', 'glib-cross', 'pcre2grep', 'pcre2', 'resolv-conf', 'glib', 'pkg-config', 'python-pip', 'python-brotli', 'brotli', 'libpng', 'freetype', 'ttf-dejavu', 'fontconfig', 'xorg-util-macros', 'xorgproto', 'libxau', 'libxdmcp', 'python-xcbgen', 'xcb-proto', 'libxcb', 'xtrans', 'libx11', 'libxrender', 'libxft', 'libxext', 'libxss', 'tk', 'python-tkinter', 'python', 'pyunbound', 'swig', 'unbound', 'libunbound', 'libgnutls', 'libksba', 'libnpth', 'libusb', 'pinentry']


 

@agnostic-apollo
Copy link
Member Author

Build order cycle before `python-tkinter` removal without `-I`
$ TERMUX_PKGS__BUILD_ORDER__LOG_LEVEL=4 ./build-package.sh gpgv &> build.log
[*] Building packages for arch 'aarch64': 'gpgv'
[*] Building package 'gnupg' for subpackage 'gpgv'...
termux - building gnupg for arch aarch64...
Running buildorder for package: /home/builder/termux-packages/packages/gnupg
p_start(gnupg) deps: libassuan,libbz2,libgcrypt,libgnutls,libgpg-error,libksba,libnpth,libsqlite,pinentry,readline,resolv-conf,zlib
p_loop(gnupg) deps: libassuan,libbz2,libgcrypt,libgnutls,libgpg-error,libksba,libnpth,libsqlite,libusb,pinentry,readline,resolv-conf,zlib
    p_start(libassuan) deps: libgpg-error
    p_loop(libassuan) deps: libgpg-error
        p_start(libgpg-error) deps: 
        p_loop(libgpg-error) deps: 
        p_end(libgpg-error) res: 
        p_add(libassuan): dep: libgpg-error: (libgpg-error -> libassuan)
    p_end(libassuan) res: libgpg-error
    p_add(gnupg): dep: libassuan: (libassuan -> gnupg)
    p_start(libbz2) deps: 
    p_loop(libbz2) deps: 
    p_end(libbz2) res: 
    p_add(gnupg): dep: libbz2: (libbz2 -> gnupg)
    p_start(libgcrypt) deps: libgpg-error
    p_loop(libgcrypt) deps: libgpg-error
        p_readd(libgcrypt): dep: libgpg-error: (libgpg-error -> libgcrypt)
    p_end(libgcrypt) res: 
    p_add(gnupg): dep: libgcrypt: (libgcrypt -> gnupg)
    p_start(libgnutls) deps: ca-certificates,libc++,libgmp,libidn2,libnettle,libunbound,libunistring,zlib
    p_loop(libgnutls) deps: ca-certificates,libc++,libgmp,libidn2,libnettle,libunbound,libunistring,zlib
        p_start(ca-certificates) deps: 
        p_loop(ca-certificates) deps: 
        p_end(ca-certificates) res: 
        p_add(libgnutls): dep: ca-certificates: (ca-certificates -> libgnutls)
        p_start(libc++) deps: 
        p_loop(libc++) deps: 
        p_end(libc++) res: 
        p_add(libgnutls): dep: libc++: (libc++ -> libgnutls)
        p_start(libgmp) deps: libc++
        p_loop(libgmp) deps: libc++
            p_readd(libgmp): dep: libc++: (libc++ -> libgmp)
        p_end(libgmp) res: 
        p_add(libgnutls): dep: libgmp: (libgmp -> libgnutls)
        p_start(libidn2) deps: libandroid-support,libiconv,libunistring
        p_loop(libidn2) deps: libandroid-support,libiconv,libunistring
            p_start(libandroid-support) deps: 
            p_loop(libandroid-support) deps: 
            p_end(libandroid-support) res: 
            p_add(libidn2): dep: libandroid-support: (libandroid-support -> libidn2)
            p_start(libiconv) deps: 
            p_loop(libiconv) deps: 
            p_end(libiconv) res: 
            p_add(libidn2): dep: libiconv: (libiconv -> libidn2)
            p_start(libunistring) deps: libandroid-support,libiconv
            p_loop(libunistring) deps: libandroid-support,libiconv
                p_readd(libunistring): dep: libandroid-support: (libandroid-support -> libunistring)
                p_readd(libunistring): dep: libiconv: (libiconv -> libunistring)
            p_end(libunistring) res: 
            p_add(libidn2): dep: libunistring: (libunistring -> libidn2)
        p_end(libidn2) res: libandroid-support,libiconv,libunistring
        p_add(libgnutls): dep: libidn2: (libidn2 -> libgnutls)
        p_start(libnettle) deps: libgmp
        p_loop(libnettle) deps: libgmp
            p_readd(libnettle): dep: libgmp: (libgmp -> libnettle)
        p_end(libnettle) res: 
        p_add(libgnutls): dep: libnettle: (libnettle -> libgnutls)
        p_start(libunbound) deps: libevent,libnghttp2,openssl,python,resolv-conf,swig
        p_loop(libunbound) deps: libevent,libexpat,libnghttp2,openssl,python,resolv-conf,swig
            p_start(libevent) deps: 
            p_loop(libevent) deps: 
            p_end(libevent) res: 
            p_add(libunbound): dep: libevent: (libevent -> libunbound)
            p_start(libexpat) deps: 
            p_loop(libexpat) deps: 
            p_end(libexpat) res: 
            p_add(libunbound): dep: libexpat: (libexpat -> libunbound)
            p_start(libnghttp2) deps: 
            p_loop(libnghttp2) deps: 
            p_end(libnghttp2) res: 
            p_add(libunbound): dep: libnghttp2: (libnghttp2 -> libunbound)
            p_start(openssl) deps: ca-certificates,zlib
            p_loop(openssl) deps: ca-certificates,zlib
                p_readd(openssl): dep: ca-certificates: (ca-certificates -> openssl)
                p_start(zlib) deps: 
                p_loop(zlib) deps: 
                p_end(zlib) res: 
                p_add(openssl): dep: zlib: (zlib -> openssl)
            p_end(openssl) res: zlib
            p_add(libunbound): dep: openssl: (openssl -> libunbound)
            p_start(python) deps: gdbm,libandroid-posix-semaphore,libandroid-support,libbz2,libcrypt,libexpat,libffi,liblzma,libsqlite,ncurses,ncurses-ui-libs,openssl,readline,tk,zlib
            p_loop(python) deps: gdbm,libandroid-posix-semaphore,libandroid-support,libbz2,libcrypt,libexpat,libffi,liblzma,libsqlite,ncurses,ncurses-ui-libs,openssl,readline,tcl,tk,zlib
                p_start(gdbm) deps: readline
                p_loop(gdbm) deps: readline
                    p_start(readline) deps: libandroid-support,ncurses
                    p_loop(readline) deps: libandroid-support,ncurses
                        p_readd(readline): dep: libandroid-support: (libandroid-support -> readline)
                        p_start(ncurses) deps: 
                        p_loop(ncurses) deps: 
                        p_end(ncurses) res: 
                        p_add(readline): dep: ncurses: (ncurses -> readline)
                    p_end(readline) res: ncurses
                    p_add(gdbm): dep: readline: (readline -> gdbm)
                p_end(gdbm) res: ncurses,readline
                p_add(python): dep: gdbm: (gdbm -> python)
                p_start(libandroid-posix-semaphore) deps: 
                p_loop(libandroid-posix-semaphore) deps: 
                p_end(libandroid-posix-semaphore) res: 
                p_add(python): dep: libandroid-posix-semaphore: (libandroid-posix-semaphore -> python)
                p_readd(python): dep: libandroid-support: (libandroid-support -> python)
                p_readd(python): dep: libbz2: (libbz2 -> python)
                p_start(libcrypt) deps: openssl
                p_loop(libcrypt) deps: openssl
                    p_readd(libcrypt): dep: openssl: (openssl -> libcrypt)
                p_end(libcrypt) res: 
                p_add(python): dep: libcrypt: (libcrypt -> python)
                p_readd(python): dep: libexpat: (libexpat -> python)
                p_start(libffi) deps: 
                p_loop(libffi) deps: 
                p_end(libffi) res: 
                p_add(python): dep: libffi: (libffi -> python)
                p_start(liblzma) deps: 
                p_loop(liblzma) deps: 
                p_end(liblzma) res: 
                p_add(python): dep: liblzma: (liblzma -> python)
                p_start(libsqlite) deps: tcl,zlib
                p_loop(libsqlite) deps: readline,tcl,zlib
                    p_readd(libsqlite): dep: readline: (readline -> libsqlite)
                    p_start(tcl) deps: zlib
                    p_loop(tcl) deps: zlib
                        p_readd(tcl): dep: zlib: (zlib -> tcl)
                    p_end(tcl) res: 
                    p_add(libsqlite): dep: tcl: (tcl -> libsqlite)
                    p_readd(libsqlite): dep: zlib: (zlib -> libsqlite)
                p_end(libsqlite) res: tcl
                p_add(python): dep: libsqlite: (libsqlite -> python)
                p_readd(python): dep: ncurses: (ncurses -> python)
                p_start(ncurses) deps: 
                p_loop(ncurses) deps: 
                p_end(ncurses) res: 
                p_add(python): dep: ncurses-ui-libs: (ncurses -> python)
                p_readd(python): dep: openssl: (openssl -> python)
                p_readd(python): dep: readline: (readline -> python)
                p_readd(python): dep: tcl: (tcl -> python)
                p_start(tk) deps: fontconfig,libx11,libxft,libxss,tcl
                p_loop(tk) deps: fontconfig,libx11,libxft,libxss,tcl
                    p_start(fontconfig) deps: freetype,libexpat,ttf-dejavu
                    p_loop(fontconfig) deps: freetype,libexpat,ttf-dejavu
                        p_start(freetype) deps: brotli,libbz2,libpng,zlib
                        p_loop(freetype) deps: brotli,libbz2,libpng,zlib
                            p_start(brotli) deps: python
                            p_loop(brotli) deps: python,python-pip
                                p_readd(brotli): dep: python: (python -> brotli)
                                p_start(python-pip) deps: clang,make,pkg-config,python
                                p_loop(python-pip) deps: make,pkg-config,python
                                    p_start(make) deps: 
                                    p_loop(make) deps: 
                                    p_end(make) res: 
                                    p_add(python-pip): dep: make: (make -> python-pip)
                                    p_start(pkg-config) deps: glib
                                    p_loop(pkg-config) deps: glib
                                        p_start(glib) deps: libandroid-support,libffi,libiconv,pcre2,python,resolv-conf,zlib
                                        p_loop(glib) deps: libandroid-support,libffi,libiconv,pcre2,python,resolv-conf,zlib
                                            p_readd(glib): dep: libandroid-support: (libandroid-support -> glib)
                                            p_readd(glib): dep: libffi: (libffi -> glib)
                                            p_readd(glib): dep: libiconv: (libiconv -> glib)
                                            p_start(pcre2) deps: 
                                            p_loop(pcre2) deps: 
                                            p_end(pcre2) res: 
                                            p_add(glib): dep: pcre2: (pcre2 -> glib)
                                            p_readd(glib): dep: python: (python -> glib)
                                            p_start(resolv-conf) deps: 
                                            p_loop(resolv-conf) deps: 
                                            p_end(resolv-conf) res: 
                                            p_add(glib): dep: resolv-conf: (resolv-conf -> glib)
                                            p_readd(glib): dep: zlib: (zlib -> glib)
                                        p_end(glib) res: pcre2,resolv-conf
                                        p_add(pkg-config): dep: glib: (glib -> pkg-config)
                                    p_end(pkg-config) res: pcre2,resolv-conf,glib
                                    p_add(python-pip): dep: pkg-config: (pkg-config -> python-pip)
                                    p_readd(python-pip): dep: python: (python -> python-pip)
                                p_end(python-pip) res: make,pcre2,resolv-conf,glib,pkg-config
                                p_add(brotli): dep: python-pip: (python-pip -> brotli)
                            p_end(brotli) res: make,pcre2,resolv-conf,glib,pkg-config,python-pip
                            p_add(freetype): dep: brotli: (brotli -> freetype)
                            p_readd(freetype): dep: libbz2: (libbz2 -> freetype)
                            p_start(libpng) deps: zlib
                            p_loop(libpng) deps: zlib
                                p_readd(libpng): dep: zlib: (zlib -> libpng)
                            p_end(libpng) res: 
                            p_add(freetype): dep: libpng: (libpng -> freetype)
                            p_readd(freetype): dep: zlib: (zlib -> freetype)
                        p_end(freetype) res: make,pcre2,resolv-conf,glib,pkg-config,python-pip,brotli,libpng
                        p_add(fontconfig): dep: freetype: (freetype -> fontconfig)
                        p_readd(fontconfig): dep: libexpat: (libexpat -> fontconfig)
                        p_start(ttf-dejavu) deps: 
                        p_loop(ttf-dejavu) deps: 
                        p_end(ttf-dejavu) res: 
                        p_add(fontconfig): dep: ttf-dejavu: (ttf-dejavu -> fontconfig)
                    p_end(fontconfig) res: make,pcre2,resolv-conf,glib,pkg-config,python-pip,brotli,libpng,freetype,ttf-dejavu
                    p_add(tk): dep: fontconfig: (fontconfig -> tk)
                    p_start(libx11) deps: libandroid-support,libxcb,xorg-util-macros,xorgproto,xtrans
                    p_loop(libx11) deps: libandroid-support,libxcb,xorg-util-macros,xorgproto,xtrans
                        p_readd(libx11): dep: libandroid-support: (libandroid-support -> libx11)
                        p_start(libxcb) deps: libxau,libxdmcp,xcb-proto,xorg-util-macros
                        p_loop(libxcb) deps: libxau,libxdmcp,xcb-proto,xorg-util-macros
                            p_start(libxau) deps: xorgproto
                            p_loop(libxau) deps: xorgproto
                                p_start(xorgproto) deps: xorg-util-macros
                                p_loop(xorgproto) deps: xorg-util-macros
                                    p_start(xorg-util-macros) deps: 
                                    p_loop(xorg-util-macros) deps: 
                                    p_end(xorg-util-macros) res: 
                                    p_add(xorgproto): dep: xorg-util-macros: (xorg-util-macros -> xorgproto)
                                p_end(xorgproto) res: xorg-util-macros
                                p_add(libxau): dep: xorgproto: (xorgproto -> libxau)
                            p_end(libxau) res: xorg-util-macros,xorgproto
                            p_add(libxcb): dep: libxau: (libxau -> libxcb)
                            p_start(libxdmcp) deps: xorg-util-macros,xorgproto
                            p_loop(libxdmcp) deps: xorg-util-macros,xorgproto
                                p_readd(libxdmcp): dep: xorg-util-macros: (xorg-util-macros -> libxdmcp)
                                p_readd(libxdmcp): dep: xorgproto: (xorgproto -> libxdmcp)
                            p_end(libxdmcp) res: 
                            p_add(libxcb): dep: libxdmcp: (libxdmcp -> libxcb)
                            p_start(xcb-proto) deps: 
                            p_loop(xcb-proto) deps: 
                            p_end(xcb-proto) res: 
                            p_add(libxcb): dep: xcb-proto: (xcb-proto -> libxcb)
                            p_readd(libxcb): dep: xorg-util-macros: (xorg-util-macros -> libxcb)
                        p_end(libxcb) res: xorg-util-macros,xorgproto,libxau,libxdmcp,xcb-proto
                        p_add(libx11): dep: libxcb: (libxcb -> libx11)
                        p_readd(libx11): dep: xorg-util-macros: (xorg-util-macros -> libx11)
                        p_readd(libx11): dep: xorgproto: (xorgproto -> libx11)
                        p_start(xtrans) deps: 
                        p_loop(xtrans) deps: 
                        p_end(xtrans) res: 
                        p_add(libx11): dep: xtrans: (xtrans -> libx11)
                    p_end(libx11) res: xorg-util-macros,xorgproto,libxau,libxdmcp,xcb-proto,libxcb,xtrans
                    p_add(tk): dep: libx11: (libx11 -> tk)
                    p_start(libxft) deps: fontconfig,freetype,libx11,libxrender
                    p_loop(libxft) deps: fontconfig,freetype,libx11,libxrender
                        p_readd(libxft): dep: fontconfig: (fontconfig -> libxft)
                        p_readd(libxft): dep: freetype: (freetype -> libxft)
                        p_readd(libxft): dep: libx11: (libx11 -> libxft)
                        p_start(libxrender) deps: libx11,xorgproto
                        p_loop(libxrender) deps: libx11,xorgproto
                            p_readd(libxrender): dep: libx11: (libx11 -> libxrender)
                            p_readd(libxrender): dep: xorgproto: (xorgproto -> libxrender)
                        p_end(libxrender) res: 
                        p_add(libxft): dep: libxrender: (libxrender -> libxft)
                    p_end(libxft) res: libxrender
                    p_add(tk): dep: libxft: (libxft -> tk)
                    p_start(libxss) deps: libx11,libxau,libxcb,libxdmcp,libxext,xorg-util-macros,xorgproto
                    p_loop(libxss) deps: libx11,libxau,libxcb,libxdmcp,libxext,xorg-util-macros,xorgproto
                        p_readd(libxss): dep: libx11: (libx11 -> libxss)
                        p_readd(libxss): dep: libxau: (libxau -> libxss)
                        p_readd(libxss): dep: libxcb: (libxcb -> libxss)
                        p_readd(libxss): dep: libxdmcp: (libxdmcp -> libxss)
                        p_start(libxext) deps: libx11,xorg-util-macros,xorgproto
                        p_loop(libxext) deps: libx11,xorg-util-macros,xorgproto
                            p_readd(libxext): dep: libx11: (libx11 -> libxext)
                            p_readd(libxext): dep: xorg-util-macros: (xorg-util-macros -> libxext)
                            p_readd(libxext): dep: xorgproto: (xorgproto -> libxext)
                        p_end(libxext) res: 
                        p_add(libxss): dep: libxext: (libxext -> libxss)
                        p_readd(libxss): dep: xorg-util-macros: (xorg-util-macros -> libxss)
                        p_readd(libxss): dep: xorgproto: (xorgproto -> libxss)
                    p_end(libxss) res: libxext
                    p_add(tk): dep: libxss: (libxss -> tk)
                    p_readd(tk): dep: tcl: (tcl -> tk)
                p_end(tk) res: make,pcre2,resolv-conf,glib,pkg-config,python-pip,brotli,libpng,freetype,ttf-dejavu,fontconfig,xorg-util-macros,xorgproto,libxau,libxdmcp,xcb-proto,libxcb,xtrans,libx11,libxrender,libxft,libxext,libxss
                p_add(python): dep: tk: (tk -> python)
                p_readd(python): dep: zlib: (zlib -> python)
            p_end(python) res: ncurses,readline,gdbm,libandroid-posix-semaphore,libcrypt,libffi,liblzma,tcl,libsqlite,make,pcre2,resolv-conf,glib,pkg-config,python-pip,brotli,libpng,freetype,ttf-dejavu,fontconfig,xorg-util-macros,xorgproto,libxau,libxdmcp,xcb-proto,libxcb,xtrans,libx11,libxrender,libxft,libxext,libxss,tk
            p_add(libunbound): dep: python: (python -> libunbound)
            p_readd(libunbound): dep: resolv-conf: (resolv-conf -> libunbound)
            p_start(swig) deps: libc++,pcre2,zlib
            p_loop(swig) deps: libc++,pcre2,zlib
                p_readd(swig): dep: libc++: (libc++ -> swig)
                p_readd(swig): dep: pcre2: (pcre2 -> swig)
                p_readd(swig): dep: zlib: (zlib -> swig)
            p_end(swig) res: 
            p_add(libunbound): dep: swig: (swig -> libunbound)
        p_end(libunbound) res: libevent,libexpat,libnghttp2,zlib,openssl,ncurses,readline,gdbm,libandroid-posix-semaphore,libcrypt,libffi,liblzma,tcl,libsqlite,make,pcre2,resolv-conf,glib,pkg-config,python-pip,brotli,libpng,freetype,ttf-dejavu,fontconfig,xorg-util-macros,xorgproto,libxau,libxdmcp,xcb-proto,libxcb,xtrans,libx11,libxrender,libxft,libxext,libxss,tk,python,swig
        p_add(libgnutls): dep: libunbound: (libunbound -> libgnutls)
        p_readd(libgnutls): dep: libunistring: (libunistring -> libgnutls)
        p_readd(libgnutls): dep: zlib: (zlib -> libgnutls)
    p_end(libgnutls) res: ca-certificates,libc++,libgmp,libandroid-support,libiconv,libunistring,libidn2,libnettle,libevent,libexpat,libnghttp2,zlib,openssl,ncurses,readline,gdbm,libandroid-posix-semaphore,libcrypt,libffi,liblzma,tcl,libsqlite,make,pcre2,resolv-conf,glib,pkg-config,python-pip,brotli,libpng,freetype,ttf-dejavu,fontconfig,xorg-util-macros,xorgproto,libxau,libxdmcp,xcb-proto,libxcb,xtrans,libx11,libxrender,libxft,libxext,libxss,tk,python,swig,libunbound
    p_add(gnupg): dep: libgnutls: (libgnutls -> gnupg)
    p_readd(gnupg): dep: libgpg-error: (libgpg-error -> gnupg)
    p_start(libksba) deps: libgpg-error
    p_loop(libksba) deps: libgpg-error
        p_readd(libksba): dep: libgpg-error: (libgpg-error -> libksba)
    p_end(libksba) res: 
    p_add(gnupg): dep: libksba: (libksba -> gnupg)
    p_start(libnpth) deps: 
    p_loop(libnpth) deps: 
    p_end(libnpth) res: 
    p_add(gnupg): dep: libnpth: (libnpth -> gnupg)
    p_readd(gnupg): dep: libsqlite: (libsqlite -> gnupg)
    p_start(libusb) deps: 
    p_loop(libusb) deps: 
    p_end(libusb) res: 
    p_add(gnupg): dep: libusb: (libusb -> gnupg)
    p_start(pinentry) deps: libandroid-support,libassuan,libgpg-error,libiconv,ncurses
    p_loop(pinentry) deps: libandroid-support,libassuan,libgpg-error,libiconv,ncurses
        p_readd(pinentry): dep: libandroid-support: (libandroid-support -> pinentry)
        p_readd(pinentry): dep: libassuan: (libassuan -> pinentry)
        p_readd(pinentry): dep: libgpg-error: (libgpg-error -> pinentry)
        p_readd(pinentry): dep: libiconv: (libiconv -> pinentry)
        p_readd(pinentry): dep: ncurses: (ncurses -> pinentry)
    p_end(pinentry) res: 
    p_add(gnupg): dep: pinentry: (pinentry -> gnupg)
    p_readd(gnupg): dep: readline: (readline -> gnupg)
    p_readd(gnupg): dep: resolv-conf: (resolv-conf -> gnupg)
    p_readd(gnupg): dep: zlib: (zlib -> gnupg)
p_end(gnupg) res: libgpg-error,libassuan,libbz2,libgcrypt,ca-certificates,libc++,libgmp,libandroid-support,libiconv,libunistring,libidn2,libnettle,libevent,libexpat,libnghttp2,zlib,openssl,ncurses,readline,gdbm,libandroid-posix-semaphore,libcrypt,libffi,liblzma,tcl,libsqlite,make,pcre2,resolv-conf,glib,pkg-config,python-pip,brotli,libpng,freetype,ttf-dejavu,fontconfig,xorg-util-macros,xorgproto,libxau,libxdmcp,xcb-proto,libxcb,xtrans,libx11,libxrender,libxft,libxext,libxss,tk,python,swig,libunbound,libgnutls,libksba,libnpth,libusb,pinentry


legacy_build_order(gnupg):
libgpg-error                   packages/libgpg-error
libassuan                      packages/libassuan
libbz2                         packages/libbz2
libgcrypt                      packages/libgcrypt
ca-certificates                packages/ca-certificates
libc++                         packages/libc++
libgmp                         packages/libgmp
libandroid-support             packages/libandroid-support
libiconv                       packages/libiconv
libunistring                   packages/libunistring
libidn2                        packages/libidn2
libnettle                      packages/libnettle
libevent                       packages/libevent
libexpat                       packages/libexpat
libnghttp2                     packages/libnghttp2
zlib                           packages/zlib
openssl                        packages/openssl
ncurses                        packages/ncurses
readline                       packages/readline
gdbm                           packages/gdbm
libandroid-posix-semaphore     packages/libandroid-posix-semaphore
libcrypt                       packages/libcrypt
libffi                         packages/libffi
liblzma                        packages/liblzma
tcl                            packages/tcl
libsqlite                      packages/libsqlite
make                           packages/make
pcre2                          packages/pcre2
resolv-conf                    packages/resolv-conf
glib                           packages/glib
pkg-config                     packages/pkg-config
python-pip                     packages/python-pip
brotli                         packages/brotli
libpng                         packages/libpng
freetype                       packages/freetype
ttf-dejavu                     packages/ttf-dejavu
fontconfig                     packages/fontconfig
xorg-util-macros               packages/xorg-util-macros
xorgproto                      packages/xorgproto
libxau                         packages/libxau
libxdmcp                       packages/libxdmcp
xcb-proto                      packages/xcb-proto
libxcb                         packages/libxcb
xtrans                         packages/xtrans
libx11                         packages/libx11
libxrender                     packages/libxrender
libxft                         packages/libxft
libxext                        packages/libxext
libxss                         packages/libxss
tk                             packages/tk
python                         packages/python
swig                           packages/swig
libunbound                     packages/libunbound
libgnutls                      packages/libgnutls
libksba                        packages/libksba
libnpth                        packages/libnpth
libusb                         packages/libusb
pinentry                       packages/pinentry


topological_build_order(gnupg):
Failed to generate target build order as cycle found: ('nodes are in a cycle', ['python', 'brotli', 'freetype', 'fontconfig', 'tk', 'python'])
Failed to get build order.
Error type: 'CMD_ERROR'

 

@agnostic-apollo
Copy link
Member Author

Build order after `python-tkinter` removal
$ TERMUX_PKGS__BUILD_ORDER__LOG_LEVEL=4 ./build-package.sh gpgv &> build.log
[*] Building packages for arch 'aarch64': 'gpgv'
[*] Building package 'gnupg' for subpackage 'gpgv'...
termux - building gnupg for arch aarch64...
Running buildorder for package: /home/builder/termux-packages/packages/gnupg
p_start(gnupg) deps: libassuan,libbz2,libgcrypt,libgnutls,libgpg-error,libksba,libnpth,libsqlite,pinentry,readline,resolv-conf,zlib
p_loop(gnupg) deps: libassuan,libbz2,libgcrypt,libgnutls,libgpg-error,libksba,libnpth,libsqlite,libusb,pinentry,readline,resolv-conf,zlib
    p_start(libassuan) deps: libgpg-error
    p_loop(libassuan) deps: libgpg-error
        p_start(libgpg-error) deps: 
        p_loop(libgpg-error) deps: 
        p_end(libgpg-error) res: 
        p_add(libassuan): dep: libgpg-error: (libgpg-error -> libassuan)
    p_end(libassuan) res: libgpg-error
    p_add(gnupg): dep: libassuan: (libassuan -> gnupg)
    p_start(libbz2) deps: 
    p_loop(libbz2) deps: 
    p_end(libbz2) res: 
    p_add(gnupg): dep: libbz2: (libbz2 -> gnupg)
    p_start(libgcrypt) deps: libgpg-error
    p_loop(libgcrypt) deps: libgpg-error
        p_readd(libgcrypt): dep: libgpg-error: (libgpg-error -> libgcrypt)
    p_end(libgcrypt) res: 
    p_add(gnupg): dep: libgcrypt: (libgcrypt -> gnupg)
    p_start(libgnutls) deps: ca-certificates,libc++,libgmp,libidn2,libnettle,libunbound,libunistring,zlib
    p_loop(libgnutls) deps: ca-certificates,libc++,libgmp,libidn2,libnettle,libunbound,libunistring,zlib
        p_start(ca-certificates) deps: 
        p_loop(ca-certificates) deps: 
        p_end(ca-certificates) res: 
        p_add(libgnutls): dep: ca-certificates: (ca-certificates -> libgnutls)
        p_start(libc++) deps: 
        p_loop(libc++) deps: 
        p_end(libc++) res: 
        p_add(libgnutls): dep: libc++: (libc++ -> libgnutls)
        p_start(libgmp) deps: libc++
        p_loop(libgmp) deps: libc++
            p_readd(libgmp): dep: libc++: (libc++ -> libgmp)
        p_end(libgmp) res: 
        p_add(libgnutls): dep: libgmp: (libgmp -> libgnutls)
        p_start(libidn2) deps: libandroid-support,libiconv,libunistring
        p_loop(libidn2) deps: libandroid-support,libiconv,libunistring
            p_start(libandroid-support) deps: 
            p_loop(libandroid-support) deps: 
            p_end(libandroid-support) res: 
            p_add(libidn2): dep: libandroid-support: (libandroid-support -> libidn2)
            p_start(libiconv) deps: 
            p_loop(libiconv) deps: 
            p_end(libiconv) res: 
            p_add(libidn2): dep: libiconv: (libiconv -> libidn2)
            p_start(libunistring) deps: libandroid-support,libiconv
            p_loop(libunistring) deps: libandroid-support,libiconv
                p_readd(libunistring): dep: libandroid-support: (libandroid-support -> libunistring)
                p_readd(libunistring): dep: libiconv: (libiconv -> libunistring)
            p_end(libunistring) res: 
            p_add(libidn2): dep: libunistring: (libunistring -> libidn2)
        p_end(libidn2) res: libandroid-support,libiconv,libunistring
        p_add(libgnutls): dep: libidn2: (libidn2 -> libgnutls)
        p_start(libnettle) deps: libgmp
        p_loop(libnettle) deps: libgmp
            p_readd(libnettle): dep: libgmp: (libgmp -> libnettle)
        p_end(libnettle) res: 
        p_add(libgnutls): dep: libnettle: (libnettle -> libgnutls)
        p_start(libunbound) deps: libevent,libnghttp2,openssl,python,resolv-conf,swig
        p_loop(libunbound) deps: libevent,libexpat,libnghttp2,openssl,python,resolv-conf,swig
            p_start(libevent) deps: 
            p_loop(libevent) deps: 
            p_end(libevent) res: 
            p_add(libunbound): dep: libevent: (libevent -> libunbound)
            p_start(libexpat) deps: 
            p_loop(libexpat) deps: 
            p_end(libexpat) res: 
            p_add(libunbound): dep: libexpat: (libexpat -> libunbound)
            p_start(libnghttp2) deps: 
            p_loop(libnghttp2) deps: 
            p_end(libnghttp2) res: 
            p_add(libunbound): dep: libnghttp2: (libnghttp2 -> libunbound)
            p_start(openssl) deps: ca-certificates,zlib
            p_loop(openssl) deps: ca-certificates,zlib
                p_readd(openssl): dep: ca-certificates: (ca-certificates -> openssl)
                p_start(zlib) deps: 
                p_loop(zlib) deps: 
                p_end(zlib) res: 
                p_add(openssl): dep: zlib: (zlib -> openssl)
            p_end(openssl) res: zlib
            p_add(libunbound): dep: openssl: (openssl -> libunbound)
            p_start(python) deps: gdbm,libandroid-posix-semaphore,libandroid-support,libbz2,libcrypt,libexpat,libffi,liblzma,libsqlite,ncurses,ncurses-ui-libs,openssl,readline,zlib
            p_loop(python) deps: gdbm,libandroid-posix-semaphore,libandroid-support,libbz2,libcrypt,libexpat,libffi,liblzma,libsqlite,ncurses,ncurses-ui-libs,openssl,readline,zlib
                p_start(gdbm) deps: readline
                p_loop(gdbm) deps: readline
                    p_start(readline) deps: libandroid-support,ncurses
                    p_loop(readline) deps: libandroid-support,ncurses
                        p_readd(readline): dep: libandroid-support: (libandroid-support -> readline)
                        p_start(ncurses) deps: 
                        p_loop(ncurses) deps: 
                        p_end(ncurses) res: 
                        p_add(readline): dep: ncurses: (ncurses -> readline)
                    p_end(readline) res: ncurses
                    p_add(gdbm): dep: readline: (readline -> gdbm)
                p_end(gdbm) res: ncurses,readline
                p_add(python): dep: gdbm: (gdbm -> python)
                p_start(libandroid-posix-semaphore) deps: 
                p_loop(libandroid-posix-semaphore) deps: 
                p_end(libandroid-posix-semaphore) res: 
                p_add(python): dep: libandroid-posix-semaphore: (libandroid-posix-semaphore -> python)
                p_readd(python): dep: libandroid-support: (libandroid-support -> python)
                p_readd(python): dep: libbz2: (libbz2 -> python)
                p_start(libcrypt) deps: openssl
                p_loop(libcrypt) deps: openssl
                    p_readd(libcrypt): dep: openssl: (openssl -> libcrypt)
                p_end(libcrypt) res: 
                p_add(python): dep: libcrypt: (libcrypt -> python)
                p_readd(python): dep: libexpat: (libexpat -> python)
                p_start(libffi) deps: 
                p_loop(libffi) deps: 
                p_end(libffi) res: 
                p_add(python): dep: libffi: (libffi -> python)
                p_start(liblzma) deps: 
                p_loop(liblzma) deps: 
                p_end(liblzma) res: 
                p_add(python): dep: liblzma: (liblzma -> python)
                p_start(libsqlite) deps: tcl,zlib
                p_loop(libsqlite) deps: readline,tcl,zlib
                    p_readd(libsqlite): dep: readline: (readline -> libsqlite)
                    p_start(tcl) deps: zlib
                    p_loop(tcl) deps: zlib
                        p_readd(tcl): dep: zlib: (zlib -> tcl)
                    p_end(tcl) res: 
                    p_add(libsqlite): dep: tcl: (tcl -> libsqlite)
                    p_readd(libsqlite): dep: zlib: (zlib -> libsqlite)
                p_end(libsqlite) res: tcl
                p_add(python): dep: libsqlite: (libsqlite -> python)
                p_readd(python): dep: ncurses: (ncurses -> python)
                p_start(ncurses) deps: 
                p_loop(ncurses) deps: 
                p_end(ncurses) res: 
                p_add(python): dep: ncurses-ui-libs: (ncurses -> python)
                p_readd(python): dep: openssl: (openssl -> python)
                p_readd(python): dep: readline: (readline -> python)
                p_readd(python): dep: zlib: (zlib -> python)
            p_end(python) res: ncurses,readline,gdbm,libandroid-posix-semaphore,libcrypt,libffi,liblzma,tcl,libsqlite
            p_add(libunbound): dep: python: (python -> libunbound)
            p_start(resolv-conf) deps: 
            p_loop(resolv-conf) deps: 
            p_end(resolv-conf) res: 
            p_add(libunbound): dep: resolv-conf: (resolv-conf -> libunbound)
            p_start(swig) deps: libc++,pcre2,zlib
            p_loop(swig) deps: libc++,pcre2,zlib
                p_readd(swig): dep: libc++: (libc++ -> swig)
                p_start(pcre2) deps: 
                p_loop(pcre2) deps: 
                p_end(pcre2) res: 
                p_add(swig): dep: pcre2: (pcre2 -> swig)
                p_readd(swig): dep: zlib: (zlib -> swig)
            p_end(swig) res: pcre2
            p_add(libunbound): dep: swig: (swig -> libunbound)
        p_end(libunbound) res: libevent,libexpat,libnghttp2,zlib,openssl,ncurses,readline,gdbm,libandroid-posix-semaphore,libcrypt,libffi,liblzma,tcl,libsqlite,python,resolv-conf,pcre2,swig
        p_add(libgnutls): dep: libunbound: (libunbound -> libgnutls)
        p_readd(libgnutls): dep: libunistring: (libunistring -> libgnutls)
        p_readd(libgnutls): dep: zlib: (zlib -> libgnutls)
    p_end(libgnutls) res: ca-certificates,libc++,libgmp,libandroid-support,libiconv,libunistring,libidn2,libnettle,libevent,libexpat,libnghttp2,zlib,openssl,ncurses,readline,gdbm,libandroid-posix-semaphore,libcrypt,libffi,liblzma,tcl,libsqlite,python,resolv-conf,pcre2,swig,libunbound
    p_add(gnupg): dep: libgnutls: (libgnutls -> gnupg)
    p_readd(gnupg): dep: libgpg-error: (libgpg-error -> gnupg)
    p_start(libksba) deps: libgpg-error
    p_loop(libksba) deps: libgpg-error
        p_readd(libksba): dep: libgpg-error: (libgpg-error -> libksba)
    p_end(libksba) res: 
    p_add(gnupg): dep: libksba: (libksba -> gnupg)
    p_start(libnpth) deps: 
    p_loop(libnpth) deps: 
    p_end(libnpth) res: 
    p_add(gnupg): dep: libnpth: (libnpth -> gnupg)
    p_readd(gnupg): dep: libsqlite: (libsqlite -> gnupg)
    p_start(libusb) deps: 
    p_loop(libusb) deps: 
    p_end(libusb) res: 
    p_add(gnupg): dep: libusb: (libusb -> gnupg)
    p_start(pinentry) deps: libandroid-support,libassuan,libgpg-error,libiconv,ncurses
    p_loop(pinentry) deps: libandroid-support,libassuan,libgpg-error,libiconv,ncurses
        p_readd(pinentry): dep: libandroid-support: (libandroid-support -> pinentry)
        p_readd(pinentry): dep: libassuan: (libassuan -> pinentry)
        p_readd(pinentry): dep: libgpg-error: (libgpg-error -> pinentry)
        p_readd(pinentry): dep: libiconv: (libiconv -> pinentry)
        p_readd(pinentry): dep: ncurses: (ncurses -> pinentry)
    p_end(pinentry) res: 
    p_add(gnupg): dep: pinentry: (pinentry -> gnupg)
    p_readd(gnupg): dep: readline: (readline -> gnupg)
    p_readd(gnupg): dep: resolv-conf: (resolv-conf -> gnupg)
    p_readd(gnupg): dep: zlib: (zlib -> gnupg)
p_end(gnupg) res: libgpg-error,libassuan,libbz2,libgcrypt,ca-certificates,libc++,libgmp,libandroid-support,libiconv,libunistring,libidn2,libnettle,libevent,libexpat,libnghttp2,zlib,openssl,ncurses,readline,gdbm,libandroid-posix-semaphore,libcrypt,libffi,liblzma,tcl,libsqlite,python,resolv-conf,pcre2,swig,libunbound,libgnutls,libksba,libnpth,libusb,pinentry


legacy_build_order(gnupg):
libgpg-error                   packages/libgpg-error
libassuan                      packages/libassuan
libbz2                         packages/libbz2
libgcrypt                      packages/libgcrypt
ca-certificates                packages/ca-certificates
libc++                         packages/libc++
libgmp                         packages/libgmp
libandroid-support             packages/libandroid-support
libiconv                       packages/libiconv
libunistring                   packages/libunistring
libidn2                        packages/libidn2
libnettle                      packages/libnettle
libevent                       packages/libevent
libexpat                       packages/libexpat
libnghttp2                     packages/libnghttp2
zlib                           packages/zlib
openssl                        packages/openssl
ncurses                        packages/ncurses
readline                       packages/readline
gdbm                           packages/gdbm
libandroid-posix-semaphore     packages/libandroid-posix-semaphore
libcrypt                       packages/libcrypt
libffi                         packages/libffi
liblzma                        packages/liblzma
tcl                            packages/tcl
libsqlite                      packages/libsqlite
python                         packages/python
resolv-conf                    packages/resolv-conf
pcre2                          packages/pcre2
swig                           packages/swig
libunbound                     packages/libunbound
libgnutls                      packages/libgnutls
libksba                        packages/libksba
libnpth                        packages/libnpth
libusb                         packages/libusb
pinentry                       packages/pinentry


topological_build_order(gnupg):
libgpg-error                   packages/libgpg-error
libbz2                         packages/libbz2
ca-certificates                packages/ca-certificates
libc++                         packages/libc++
libandroid-support             packages/libandroid-support
libiconv                       packages/libiconv
libevent                       packages/libevent
libexpat                       packages/libexpat
libnghttp2                     packages/libnghttp2
zlib                           packages/zlib
ncurses                        packages/ncurses
libandroid-posix-semaphore     packages/libandroid-posix-semaphore
libffi                         packages/libffi
liblzma                        packages/liblzma
resolv-conf                    packages/resolv-conf
pcre2                          packages/pcre2
libnpth                        packages/libnpth
libusb                         packages/libusb
libassuan                      packages/libassuan
libgcrypt                      packages/libgcrypt
libksba                        packages/libksba
libgmp                         packages/libgmp
libunistring                   packages/libunistring
openssl                        packages/openssl
tcl                            packages/tcl
readline                       packages/readline
swig                           packages/swig
pinentry                       packages/pinentry
libnettle                      packages/libnettle
libidn2                        packages/libidn2
libcrypt                       packages/libcrypt
gdbm                           packages/gdbm
libsqlite                      packages/libsqlite
python                         packages/python
libunbound                     packages/libunbound
libgnutls                      packages/libgnutls
Returning topological_build_order(gnupg): ['libgpg-error', 'libbz2', 'ca-certificates', 'libc++', 'libandroid-support', 'libiconv', 'libevent', 'libexpat', 'libnghttp2', 'zlib', 'ncurses', 'libandroid-posix-semaphore', 'libffi', 'liblzma', 'resolv-conf', 'pcre2', 'libnpth', 'libusb', 'libassuan', 'libgcrypt', 'libksba', 'libgmp', 'libunistring', 'openssl', 'tcl', 'readline', 'swig', 'pinentry', 'libnettle', 'libidn2', 'libcrypt', 'gdbm', 'libsqlite', 'python', 'libunbound', 'libgnutls']

 

agnostic-apollo referenced this pull request in agnostic-apollo/termux-packages May 7, 2025
@agnostic-apollo agnostic-apollo marked this pull request as draft May 7, 2025 18:54
declare -a PACKAGES_LIST=()

for i in "${PACKAGES_ARGS_LIST[@]}"; do
if [[ -z "${i:-}" ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK it is not needed to do :- inside [[, the test will not cause bailing because of set -u. Same applies to all places you used this.

Also AFAIK this causes some speed hit.


build_bootstrap_killtree() {

local signal="$1"; local pid="$2"; local cpid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be collapsed to a single local expression if you do not mind.

if [[ " ${TERMUX_DEFAULT_ARCHITECTURES[*]} " != *" $TERMUX_ARCH "* ]]; then
echo "Unsupported architecture '$TERMUX_ARCH' for in architectures list: '${TERMUX_ARCHITECTURES[*]}'" 1>&2
echo "Supported architectures: '${TERMUX_DEFAULT_ARCHITECTURES[*]}'" 1>&2
if [[ "$TERMUX_PACKAGE_MANAGER" == *" "* ]] || [[ " ${TERMUX_SUPPORTED_PACKAGE_MANAGERS[*]} " != *" $TERMUX_PACKAGE_MANAGER "* ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be collapsed to a single [[ ... || ... ]] expression.

Comment on lines +574 to 587
if [[ $NO_CLEAN_BEFORE_BUILD != "true" ]]; then
# The "-f" flag must never be passed to `build-package.sh`
# with `BUILD_PACKAGE_OPTIONS` as otherwise if a package
# in `PACKAGES` list first gets built as a dependency of
# another package, and then its build is manually
# started as part of bootstrap packages, then it will
# get built again, which may also fail or create an
# inconsistent state for certain packages as prefix
# wouldn't have been wiped. So all packages are manually
# cleaned before building bootstrap.

# Remove `$HOME/.termux-build` and termux prefix.
"$TERMUX_SCRIPTDIR/clean.sh"
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably can be

Suggested change
if [[ $NO_CLEAN_BEFORE_BUILD != "true" ]]; then
# The "-f" flag must never be passed to `build-package.sh`
# with `BUILD_PACKAGE_OPTIONS` as otherwise if a package
# in `PACKAGES` list first gets built as a dependency of
# another package, and then its build is manually
# started as part of bootstrap packages, then it will
# get built again, which may also fail or create an
# inconsistent state for certain packages as prefix
# wouldn't have been wiped. So all packages are manually
# cleaned before building bootstrap.
# Remove `$HOME/.termux-build` and termux prefix.
"$TERMUX_SCRIPTDIR/clean.sh"
fi
# The "-f" flag must never be passed to `build-package.sh`
# with `BUILD_PACKAGE_OPTIONS` as otherwise if a package
# in `PACKAGES` list first gets built as a dependency of
# another package, and then its build is manually
# started as part of bootstrap packages, then it will
# get built again, which may also fail or create an
# inconsistent state for certain packages as prefix
# wouldn't have been wiped. So all packages are manually
# cleaned before building bootstrap.
# Remove `$HOME/.termux-build` and termux prefix.
[[ $NO_CLEAN_BEFORE_BUILD != "true" ]] && "$TERMUX_SCRIPTDIR/clean.sh"

Copy link
Member Author

@agnostic-apollo agnostic-apollo May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If some other code would need to be added with no clean enabled, then would have to readd the if condition, make changes to indent, which would also mess with git line history. Additionally, my newer build-bootstraps.sh script does not use set -e and can't use above directly with || return $?.


# Case statements are slow for long strings
# 1000 is arbitrarily selected and needs testing
if [ "${#1}" -lt 1000 ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [ "${#1}" -lt 1000 ]; then
if (( ${#1} < 1000 )); then

# start `^` and end `$` anchors
# We manually add everything to pattern space and print only
# if it matches the regex
[ -n "$(data__printf_string "${1}x" | sed -r -n -e '$!{:a;N;$!ba;}; /^[a-zA-Z_][a-zA-Z0-9_]+$/p')" ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case if this function is intensively used probably you want to use only bash builtins here to avoid performance hit.

Copy link
Member Author

@agnostic-apollo agnostic-apollo May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the if condition above, its only used if a variable name length exceeds 1000 characters, that normally does not happen, other than some of my crazy projects stuff where in rare conditions it can exceed depending on user input.

Comment on lines +108 to +117
if [ -z "$curr_value" ]; then
if [ -n "${2-}" ]; then
logger__log_errors "The $1 is not set while running \"${2-}\"${3-}"
else
logger__log_errors "The $1 is not set"
fi
return 1
else
return 0
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [ -z "$curr_value" ]; then
if [ -n "${2-}" ]; then
logger__log_errors "The $1 is not set while running \"${2-}\"${3-}"
else
logger__log_errors "The $1 is not set"
fi
return 1
else
return 0
fi
[[ -n "$curr_value" ]] && return 0
if [ -n "${2-}" ]; then
logger__log_errors "The $1 is not set while running \"${2-}\"${3-}"
else
logger__log_errors "The $1 is not set"
fi
return 1

Comment on lines +124 to +140
shell__validate_variable_unset() {

local curr_value
shell__copy_variable curr_value "${1-}" || return $?

if [ -n "$curr_value" ]; then
if [ -n "${2-}" ]; then
logger__log_errors "The $1 is set while running \"${2-}\"${3-}"
else
logger__log_errors "The $1 is set"
fi
return 1
else
return 0
fi

}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same applies here.

package_dir="$TERMUX_SCRIPTDIR/$packages_dir/$package_name"

# Search for virtual static subpackage
elif [[ "$package_name" == *"-static" ]] && [ -f "$TERMUX_SCRIPTDIR/$packages_dir/${package_name%-static}/build.sh" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elif [[ "$package_name" == *"-static" ]] && [ -f "$TERMUX_SCRIPTDIR/$packages_dir/${package_name%-static}/build.sh" ]; then
elif [[ "$package_name" == *"-static" && -f "$TERMUX_SCRIPTDIR/$packages_dir/${package_name%-static}/build.sh" ]]; then

@agnostic-apollo
Copy link
Member Author

I'm gonna just have to stop my review here.
And there are a good amount of seemingly unrelated packaging changes wrapped up in this PR.

Yeah, thanks for looking into it, but I wasn't looking for a serious review right now, other than maybe buildorder. These changes are not meant to be merged, as I commented above.

The build dependency changes would get pushed to master, the buildorder likely finalized in a separate PR. Python one for whoever decides to pick it up. The bootstrap and other infra changes can be merged from here, but that's long ahead. I don't have time right now, I just pushed this now for users and forkers who may want to build bootstraps for their apps, as that has been broken for years, and it will still be a few weeks/months before my bootstrap changes are finalized.

@robertkirkman
Copy link
Contributor

Build order cycle before python-tkinter removal without -I

Build order after python-tkinter removal

are these results from a recent version of the repository, or are they more of a test from an older version of the repository? If they are from an older version and this will eventually be updated to match the current repository, that is completely ok.

It is my understanding from testing that after

it is no longer be possible to build scripts/run-docker.sh ./build-package.sh python without -I without encountering a de facto dependency cycle (build error) that is not currently detected by buildorder.py, so I have been applying a workaround to force it to build when I need it.

@agnostic-apollo
Copy link
Member Author

The tests were run after rebasing this branch against upstream master 2 days ago, including bootstrap zips diff.

https://github.com/agnostic-apollo/termux-packages/commits/infra-improvs/

Ah, then easier to revert that than moving python-tkinter to a separate package. I wasn't seeing the cycle a few months ago, and surely that's the cause.

@agnostic-apollo
Copy link
Member Author

I dropped 63cfe26 in my last push as the cycle got fixed in d09a983 and it readded the tk build dependency for python, which increased the build time for bootstrap as tk and its dependencies were being needlessly built as python-tkinter wasn't needed for bootstrap with --no-build-unneeded-subpackages. I have fixed that with c35a832.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants