public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] dpkg: warn when S equals WORKDIR
@ 2019-04-29 11:06 Henning Schild
  2019-05-14 12:42 ` Maxim Yu. Osipov
  0 siblings, 1 reply; 2+ messages in thread
From: Henning Schild @ 2019-04-29 11:06 UTC (permalink / raw)
  To: isar-users; +Cc: Henning Schild

From: Henning Schild <henning.schild@siemens.com>

This patch does not change any logic, it just introduces a warning. If S
is not a directory inside WORKDIR do_deploy_deb and repo_clean will not
actually find any "*.deb" because they remain inside buildchroot.
Finding debs relative to BUILDROOT instead of S would require mounting
and locking. Intead of doing all of that document the small
limitation/assumption with a warning.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/classes/dpkg-base.bbclass | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 742b8ad..e31dd8d 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -45,9 +45,12 @@ do_apt_fetch[lockfiles] += "${REPO_ISAR_DIR}/isar.lock"
 do_apt_fetch[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
 
 def get_package_srcdir(d):
-    s = d.getVar("S", True)
-    workdir = d.getVar("WORKDIR", True)
-    if s.startswith(workdir):
+    s = os.path.abspath(d.getVar("S", True))
+    workdir = os.path.abspath(d.getVar("WORKDIR", True))
+    if os.path.commonpath([s, workdir]) == workdir:
+        if s == workdir:
+            bb.warn('S is not a subdir of WORKDIR debian package operations' +
+                    ' will not work for this recipe.')
         return s[len(workdir)+1:]
     bb.warn('S does not start with WORKDIR')
     return s
-- 
2.21.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dpkg: warn when S equals WORKDIR
  2019-04-29 11:06 [PATCH] dpkg: warn when S equals WORKDIR Henning Schild
@ 2019-05-14 12:42 ` Maxim Yu. Osipov
  0 siblings, 0 replies; 2+ messages in thread
From: Maxim Yu. Osipov @ 2019-05-14 12:42 UTC (permalink / raw)
  To: Henning Schild, isar-users

On 4/29/19 1:06 PM, Henning Schild wrote:
> From: Henning Schild <henning.schild@siemens.com>
> 
> This patch does not change any logic, it just introduces a warning. If S
> is not a directory inside WORKDIR do_deploy_deb and repo_clean will not
> actually find any "*.deb" because they remain inside buildchroot.
> Finding debs relative to BUILDROOT instead of S would require mounting
> and locking. Intead of doing all of that document the small
> limitation/assumption with a warning.

Applied to the 'next'.

Thanks,
Maxim.

> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>   meta/classes/dpkg-base.bbclass | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
> index 742b8ad..e31dd8d 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -45,9 +45,12 @@ do_apt_fetch[lockfiles] += "${REPO_ISAR_DIR}/isar.lock"
>   do_apt_fetch[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>   
>   def get_package_srcdir(d):
> -    s = d.getVar("S", True)
> -    workdir = d.getVar("WORKDIR", True)
> -    if s.startswith(workdir):
> +    s = os.path.abspath(d.getVar("S", True))
> +    workdir = os.path.abspath(d.getVar("WORKDIR", True))
> +    if os.path.commonpath([s, workdir]) == workdir:
> +        if s == workdir:
> +            bb.warn('S is not a subdir of WORKDIR debian package operations' +
> +                    ' will not work for this recipe.')
>           return s[len(workdir)+1:]
>       bb.warn('S does not start with WORKDIR')
>       return s
> 


-- 
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mosipov@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-14 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29 11:06 [PATCH] dpkg: warn when S equals WORKDIR Henning Schild
2019-05-14 12:42 ` Maxim Yu. Osipov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox