From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6935499186756386816 Date: Wed, 3 Mar 2021 11:25:53 -0800 (PST) From: "vijaikumar....@gmail.com" To: isar-users Message-Id: In-Reply-To: <20210303195911.76cfd86a@md1za8fc.ad001.siemens.net> References: <20210303183823.11563-1-Vijaikumar_Kanagarajan@mentor.com> <20210303195911.76cfd86a@md1za8fc.ad001.siemens.net> Subject: Re: [PATCH v2] dpkg-base: Introduce do_apt_unpack MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1324_1618983233.1614799553468" X-TUID: CVm7eK2g+akT ------=_Part_1324_1618983233.1614799553468 Content-Type: multipart/alternative; boundary="----=_Part_1325_1242549614.1614799553468" ------=_Part_1325_1242549614.1614799553468 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Thursday, March 4, 2021 at 12:29:14 AM UTC+5:30 Henning Schild wrote: > Am Thu, 4 Mar 2021 00:08:23 +0530 > schrieb Vijai Kumar K : > > > The Debian source package fetch and unpacking happens now inside the > > do_apt_fetch task. > > > > With the current do_apt_fetch implementation, it is not possible to > > use a custom source directory(${S}). > > apt-get source by default extracts the contents of the debian source > > into folder with name _. > > > > Add provision for specifying a custom source directory. > > > > Add a new task called do_apt_unpack and move unpacking logic there. > > > > Signed-off-by: Vijai Kumar K > > --- > > meta/classes/dpkg-base.bbclass | 24 +++++++++++++++++++++--- > > 1 file changed, 21 insertions(+), 3 deletions(-) > > > > diff --git a/meta/classes/dpkg-base.bbclass > > b/meta/classes/dpkg-base.bbclass index 5c7bddc..a6c2e3b 100644 > > --- a/meta/classes/dpkg-base.bbclass > > +++ b/meta/classes/dpkg-base.bbclass > > @@ -58,7 +58,6 @@ do_apt_fetch() { > > if [ -z "${@d.getVar("SRC_APT", True).strip()}" ]; then > > return 0 > > fi > > - rm -rf ${S} > > dpkg_do_mounts > > E="${@ isar_export_proxies(d)}" > > sudo -E chroot ${BUILDCHROOT_DIR} /usr/bin/apt-get update \ > > @@ -69,8 +68,6 @@ do_apt_fetch() { > > for uri in "${SRC_APT}"; do > > sudo -E chroot --userspec=$( id -u ):$( id -g ) > > ${BUILDCHROOT_DIR} \ sh -c 'mkdir -p /downloads/deb-src/"$1"/"$2" && > > cd /downloads/deb-src/"$1"/"$2" && apt-get -y --download-only > > --only-source source "$2"' my_script "${DISTRO}" "${uri}" > > - sudo -E chroot --userspec=$( id -u ):$( id -g ) > > ${BUILDCHROOT_DIR} \ > > - sh -c 'cp /downloads/deb-src/"$1"/"$2"/* ${PP} && cd > > ${PP} && apt-get -y --only-source source "$2"' my_script "${DISTRO}" > > "${uri}" done > > dpkg_undo_mounts > > @@ -79,6 +76,27 @@ do_apt_fetch() { > > addtask apt_fetch after do_unpack before do_patch > > before do_apt_unpack Will fix it in v3 > > > > do_apt_fetch[lockfiles] += "${REPO_ISAR_DIR}/isar.lock" > > > > +do_apt_unpack() { > > + rm -rf ${S} > > + dpkg_do_mounts > > + E="${@ isar_export_proxies(d)}" > > Not sure about this, i would hope the unpack would be "purely offline" > > > + for uri in "${SRC_APT}"; do > > + sudo -E chroot --userspec=$( id -u ):$( id -g ) > > ${BUILDCHROOT_DIR} \ > > + sh -c ' \ > > + set -e > > + dscfile="$(apt-get -y -qq --print-uris source "${2}" > > | cut -d " " -f2 | grep -E "*.dsc")" > > but maybe this guy needs network > > Thanks, looking good so far! > > Henning > > > + cd ${PP} > > + cp /downloads/deb-src/"${1}"/"${2}"/* ${PP} > > + dpkg-source -x "${dscfile}" "${PPS}"' \ > > + my_script "${DISTRO}" "${uri}" > > + done > > + > > + dpkg_undo_mounts > > +} > > + > > +addtask apt_unpack after do_apt_fetch before do_patch > > + > > addtask cleanall_apt before do_cleanall > > do_cleanall_apt[nostamp] = "1" > > do_cleanall_apt() { > > ------=_Part_1325_1242549614.1614799553468 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

