From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: Uladzimir Bely <ubely@ilbers.de>,
isar-users <isar-users@googlegroups.com>
Subject: Re: [PATCH] Convert apt source fetcher into native bitbake variant
Date: Thu, 18 Jul 2024 09:18:51 +0200 [thread overview]
Message-ID: <6c378ad8-5ea4-4295-b459-8f9842be13a4@siemens.com> (raw)
In-Reply-To: <bc0900fb4c3c281049c131b9a9524b0857f3e8e3.camel@ilbers.de>
On 18.07.24 08:50, Uladzimir Bely wrote:
> On Tue, 2024-07-16 at 07:09 +0200, 'Jan Kiszka' via isar-users wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> There is no major functional difference, but we no longer have to
>> manipulate SRC_URI by registering an official fetcher for apt://.
>>
>> As the fetching no longer takes place in separate tasks, do_fetch and
>> do_unpack need to gain the extra flags that were so far assigned to
>> apt_fetch and apt_unpack. That happens conditionally, i.e. only if
>> SRC_URI actually contains an apt URL.
>>
>> One difference to the original version is the possibility - even if
>> practically of minor relevance - to unpack multiple apt sources into
>> S.
>> The old version contained a loop but was directing dpkg-source to a
>> pre-existing dir which would have failed on the second iteration. The
>> new version now folds the results together after each step.
>>
>> Another minor difference is that unversioned fetches put their
>> results
>> into the same subfolder in DL_DIR, also when specifying a distro
>> codename. Only versioned fetches get dedicated folders (and .done
>> stamps).
>>
>> There is no progress report realized because dpkg-source
>> unfortunately
>> does not provide information upfront to make this predictable, thus
>> expressible in form of percentage.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>
>> Depends on
>> https://patchwork.isar-build.org/project/isar/list/?series=1248
>> and
>> https://patchwork.isar-build.org/project/isar/patch/b94f35cd-5fef-4a34-9e5d-8af282afe7c7@siemens.com/
>> for conflict-free application.
>>
>> meta/classes/dpkg-base.bbclass | 96 ++++----------------------------
>> --
>> meta/lib/aptsrc_fetcher.py | 86 ++++++++++++++++++++++++++++++
>> 2 files changed, 97 insertions(+), 85 deletions(-)
>> create mode 100644 meta/lib/aptsrc_fetcher.py
>>
>> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-
>> base.bbclass
>> index 95cc830d..20c59ce8 100644
>> --- a/meta/classes/dpkg-base.bbclass
>> +++ b/meta/classes/dpkg-base.bbclass
>> @@ -80,102 +80,28 @@ do_adjust_git[lockfiles] +=
>> "${DL_DIR}/git/isar.lock"
>> inherit patch
>> addtask patch after do_adjust_git
>>
>> -SRC_APT ?= ""
>> -
>> -# filter out all "apt://" URIs out of SRC_URI and stick them into
>> SRC_APT
>> python() {
>> - src_uri = (d.getVar('SRC_URI', False) or "").split()
>> + from bb.fetch2 import methods
>>
>> - prefix = "apt://"
>> - src_apt = []
>> - for u in src_uri:
>> - if u.startswith(prefix):
>> - src_apt.append(u[len(prefix) :])
>> - d.setVar('SRC_URI:remove', u)
>> + # apt-src fetcher
>> + import aptsrc_fetcher
>> + methods.append(aptsrc_fetcher.AptSrc())
>>
>> - d.prependVar('SRC_APT', ' '.join(src_apt))
>> + src_uri = (d.getVar('SRC_URI', False) or "").split()
>> + for u in src_uri:
>> + if u.startswith("apt://"):
>> + d.appendVarFlag('do_fetch', 'depends',
>> d.getVar('SCHROOT_DEP'))
>>
>> - if len(d.getVar('SRC_APT').strip()) > 0:
>> - bb.build.addtask('apt_unpack', 'do_patch', '', d)
>> - bb.build.addtask('cleanall_apt', 'do_cleanall', '', d)
>> + d.appendVarFlag('do_unpack', 'cleandirs', d.getVar('S'))
>> + d.setVarFlag('do_unpack', 'network',
>> d.getVar('TASK_USE_SUDO'))
>> + break
>>
>> # container docker fetcher
>> import container_fetcher
>> - from bb.fetch2 import methods
>>
>> methods.append(container_fetcher.Container())
>> }
>>
>> -do_apt_fetch() {
>> - E="${@ isar_export_proxies(d)}"
>> - schroot_create_configs
>> -
>> - session_id=$(schroot -q -b -c ${SBUILD_CHROOT})
>> - echo "Started session: ${session_id}"
>> -
>> - schroot_cleanup() {
>> - schroot -q -f -e -c ${session_id} > /dev/null 2>&1
>> - schroot_delete_configs
>> - }
>> - trap 'exit 1' INT HUP QUIT TERM ALRM USR1
>> - trap 'schroot_cleanup' EXIT
>> -
>> - schroot -r -c ${session_id} -d / -u root -- \
>> - rm /etc/apt/sources.list.d/isar-apt.list
>> /etc/apt/preferences.d/isar-apt
>> - schroot -r -c ${session_id} -d / -- \
>> - sh -c '
>> - set -e
>> - for uri in $2; do
>> - mkdir -p /downloads/deb-src/"$1"/${uri}
>> - cd /downloads/deb-src/"$1"/${uri}
>> - apt-get -y --download-only --only-source source
>> ${uri}
>> - done' \
>> - my_script "${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
>> "${SRC_APT}"
>> -
>> - schroot -e -c ${session_id}
>> - schroot_delete_configs
>> -}
>> -
>> -addtask apt_fetch
>> -do_apt_fetch[lockfiles] += "${REPO_ISAR_DIR}/isar.lock"
>> -do_apt_fetch[network] = "${TASK_USE_NETWORK_AND_SUDO}"
>> -
>> -# Add dependency from the correct schroot: host or target
>> -do_apt_fetch[depends] += "${SCHROOT_DEP}"
>> -
>> -do_apt_unpack() {
>> - rm -rf ${S}
>> - schroot_create_configs
>> -
>> - schroot_cleanup() {
>> - schroot_delete_configs
>> - }
>> - trap 'exit 1' INT HUP QUIT TERM ALRM USR1
>> - trap 'schroot_cleanup' EXIT
>> -
>> - schroot -d / -c ${SBUILD_CHROOT} -- \
>> - sh -c '
>> - set -e
>> - for uri in $2; do
>> - dscfile="$(apt-get -y -qq --print-uris --only-source
>> source $uri | cut -d " " -f2 | grep -E "*.dsc")"
>> - cd ${PP}
>> - cp /downloads/deb-src/"${1}"/${uri}/* ${PP}
>> - dpkg-source -x "${dscfile}" "${PPS}"
>> - done' \
>> - my_script "${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
>> "${SRC_APT}"
>> - schroot_delete_configs
>> -}
>> -do_apt_unpack[network] = "${TASK_USE_SUDO}"
>> -
>> -addtask apt_unpack after do_apt_fetch
>> -
>> -do_cleanall_apt[nostamp] = "1"
>> -do_cleanall_apt() {
>> - for uri in "${SRC_APT}"; do
>> - rm -rf "${DEBSRCDIR}/${BASE_DISTRO}-
>> ${BASE_DISTRO_CODENAME}/$uri"
>> - done
>> -}
>> -
>
> This relays on a previous patch "Fix do_cleanall_apt with custom DISTRO
> values", but also makes it redundant. Probably, they could be just
> squashed into one?
As you like, but you normally split fixes from features or refactorings.
I would not want this in my projects.
Jan
--
Siemens AG, Technology
Linux Expert Center
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/6c378ad8-5ea4-4295-b459-8f9842be13a4%40siemens.com.
next prev parent reply other threads:[~2024-07-18 7:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 5:09 'Jan Kiszka' via isar-users
2024-07-18 6:50 ` Uladzimir Bely
2024-07-18 7:18 ` 'Jan Kiszka' via isar-users [this message]
2024-07-24 5:08 ` Uladzimir Bely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6c378ad8-5ea4-4295-b459-8f9842be13a4@siemens.com \
--to=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=ubely@ilbers.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox