From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7059736144635756544 X-Received: by 2002:a5d:64c4:: with SMTP id f4mr2090854wri.278.1643971879586; Fri, 04 Feb 2022 02:51:19 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:600c:3487:: with SMTP id a7ls6022778wmq.2.canary-gmail; Fri, 04 Feb 2022 02:51:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxun1OEXWuQ+bSVwVC0j9jyPCqHYB1v5HXMRKzp8h60YYuagQNRkJmaH07jLAIoLBo8tAtT X-Received: by 2002:a05:600c:4308:: with SMTP id p8mr1742545wme.72.1643971878327; Fri, 04 Feb 2022 02:51:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643971878; cv=none; d=google.com; s=arc-20160816; b=xfip/46XRn7eXS8k5V0ZiGt3w2MnJUgi65Ate/M8HWQ8XQ/t4Ht5lJBTMLHoDpXAf6 p1Ep/m5+oYYOCLSvLYRhYO0iSprogOMp3h3TugU1Ew+9J+p4KU2+lzBEzwHY4xBwRX13 km17QFKBSKupzHzJUCJhLLdVc0IrjYgt6KcrlWOYHY8IZ0EKgQQn2LL8W3+oOdb0zvro OFmln8wP6t8YsRkT/FzOsLx2ZzaIfp7+HmyqsnXH6F3P2VqwX8h7/HV6uXz9cJ8WKSED +94mKwqynNdWvQK1xLQegyY+6pKP4ywOk2Sh1fXldb36la8ycirel+w0v03FdLMJEIol hehA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=2GZDAAYYldAndGXyIqUg+n3ZPrmSxOookFXfi2acu3w=; b=imEwMe/o786BCDhXByNpawYonSqC0ctgDuCSRuiUBeWOoHbuRgkNraoKPnoX+Ufviz 2goD/xkx8jrMV/Uu+1lFQAjSUSsuX5DP2uQw7zwOjPc8usDh1ojSYVqPBTS6HBTSeAjK u1ENB+bvGZwIgxR/JWPBz5HlQJr+kfXoPmrkxht2sOVUVU52YdQsd8Yg/HL4qsE21YV9 iABr0aiel78d3tn2VgmpFkzgWN/LNYaMcgkFUqbEzKEihoQ8gxeECAoT/MyeNGx8cfwV a0lQ4gzdSqb8Axl2SDBhTiIPvbVTJVOB7scvQBGWYKGtd4wXGTj90PRiylr3HPlHiAtE e6Mg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 68.232.137.180 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com. [68.232.137.180]) by gmr-mx.google.com with ESMTPS id be15si347876wmb.0.2022.02.04.02.51.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Feb 2022 02:51:18 -0800 (PST) Received-SPF: pass (google.com: domain of cedric_hombourger@mentor.com designates 68.232.137.180 as permitted sender) client-ip=68.232.137.180; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 68.232.137.180 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com IronPort-SDR: dNGypEWXkp3ushT5Q2dFclP9kRUKTBmthtyGG5eTRMEOHQ+BpZDE3tCOPyWwaU1yidld0kuq3l ok3gEXplTKW/CLu/kCxLpfaJ26cvGrTmUeBN8Z9glMuvOTme9NWynh8i/YkXgZVnVhe7QOdtht FXRJZ+ZbE8TkehJLZmAEjYf6vj3BtvMNeNKaMW3he5/yFPWhLls74RF9hTBJuwjgEWTI6UZ2qx eJGmAwCo2qyQBeVyWsgwlw9IY9DglmLwxS+P3Hmn1lUVUfK+RyVSaeWJ7rrUZpNt/eBtGr+MCh miWC+f/6ZewhfXp9ljE+hNFh X-IronPort-AV: E=Sophos;i="5.88,342,1635235200"; d="scan'208";a="71428267" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 04 Feb 2022 02:51:16 -0800 IronPort-SDR: Cc4vCZo71NMUu/NhwFzdwvYbOBLXD4YQS1SuWe3ho55aENONC8xmbq5+0Eodjtb0d+pEriGp7K OTMZ0/NWgsricZV/dRdW6I2igTz9NauadQXatEu/zhTvTtsUh5Ix1/Gzv6T45HLYad5pzVgoU6 PijbJ8S1+93EiaQyMgaD325vkkjNVvk/K9F2e+mvvnWfGRJ9byM1dM/HSGjnek+GHg4KfhH1ec KkiXXSDG758CdgFyn0TuxzlMHDEHRwiFp25BoTLXBgQkxKQtLnszWQAqxCJb3Q+X1EdMhVBvAb Uxc= From: Cedric Hombourger To: CC: Cedric Hombourger Subject: [[PATCH v2]] dpkg-base: resolve DL_DIR in do_adjust_git Date: Fri, 4 Feb 2022 11:50:55 +0100 Message-ID: <20220204105055.30050-1-Cedric_Hombourger@mentor.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <0a7f590d-63f5-5505-a9c9-718f9d8c81fb@siemens.com> References: <0a7f590d-63f5-5505-a9c9-718f9d8c81fb@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Return-Path: Cedric_Hombourger@mentor.com X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-14.mgc.mentorg.com (139.181.222.14) To svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) X-TUID: Ig4BYHhGSu/3 From: Cedric Hombourger 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. Disposition: Submit upstream Signed-off-by: Cedric Hombourger --- 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) -- 2.30.2