From b6697fdfc946a98e8e7d6561dce8c43171395f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Mon, 19 Apr 2021 18:57:41 +0200 Subject: [PATCH] - move new bsp packages to $release-utils (#2783) - remove creating repository for xenial and stretch - creating meta upgrade packages which are gone with apt autoremove Tested on focal and stretch Note: we lost BRANCH information from /etc/armbian-release file https://armbian.atlassian.net/browse/AR-731 --- lib/general.sh | 21 +++++++++++++++------ lib/image-helpers.sh | 3 +-- lib/main.sh | 9 +++------ lib/makeboarddeb.sh | 23 ++++++++++++++--------- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/lib/general.sh b/lib/general.sh index 2803e6f30c..636521473d 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -657,7 +657,7 @@ adding_packages() # add if not already there aptly repo search -architectures="${arch}" -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${1}" 'Name (% '${name}'), $Version (='${version}'), $Architecture (='${arch}')' &>/dev/null if [[ $? -ne 0 ]]; then - display_alert "Adding" "$name" "info" + display_alert "Adding ${1}" "$name" "info" aptly repo add -force-replace=true -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${1}" "${f}" &>/dev/null fi done @@ -674,7 +674,7 @@ addtorepo() # parameter "delete" remove incoming directory if publishing is succesful # function: cycle trough distributions - local distributions=("xenial" "stretch" "bionic" "buster" "bullseye" "groovy" "focal" "hirsute" "sid") + local distributions=("bionic" "buster" "bullseye" "focal" "hirsute" "sid") local errors=0 for release in "${distributions[@]}"; do @@ -688,10 +688,11 @@ addtorepo() # create local repository if not exist if [[ -z $(aptly repo list -config="${SCRIPTPATH}config/${REPO_CONFIG}" -raw | awk '{print $(NF)}' | grep "${release}") ]]; then - display_alert "Creating section" "$release" "info" + display_alert "Creating section" "main" "info" aptly repo create -config="${SCRIPTPATH}config/${REPO_CONFIG}" -distribution="${release}" -component="main" \ -comment="Armbian main repository" "${release}" >/dev/null fi + if [[ -z $(aptly repo list -config="${SCRIPTPATH}config/${REPO_CONFIG}" -raw | awk '{print $(NF)}' | grep "^utils") ]]; then aptly repo create -config="${SCRIPTPATH}config/${REPO_CONFIG}" -distribution="${release}" -component="utils" \ -comment="Armbian utilities (backwards compatibility)" utils >/dev/null @@ -717,7 +718,7 @@ addtorepo() # adding main distribution packages if find "${DEB_STORAGE}/${release}" -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then - adding_packages "$release" "/${release}" "release" + adding_packages "${release}-utils" "/${release}" "release packages" else # workaround - add dummy package to not trigger error aptly repo add -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" "${SCRIPTPATH}config/templates/example.deb" >/dev/null @@ -746,9 +747,17 @@ addtorepo() desknum=$(aptly repo show -with-packages -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}-utils" | grep "Number of packages" | awk '{print $NF}') if [ $mainnum -gt 0 ] && [ $utilnum -gt 0 ] && [ $desknum -gt 0 ]; then + # publish - aptly publish -force-overwrite -passphrase="${GPG_PASS}" -origin=Armbian -label=Armbian -config="${SCRIPTPATH}config/${REPO_CONFIG}" -component="${COMPONENTS// /,}" \ - --distribution="${release}" repo "${release}" ${COMPONENTS//main/} >/dev/null + aptly publish \ + -acquire-by-hash \ + -passphrase="${GPG_PASS}" \ + -origin="Armbian" \ + -label="Armbian" \ + -config="${SCRIPTPATH}config/${REPO_CONFIG}" \ + -component="${COMPONENTS// /,}" \ + -distribution="${release}" repo "${release}" ${COMPONENTS//main/} >/dev/null + if [[ $? -ne 0 ]]; then display_alert "Publishing failed" "${release}" "err" errors=$((errors+1)) diff --git a/lib/image-helpers.sh b/lib/image-helpers.sh index c2b5d64aa3..29abc810c4 100644 --- a/lib/image-helpers.sh +++ b/lib/image-helpers.sh @@ -94,9 +94,8 @@ write_uboot() chmod 700 ${TEMP_DIR} revision=${REVISION} if [[ -n $UPSTREM_VER ]]; then - DEB_BRANCH=${DEB_BRANCH/-/} revision=${UPSTREM_VER} - dpkg -x "${DEB_STORAGE}/linux-u-boot-${BOARD}-${DEB_BRANCH/-/}_${revision}_${ARCH}.deb" ${TEMP_DIR}/ + dpkg -x "${DEB_STORAGE}/linux-u-boot-${BOARD}-${BRANCH}_${revision}_${ARCH}.deb" ${TEMP_DIR}/ else dpkg -x "${DEB_STORAGE}/${CHOSEN_UBOOT}_${revision}_${ARCH}.deb" ${TEMP_DIR}/ fi diff --git a/lib/main.sh b/lib/main.sh index 850dcbcf07..67d5427375 100644 --- a/lib/main.sh +++ b/lib/main.sh @@ -394,12 +394,9 @@ LINUXSOURCEDIR="${KERNELDIR}/$(branch2dir "${KERNELBRANCH}")" BSP_CLI_PACKAGE_NAME="armbian-bsp-cli-${BOARD}" BSP_CLI_PACKAGE_FULLNAME="${BSP_CLI_PACKAGE_NAME}_${REVISION}_${ARCH}" -# define package names -DEB_BRANCH=${BRANCH//default} -# if not empty, append hyphen -DEB_BRANCH=${DEB_BRANCH:+${DEB_BRANCH}-} -CHOSEN_UBOOT=linux-u-boot-${DEB_BRANCH}${BOARD} -CHOSEN_KERNEL=linux-image-${DEB_BRANCH}${LINUXFAMILY} + +CHOSEN_UBOOT=linux-u-boot-${BRANCH}-${BOARD} +CHOSEN_KERNEL=linux-image-${BRANCH}-${LINUXFAMILY} CHOSEN_ROOTFS=${BSP_CLI_PACKAGE_NAME} CHOSEN_DESKTOP=armbian-${RELEASE}-desktop-${DESKTOP_ENVIRONMENT} CHOSEN_KSRC=linux-source-${BRANCH}-${LINUXFAMILY} diff --git a/lib/makeboarddeb.sh b/lib/makeboarddeb.sh index 6e7db37369..8092a7d383 100644 --- a/lib/makeboarddeb.sh +++ b/lib/makeboarddeb.sh @@ -58,10 +58,10 @@ create_board_package() Section: kernel Priority: optional Depends: bash, linux-base, u-boot-tools, initramfs-tools, lsb-release, fping - Provides: armbian-bsp - Conflicts: armbian-bsp + Provides: linux-${RELEASE}-root-legacy-$BOARD, linux-${RELEASE}-root-current-$BOARD, linux-${RELEASE}-root-edge-$BOARD Suggests: armbian-config - Replaces: zram-config, base-files, armbian-tools-$RELEASE + Replaces: zram-config, base-files, armbian-tools-$RELEASE, linux-${RELEASE}-root-legacy-$BOARD (<< $REVISION~), linux-${RELEASE}-root-current-$BOARD (<< $REVISION~), linux-${RELEASE}-root-edge-$BOARD (<< $REVISION~) + Breaks: linux-${RELEASE}-root-legacy-$BOARD (<< $REVISION~), linux-${RELEASE}-root-current-$BOARD (<< $REVISION~), linux-${RELEASE}-root-edge-$BOARD (<< $REVISION~) Recommends: bsdutils, parted, util-linux, toilet Description: Tweaks for Armbian $RELEASE on $BOARD EOF @@ -281,7 +281,6 @@ fi DISTRIBUTION_STATUS=${DISTRIBUTION_STATUS} VERSION=$REVISION LINUXFAMILY=$LINUXFAMILY - BRANCH=$BRANCH ARCH=$ARCHITECTURE IMAGE_TYPE=$IMAGE_TYPE BOARD_TYPE=$BOARD_TYPE @@ -323,20 +322,26 @@ fi # Can be removed after 21.05 # create meta package for upgrade - local destination=${bsptempdir}/${RELEASE}/linux-${RELEASE}-root-${DEB_BRANCH}${BOARD}_${REVISION}_${ARCH} + local DEB_BRANCH=("legacy" "current" "edge") + for deb_branch in "${DEB_BRANCH[@]}"; do + + local destination=${bsptempdir}/${RELEASE}/linux-${RELEASE}-root-${deb_branch}-${BOARD}_${REVISION}_${ARCH} mkdir -p "${destination}"/DEBIAN cat <<-EOF > "${destination}"/DEBIAN/control - Package: linux-${RELEASE}-root-${DEB_BRANCH}${BOARD} + Package: linux-${RELEASE}-root-${deb_branch}-${BOARD} Version: $REVISION - Architecture: $ARCH + Architecture: all + Priority: optional + Section: oldlibs Maintainer: $MAINTAINER <$MAINTAINERMAIL> - Pre-Depends: ${BSP_CLI_PACKAGE_NAME} - Description: Meta package that upgrades to ${BSP_CLI_PACKAGE_NAME} + Depends: ${BSP_CLI_PACKAGE_NAME} + Description: This is a transitional package. It can safely be removed. EOF display_alert "Building meta package" "$CHOSEN_ROOTFS" "info" fakeroot dpkg-deb -b "${destination}" "${destination}.deb" >> "${DEST}"/debug/install.log 2>&1 mkdir -p "${DEB_STORAGE}/${RELEASE}/" rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/${RELEASE}/" + done # Can be removed after 21.05 # cleanup