summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhramshinr <khramshinr@gmail.com>2024-09-11 20:31:49 +0600
committerkhramshinr <khramshinr@gmail.com>2024-09-16 14:23:59 +0600
commita26ef9e1700b3aa3885a7e0769a1672aa5f485dc (patch)
treef879931cac3269058d5e141fcf6cef2f5e14aaa4
parent300674c1444d361e31e9a5d3a05bd4e6cd409f17 (diff)
downloadvyos-build-a26ef9e1700b3aa3885a7e0769a1672aa5f485dc.tar.gz
vyos-build-a26ef9e1700b3aa3885a7e0769a1672aa5f485dc.zip
T6684: new Debian package repo snapshot logic
patch live-build to save information about all installed packages and their source repo, including temporary packages
-rw-r--r--docker/Dockerfile12
-rw-r--r--docker/patches/live-build/0001-save-package-info.patch60
2 files changed, 72 insertions, 0 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 40b2067d..2824bcb0 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -177,6 +177,18 @@ RUN wget -O /tmp/open-vmdk-master.zip https://github.com/vmware/open-vmdk/archiv
unzip -d /tmp/ /tmp/open-vmdk-master.zip && \
cd /tmp/open-vmdk-master/ && make && make install
+# Packages need for build live-build
+RUN apt-get update && apt-get install -y \
+ cpio
+
+COPY patches/live-build/0001-save-package-info.patch /tmp/0001-save-package-info.patch
+
+RUN git clone https://salsa.debian.org/live-team/live-build.git /tmp/live-build && \
+ cd /tmp/live-build && git checkout debian/1%20240810 && \
+ patch -p1 < /tmp/0001-save-package-info.patch && \
+ dch -n "Applying fix for save package info" && \
+ dpkg-buildpackage -us -uc && \
+ dpkg -i ../live-build*.deb
#
# live-build: building in docker fails with mounting /proc | /sys
#
diff --git a/docker/patches/live-build/0001-save-package-info.patch b/docker/patches/live-build/0001-save-package-info.patch
new file mode 100644
index 00000000..abb4308d
--- /dev/null
+++ b/docker/patches/live-build/0001-save-package-info.patch
@@ -0,0 +1,60 @@
+From 3ddf0e979c352f2917be6a949fb8dd37b5c9f2b7 Mon Sep 17 00:00:00 2001
+From: khramshinr <khramshinr@gmail.com>
+Date: Wed, 28 Aug 2024 14:38:15 +0600
+Subject: [PATCH] T6684: new Debian package repo snapshot logic
+
+save information about all installed packages and teir source repo, including temporary packages
+---
+ functions/packages.sh | 7 +++++++
+ scripts/build/chroot | 6 ++++++
+ scripts/build/clean | 2 +-
+ 3 files changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/functions/packages.sh b/functions/packages.sh
+index 9e25df5f3..4d1fa695e 100755
+--- a/functions/packages.sh
++++ b/functions/packages.sh
+@@ -60,6 +60,13 @@ Install_packages ()
+ Chroot chroot "aptitude install --without-recommends ${APTITUDE_OPTIONS} ${_LB_PACKAGES}"
+ ;;
+ esac
++
++ # save information about all temporary installed packages and source repos
++ for PACKAGE in ${_LB_PACKAGES}; do
++ Chroot chroot "apt-cache policy ${PACKAGE}" | sed -n '/\*\*\*/,$p' | grep -P 'http:|https:' -m 1 | awk -v pkg="${PACKAGE}" '{print $2" "$3" "pkg}' >> chroot.packages.all.info
++
++ done
++
+ unset _LB_PACKAGES # Can clear this now
+ }
+
+diff --git a/scripts/build/chroot b/scripts/build/chroot
+index a0aa10be0..700762e78 100755
+--- a/scripts/build/chroot
++++ b/scripts/build/chroot
+@@ -48,6 +48,12 @@ for _PASS in install live; do
+ fi
+ done
+
++# save information about all installed packages and source repos
++Chroot chroot "dpkg-query -W" | while read PACKAGE; do
++ Chroot chroot "apt-cache policy ${PACKAGE}" | sed -n '/\*\*\*/,$p' | grep -P 'http:|https:' -m 1 | awk -v pkg="${PACKAGE}" '{print $2" "$3" "pkg}' >> chroot.packages.all.info
++done
++
++
+ lb chroot_includes_after_packages "${@}"
+ lb chroot_hooks "${@}"
+ lb chroot_hacks "${@}"
+diff --git a/scripts/build/clean b/scripts/build/clean
+index 6549fc635..4376d7525 100755
+--- a/scripts/build/clean
++++ b/scripts/build/clean
+@@ -159,7 +159,7 @@ if [ "${RM_CHROOT}" = "true" ]; then
+
+ rm -rf chroot chroot.tmp
+
+- rm -f chroot.packages.live chroot.packages.install
++ rm -f chroot.packages.live chroot.packages.install chroot.packages.all.info
+ rm -f chroot.files
+
+ rm -f "$(Installed_tmp_packages_file)" \ No newline at end of file