Fixes to support building from non-Debian hosts
The Live Manual lists the requirements for live-build
, and it explicitly mentions that a Debian host is not required. However, when using it from Arch Linux, I found a few spots that assumed a Debian host (namely, a specific PATH
or the presence of dpkg
tools).
Merge request reports
Activity
35 35 } 36 36 37 37 Chroot_has_package() { 38 local PACKAGE="${1}"; shift 39 local CHROOT="${2:-chroot}"; shift 38 local PACKAGE="${1}" 39 local CHROOT="${2:-chroot}" There's a couple reasons why I think this is the better solution:
First, As the requirements section from the live build manual states, the only required packages are a POSIX-compliant shell and
debootstrap
. It seems clear to me that dpkg tools are not intended to be required for the use of live build. The fact that this path is only about 15 lines reinforces the fact that these uses ofdpkg
anddpkg-query
were unintentional oversights, not an attempt to add a dpkg dependency.Second, I can tell you from experience, it's much easier to apply this patch before building and installing live-build than it is to install the dpkg tools that are used here, especially since they are not currently packaged for Arch (debootstrap is). I've applied this patch and been using the patched version for a while.
Good suggestion. However, I'm not sure how to create an autopkgtest environment without the presence of
dpkg
, etc. The documentation seems to indicate that it always creates a basic Debian environment.One idea I had was to create a simple chroot inside the autopkgtest environment that just contained
debootstrap
and then runbusybox --install -s
to create a very minimal environemnt, but that seemed like too much minimalism.busybox sh
is more barebones thanbash
, so I'm guessing that there are other areas that would need to be changed to support using that.
Please go to https://salsa.debian.org/sam-lunt/live-build/-/settings/ci_cd and under "General pipelines" change "Timeout" to "3h", and then restart the autopkgtest job - unfortunately default settings are not inherited on fork
35 35 } 36 36 37 37 Chroot_has_package() { 38 local PACKAGE="${1}"; shift 39 local CHROOT="${2:-chroot}"; shift 38 local PACKAGE="${1}" 39 local CHROOT="${2:-chroot}" 195 195 fi 196 196 } 197 197 198 PRE_EFI_IMAGE_PATH="${PATH}" 198 PRE_EFI_IMAGE_PATH="\${PATH}" 199 199 if [ ! -e "${LIVE_BUILD}" ] ; then 200 200 LIVE_BUILD_PATH="/usr/lib/live/build" 201 201 else 202 202 LIVE_BUILD_PATH="${LIVE_BUILD}/scripts/build" 203 203 fi 204 204 205 PATH="${PATH}:\${LIVE_BUILD_PATH}" # Make sure grub-cpmodules is used as if it was installed in the system 205 PATH="\${PATH}:\${LIVE_BUILD_PATH}" # Make sure grub-cpmodules is used as if it was installed in the system 140 140 141 141 Install_file() { 142 142 local FILE="${1}" 143 local DEST="${2}" 144 local CHROOT="${3:-chroot}"; changed this line in version 2 of the diff
140 140 141 141 Install_file() { 142 142 local FILE="${1}" 143 local DEST="${2}" 144 local CHROOT="${3:-chroot}"; 143 145 144 146 Echo_debug "Installing file %s" "${FILE}" 145 147 146 148 local ARCHIVE_AREA 147 ARCHIVE_AREA="$(dpkg -I ${FILE} | awk '/^.*Section: / { print $2 }')" 149 ARCHIVE_AREA="$(Chroot "${CHROOT}" dpkg -I ${FILE} | awk '/^.*Section: / { print $2 }')" Have you tested this?
I've tried to place some random .deb files in the various locations in the configuration:
mkdir -p config/packages cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages/w1_amd64.deb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages/w2_amd64.deb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages/w3_all.deb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages/w4_all.deb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages/w1_amd64.udeb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages/w2_amd64.udeb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages/w3_all.udeb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages/w4_all.udeb mkdir -p config/packages.binary cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages.binary/w5_amd64.deb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages.binary/w6_amd64.deb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages.binary/w7_all.deb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages.binary/w8_all.deb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages.binary/w5_amd64.udeb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages.binary/w6_amd64.udeb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages.binary/w7_all.udeb cp -a /var/cache/apt/archives/wireplumber_0.4.4-1_amd64.deb config/packages.binary/w8_all.udeb
When
dpkg
is called, the files are not (yet?) inside the chroot.changed this line in version 2 of the diff
You're right, this isn't correct. I think a correct solution could be to change
Install_file
to just copy the.deb
or.udeb
file to the top-levelDEST
, then have a separate function that runs a script in the chroot along the lines of:for FILE in *.deb *.udeb do : # reorganize based on archive area done
(similar to how
apt-ftparchive
is run here and here)I'm hesitant to change so much about the script though; obviously I'm not super familiar with how it operates. On the other hand, it does seem like a bummer to have
dpkg
required on the host side solely for use inInstall_file
This was something I'd considered as well, but I thought it seemed too fragile. Maybe it's worth exploring further, though.
A
.deb
file (and presumably.udeb
as well) is an archive of 3 files,control.tar.xz
,data.tar.xz
, anddebian-binary
. The file we are interested in here is part of thecontrol.tar.xz
tarball, namelycontrol
. So we could do this:ar p "$deb_file" control.tar.xz | tar -x --xz -f - ./control -O | grep -F 'Section:'
The main issue is that the compression format has not always been
.xz
(and thus might not always be xz). So there would need to be a step beforehand to list the archive contents and choose the decompression option based on that. At this point, I worry that this will re-implement too much ofdpkg
's functionality. That said, maybe it's feasible; I'm open to opinions/suggestions.
added 1 commit
- 87d6b693 - Fixes to support building from non-Debian hosts