All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fetch2: save/restore cwd for mirror URL downloads
@ 2016-08-07 13:37 Matt Madison
  0 siblings, 0 replies; 4+ messages in thread
From: Matt Madison @ 2016-08-07 13:37 UTC (permalink / raw)
  To: bitbake-devel

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



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

* Re: [PATCH] fetch2: save/restore cwd for mirror URL downloads
  2016-08-10 10:40 ` Richard Purdie
@ 2016-08-10 12:25   ` Matt Madison
  0 siblings, 0 replies; 4+ messages in thread
From: Matt Madison @ 2016-08-10 12:25 UTC (permalink / raw)
  To: Richard Purdie; +Cc: bitbake-devel

On Wed, Aug 10, 2016 at 3:40 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Mon, 2016-08-08 at 15:43 -0700, Matt Madison wrote:
>> 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(+)
>
> bitbake-selftest doesn't seem to like this change:
>
> https://autobuilder.yoctoproject.org/main/builders/nightly/builds/973/steps/BitbakeSelftest/logs/stdio
>
> I do wonder if we need to fix the individual fetcher modules...

I could at least rework the patch to put the getcwd call into a
try/except block.  I'll
take a closer look.

Thanks,
-Matt

>
> Cheers,
>
> Richard
>
>> 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
>>


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

* Re: [PATCH] fetch2: save/restore cwd for mirror URL downloads
  2016-08-08 22:43 Matt Madison
@ 2016-08-10 10:40 ` Richard Purdie
  2016-08-10 12:25   ` Matt Madison
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2016-08-10 10:40 UTC (permalink / raw)
  To: Matt Madison, bitbake-devel

On Mon, 2016-08-08 at 15:43 -0700, Matt Madison wrote:
> 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(+)

bitbake-selftest doesn't seem to like this change:

https://autobuilder.yoctoproject.org/main/builders/nightly/builds/973/steps/BitbakeSelftest/logs/stdio

I do wonder if we need to fix the individual fetcher modules...

Cheers,

Richard

> 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
> 


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

* [PATCH] fetch2: save/restore cwd for mirror URL downloads
@ 2016-08-08 22:43 Matt Madison
  2016-08-10 10:40 ` Richard Purdie
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Madison @ 2016-08-08 22:43 UTC (permalink / raw)
  To: bitbake-devel

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



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

end of thread, other threads:[~2016-08-10 12:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-07 13:37 [PATCH] fetch2: save/restore cwd for mirror URL downloads Matt Madison
2016-08-08 22:43 Matt Madison
2016-08-10 10:40 ` Richard Purdie
2016-08-10 12:25   ` Matt Madison

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.