public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
To: <isar-users@googlegroups.com>, <henning.schild@siemens.com>
Cc: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
Subject: [PATCH v3 1/2] dpkg-base: Introduce do_apt_unpack
Date: Thu, 4 Mar 2021 23:11:36 +0530	[thread overview]
Message-ID: <20210304174137.11166-2-Vijaikumar_Kanagarajan@mentor.com> (raw)
In-Reply-To: <20210304174137.11166-1-Vijaikumar_Kanagarajan@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_Kanagarajan@mentor.com>
---
 meta/classes/dpkg-base.bbclass | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 5c7bddc..c1425bd 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,16 +68,38 @@ 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
 }
 
-addtask apt_fetch after do_unpack before do_patch
+addtask apt_fetch after do_unpack before do_apt_unpack
 do_apt_fetch[lockfiles] += "${REPO_ISAR_DIR}/isar.lock"
 
+do_apt_unpack() {
+    if [ -z "${@d.getVar("SRC_APT", True).strip()}" ]; then
+        return 0
+    fi
+    rm -rf ${S}
+    dpkg_do_mounts
+    E="${@ isar_export_proxies(d)}"
+
+    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")"
+                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() {
-- 
2.17.1


  reply	other threads:[~2021-03-04 17:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 17:41 [PATCH v3 0/2] Custom ${S} series Vijai Kumar K
2021-03-04 17:41 ` Vijai Kumar K [this message]
2021-03-04 17:41 ` [PATCH v3 2/2] Modify hello to demonstrate apt:// without ${PV} Vijai Kumar K
2021-03-04 18:56 ` [PATCH v3 0/2] Custom ${S} series Henning Schild
2021-03-04 20:53   ` Henning Schild
2021-03-29  9:14 ` Anton Mikanovich
2021-03-30  6:20   ` vijaikumar....@gmail.com

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=20210304174137.11166-2-Vijaikumar_Kanagarajan@mentor.com \
    --to=vijaikumar_kanagarajan@mentor.com \
    --cc=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    /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