All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Madison <matt@madison.systems>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH] fetch2: save/restore cwd for mirror URL downloads
Date: Mon,  8 Aug 2016 15:43:43 -0700	[thread overview]
Message-ID: <1470696223-9260-1-git-send-email-matt@madison.systems> (raw)

Fixes "changed cwd" warnings from setscene tasks when the
packages are downloaded from a shared-state mirror.

Signed-off-by: Matt Madison <matt@madison.systems>
---
 lib/bb/fetch2/__init__.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 9054b2e..c0017a8 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -928,6 +928,8 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
     if ud.lockfile and ud.lockfile != origud.lockfile:
         lf = bb.utils.lockfile(ud.lockfile)
 
+    save_cwd = os.getcwd()
+
     try:
         if check:
             found = ud.method.checkstatus(fetch, ud, ld)
@@ -995,6 +997,7 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
             pass
         return False
     finally:
+        os.chdir(save_cwd)
         if ud.lockfile and ud.lockfile != origud.lockfile:
             bb.utils.unlockfile(lf)
 
@@ -1558,6 +1561,7 @@ class Fetch(object):
 
         network = self.d.getVar("BB_NO_NETWORK", True)
         premirroronly = (self.d.getVar("BB_FETCH_PREMIRRORONLY", True) == "1")
+        save_cwd = os.getcwd()
 
         for u in urls:
             ud = self.ud[u]
@@ -1635,6 +1639,7 @@ class Fetch(object):
             finally:
                 if ud.lockfile:
                     bb.utils.unlockfile(lf)
+        os.chdir(save_cwd)
 
     def checkstatus(self, urls=None):
         """
-- 
2.7.4



             reply	other threads:[~2016-08-08 22:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 22:43 Matt Madison [this message]
2016-08-10 10:40 ` [PATCH] fetch2: save/restore cwd for mirror URL downloads Richard Purdie
2016-08-10 12:25   ` Matt Madison
  -- strict thread matches above, loose matches on Subject: below --
2016-08-07 13:37 Matt Madison

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=1470696223-9260-1-git-send-email-matt@madison.systems \
    --to=matt@madison.systems \
    --cc=bitbake-devel@lists.openembedded.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.