From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7059736144635756544 X-Received: by 2002:a9d:7d90:: with SMTP id j16mr889554otn.166.1643972078374; Fri, 04 Feb 2022 02:54:38 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6870:f60c:: with SMTP id ek12ls220192oab.8.gmail; Fri, 04 Feb 2022 02:54:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwExpnOTE/6VM2Umf5VNivug8wcbOxaHWCLAJAHLiDApoqhIR2tgAtThJ41wUtYlVAKpOob X-Received: by 2002:a05:6870:4145:: with SMTP id r5mr425573oad.350.1643972077762; Fri, 04 Feb 2022 02:54:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643972077; cv=none; d=google.com; s=arc-20160816; b=zg6kwyQTHbqdJbEYPdS/qb6omYfbnZ9ItlR2sX53rIO5VaO/BtGKYtVwsx4YPzbOk6 aPsFUbLcF+DZxT7xHlt/wopJ2XeVn5n5kvKRle3ysOn7/428uqCvOLOgmEAl59iZ3JIz I5rbOSEPEqOi+zvbh4wcfSqI02KMLZyxh9kaCNKxO8xx6u3H49+fc4ojyL32c2D5Vgxu dl2mDKEIogK8DcE9yJimvfOrsMn516tDZEOL3f5KUUK9xd6xvkh9Gp0eOcQtlk7Ck8uL 16vcAY9jhhcJSpU8xu/vh1NFUfwFkEIK0WLU4gHAq2hd6F3saWXVUmkB96KK7pORraa+ hgLg== 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=QAawDA/NCsK8aUhob9QLv+yJtWPOnx4WxmFY32UwDhY=; b=aBYlmmxpMu5VyAppCX5soJT4Yr4XQoRoGbN3vlajuqydagmgDVkuYifZYHxbHgclOc ED6jg2ZNJfd01hIatpcSj49B4fTJsN1ihEaqgr+JDLAKxIqlgsjre+uSxgYmX+IZayif L7masvY6dqB9APH5+EGr5CkqHOETk2FvcbVipvxA3gZ/4JCYUHjIKwtjk8pZPE8WIq+i /wAepU3E2ngJiZyT49/+gwf+h0B2XDcJhAEmfr5sZYKadE+poKmInVua/BN+4aN1663J OVPVc+JZAH7nNeATA2ivj9lRQ38Z6azADlhdVqzQRt/8QiSGqjn4ou7Mvjg7PDfoLxIB OH/Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 68.232.129.153 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com. [68.232.129.153]) by gmr-mx.google.com with ESMTPS id m6si73683oae.3.2022.02.04.02.54.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Feb 2022 02:54:37 -0800 (PST) Received-SPF: pass (google.com: domain of cedric_hombourger@mentor.com designates 68.232.129.153 as permitted sender) client-ip=68.232.129.153; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 68.232.129.153 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com IronPort-SDR: VrUEMr2WRGVu9HygcJD3T3+hfPL9GHAxGOlAndZERY59dY2ZJTUxdVgiOSUEY40wvUHZxLrEy4 wbXGO7Jwm2jC7A0VWPGaCMUNC8f9SVKD1/G0zbu804cFc6Xm8BI8LL/yHOi8wDYvP8FiFFjyXY k3Eukp+mpYfPLqHBqpGCrItZWMphgsB35krHLHjddfHK+jFd21g/N2674hAr25g406XBnff1Lk 9BB5i/bCCDWTlJrY0Uvrbc/Dub2votSGPhSDLCsIKGizzyJ+ePucxLRFqj8wjLYC0slmXlNabU 4ROLVBaZz5SyeYPQjofY2Z/9 X-IronPort-AV: E=Sophos;i="5.88,342,1635235200"; d="scan'208";a="74137808" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 04 Feb 2022 02:54:36 -0800 IronPort-SDR: Md9IzFtAX2CiUKcYl71Y12+jay9elvysTtK3V5VCt1ISIboDQ3DQJFpStORkH2gOUtbEzY3/pr FMsVJBieTUGOiUaVfg0x65N02oQy2HL1UU73GidtY5Gvf9OkOY5gY2MY03wU4xOr3A0g5x98GH 0nuU2g5glUIL3ib9T0kI4p6AgKZHHS10U15ZaG6hzpZ1g5IWTA4B9ABwfsDZgg14bbqUtCxqoi NQOSsytggcldfN8Fk9gt6ya/5W9JwDLQb7e7roXrqmwUwds1tZG43cg+RbOZV5PN6LzIes/lVD 0aU= From: Cedric Hombourger To: CC: Cedric Hombourger Subject: [PATCH v3] dpkg-base: resolve DL_DIR in do_adjust_git Date: Fri, 4 Feb 2022 11:54:18 +0100 Message-ID: <20220204105418.30167-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-10.mgc.mentorg.com (139.181.222.10) To svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) X-TUID: LV9XUytyuWqA 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. 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