Skip to content

Commit

Permalink
Chroot build packages cleanup and bug fixing (armbian#3266)
Browse files Browse the repository at this point in the history
* Small fixes and removal of deprecated component
* Fix to properly create armbian repo in chroot
  • Loading branch information
igorpecovnik authored Nov 17, 2021
1 parent eead1f1 commit 6979718
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 186 deletions.
1 change: 1 addition & 0 deletions config/aptly-temp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"dependencyFollowSource": false,
"gpgDisableSign": false,
"gpgDisableVerify": false,
"gpgProvider": "internal",
"downloadSourcePackages": false,
"ppaDistributorID": "ubuntu",
"ppaCodename": "",
Expand Down
13 changes: 5 additions & 8 deletions lib/chroot-buildpackages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,16 @@ create_chroot()
declare -A qemu_binary apt_mirror components
qemu_binary['armhf']='qemu-arm-static'
qemu_binary['arm64']='qemu-aarch64-static'
apt_mirror['stretch']="$DEBIAN_MIRROR"
apt_mirror['buster']="$DEBIAN_MIRROR"
apt_mirror['bullseye']="$DEBIAN_MIRROR"
apt_mirror['xenial']="$UBUNTU_MIRROR"
apt_mirror['bionic']="$UBUNTU_MIRROR"
apt_mirror['focal']="$UBUNTU_MIRROR"
apt_mirror['hirsute']="$UBUNTU_MIRROR"
apt_mirror['impish']="$UBUNTU_MIRROR"
apt_mirror['jammy']="$UBUNTU_MIRROR"
components['stretch']='main,contrib'
components['buster']='main,contrib'
components['bullseye']='main,contrib'
components['sid']='main,contrib'
components['xenial']='main,universe,multiverse'
components['bionic']='main,universe,multiverse'
components['focal']='main,universe,multiverse'
components['hirsute']='main,universe,multiverse'
Expand All @@ -58,12 +54,15 @@ create_chroot()
else
local mirror_addr="http://${apt_mirror[${release}]}"
fi
mkdir -p "${target_dir}"
cd "${target_dir}"
debootstrap --variant=buildd --components="${components[${release}]}" --arch="${arch}" $DEBOOTSTRAP_OPTION --foreign --include="${includes}" "${release}" "${target_dir}" "${mirror_addr}"
[[ $? -ne 0 || ! -f "${target_dir}"/debootstrap/debootstrap ]] && exit_with_error "Create chroot first stage failed"
cp /usr/bin/${qemu_binary[$arch]} "${target_dir}"/usr/bin/
[[ ! -f "${target_dir}"/usr/share/keyrings/debian-archive-keyring.gpg ]] && \
mkdir -p "${target_dir}"/usr/share/keyrings/ && \
cp /usr/share/keyrings/debian-archive-keyring.gpg "${target_dir}"/usr/share/keyrings/

chroot "${target_dir}" /bin/bash -c "/debootstrap/debootstrap --second-stage"
[[ $? -ne 0 || ! -f "${target_dir}"/bin/bash ]] && exit_with_error "Create chroot second stage failed"
create_sources_list "$release" "${target_dir}"
Expand Down Expand Up @@ -101,10 +100,8 @@ chroot_prepare_distccd()
local arch=$2
local dest=/tmp/distcc/${release}-${arch}
declare -A gcc_version gcc_type
gcc_version['stretch']='6.3'
gcc_version['buster']='8.3'
gcc_version['bullseye']='9.2'
gcc_version['xenial']='5.4'
gcc_version['bionic']='5.4'
gcc_version['focal']='9.2'
gcc_version['hirsute']='10.2'
Expand Down Expand Up @@ -142,7 +139,7 @@ chroot_build_packages()
target_arch="${ARCH}"
else
# only make packages for recent releases. There are no changes on older
target_release="stretch bionic buster bullseye focal hirsute sid"
target_release="bionic buster bullseye focal hirsute jammy sid"
target_arch="armhf arm64"
fi

Expand Down Expand Up @@ -228,7 +225,7 @@ chroot_build_packages()
mv "${target_dir}"/root/*.deb "${plugin_target_dir}" 2>/dev/null
done
# cleanup for distcc
kill "$(<"/var/run/distcc/${release}-${arch}.pid")"
kill $(</var/run/distcc/${release}-${arch}.pid)
done
done
if [[ ${#built_ok[@]} -gt 0 ]]; then
Expand Down
16 changes: 8 additions & 8 deletions lib/general.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,20 +215,20 @@ create_sources_list()

# stage: add armbian repository and install key
if [[ $DOWNLOAD_MIRROR == "china" ]]; then
echo "deb https://mirrors.tuna.tsinghua.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${SDCARD}"/etc/apt/sources.list.d/armbian.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
elif [[ $DOWNLOAD_MIRROR == "bfsu" ]]; then
echo "deb http://mirrors.bfsu.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${SDCARD}"/etc/apt/sources.list.d/armbian.list
echo "deb http://mirrors.bfsu.edu.cn/armbian $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
else
echo "deb http://"$([[ $BETA == yes ]] && echo "beta" || echo "apt" )".armbian.com $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${SDCARD}"/etc/apt/sources.list.d/armbian.list
echo "deb http://"$([[ $BETA == yes ]] && echo "beta" || echo "apt" )".armbian.com $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list
fi

# replace local package server if defined. Suitable for development
[[ -n $LOCAL_MIRROR ]] && echo "deb http://$LOCAL_MIRROR $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${SDCARD}"/etc/apt/sources.list.d/armbian.list
[[ -n $LOCAL_MIRROR ]] && echo "deb http://$LOCAL_MIRROR $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" > "${basedir}"/etc/apt/sources.list.d/armbian.list

display_alert "Adding Armbian repository and authentication key" "/etc/apt/sources.list.d/armbian.list" "info"
cp "${SRC}"/config/armbian.key "${SDCARD}"
chroot "${SDCARD}" /bin/bash -c "cat armbian.key | apt-key add - > /dev/null 2>&1"
rm "${SDCARD}"/armbian.key
cp "${SRC}"/config/armbian.key "${basedir}"
chroot "${basedir}" /bin/bash -c "cat armbian.key | apt-key add - > /dev/null 2>&1"
rm "${basedir}"/armbian.key
}


Expand Down Expand Up @@ -1209,7 +1209,7 @@ prepare_host()
nfs-kernel-server btrfs-progs ncurses-term p7zip-full kmod dosfstools libc6-dev-armhf-cross imagemagick \
curl patchutils liblz4-tool libpython2.7-dev linux-base swig aptly acl python3-dev python3-distutils \
locales ncurses-base pixz dialog systemd-container udev libfdt-dev lib32stdc++6 libc6-i386 lib32ncurses5 lib32tinfo5 \
bison libbison-dev flex libfl-dev cryptsetup gpg gnupg1 cpio aria2 pigz dirmngr python3-distutils jq"
bison libbison-dev flex libfl-dev cryptsetup gpg gnupg1 cpio aria2 pigz dirmngr python3-distutils jq distcc"

# build aarch64
else
Expand Down
16 changes: 0 additions & 16 deletions packages/extras-buildpkgs/90-mmc-utils.conf

This file was deleted.

18 changes: 0 additions & 18 deletions packages/extras-buildpkgs/mmc-utils/debian/changelog

This file was deleted.

1 change: 0 additions & 1 deletion packages/extras-buildpkgs/mmc-utils/debian/compat

This file was deleted.

40 changes: 0 additions & 40 deletions packages/extras-buildpkgs/mmc-utils/debian/control

This file was deleted.

77 changes: 0 additions & 77 deletions packages/extras-buildpkgs/mmc-utils/debian/copyright

This file was deleted.

1 change: 0 additions & 1 deletion packages/extras-buildpkgs/mmc-utils/debian/manpages

This file was deleted.

16 changes: 0 additions & 16 deletions packages/extras-buildpkgs/mmc-utils/debian/rules

This file was deleted.

1 change: 0 additions & 1 deletion packages/extras-buildpkgs/mmc-utils/debian/source/format

This file was deleted.

0 comments on commit 6979718

Please sign in to comment.