hashed-OCI-revisioned-debs: build debs in PACKAGES_HASHED_STORAGE, not DEB_STORAGE (temp commit, will be rewritten by a later commit)

- fakeroot_dpkg_deb_build() now only takes a single argument, the unpacked package dir
This commit is contained in:
Ricardo Pardini 2023-07-28 12:37:34 +02:00 committed by Igor
parent ec0a87efb5
commit a592ab763c
25 changed files with 42 additions and 61 deletions

View File

@ -53,8 +53,8 @@ function artifact_armbian-base-files_prepare_version() {
artifact_name="armbian-base-files-${RELEASE}-${ARCH}"
declare deb_name="base-files" # the artifact_name is only Armbian's reference; the deb_name is still base_files
artifact_type="deb"
artifact_base_dir="${DEB_STORAGE}/${RELEASE}"
artifact_final_file="${DEB_STORAGE}/${RELEASE}/${deb_name}_${artifact_version}_${ARCH}.deb"
artifact_base_dir="${PACKAGES_HASHED_STORAGE}/${RELEASE}"
artifact_final_file="${PACKAGES_HASHED_STORAGE}/${RELEASE}/${deb_name}_${artifact_version}_${ARCH}.deb"
artifact_map_packages=(["armbian-base-files"]="${deb_name}")
@ -181,8 +181,7 @@ function compile_armbian-base-files() {
rm -f "${destination}"/etc/os-release.orig "${destination}"/etc/issue.orig "${destination}"/etc/issue.net.orig "${destination}"/DEBIAN/conffiles.orig
# Done, pack it.
mkdir -p "${DEB_STORAGE}/${RELEASE}"
fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/${RELEASE}"
fakeroot_dpkg_deb_build "${destination}"
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early
}

View File

@ -103,8 +103,8 @@ function artifact_armbian-bsp-cli_prepare_version() {
artifact_name="armbian-bsp-cli-${BOARD}-${BRANCH}${EXTRA_BSP_NAME}"
artifact_type="deb-tar"
artifact_base_dir="${DEB_STORAGE}"
artifact_final_file="${DEB_STORAGE}/${artifact_name}_${artifact_version}_${ARCH}.tar"
artifact_base_dir="${PACKAGES_HASHED_STORAGE}"
artifact_final_file="${PACKAGES_HASHED_STORAGE}/${artifact_name}_${artifact_version}_${ARCH}.tar"
artifact_map_packages=(
["armbian-bsp-cli"]="${artifact_name}"

View File

@ -53,8 +53,8 @@ function artifact_armbian-bsp-desktop_prepare_version() {
artifact_name="armbian-bsp-desktop-${BOARD}-${BRANCH}"
artifact_type="deb"
artifact_base_dir="${DEB_STORAGE}/${RELEASE}"
artifact_final_file="${DEB_STORAGE}/${RELEASE}/${artifact_name}_${artifact_version}_${ARCH}.deb"
artifact_base_dir="${PACKAGES_HASHED_STORAGE}/${RELEASE}"
artifact_final_file="${PACKAGES_HASHED_STORAGE}/${RELEASE}/${artifact_name}_${artifact_version}_${ARCH}.deb"
artifact_map_packages=(
["armbian-bsp-desktop"]="${artifact_name}"

View File

@ -60,8 +60,8 @@ function artifact_armbian-config_prepare_version() {
artifact_name="armbian-config"
artifact_type="deb"
artifact_base_dir="${DEB_STORAGE}"
artifact_final_file="${DEB_STORAGE}/armbian-config_${artifact_version}_all.deb"
artifact_base_dir="${PACKAGES_HASHED_STORAGE}"
artifact_final_file="${PACKAGES_HASHED_STORAGE}/armbian-config_${artifact_version}_all.deb"
return 0
}

View File

@ -59,8 +59,8 @@ function artifact_armbian-desktop_prepare_version() {
artifact_name="armbian-${RELEASE}-desktop-${DESKTOP_ENVIRONMENT}"
artifact_type="deb"
artifact_base_dir="${DEB_STORAGE}/${RELEASE}"
artifact_final_file="${DEB_STORAGE}/${RELEASE}/${artifact_name}_${artifact_version}_all.deb"
artifact_base_dir="${PACKAGES_HASHED_STORAGE}/${RELEASE}"
artifact_final_file="${PACKAGES_HASHED_STORAGE}/${RELEASE}/${artifact_name}_${artifact_version}_all.deb"
artifact_map_packages=(
["armbian-desktop"]="${artifact_name}"

View File

@ -46,8 +46,8 @@ function artifact_armbian-plymouth-theme_prepare_version() {
artifact_name="armbian-plymouth-theme"
artifact_type="deb"
artifact_base_dir="${DEB_STORAGE}"
artifact_final_file="${DEB_STORAGE}/armbian-plymouth-theme_${artifact_version}_all.deb"
artifact_base_dir="${PACKAGES_HASHED_STORAGE}"
artifact_final_file="${PACKAGES_HASHED_STORAGE}/armbian-plymouth-theme_${artifact_version}_all.deb"
return 0
}

View File

@ -61,8 +61,8 @@ function artifact_armbian-zsh_prepare_version() {
artifact_name="armbian-zsh"
artifact_type="deb"
artifact_base_dir="${DEB_STORAGE}"
artifact_final_file="${DEB_STORAGE}/armbian-zsh_${artifact_version}_all.deb"
artifact_base_dir="${PACKAGES_HASHED_STORAGE}"
artifact_final_file="${PACKAGES_HASHED_STORAGE}/armbian-zsh_${artifact_version}_all.deb"
return 0
}

View File

@ -46,8 +46,8 @@ function artifact_fake_ubuntu_advantage_tools_prepare_version() {
artifact_name="fake-ubuntu-advantage-tools"
artifact_type="deb"
artifact_base_dir="${DEB_STORAGE}"
artifact_final_file="${DEB_STORAGE}/fake-ubuntu-advantage-tools_${artifact_version}_all.deb"
artifact_base_dir="${PACKAGES_HASHED_STORAGE}"
artifact_final_file="${PACKAGES_HASHED_STORAGE}/fake-ubuntu-advantage-tools_${artifact_version}_all.deb"
return 0
}

View File

@ -61,8 +61,8 @@ function artifact_firmware_prepare_version() {
artifact_name="armbian-firmware"
artifact_type="deb"
artifact_base_dir="${DEB_STORAGE}"
artifact_final_file="${DEB_STORAGE}/armbian-firmware_${artifact_version}_all.deb"
artifact_base_dir="${PACKAGES_HASHED_STORAGE}"
artifact_final_file="${PACKAGES_HASHED_STORAGE}/armbian-firmware_${artifact_version}_all.deb"
return 0
}

View File

@ -71,8 +71,8 @@ function artifact_full_firmware_prepare_version() {
artifact_name="armbian-firmware-full"
artifact_type="deb"
artifact_base_dir="${DEB_STORAGE}"
artifact_final_file="${DEB_STORAGE}/armbian-firmware-full_${artifact_version}_all.deb"
artifact_base_dir="${PACKAGES_HASHED_STORAGE}"
artifact_final_file="${PACKAGES_HASHED_STORAGE}/armbian-firmware-full_${artifact_version}_all.deb"
return 0
}

View File

@ -212,8 +212,8 @@ function artifact_kernel_prepare_version() {
artifact_name="kernel-${LINUXFAMILY}-${BRANCH}"
artifact_type="deb-tar" # this triggers processing of .deb files in the maps to produce a tarball
artifact_base_dir="${DEB_STORAGE}"
artifact_final_file="${DEB_STORAGE}/kernel-${LINUXFAMILY}-${BRANCH}_${artifact_version}.tar"
artifact_base_dir="${PACKAGES_HASHED_STORAGE}"
artifact_final_file="${PACKAGES_HASHED_STORAGE}/kernel-${LINUXFAMILY}-${BRANCH}_${artifact_version}.tar"
return 0
}

View File

@ -134,8 +134,8 @@ function artifact_uboot_prepare_version() {
artifact_name="uboot-${BOARD}-${BRANCH}"
artifact_type="deb"
artifact_base_dir="${DEB_STORAGE}"
artifact_final_file="${DEB_STORAGE}/linux-u-boot-${BOARD}-${BRANCH}_${artifact_version}_${ARCH}.deb"
artifact_base_dir="${PACKAGES_HASHED_STORAGE}"
artifact_final_file="${PACKAGES_HASHED_STORAGE}/linux-u-boot-${BOARD}-${BRANCH}_${artifact_version}_${ARCH}.deb"
return 0
}

View File

@ -35,7 +35,7 @@ function compile_armbian-bsp-cli-transitional() {
EOF
# Build / close the package. This will run shellcheck / show the generated files if debugging
fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/"
fakeroot_dpkg_deb_build "${destination}"
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early
@ -210,7 +210,7 @@ function compile_armbian-bsp-cli() {
fi
# Build / close the package. This will run shellcheck / show the generated files if debugging
fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/"
fakeroot_dpkg_deb_build "${destination}"
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early

View File

@ -59,8 +59,7 @@ function compile_armbian-bsp-desktop() {
eval "${AGGREGATED_DESKTOP_BSP_PREPARE}"
display_alert "Done with bsp-desktop -specific aggregated prepare script" "AGGREGATED_DESKTOP_BSP_PREPARE" "debug"
mkdir -p "${DEB_STORAGE}/${RELEASE}"
fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/${RELEASE}"
fakeroot_dpkg_deb_build "${destination}"
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early
}

View File

@ -150,7 +150,6 @@ function kernel_prepare_build_and_package() {
LOG_SECTION="kernel_package" do_with_logging do_with_hooks kernel_package
# This deploys to DEB_STORAGE...
LOG_SECTION="kernel_deploy_pkg" do_with_logging do_with_hooks kernel_deploy_pkg
done_with_temp_dir "${cleanup_id_debs}" # changes cwd to "${SRC}" and fires the cleanup function early
@ -180,5 +179,5 @@ function kernel_package() {
function kernel_deploy_pkg() {
: "${kernel_debs_temp_dir:?kernel_debs_temp_dir is not set}"
run_host_command_logged rsync -v --remove-source-files -r "${kernel_debs_temp_dir}"/*.deb "${DEB_STORAGE}/"
run_host_command_logged rsync -v --remove-source-files -r "${kernel_debs_temp_dir}"/*.deb "${DEB_STORAGE}/" # @TODO this stuff... shouldn't it be directly where they should?
}

View File

@ -68,7 +68,7 @@ compile_armbian-config() {
ln -sf /usr/sbin/armbian-config "${tmp_dir}/${armbian_config_dir}"/usr/bin/armbian-config
ln -sf /usr/sbin/softy "${tmp_dir}/${armbian_config_dir}"/usr/bin/softy
fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_config_dir}" "${DEB_STORAGE}"
fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_config_dir}"
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early

View File

@ -58,8 +58,7 @@ function compile_armbian-desktop() {
eval "${AGGREGATED_DESKTOP_CREATE_DESKTOP_PACKAGE}"
display_alert "Running desktop-specific aggregated prepare script" "AGGREGATED_DESKTOP_CREATE_DESKTOP_PACKAGE" "debug"
mkdir -p "${DEB_STORAGE}/${RELEASE}"
fakeroot_dpkg_deb_build "${destination}" "${DEB_STORAGE}/${RELEASE}"
fakeroot_dpkg_deb_build "${destination}"
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early
}

View File

@ -55,7 +55,7 @@ compile_armbian-plymouth-theme() {
run_host_command_logged cp "${SRC}"/packages/plymouth-theme-armbian/armbian.plymouth \
"${tmp_dir}/${plymouth_theme_armbian_dir}"/usr/share/plymouth/themes/armbian/
fakeroot_dpkg_deb_build "${tmp_dir}/${plymouth_theme_armbian_dir}" "${DEB_STORAGE}"
fakeroot_dpkg_deb_build "${tmp_dir}/${plymouth_theme_armbian_dir}"
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early
}

View File

@ -80,7 +80,7 @@ compile_armbian-zsh() {
chmod 755 "${tmp_dir}/${armbian_zsh_dir}"/DEBIAN/postinst
fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_zsh_dir}" "${DEB_STORAGE}"
fakeroot_dpkg_deb_build "${tmp_dir}/${armbian_zsh_dir}"
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early
}

View File

@ -45,9 +45,7 @@ function compile_fake_ubuntu_advantage_tools() {
cd "${fw_temp_dir}" || exit_with_error "can't change directory"
# package, directly to DEB_STORAGE; full version might be very big for tmpfs.
display_alert "Building fake Ubuntu advantage tools package" "fake_ubuntu_advantage_tools" "info"
fakeroot_dpkg_deb_build "fake_ubuntu_advantage_tools" "${DEB_STORAGE}"
fakeroot_dpkg_deb_build "fake_ubuntu_advantage_tools"
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early
}

View File

@ -71,9 +71,7 @@ function compile_firmware() {
cd "${fw_temp_dir}" || exit_with_error "can't change directory"
# package, directly to DEB_STORAGE; full version might be very big for tmpfs.
display_alert "Building firmware package" "armbian-firmware${FULL}" "info"
fakeroot_dpkg_deb_build "armbian-firmware${FULL}" "${DEB_STORAGE}"
fakeroot_dpkg_deb_build "armbian-firmware${FULL}"
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early
}

View File

@ -7,22 +7,16 @@
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
# for RAW deb building. does a bunch of magic to "DEBIAN" directory.
# for RAW deb building. does a bunch of magic to "DEBIAN" directory. Argument is the open package directory. Target is always artifact_base_dir
function fakeroot_dpkg_deb_build() {
# check artifact_name and artifact_version is set otherwise exit_with_error
[[ -z "${artifact_name}" ]] && exit_with_error "fakeroot_dpkg_deb_build: artifact_name is not set"
[[ -z "${artifact_version}" ]] && exit_with_error "fakeroot_dpkg_deb_build: artifact_version is not set"
[[ -z "${artifact_base_dir}" ]] && exit_with_error "fakeroot_dpkg_deb_build: artifact_base_dir is not set"
display_alert "Building .deb package" "${artifact_name}: $*" "debug"
declare -a orig_args=("$@")
# find the first non-option argument
declare first_arg
for first_arg in "${orig_args[@]}"; do
if [[ "${first_arg}" != -* ]]; then
break
fi
done
declare first_arg="${1}"
if [[ ! -d "${first_arg}" ]]; then
exit_with_error "fakeroot_dpkg_deb_build: can't find source package directory: ${first_arg}"
@ -93,7 +87,8 @@ function fakeroot_dpkg_deb_build() {
run_tool_batcat --file-name "${artifact_name}/DEBIAN/md5sums" "${first_arg}/DEBIAN/md5sums"
fi
run_host_command_logged_raw fakeroot dpkg-deb -b "-Z${DEB_COMPRESS}" "${orig_args[@]}"
mkdir -p "${artifact_base_dir}"
run_host_command_logged_raw fakeroot dpkg-deb -b "-Z${DEB_COMPRESS}" "${first_arg}" "${artifact_base_dir}/"
}
function dpkg_deb_run_shellcheck_on_scripts() {

View File

@ -424,7 +424,7 @@ function compile_uboot() {
[[ -n $atftempdir && -f $atftempdir/license.md ]] && run_host_command_logged cp "${atftempdir}/license.md" "$uboottempdir/${uboot_name}/usr/lib/u-boot/LICENSE.atf"
display_alert "Building u-boot deb" "(version: ${artifact_version})"
fakeroot_dpkg_deb_build "$uboottempdir/${uboot_name}" "${DEB_STORAGE}"
fakeroot_dpkg_deb_build "$uboottempdir/${uboot_name}"
[[ -n $atftempdir ]] && rm -rf "${atftempdir:?}" # @TODO: intricate cleanup; u-boot's pkg uses ATF's tempdir...

View File

@ -80,6 +80,7 @@ function do_main_configuration() {
fi
display_alert ".deb compression" "DEB_COMPRESS=${DEB_COMPRESS}" "debug"
declare -g -r PACKAGES_HASHED_STORAGE="${DEST}/packages-hashed"
if [[ $BETA == yes ]]; then
DEB_STORAGE=$DEST/debs-beta
else

View File

@ -106,13 +106,6 @@ function install_deb_chroot() {
DONT_MAINTAIN_APT_CACHE="yes" chroot_sdcard_apt_get --no-install-recommends install "${install_target}" # don't auto-maintain apt cache when installing from packages.
unset extra_apt_envs
# @TODO: mysterious. store installed/downloaded packages in deb storage. only used for u-boot deb. why?
# this is some contrived way to get the uboot.deb when installing from repo; image builder needs the deb to be able to deploy uboot later, even though it is already installed inside the chroot, it needs deb to be in host to reuse code later
if [[ ${variant} == remote && ${transfer} == yes ]]; then
display_alert "install_deb_chroot called with" "transfer=yes, copy WHOLE CACHE back to DEB_STORAGE, this is probably a bug" "warn"
run_host_command_logged rsync -r "${SDCARD}"/var/cache/apt/archives/*.deb "${DEB_STORAGE}"/
fi
# IMPORTANT! Do not use short-circuit above as last statement in a function, since it determines the result of the function.
return 0
}