All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] scanpypi: use archive file name to specify the extraction folder
@ 2018-11-02 13:45 yegorslists at googlemail.com
  2018-11-02 15:28 ` Asaf Kahlon
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: yegorslists at googlemail.com @ 2018-11-02 13:45 UTC (permalink / raw)
  To: buildroot

From: Yegor Yefremov <yegorslists@googlemail.com>

Some packages have archive name that is different from package name.
For example websocket-client's archive name is websocket_client-*.tar.gz.
scanpypi expects the temporary extract folder to be:

/tmp-folder/BR-package-name/PyPI-packagename-and-version

In the case of websocket-client package the real extraction folder
will be different from the expected one because of the '_' in the
archive file name.

Use archive file name instead of package name to specify the extraction
folder. As the version is already part of this file, we don't need to
specify it.

Bonus: remove obsolete "return None, None" as the function doesn't return
anything. OSError class doesn't provide "message" member, so replace it
with "strerror".

Fixes:
https://bugs.busybox.net/show_bug.cgi?id=11251

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
Changes v1->v2:
	- fix typos
	- add fixes tag

 utils/scanpypi | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/utils/scanpypi b/utils/scanpypi
index 3983be1ad1..3d3e604435 100755
--- a/utils/scanpypi
+++ b/utils/scanpypi
@@ -243,13 +243,14 @@ class BuildrootPackage():
                     os.makedirs(tmp_pkg)
                 except OSError as exception:
                     if exception.errno != errno.EEXIST:
-                        print("ERROR: ", exception.message, file=sys.stderr)
-                        return None, None
-                    print('WARNING:', exception.message, file=sys.stderr)
+                        print("ERROR: ", exception.strerror, file=sys.stderr)
+                        return
+                    print('WARNING:', exception.strerror, file=sys.stderr)
                     print('Removing {pkg}...'.format(pkg=tmp_pkg))
                     shutil.rmtree(tmp_pkg)
                     os.makedirs(tmp_pkg)
                 as_zipfile.extractall(tmp_pkg)
+                pkg_filename = self.filename.split(".zip")[0]
         else:
             with tarfile.open(fileobj=as_file) as as_tarfile:
                 tmp_pkg = os.path.join(tmp_path, self.buildroot_name)
@@ -257,19 +258,19 @@ class BuildrootPackage():
                     os.makedirs(tmp_pkg)
                 except OSError as exception:
                     if exception.errno != errno.EEXIST:
-                        print("ERROR: ", exception.message, file=sys.stderr)
-                        return None, None
-                    print('WARNING:', exception.message, file=sys.stderr)
+                        print("ERROR: ", exception.strerror, file=sys.stderr)
+                        return
+                    print('WARNING:', exception.strerror, file=sys.stderr)
                     print('Removing {pkg}...'.format(pkg=tmp_pkg))
                     shutil.rmtree(tmp_pkg)
                     os.makedirs(tmp_pkg)
                 as_tarfile.extractall(tmp_pkg)
+                pkg_filename = self.filename.split(".tar")[0]
 
-        tmp_extract = '{folder}/{name}-{version}'
+        tmp_extract = '{folder}/{name}'
         self.tmp_extract = tmp_extract.format(
             folder=tmp_pkg,
-            name=self.metadata_name,
-            version=self.version)
+            name=pkg_filename)
 
     def load_setup(self):
         """
-- 
2.17.0

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

* [Buildroot] [PATCH v2] scanpypi: use archive file name to specify the extraction folder
  2018-11-02 13:45 [Buildroot] [PATCH v2] scanpypi: use archive file name to specify the extraction folder yegorslists at googlemail.com
@ 2018-11-02 15:28 ` Asaf Kahlon
  2018-11-02 20:36 ` Thomas Petazzoni
  2018-11-14 22:36 ` Peter Korsgaard
  2 siblings, 0 replies; 5+ messages in thread
From: Asaf Kahlon @ 2018-11-02 15:28 UTC (permalink / raw)
  To: buildroot

On Fri, Nov 2, 2018 at 3:45 PM <yegorslists@googlemail.com> wrote:
>
> From: Yegor Yefremov <yegorslists@googlemail.com>

