* [PATCH] dpkg-base: Remove newly deployed debs from buildchroots
@ 2020-06-03 7:37 Jan Kiszka
2020-08-07 9:34 ` Harald Seiler
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2020-06-03 7:37 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
This ensures clean reinstallation after partial rebuilds.
A typical error pattern so far was that firmware packages pulled by the
buildchroot-target were not updated there on rebuilds, causing the old
firmware being deployed into the image.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta/classes/dpkg-base.bbclass | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 9aa2d546..80da713d 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -154,20 +154,26 @@ python do_dpkg_build() {
addtask dpkg_build before do_build
-CLEANFUNCS += "repo_clean"
+CLEANFUNCS += "deb_clean"
-repo_clean() {
+deb_clean() {
DEBS=$( find ${S}/.. -maxdepth 1 -name "*.deb" || [ ! -d ${S} ] )
if [ -n "${DEBS}" ]; then
for d in ${DEBS}; do
repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
"${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${d}"
+ package=$(basename "${d}")
+ package_remove="/usr/bin/apt-get remove -y -U ${package%%_*}"
+ sudo -E chroot ${BUILDCHROOT_DIR} ${package_remove} || true
+ if [ "${BUILDCHROOT_DIR}" != "${BUILDCHROOT_TARGET_DIR}" ]; then
+ sudo -E chroot ${BUILDCHROOT_TARGET_DIR} ${package_remove} || true
+ fi
done
fi
}
do_deploy_deb() {
- repo_clean
+ deb_clean
repo_add_packages "${REPO_ISAR_DIR}"/"${DISTRO}" \
"${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" ${S}/../*.deb
}
--
2.26.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dpkg-base: Remove newly deployed debs from buildchroots
2020-06-03 7:37 [PATCH] dpkg-base: Remove newly deployed debs from buildchroots Jan Kiszka
@ 2020-08-07 9:34 ` Harald Seiler
2020-08-11 6:57 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Harald Seiler @ 2020-08-07 9:34 UTC (permalink / raw)
To: Jan Kiszka, isar-users
Hi Jan,
after wasting way too much time hunting another bug that turned out to be
caused by the bootloader not getting updated, I gave this patch another
try. It works as intended, I just had to fix one small issue. See below.
On Wed, 2020-06-03 at 09:37 +0200, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> This ensures clean reinstallation after partial rebuilds.
>
> A typical error pattern so far was that firmware packages pulled by the
> buildchroot-target were not updated there on rebuilds, causing the old
> firmware being deployed into the image.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> meta/classes/dpkg-base.bbclass | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
> index 9aa2d546..80da713d 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -154,20 +154,26 @@ python do_dpkg_build() {
>
> addtask dpkg_build before do_build
>
> -CLEANFUNCS += "repo_clean"
> +CLEANFUNCS += "deb_clean"
>
> -repo_clean() {
> +deb_clean() {
> DEBS=$( find ${S}/.. -maxdepth 1 -name "*.deb" || [ ! -d ${S} ] )
> if [ -n "${DEBS}" ]; then
> for d in ${DEBS}; do
> repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
> "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${d}"
> + package=$(basename "${d}")
> + package_remove="/usr/bin/apt-get remove -y -U ${package%%_*}"
I had to remove -U here. Not sure what it was for, I can't find any
documentation about this switch.
> + sudo -E chroot ${BUILDCHROOT_DIR} ${package_remove} || true
> + if [ "${BUILDCHROOT_DIR}" != "${BUILDCHROOT_TARGET_DIR}" ]; then
> + sudo -E chroot ${BUILDCHROOT_TARGET_DIR} ${package_remove} || true
> + fi
> done
> fi
> }
>
> do_deploy_deb() {
> - repo_clean
> + deb_clean
> repo_add_packages "${REPO_ISAR_DIR}"/"${DISTRO}" \
> "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" ${S}/../*.deb
> }
> --
> 2.26.2
>
--
Harald
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-62 Fax: +49-8142-66989-80 Email: hws@denx.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dpkg-base: Remove newly deployed debs from buildchroots
2020-08-07 9:34 ` Harald Seiler
@ 2020-08-11 6:57 ` Jan Kiszka
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2020-08-11 6:57 UTC (permalink / raw)
To: Harald Seiler, isar-users
On 07.08.20 11:34, Harald Seiler wrote:
> Hi Jan,
>
> after wasting way too much time hunting another bug that turned out to be
> caused by the bootloader not getting updated, I gave this patch another
> try. It works as intended, I just had to fix one small issue. See below.
>
> On Wed, 2020-06-03 at 09:37 +0200, Jan Kiszka wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> This ensures clean reinstallation after partial rebuilds.
>>
>> A typical error pattern so far was that firmware packages pulled by the
>> buildchroot-target were not updated there on rebuilds, causing the old
>> firmware being deployed into the image.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>> meta/classes/dpkg-base.bbclass | 12 +++++++++---
>> 1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
>> index 9aa2d546..80da713d 100644
>> --- a/meta/classes/dpkg-base.bbclass
>> +++ b/meta/classes/dpkg-base.bbclass
>> @@ -154,20 +154,26 @@ python do_dpkg_build() {
>>
>> addtask dpkg_build before do_build
>>
>> -CLEANFUNCS += "repo_clean"
>> +CLEANFUNCS += "deb_clean"
>>
>> -repo_clean() {
>> +deb_clean() {
>> DEBS=$( find ${S}/.. -maxdepth 1 -name "*.deb" || [ ! -d ${S} ] )
>> if [ -n "${DEBS}" ]; then
>> for d in ${DEBS}; do
>> repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
>> "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${d}"
>> + package=$(basename "${d}")
>> + package_remove="/usr/bin/apt-get remove -y -U ${package%%_*}"
>
> I had to remove -U here. Not sure what it was for, I can't find any
> documentation about this switch.
>
No idea anymore where it came from - and why it worked. I'll send v2.
Jan
>> + sudo -E chroot ${BUILDCHROOT_DIR} ${package_remove} || true
>> + if [ "${BUILDCHROOT_DIR}" != "${BUILDCHROOT_TARGET_DIR}" ]; then
>> + sudo -E chroot ${BUILDCHROOT_TARGET_DIR} ${package_remove} || true
>> + fi
>> done
>> fi
>> }
>>
>> do_deploy_deb() {
>> - repo_clean
>> + deb_clean
>> repo_add_packages "${REPO_ISAR_DIR}"/"${DISTRO}" \
>> "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" ${S}/../*.deb
>> }
>> --
>> 2.26.2
>>
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-11 6:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 7:37 [PATCH] dpkg-base: Remove newly deployed debs from buildchroots Jan Kiszka
2020-08-07 9:34 ` Harald Seiler
2020-08-11 6:57 ` Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox