From 2c9582f9bac1efacd82d9e40b2c2bad45f3a01d0 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Fri, 27 Jan 2023 17:42:21 +0100 Subject: [PATCH] armbian-next: add Debian Ports keyring hostdep to strap Debian riscv64 from ports - rpardini: actually use ports keyring for Debian Risc-V - `risc-v`: correctly include `debian-ports-archive-keyring` in Risc-V CLI packages - include in debootstrap list, via `config/optional/architectures/riscv64/_config/cli/_all_distributions/main/packages` - can't have two `--include` in debootstrap call - riscv64: move `debian-ports-archive-keyring` from main to debootstrap; also only for `sid` --- lib/functions/configuration/main-config.sh | 5 +++++ lib/functions/host/prepare-host.sh | 3 ++- lib/functions/rootfs/create-cache.sh | 19 +++++++++++++++++-- lib/tools/aggregation.py | 6 ++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/lib/functions/configuration/main-config.sh b/lib/functions/configuration/main-config.sh index d5340ce74..43ef818c7 100644 --- a/lib/functions/configuration/main-config.sh +++ b/lib/functions/configuration/main-config.sh @@ -342,6 +342,11 @@ function do_extra_configuration() { fi fi + # Debian needs the ports repo when strapping riscv64 - revise after bookworm release + if [[ "${ARCH}" == "riscv64" ]] && [[ $DISTRIBUTION == Debian ]]; then + DEBIAN_MIRROR='deb.debian.org/debian-ports' + fi + # Control aria2c's usage of ipv6. [[ -z $DISABLE_IPV6 ]] && DISABLE_IPV6="true" diff --git a/lib/functions/host/prepare-host.sh b/lib/functions/host/prepare-host.sh index a8aa8a8ae..5cf143d92 100644 --- a/lib/functions/host/prepare-host.sh +++ b/lib/functions/host/prepare-host.sh @@ -302,7 +302,8 @@ function adaptative_prepare_host_dependencies() { fi if [[ "${wanted_arch}" == "riscv64" || "${wanted_arch}" == "all" ]]; then - host_dependencies+=("gcc-riscv64-linux-gnu") # crossbuild-essential-riscv64 is not even available "yet" + host_dependencies+=("gcc-riscv64-linux-gnu") # crossbuild-essential-riscv64 is not even available "yet" + host_dependencies+=("debian-ports-archive-keyring") # Debian Ports keyring needed, as riscv64 is not released yet fi if [[ "${wanted_arch}" != "amd64" ]]; then diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh index 165b98005..28e244035 100644 --- a/lib/functions/rootfs/create-cache.sh +++ b/lib/functions/rootfs/create-cache.sh @@ -125,8 +125,23 @@ function create_new_rootfs_cache() { deboostrap_arguments+=("--cache-dir=${apt_cache_host_dir}/archives") # cache .deb's used fi - # This always last, positional arguments. - deboostrap_arguments+=("--foreign" "${RELEASE}" "${SDCARD}/" "${debootstrap_apt_mirror}") # path and mirror + deboostrap_arguments+=("--foreign") # release name + + # Debian does not carry riscv64 in their main repo, needs ports, which needs a specific keyring in the host. + # that's done in prepare-host.sh when by adding debian-ports-archive-keyring hostdep, but there's an if anyway. + # debian-ports-archive-keyring is also included in-image by: config/optional/architectures/riscv64/_config/cli/_all_distributions/main/packages + # Revise this after bookworm release. + # @TODO: rpardini: this clearly shows a need for hooks for debootstrap + if [[ "${ARCH}" == "riscv64" ]] && [[ $DISTRIBUTION == Debian ]]; then + if [[ -f /usr/share/keyrings/debian-ports-archive-keyring.gpg ]]; then + display_alert "Adding ports keyring for Debian debootstrap" "riscv64" "info" + deboostrap_arguments+=("--keyring" "/usr/share/keyrings/debian-ports-archive-keyring.gpg") + else + exit_with_error "Debian debootstrap for riscv64 needs debian-ports-archive-keyring hostdep" + fi + fi + + deboostrap_arguments+=("${RELEASE}" "${SDCARD}/" "${debootstrap_apt_mirror}") # release, path and mirror; always last, positional arguments. run_host_command_logged debootstrap "${deboostrap_arguments[@]}" || { exit_with_error "Debootstrap first stage failed" "${RELEASE} ${DESKTOP_APPGROUPS_SELECTED} ${DESKTOP_ENVIRONMENT} ${BUILD_MINIMAL}" diff --git a/lib/tools/aggregation.py b/lib/tools/aggregation.py index 401998d9a..717047d4b 100644 --- a/lib/tools/aggregation.py +++ b/lib/tools/aggregation.py @@ -215,4 +215,10 @@ with open(output_file, "w") as bash, SummarizedMarkdownWriter("aggregation.md", # PACKAGE_LIST_UNINSTALL="$(cleanup_list aggregated_content)" # unset aggregated_content + # Debug potential paths: + all_potentials = util.get_all_potential_paths_packages() + md.write(f"## Potential paths \n") + for potential in all_potentials: + md.write(f"- `{potential}`\n") + log.debug(f"Done. Output written to {output_file}")