public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: Cedric Hombourger <Cedric_Hombourger@mentor.com>
Cc: <isar-users@googlegroups.com>,
	Cedric Hombourger <cedric.hombourger@siemens.com>
Subject: Re: [PATCH v3] dpkg-base: resolve DL_DIR in do_adjust_git
Date: Fri, 4 Feb 2022 13:30:36 +0100	[thread overview]
Message-ID: <20220204133036.432f744c@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20220204105418.30167-1-Cedric_Hombourger@mentor.com>

Working with sstate i found a very similiar thing but in a very
different place.

https://github.com/henning-schild-work/isar/commit/d7eff82427fbe8e4f5ef50268804257fc9c143a0

Makes me wonder who is responsible for creating the link, or if every
stakeholder is just hammering around.

In fact i still vote for dropping adjust git and using "no shared"
cloning.

Henning

Am Fri, 4 Feb 2022 11:54:18 +0100
schrieb Cedric Hombourger <Cedric_Hombourger@mentor.com>:

> From: Cedric Hombourger <cedric.hombourger@siemens.com>
> 
> git_link is resolved using os.path.realpath() but git_dl is not.
> If DL_DIR points to a symbolic link, the comparison will always
> fail and do_adjust_git() will attempt to re-create the symbolic
> link. Resolve DL_DIR for a comparison between resolved paths.
> In the event where paths do differ, the symbolic link needs to
> be deleted first.
> 
> Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
> ---
>  meta/classes/dpkg-base.bbclass | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/classes/dpkg-base.bbclass
> b/meta/classes/dpkg-base.bbclass index 2add0b2..258e040 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -20,9 +20,13 @@ python do_adjust_git() {
>      rootdir = d.getVar('WORKDIR', True)
>  
>      git_link = os.path.join(d.getVar('GIT_DL_LINK_DIR'),
> '.git-downloads')
> -    git_dl = os.path.join(d.getVar("DL_DIR"), "git")
> +    dl_dir = os.path.realpath(d.getVar("DL_DIR"))
> +    git_dl = os.path.join(dl_dir, "git")
>  
> -    if not os.path.exists(git_link) or os.path.realpath(git_link) !=
> git_dl:
> +    if os.path.exists(git_link) and os.path.realpath(git_link) !=
> git_dl:
> +        os.unlink(git_link)
> +
> +    if not os.path.exists(git_link):
>          os.symlink(git_dl, git_link)
>  
>      for src_uri in (d.getVar("SRC_URI", True) or "").split():
> @@ -34,7 +38,7 @@ python do_adjust_git() {
>  
>              if os.path.islink(ud.localpath):
>                  realpath = os.path.realpath(ud.localpath)
> -                filter_out = os.path.join(d.getVar("DL_DIR"), "git")
> + "/"
> +                filter_out = git_dl + "/"
>                  if realpath.startswith(filter_out):
>                      # make the link relative
>                      link = realpath.replace(filter_out, '', 1)


  parent reply	other threads:[~2022-02-04 12:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 13:41 [PATCH] dpkg-base: cope with race around check/creation of .git-downloads symlink Cedric Hombourger
2022-02-02  7:05 ` Jan Kiszka
2022-02-04  8:34   ` Cedric Hombourger
2022-02-04 10:50   ` [[PATCH v2]] dpkg-base: resolve DL_DIR in do_adjust_git Cedric Hombourger
2022-02-04 10:54   ` [PATCH v3] " Cedric Hombourger
2022-02-04 11:04     ` Jan Kiszka
2022-02-04 12:45       ` Cedric Hombourger
2022-02-09  8:12         ` [PATCH v4 0/1] " Cedric Hombourger
2022-02-09  8:12           ` [PATCH v4 1/1] " Cedric Hombourger
2022-02-21  9:25           ` [PATCH v4 0/1] " Anton Mikanovich
2022-02-04 12:30     ` Henning Schild [this message]
2022-02-04 12:43       ` [PATCH v3] " Jan Kiszka
2023-02-16 12:57       ` Henning Schild

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=20220204133036.432f744c@md1za8fc.ad001.siemens.net \
    --to=henning.schild@siemens.com \
    --cc=Cedric_Hombourger@mentor.com \
    --cc=cedric.hombourger@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