2023-03-09 17:30:40 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
#
|
|
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
#
|
|
|
|
|
# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com
|
|
|
|
|
#
|
|
|
|
|
# This file is a part of the Armbian Build Framework
|
|
|
|
|
# https://github.com/armbian/build/
|
|
|
|
|
|
2023-01-13 03:37:30 +00:00
|
|
|
# This whole thing is a big "I refuse to use venv in a simple bash script" delusion.
|
|
|
|
|
# If you know to tame it, teach me. I'd rather not know about PYTHONUSERBASE and such.
|
|
|
|
|
# --rpardini
|
|
|
|
|
|
|
|
|
|
# call: prepare_python_and_pip # this defines global PYTHON3_INFO dict and PYTHON3_VARS array
|
|
|
|
|
function prepare_python_and_pip() {
|
2023-01-29 21:32:49 +00:00
|
|
|
assert_prepared_host # this needs a prepared host to work; avoid fake errors about "python3-pip" not being installed
|
2023-01-13 03:37:30 +00:00
|
|
|
# First determine with python3 to use; requires knowing the HOSTRELEASE.
|
|
|
|
|
[[ -z "${HOSTRELEASE}" ]] && exit_with_error "HOSTRELEASE is not set"
|
armbian-next: Python patching delusion, pt1 & pt2 & pt3
- WiP: Python patching delusion, pt 1: finding & parsing patches; apply & git commit with pygit2; Markdown summaries (also for aggregation); git-to-patches tool
- Python: Markdown aggregation and patching summaries; collapsible; SummarizedMarkdownWriter
- Python: Markdown aggregation and patching summaries
- Python: reorg a bit into common/armbian_utils; define the `ASSET_LOG_BASE` in preparation for Markdown delusion
- Python patching: initial apply patches & initial commit patches to git (using pygit2)
- Python patching: add basic `series.conf` support
- Python patching: force use of utf-8; better error handling; use realpath of dirs
- Python patching: `git-to-patches` initial hack. not proud. half-reused some of the patches-to-git
- Python patching: "tag" the git commits with info for extracting later; introduce REWRITE_PATCHES/rewrite_patches_in_place
- Python patching: commented-out, recover-bad-patches hacks
- Python patching: shorten the signature
- Python patching: allow BASE_GIT_TAG as well as BASE_GIT_REVISION
- Python patching: git-archeology for patches missing descriptions; avoid UTF-8 in header/desc (not diff)
- Python patching: use modern-er email.utils.parsedate_to_datetime to parse commit date
- Python patching: unify PatchInPatchFile; better git-commiting; re-exporting patches from Git (directly)
- Python patching: switch to GitPython
- GitPython is like 100x slower than pygit2, but actually allows for date & committer
- also allows to remove untracked files before starting
- Python aggregation: fix missing `AGGREGATED_APT_SOURCES_DICT`
- Python patching: add `unidecode` dependency to pip3 install
- Python patching: don't try archeology if SRC is not a Git Repo (eg, in Docker)
- Python patching: don't try archeology if not applying patches to git
- WiP: Python patching delusion, pt2: actually use for u-boot & kernel patching
- Python patching: much better problem handling/logging; lenient with recreations (kernel)
- Python patching: don't force SHOW_LOG for u-boot patching
- Python patching: don't bomb for no reason when there are no patches to apply
- Python patching: fully (?) switch kernel patching to Python
- Python patching: more logging fixups
- Python patching: capture `kernel_git_revision` from `fetch_from_repo()`'s `checked_out_revision`
- Python patching: fully switch u-boot patching to Python
- Python aggregation/patching: colored logging; patching: always reset to git revision
- Python aggregation/patching: better logging; introduce u-boot Python patching
- Python patching pt3: recovers and better Markdown
- Python patching: detect, and rescue, `wrong_strip_level` problem; don't try to export patches that didn't apply, bitch instead
- Python patching: Markdown patching summary table, complete with emoji
- Python patching: include the problem breakdown in Markdown summary
- Python patching: sanity check against half-bare, half-mbox patches
- Python patching: try to recover from 1) bad utf-8 encoded patches; 2) bad unidiff patches; add a few sanity checks
- Python patching: try, and fail, to apply badly utf-8 encoded patches directly as bytes [reverted]
- Python patching: try to recover from patch *parse* failures; show summary; better logging
- set `GIT_ARCHEOLOGY=yes` to do archeology, default not
- armbian-next: Python `pip` dependencies handling, similar to `hostdeps`
- same scheme for Dockerfile caching
- @TODO: still using global/shared environment; should move to a dir under `cache` or some kinda venv
- WiP: add `python3-pip` to hostdeps; remove `python-setuptools`
- remove `python-setuptools` (Python2, no longer exists in Sid) from hostdeps
- add `python3-pip` to hostdeps; part of virtualenv saga
- WiP: split `kernel.sh` a bit, into `kernel-patching.sh`, `kernel-config.sh` and `kernel-make.sh`
- `advanced_patch()`: rename vars for clarity; no real changes
- Python patching: introduce FAST_ARCHEOLOGY; still trying for Markdown links
2022-12-01 15:09:26 +00:00
|
|
|
|
2023-01-13 03:37:30 +00:00
|
|
|
# fake-memoize this, it's expensive and does not need to be done twice
|
|
|
|
|
declare -g _already_prepared_python_and_pip="${_already_prepared_python_and_pip:-no}"
|
|
|
|
|
if [[ "${_already_prepared_python_and_pip}" == "yes" ]]; then
|
|
|
|
|
display_alert "All Python preparation done before" "skipping python prep" "debug"
|
armbian-next: Python patching delusion, pt1 & pt2 & pt3
- WiP: Python patching delusion, pt 1: finding & parsing patches; apply & git commit with pygit2; Markdown summaries (also for aggregation); git-to-patches tool
- Python: Markdown aggregation and patching summaries; collapsible; SummarizedMarkdownWriter
- Python: Markdown aggregation and patching summaries
- Python: reorg a bit into common/armbian_utils; define the `ASSET_LOG_BASE` in preparation for Markdown delusion
- Python patching: initial apply patches & initial commit patches to git (using pygit2)
- Python patching: add basic `series.conf` support
- Python patching: force use of utf-8; better error handling; use realpath of dirs
- Python patching: `git-to-patches` initial hack. not proud. half-reused some of the patches-to-git
- Python patching: "tag" the git commits with info for extracting later; introduce REWRITE_PATCHES/rewrite_patches_in_place
- Python patching: commented-out, recover-bad-patches hacks
- Python patching: shorten the signature
- Python patching: allow BASE_GIT_TAG as well as BASE_GIT_REVISION
- Python patching: git-archeology for patches missing descriptions; avoid UTF-8 in header/desc (not diff)
- Python patching: use modern-er email.utils.parsedate_to_datetime to parse commit date
- Python patching: unify PatchInPatchFile; better git-commiting; re-exporting patches from Git (directly)
- Python patching: switch to GitPython
- GitPython is like 100x slower than pygit2, but actually allows for date & committer
- also allows to remove untracked files before starting
- Python aggregation: fix missing `AGGREGATED_APT_SOURCES_DICT`
- Python patching: add `unidecode` dependency to pip3 install
- Python patching: don't try archeology if SRC is not a Git Repo (eg, in Docker)
- Python patching: don't try archeology if not applying patches to git
- WiP: Python patching delusion, pt2: actually use for u-boot & kernel patching
- Python patching: much better problem handling/logging; lenient with recreations (kernel)
- Python patching: don't force SHOW_LOG for u-boot patching
- Python patching: don't bomb for no reason when there are no patches to apply
- Python patching: fully (?) switch kernel patching to Python
- Python patching: more logging fixups
- Python patching: capture `kernel_git_revision` from `fetch_from_repo()`'s `checked_out_revision`
- Python patching: fully switch u-boot patching to Python
- Python aggregation/patching: colored logging; patching: always reset to git revision
- Python aggregation/patching: better logging; introduce u-boot Python patching
- Python patching pt3: recovers and better Markdown
- Python patching: detect, and rescue, `wrong_strip_level` problem; don't try to export patches that didn't apply, bitch instead
- Python patching: Markdown patching summary table, complete with emoji
- Python patching: include the problem breakdown in Markdown summary
- Python patching: sanity check against half-bare, half-mbox patches
- Python patching: try to recover from 1) bad utf-8 encoded patches; 2) bad unidiff patches; add a few sanity checks
- Python patching: try, and fail, to apply badly utf-8 encoded patches directly as bytes [reverted]
- Python patching: try to recover from patch *parse* failures; show summary; better logging
- set `GIT_ARCHEOLOGY=yes` to do archeology, default not
- armbian-next: Python `pip` dependencies handling, similar to `hostdeps`
- same scheme for Dockerfile caching
- @TODO: still using global/shared environment; should move to a dir under `cache` or some kinda venv
- WiP: add `python3-pip` to hostdeps; remove `python-setuptools`
- remove `python-setuptools` (Python2, no longer exists in Sid) from hostdeps
- add `python3-pip` to hostdeps; part of virtualenv saga
- WiP: split `kernel.sh` a bit, into `kernel-patching.sh`, `kernel-config.sh` and `kernel-make.sh`
- `advanced_patch()`: rename vars for clarity; no real changes
- Python patching: introduce FAST_ARCHEOLOGY; still trying for Markdown links
2022-12-01 15:09:26 +00:00
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
|
2023-01-13 03:37:30 +00:00
|
|
|
declare python3_binary_path="/usr/bin/python3"
|
|
|
|
|
# Determine what version of python3; focal-like OS's have Python 3.8, but we need 3.9.
|
|
|
|
|
if [[ "focal ulyana ulyssa uma una" == *"$HOSTRELEASE"* ]]; then
|
|
|
|
|
python3_binary_path="/usr/bin/python3.9"
|
|
|
|
|
display_alert "Using '${python3_binary_path}' for" "'$HOSTRELEASE' has outdated python3, using python3.9" "warn"
|
|
|
|
|
fi
|
2023-01-05 14:12:58 +00:00
|
|
|
|
2023-01-13 03:37:30 +00:00
|
|
|
# Check that the actual python3 --version is 3.9 at least
|
2024-06-13 22:09:48 +00:00
|
|
|
declare python3_version python3_version_full
|
|
|
|
|
python3_version_full="$("${python3_binary_path}" --version)" # "cut" below masks errors, do it twice.
|
2023-01-21 18:24:04 +00:00
|
|
|
python3_version="$("${python3_binary_path}" --version | cut -d' ' -f2)"
|
2024-06-13 22:09:48 +00:00
|
|
|
display_alert "Python3 version" "${python3_version} - '${python3_version_full}'" "info"
|
2023-01-13 03:37:30 +00:00
|
|
|
if ! linux-version compare "${python3_version}" ge "3.9"; then
|
|
|
|
|
exit_with_error "Python3 version is too old (${python3_version}), need at least 3.9"
|
|
|
|
|
fi
|
|
|
|
|
|
2024-06-13 22:09:48 +00:00
|
|
|
declare python3_version_majorminor python3_version_string
|
|
|
|
|
# Extract the major and minor version numbers (e.g., "3.12" instead of "3.12.2")
|
|
|
|
|
python3_version_majorminor=$(echo "${python3_version_full}" | awk '{print $2}' | cut -d. -f1,2)
|
|
|
|
|
# Construct the version string (e.g., "python3.12")
|
|
|
|
|
python3_version_string="python$python3_version_majorminor"
|
|
|
|
|
|
2023-01-13 03:37:30 +00:00
|
|
|
# Hash the contents of the dependencies array + the Python version + the release
|
2024-06-24 13:52:46 +00:00
|
|
|
declare python3_pip_dependencies_path
|
2023-01-13 03:37:30 +00:00
|
|
|
declare python3_pip_dependencies_hash
|
2024-06-24 13:52:46 +00:00
|
|
|
|
|
|
|
|
python3_pip_dependencies_path="${SRC}/requirements.txt"
|
|
|
|
|
# Check for the existence of requirements.txt, fail if not found
|
|
|
|
|
[[ ! -f "${python3_pip_dependencies_path}" ]] && exit_with_error "Python Pip requirements.txt file not found at path: ${python3_pip_dependencies_path}"
|
|
|
|
|
|
2025-02-24 03:08:25 +00:00
|
|
|
# We will install our own pip; we don't want to rely on the host's pip version, as that implies old setuptools etc.
|
|
|
|
|
# Parse the pip version from the requirements.txt file; use grep to find the line starting with "pip == "
|
|
|
|
|
# Example line: "pip == 25.0.1 # pip is the package installer for Python" so get rid of comments
|
|
|
|
|
declare pip3_version_number="undetermined"
|
|
|
|
|
pip3_version_number=$(grep -E "^pip[[:space:]]*==" "${python3_pip_dependencies_path}" | cut -d'=' -f3 | cut -d'#' -f 1 | tr -d '[:space:]')
|
|
|
|
|
display_alert "pip3 version" "${pip3_version_number}" "info"
|
|
|
|
|
|
2024-06-24 13:52:46 +00:00
|
|
|
# Calculate the hash for the Pip requirements
|
2025-02-24 03:08:25 +00:00
|
|
|
python3_pip_dependencies_hash="$(echo "${HOSTRELEASE}" "${python3_version}" "${pip3_version_number}" "$(cat "${python3_pip_dependencies_path}")" | sha256sum | cut -d' ' -f1)"
|
2023-01-13 03:37:30 +00:00
|
|
|
|
2023-02-02 18:02:52 +00:00
|
|
|
declare non_cache_dir="/armbian-pip"
|
2023-01-13 03:37:30 +00:00
|
|
|
declare python_pip_cache="${SRC}/cache/pip"
|
2023-02-02 18:02:52 +00:00
|
|
|
|
|
|
|
|
if [[ "${deploy_to_non_cache_dir:-"no"}" == "yes" ]]; then
|
|
|
|
|
display_alert "Using non-cache dir" "PIP: ${non_cache_dir}" "warn"
|
|
|
|
|
python_pip_cache="${non_cache_dir}"
|
|
|
|
|
else
|
|
|
|
|
# if the non-cache dir exists, copy it into place, if not already existing...
|
|
|
|
|
if [[ -d "${non_cache_dir}" && ! -d "${python_pip_cache}" ]]; then
|
|
|
|
|
display_alert "Deploying pip cache from Docker image" "${non_cache_dir} -> ${python_pip_cache}" "info"
|
|
|
|
|
run_host_command_logged cp -pr "${non_cache_dir}" "${python_pip_cache}"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2025-02-24 03:08:25 +00:00
|
|
|
# we run as root, but with --user; --break-system-packages is required due to PEP 668 (no system packages are installed here anyway)
|
|
|
|
|
declare -a pip3_extra_args=("--no-warn-script-location" "--user" "--root-user-action=ignore" "--break-system-packages")
|
2023-02-18 10:28:39 +00:00
|
|
|
|
2023-01-13 03:37:30 +00:00
|
|
|
declare python_hash_base="${python_pip_cache}/pip_pkg_hash"
|
|
|
|
|
declare python_hash_file="${python_hash_base}_${python3_pip_dependencies_hash}"
|
2023-02-02 18:02:52 +00:00
|
|
|
declare python3_user_base="${python_pip_cache}/base"
|
2024-06-13 22:09:48 +00:00
|
|
|
declare python3_modules_path="${python3_user_base}/lib/${python3_version_string}/site-packages"
|
2023-02-02 18:02:52 +00:00
|
|
|
declare python3_pycache="${python_pip_cache}/pycache"
|
2023-01-13 03:37:30 +00:00
|
|
|
|
|
|
|
|
# declare a readonly global dict with all needed info for executing stuff using this setup
|
|
|
|
|
declare -r -g -A PYTHON3_INFO=(
|
|
|
|
|
[BIN]="${python3_binary_path}"
|
|
|
|
|
[USERBASE]="${python3_user_base}"
|
2024-06-13 22:09:48 +00:00
|
|
|
[MODULES_PATH]="${python3_modules_path}"
|
2023-01-13 03:37:30 +00:00
|
|
|
[PYCACHEPREFIX]="${python3_pycache}"
|
2024-06-24 13:52:46 +00:00
|
|
|
[REQUIREMENTS_HASH]="${python3_pip_dependencies_hash}"
|
|
|
|
|
[REQUIREMENTS_PATH]="${python3_pip_dependencies_path}"
|
2023-01-13 03:37:30 +00:00
|
|
|
[VERSION]="${python3_version}"
|
2024-06-13 22:09:48 +00:00
|
|
|
[VERSION_STRING]="${python3_version_string}"
|
2025-02-24 03:08:25 +00:00
|
|
|
[PIP_VERSION]="${pip3_version_number}"
|
|
|
|
|
[GET_PIP_BIN]="${PYTHON3_INFO[USERBASE]}/bin/get-pip-${pip3_version_number}.py"
|
2023-01-13 03:37:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# declare a readonly global array for ENV vars to invoke python3 with
|
|
|
|
|
declare -r -g -a PYTHON3_VARS=(
|
2025-02-24 03:08:25 +00:00
|
|
|
"PYTHONPATH=/does/not/exist/armbian/uses/user/packages/only"
|
2023-01-13 03:37:30 +00:00
|
|
|
"PYTHONUSERBASE=${PYTHON3_INFO[USERBASE]}"
|
|
|
|
|
"PYTHONUNBUFFERED=yes"
|
|
|
|
|
"PYTHONPYCACHEPREFIX=${PYTHON3_INFO[PYCACHEPREFIX]}"
|
2024-06-25 13:25:51 +00:00
|
|
|
"PATH=\"${toolchain}:${PYTHON3_INFO[USERBASE]}/bin:${PATH}\"" # add toolchain to PATH to make building wheels work
|
2023-01-13 03:37:30 +00:00
|
|
|
)
|
armbian-next: Python patching delusion, pt1 & pt2 & pt3
- WiP: Python patching delusion, pt 1: finding & parsing patches; apply & git commit with pygit2; Markdown summaries (also for aggregation); git-to-patches tool
- Python: Markdown aggregation and patching summaries; collapsible; SummarizedMarkdownWriter
- Python: Markdown aggregation and patching summaries
- Python: reorg a bit into common/armbian_utils; define the `ASSET_LOG_BASE` in preparation for Markdown delusion
- Python patching: initial apply patches & initial commit patches to git (using pygit2)
- Python patching: add basic `series.conf` support
- Python patching: force use of utf-8; better error handling; use realpath of dirs
- Python patching: `git-to-patches` initial hack. not proud. half-reused some of the patches-to-git
- Python patching: "tag" the git commits with info for extracting later; introduce REWRITE_PATCHES/rewrite_patches_in_place
- Python patching: commented-out, recover-bad-patches hacks
- Python patching: shorten the signature
- Python patching: allow BASE_GIT_TAG as well as BASE_GIT_REVISION
- Python patching: git-archeology for patches missing descriptions; avoid UTF-8 in header/desc (not diff)
- Python patching: use modern-er email.utils.parsedate_to_datetime to parse commit date
- Python patching: unify PatchInPatchFile; better git-commiting; re-exporting patches from Git (directly)
- Python patching: switch to GitPython
- GitPython is like 100x slower than pygit2, but actually allows for date & committer
- also allows to remove untracked files before starting
- Python aggregation: fix missing `AGGREGATED_APT_SOURCES_DICT`
- Python patching: add `unidecode` dependency to pip3 install
- Python patching: don't try archeology if SRC is not a Git Repo (eg, in Docker)
- Python patching: don't try archeology if not applying patches to git
- WiP: Python patching delusion, pt2: actually use for u-boot & kernel patching
- Python patching: much better problem handling/logging; lenient with recreations (kernel)
- Python patching: don't force SHOW_LOG for u-boot patching
- Python patching: don't bomb for no reason when there are no patches to apply
- Python patching: fully (?) switch kernel patching to Python
- Python patching: more logging fixups
- Python patching: capture `kernel_git_revision` from `fetch_from_repo()`'s `checked_out_revision`
- Python patching: fully switch u-boot patching to Python
- Python aggregation/patching: colored logging; patching: always reset to git revision
- Python aggregation/patching: better logging; introduce u-boot Python patching
- Python patching pt3: recovers and better Markdown
- Python patching: detect, and rescue, `wrong_strip_level` problem; don't try to export patches that didn't apply, bitch instead
- Python patching: Markdown patching summary table, complete with emoji
- Python patching: include the problem breakdown in Markdown summary
- Python patching: sanity check against half-bare, half-mbox patches
- Python patching: try to recover from 1) bad utf-8 encoded patches; 2) bad unidiff patches; add a few sanity checks
- Python patching: try, and fail, to apply badly utf-8 encoded patches directly as bytes [reverted]
- Python patching: try to recover from patch *parse* failures; show summary; better logging
- set `GIT_ARCHEOLOGY=yes` to do archeology, default not
- armbian-next: Python `pip` dependencies handling, similar to `hostdeps`
- same scheme for Dockerfile caching
- @TODO: still using global/shared environment; should move to a dir under `cache` or some kinda venv
- WiP: add `python3-pip` to hostdeps; remove `python-setuptools`
- remove `python-setuptools` (Python2, no longer exists in Sid) from hostdeps
- add `python3-pip` to hostdeps; part of virtualenv saga
- WiP: split `kernel.sh` a bit, into `kernel-patching.sh`, `kernel-config.sh` and `kernel-make.sh`
- `advanced_patch()`: rename vars for clarity; no real changes
- Python patching: introduce FAST_ARCHEOLOGY; still trying for Markdown links
2022-12-01 15:09:26 +00:00
|
|
|
|
2023-01-13 03:37:30 +00:00
|
|
|
# If the hash file exists, we're done.
|
|
|
|
|
if [[ -f "${python_hash_file}" ]]; then
|
2023-01-21 18:24:04 +00:00
|
|
|
display_alert "Using cached pip packages for Python tools" "${python3_pip_dependencies_hash}" "info"
|
2023-01-13 03:37:30 +00:00
|
|
|
else
|
|
|
|
|
display_alert "Installing pip packages for Python tools" "${python3_pip_dependencies_hash:0:10}" "info"
|
|
|
|
|
# remove the old hashes matching base, don't leave junk behind
|
|
|
|
|
run_host_command_logged rm -fv "${python_hash_base}*"
|
|
|
|
|
|
2025-02-24 03:08:25 +00:00
|
|
|
# If get-pip.py is not present, download it, using curl.
|
|
|
|
|
if [[ ! -f "${PYTHON3_INFO[GET_PIP_BIN]}" ]]; then
|
|
|
|
|
display_alert "Downloading get-pip.py" "from https://bootstrap.pypa.io/get-pip.py" "info"
|
|
|
|
|
run_host_command_logged curl -sSL -o "${PYTHON3_INFO[GET_PIP_BIN]}" "https://bootstrap.pypa.io/get-pip.py"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Install pip, using get-pip.py; that bootstraps pip using an embedded, temporary, pip contained in get-pip.py
|
|
|
|
|
display_alert "Installing pip using get-pip.py" "${pip3_version_number}" "info"
|
|
|
|
|
run_host_command_logged env -i "${PYTHON3_VARS[@]@Q}" "${PYTHON3_INFO[BIN]}" "${PYTHON3_INFO[GET_PIP_BIN]}" "${pip3_extra_args[@]}" "pip==${pip3_version_number}"
|
|
|
|
|
|
|
|
|
|
# Install the dependencies
|
|
|
|
|
display_alert "Installing Python dependencies" "from ${python3_pip_dependencies_path}" "info"
|
2024-06-24 13:52:46 +00:00
|
|
|
run_host_command_logged env -i "${PYTHON3_VARS[@]@Q}" "${PYTHON3_INFO[BIN]}" -m pip install "${pip3_extra_args[@]}" -r "${python3_pip_dependencies_path}"
|
2023-01-13 03:37:30 +00:00
|
|
|
|
|
|
|
|
# Create the hash file
|
|
|
|
|
run_host_command_logged touch "${python_hash_file}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
_already_prepared_python_and_pip="yes"
|
armbian-next: Python patching delusion, pt1 & pt2 & pt3
- WiP: Python patching delusion, pt 1: finding & parsing patches; apply & git commit with pygit2; Markdown summaries (also for aggregation); git-to-patches tool
- Python: Markdown aggregation and patching summaries; collapsible; SummarizedMarkdownWriter
- Python: Markdown aggregation and patching summaries
- Python: reorg a bit into common/armbian_utils; define the `ASSET_LOG_BASE` in preparation for Markdown delusion
- Python patching: initial apply patches & initial commit patches to git (using pygit2)
- Python patching: add basic `series.conf` support
- Python patching: force use of utf-8; better error handling; use realpath of dirs
- Python patching: `git-to-patches` initial hack. not proud. half-reused some of the patches-to-git
- Python patching: "tag" the git commits with info for extracting later; introduce REWRITE_PATCHES/rewrite_patches_in_place
- Python patching: commented-out, recover-bad-patches hacks
- Python patching: shorten the signature
- Python patching: allow BASE_GIT_TAG as well as BASE_GIT_REVISION
- Python patching: git-archeology for patches missing descriptions; avoid UTF-8 in header/desc (not diff)
- Python patching: use modern-er email.utils.parsedate_to_datetime to parse commit date
- Python patching: unify PatchInPatchFile; better git-commiting; re-exporting patches from Git (directly)
- Python patching: switch to GitPython
- GitPython is like 100x slower than pygit2, but actually allows for date & committer
- also allows to remove untracked files before starting
- Python aggregation: fix missing `AGGREGATED_APT_SOURCES_DICT`
- Python patching: add `unidecode` dependency to pip3 install
- Python patching: don't try archeology if SRC is not a Git Repo (eg, in Docker)
- Python patching: don't try archeology if not applying patches to git
- WiP: Python patching delusion, pt2: actually use for u-boot & kernel patching
- Python patching: much better problem handling/logging; lenient with recreations (kernel)
- Python patching: don't force SHOW_LOG for u-boot patching
- Python patching: don't bomb for no reason when there are no patches to apply
- Python patching: fully (?) switch kernel patching to Python
- Python patching: more logging fixups
- Python patching: capture `kernel_git_revision` from `fetch_from_repo()`'s `checked_out_revision`
- Python patching: fully switch u-boot patching to Python
- Python aggregation/patching: colored logging; patching: always reset to git revision
- Python aggregation/patching: better logging; introduce u-boot Python patching
- Python patching pt3: recovers and better Markdown
- Python patching: detect, and rescue, `wrong_strip_level` problem; don't try to export patches that didn't apply, bitch instead
- Python patching: Markdown patching summary table, complete with emoji
- Python patching: include the problem breakdown in Markdown summary
- Python patching: sanity check against half-bare, half-mbox patches
- Python patching: try to recover from 1) bad utf-8 encoded patches; 2) bad unidiff patches; add a few sanity checks
- Python patching: try, and fail, to apply badly utf-8 encoded patches directly as bytes [reverted]
- Python patching: try to recover from patch *parse* failures; show summary; better logging
- set `GIT_ARCHEOLOGY=yes` to do archeology, default not
- armbian-next: Python `pip` dependencies handling, similar to `hostdeps`
- same scheme for Dockerfile caching
- @TODO: still using global/shared environment; should move to a dir under `cache` or some kinda venv
- WiP: add `python3-pip` to hostdeps; remove `python-setuptools`
- remove `python-setuptools` (Python2, no longer exists in Sid) from hostdeps
- add `python3-pip` to hostdeps; part of virtualenv saga
- WiP: split `kernel.sh` a bit, into `kernel-patching.sh`, `kernel-config.sh` and `kernel-make.sh`
- `advanced_patch()`: rename vars for clarity; no real changes
- Python patching: introduce FAST_ARCHEOLOGY; still trying for Markdown links
2022-12-01 15:09:26 +00:00
|
|
|
return 0
|
|
|
|
|
}
|
2023-01-05 13:01:40 +00:00
|
|
|
|
2023-01-09 23:17:40 +00:00
|
|
|
# Called during early_prepare_host_dependencies(); when building a Dockerfile, host_release is set to the Docker image name.
|
2023-01-05 13:01:40 +00:00
|
|
|
function host_deps_add_extra_python() {
|
2023-01-09 23:17:40 +00:00
|
|
|
# check host_release is set, or bail.
|
|
|
|
|
[[ -z "${host_release}" ]] && exit_with_error "host_release is not set"
|
|
|
|
|
|
|
|
|
|
# host_release is from outer scope (
|
2023-01-05 13:01:40 +00:00
|
|
|
# Determine what version of python3; focal-like OS's have Python 3.8, but we need 3.9.
|
2023-01-09 23:17:40 +00:00
|
|
|
if [[ "focal ulyana ulyssa uma una" == *"${host_release}"* ]]; then
|
2023-01-13 03:37:30 +00:00
|
|
|
display_alert "Using Python 3.9 for" "hostdeps: '${host_release}' has outdated python3, using python3.9" "warn"
|
2023-01-09 23:17:40 +00:00
|
|
|
host_dependencies+=("python3.9-dev")
|
2023-01-05 13:01:40 +00:00
|
|
|
else
|
2023-01-13 03:37:30 +00:00
|
|
|
display_alert "Using Python3 for" "hostdeps: '${host_release}' has python3 >= 3.9" "debug"
|
2023-01-05 13:01:40 +00:00
|
|
|
fi
|
|
|
|
|
}
|