Reviewed-by: Asaf Kahlon <asafka7@gmail.com>
>
> Some packages have archive name that is different from package name.
> For example websocket-client's archive name is websocket_client-*.tar.gz.
> scanpypi expects the temporary extract folder to be:
>
> /tmp-folder/BR-package-name/PyPI-packagename-and-version
>
> In the case of websocket-client package the real extraction folder
> will be different from the expected one because of the '_' in the
> archive file name.
>
> Use archive file name instead of package name to specify the extraction
> folder. As the version is already part of this file, we don't need to
> specify it.
>
> Bonus: remove obsolete "return None, None" as the function doesn't return
> anything. OSError class doesn't provide "message" member, so replace it
> with "strerror".
>
> Fixes:
> https://bugs.busybox.net/show_bug.cgi?id=11251
>
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
> Changes v1->v2:
>         - fix typos
>         - add fixes tag
>
>  utils/scanpypi | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/utils/scanpypi b/utils/scanpypi
> index 3983be1ad1..3d3e604435 100755
> --- a/utils/scanpypi
> +++ b/utils/scanpypi
> @@ -243,13 +243,14 @@ class BuildrootPackage():
>                      os.makedirs(tmp_pkg)
>                  except OSError as exception:
>                      if exception.errno != errno.EEXIST:
> -                        print("ERROR: ", exception.message, file=sys.stderr)
> -                        return None, None
> -                    print('WARNING:', exception.message, file=sys.stderr)
> +                        print("ERROR: ", exception.strerror, file=sys.stderr)
> +                        return
> +                    print('WARNING:', exception.strerror, file=sys.stderr)
>                      print('Removing {pkg}...'.format(pkg=tmp_pkg))
>                      shutil.rmtree(tmp_pkg)
>                      os.makedirs(tmp_pkg)
>                  as_zipfile.extractall(tmp_pkg)
> +                pkg_filename = self.filename.split(".zip")[0]
>          else:
>              with tarfile.open(fileobj=as_file) as as_tarfile:
>                  tmp_pkg = os.path.join(tmp_path, self.buildroot_name)
> @@ -257,19 +258,19 @@ class BuildrootPackage():
>                      os.makedirs(tmp_pkg)
>                  except OSError as exception:
>                      if exception.errno != errno.EEXIST:
> -                        print("ERROR: ", exception.message, file=sys.stderr)
> -                        return None, None
> -                    print('WARNING:', exception.message, file=sys.stderr)
> +                        print("ERROR: ", exception.strerror, file=sys.stderr)
> +                        return
> +                    print('WARNING:', exception.strerror, file=sys.stderr)
>                      print('Removing {pkg}...'.format(pkg=tmp_pkg))
>                      shutil.rmtree(tmp_pkg)
>                      os.makedirs(tmp_pkg)
>                  as_tarfile.extractall(tmp_pkg)
> +                pkg_filename = self.filename.split(".tar")[0]
>
> -        tmp_extract = '{folder}/{name}-{version}'
> +        tmp_extract = '{folder}/{name}'
>          self.tmp_extract = tmp_extract.format(
>              folder=tmp_pkg,
> -            name=self.metadata_name,
> -            version=self.version)
> +            name=pkg_filename)
>
>      def load_setup(self):
>          """
> --
> 2.17.0
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2] scanpypi: use archive file name to specify the extraction folder
  2018-11-02 13:45 [Buildroot] [PATCH v2] scanpypi: use archive file name to specify the extraction folder yegorslists at googlemail.com
  2018-11-02 15:28 ` Asaf Kahlon
@ 2018-11-02 20:36 ` Thomas Petazzoni
  2018-11-05  8:22   ` Yegor Yefremov
  2018-11-14 22:36 ` Peter Korsgaard
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2018-11-02 20:36 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri,  2 Nov 2018 14:45:01 +0100, yegorslists at googlemail.com wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
> 
> Some packages have archive name that is different from package name.
> For example websocket-client's archive name is websocket_client-*.tar.gz.
> scanpypi expects the temporary extract folder to be:
> 
> /tmp-folder/BR-package-name/PyPI-packagename-and-version
> 
> In the case of websocket-client package the real extraction folder
> will be different from the expected one because of the '_' in the
> archive file name.
> 
> Use archive file name instead of package name to specify the extraction
> folder. As the version is already part of this file, we don't need to
> specify it.
> 
> Bonus: remove obsolete "return None, None" as the function doesn't return
> anything. OSError class doesn't provide "message" member, so replace it
> with "strerror".

I've applied to master, but I believe it should perhaps have been two
separate patches. Indeed, I don't see the relationship between the use
of the archive file name, and the change around "return None, None".

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH v2] scanpypi: use archive file name to specify the extraction folder
  2018-11-02 20:36 ` Thomas Petazzoni
@ 2018-11-05  8:22   ` Yegor Yefremov
  0 siblings, 0 replies; 5+ messages in thread
From: Yegor Yefremov @ 2018-11-05  8:22 UTC (permalink / raw)
  To: buildroot

On Fri, Nov 2, 2018 at 9:36 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> On Fri,  2 Nov 2018 14:45:01 +0100, yegorslists at googlemail.com wrote:
> > From: Yegor Yefremov <yegorslists@googlemail.com>
> >
> > Some packages have archive name that is different from package name.
> > For example websocket-client's archive name is websocket_client-*.tar.gz.
> > scanpypi expects the temporary extract folder to be:
> >
> > /tmp-folder/BR-package-name/PyPI-packagename-and-version
> >
> > In the case of websocket-client package the real extraction folder
> > will be different from the expected one because of the '_' in the
> > archive file name.
> >
> > Use archive file name instead of package name to specify the extraction
> > folder. As the version is already part of this file, we don't need to
> > specify it.
> >
> > Bonus: remove obsolete "return None, None" as the function doesn't return
> > anything. OSError class doesn't provide "message" member, so replace it
> > with "strerror".
>
> I've applied to master, but I believe it should perhaps have been two
> separate patches. Indeed, I don't see the relationship between the use
> of the archive file name, and the change around "return None, None".

You're right. Will do next time.

Yegor

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

* [Buildroot] [PATCH v2] scanpypi: use archive file name to specify the extraction folder
  2018-11-02 13:45 [Buildroot] [PATCH v2] scanpypi: use archive file name to specify the extraction folder yegorslists at googlemail.com
  2018-11-02 15:28 ` Asaf Kahlon
  2018-11-02 20:36 ` Thomas Petazzoni
@ 2018-11-14 22:36 ` Peter Korsgaard
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2018-11-14 22:36 UTC (permalink / raw)
  To: buildroot

>>>>> "yegorslists" == yegorslists  <yegorslists@googlemail.com> writes:

 > From: Yegor Yefremov <yegorslists@googlemail.com>
 > Some packages have archive name that is different from package name.
 > For example websocket-client's archive name is websocket_client-*.tar.gz.
 > scanpypi expects the temporary extract folder to be:

 > /tmp-folder/BR-package-name/PyPI-packagename-and-version

 > In the case of websocket-client package the real extraction folder
 > will be different from the expected one because of the '_' in the
 > archive file name.

 > Use archive file name instead of package name to specify the extraction
 > folder. As the version is already part of this file, we don't need to
 > specify it.

 > Bonus: remove obsolete "return None, None" as the function doesn't return
 > anything. OSError class doesn't provide "message" member, so replace it
 > with "strerror".

 > Fixes:
 > https://bugs.busybox.net/show_bug.cgi?id=11251

 > Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
 > ---
 > Changes v1->v2:
 > 	- fix typos
 > 	- add fixes tag

Committed to 2018.02.x and 2018.08.x, thanks.

-- 
Bye, Peter Korsgaard

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

end of thread, other threads:[~2018-11-14 22:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-02 13:45 [Buildroot] [PATCH v2] scanpypi: use archive file name to specify the extraction folder yegorslists at googlemail.com
2018-11-02 15:28 ` Asaf Kahlon
2018-11-02 20:36 ` Thomas Petazzoni
2018-11-05  8:22   ` Yegor Yefremov
2018-11-14 22:36 ` Peter Korsgaard

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.