On Thursday, March 4, 2021 at 12:29:14 AM UTC+5:30 Henning Schild wrote:
Am Thu, 4 Mar 2021 00:08:23 +0530
schrieb Vijai Kumar K <Vijaikumar_...@mentor.com>:

> The Debian source package fetch and unpacking happens now inside the
> do_apt_fetch task.
>
> With the current do_apt_fetch implementation, it is not possible to
> use a custom source directory(${S}).
> apt-get source by default extracts the contents of the debian source
> into folder with name <pkg>_<version>.
>
> Add provision for specifying a custom source directory.
>
> Add a new task called do_apt_unpack and move unpacking logic there.
>
> Signed-off-by: Vijai Kumar K <Vijaikumar_...@mentor.com>
> ---
> meta/classes/dpkg-base.bbclass | 24 +++++++++++++++++++++---
> 1 file changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/meta/classes/dpkg-base.bbclass
> b/meta/classes/dpkg-base.bbclass index 5c7bddc..a6c2e3b 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -58,7 +58,6 @@ do_apt_fetch() {
> if [ -z "${@d.getVar("SRC_APT", True).strip()}" ]; then
> return 0
> fi
> - rm -rf ${S}
> dpkg_do_mounts
> E="${@ isar_export_proxies(d)}"
> sudo -E chroot ${BUILDCHROOT_DIR} /usr/bin/apt-get update \
> @@ -69,8 +68,6 @@ do_apt_fetch() {
> for uri in "${SRC_APT}"; do
> sudo -E chroot --userspec=$( id -u ):$( id -g )
> ${BUILDCHROOT_DIR} \ sh -c 'mkdir -p /downloads/deb-src/"$1"/"$2" &&
> cd /downloads/deb-src/"$1"/"$2" && apt-get -y --download-only
> --only-source source "$2"' my_script "${DISTRO}" "${uri}"
> - sudo -E chroot --userspec=$( id -u ):$( id -g )
> ${BUILDCHROOT_DIR} \
> - sh -c 'cp /downloads/deb-src/"$1"/"$2"/* ${PP} && cd
> ${PP} && apt-get -y --only-source source "$2"' my_script "${DISTRO}"
> "${uri}" done
> dpkg_undo_mounts
> @@ -79,6 +76,27 @@ do_apt_fetch() {
> addtask apt_fetch after do_unpack before do_patch

before do_apt_unpack

Will fix it in v3
 


> do_apt_fetch[lockfiles] += "${REPO_ISAR_DIR}/isar.lock"
>
> +do_apt_unpack() {
> + rm -rf ${S}
> + dpkg_do_mounts
> + E="${@ isar_export_proxies(d)}"

Not sure about this, i would hope the unpack would be "purely offline"

> + for uri in "${SRC_APT}"; do
> + sudo -E chroot --userspec=$( id -u ):$( id -g )
> ${BUILDCHROOT_DIR} \
> + sh -c ' \
> + set -e
> + dscfile="$(apt-get -y -qq --print-uris source "${2}"
> | cut -d " " -f2 | grep -E "*.dsc")"

but maybe this guy needs network

Thanks, looking good so far!

Henning

> + cd ${PP}
> + cp /downloads/deb-src/"${1}"/"${2}"/* ${PP}
> + dpkg-source -x "${dscfile}" "${PPS}"' \
> + my_script "${DISTRO}" "${uri}"
> + done
> +
> + dpkg_undo_mounts
> +}
> +
> +addtask apt_unpack after do_apt_fetch before do_patch
> +
> addtask cleanall_apt before do_cleanall
> do_cleanall_apt[nostamp] = "1"
> do_cleanall_apt() {

------=_Part_1325_1242549614.1614799553468-- ------=_Part_1324_1618983233.1614799553468--