[RFC,05/15] bitbake: fetch2: Support archives with missing search directory mode

Message ID 20211124144739.2250-6-stefan.herbrechtsmeier-oss@weidmueller.com
State New
Headers show
Series Rework npm support | expand

Commit Message

Stefan Herbrechtsmeier Nov. 24, 2021, 2:47 p.m. UTC
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
---

 bitbake/lib/bb/fetch2/__init__.py | 1 +
 1 file changed, 1 insertion(+)

Comments

Alexander Kanavin Nov. 24, 2021, 3:17 p.m. UTC | #1
Is it the missing x bit on directories? If you've encountered this, then
where did it happen, and shouldn't the tarball be fixed instead?

Alex

On Wed, 24 Nov 2021 at 15:48, Stefan Herbrechtsmeier <
stefan.herbrechtsmeier-oss@weidmueller.com> wrote:

> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>
> Signed-off-by: Stefan Herbrechtsmeier <
> stefan.herbrechtsmeier@weidmueller.com>
> ---
>
>  bitbake/lib/bb/fetch2/__init__.py | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/bitbake/lib/bb/fetch2/__init__.py
> b/bitbake/lib/bb/fetch2/__init__.py
> index 05b2d2e924..8ad4e3a5ec 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -1554,6 +1554,7 @@ class FetchMethod(object):
>          path = data.getVar('PATH')
>          if path:
>              cmd = "PATH=\"%s\" %s" % (path, cmd)
> +        cmd += " && chmod -R +X %s" % (unpackdir)
>          bb.note("Unpacking %s to %s/" % (file, unpackdir))
>          ret = subprocess.call(cmd, preexec_fn=subprocess_setup,
> shell=True, cwd=unpackdir)
>
> --
> 2.20.1
>
>
Stefan Herbrechtsmeier Nov. 24, 2021, 5:11 p.m. UTC | #2
Am 24.11.2021 um 16:17 schrieb Alexander Kanavin:
> Is it the missing x bit on directories? 

Yes.

https://registry.npmjs.org/protoc/-/protoc-1.0.4.tgz


> If you've encountered this, then 
> where did it happen,

cp: cannot stat 
'.../git/ui/./node_modules/protoc/scripts/postinstall.js': Permission denied

> and shouldn't the tarball be fixed instead?

How should we fix a tarball from npmjs.com?


Is such an influencing change acceptable or should I move the change to 
the npm class?

> On Wed, 24 Nov 2021 at 15:48, Stefan Herbrechtsmeier 
> <stefan.herbrechtsmeier-oss@weidmueller.com 
> <mailto:stefan.herbrechtsmeier-oss@weidmueller.com>> wrote:
> 
>     From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com
>     <mailto:stefan.herbrechtsmeier@weidmueller.com>>
> 
>     Signed-off-by: Stefan Herbrechtsmeier
>     <stefan.herbrechtsmeier@weidmueller.com
>     <mailto:stefan.herbrechtsmeier@weidmueller.com>>
>     ---
> 
>       bitbake/lib/bb/fetch2/__init__.py | 1 +
>       1 file changed, 1 insertion(+)
> 
>     diff --git a/bitbake/lib/bb/fetch2/__init__.py
>     b/bitbake/lib/bb/fetch2/__init__.py
>     index 05b2d2e924..8ad4e3a5ec 100644
>     --- a/bitbake/lib/bb/fetch2/__init__.py
>     +++ b/bitbake/lib/bb/fetch2/__init__.py
>     @@ -1554,6 +1554,7 @@ class FetchMethod(object):
>               path = data.getVar('PATH')
>               if path:
>                   cmd = "PATH=\"%s\" %s" % (path, cmd)
>     +        cmd += " && chmod -R +X %s" % (unpackdir)
>               bb.note("Unpacking %s to %s/" % (file, unpackdir))
>               ret = subprocess.call(cmd, preexec_fn=subprocess_setup,
>     shell=True, cwd=unpackdir)
> 
>     -- 
>     2.20.1
>
Alexander Kanavin Nov. 24, 2021, 5:14 p.m. UTC | #3
On Wed, 24 Nov 2021 at 18:11, Stefan Herbrechtsmeier <
stefan.herbrechtsmeier-oss@weidmueller.com> wrote:

>
> > and shouldn't the tarball be fixed instead?
>
> How should we fix a tarball from npmjs.com?
>

By submitting a bug report or (better) a patch to the maintainers of the
tarball?

Alex
Stefan Herbrechtsmeier Nov. 24, 2021, 5:43 p.m. UTC | #4
Am 24.11.2021 um 18:14 schrieb Alexander Kanavin:
> On Wed, 24 Nov 2021 at 18:11, Stefan Herbrechtsmeier 
> <stefan.herbrechtsmeier-oss@weidmueller.com 
> <mailto:stefan.herbrechtsmeier-oss@weidmueller.com>> wrote:
> 
> 
>      > and shouldn't the tarball be fixed instead?
> 
>     How should we fix a tarball from npmjs.com <http://npmjs.com>?
> 
> 
> By submitting a bug report or (better) a patch to the maintainers of the 
> tarball?

The package is only an example and fixed on the fly by npm install.

The world is different in the npm ecosystem. The package is 2 years old, 
have no maintainer, no repository and 4k downloads per week. Furthermore 
you have to convince your dependencies to update their dependencies 
after you have fix a package.
Richard Purdie Nov. 24, 2021, 5:54 p.m. UTC | #5
On Wed, 2021-11-24 at 18:11 +0100, Stefan Herbrechtsmeier wrote:
> Am 24.11.2021 um 16:17 schrieb Alexander Kanavin:
> > Is it the missing x bit on directories? 
> 
> Yes.
> 
> https://registry.npmjs.org/protoc/-/protoc-1.0.4.tgz
> 
> 
> > If you've encountered this, then 
> > where did it happen,
> 
> cp: cannot stat 
> '.../git/ui/./node_modules/protoc/scripts/postinstall.js': Permission denied
> 
> > and shouldn't the tarball be fixed instead?
> 
> How should we fix a tarball from npmjs.com?
> 
> 
> Is such an influencing change acceptable or should I move the change to 
> the npm class?

We don't want to support that in the general case, that needs to be in the npm
class.

Cheers,

Richard
Stefan Herbrechtsmeier Nov. 25, 2021, 10:40 a.m. UTC | #6
Am 24.11.2021 um 18:54 schrieb Richard Purdie:
> On Wed, 2021-11-24 at 18:11 +0100, Stefan Herbrechtsmeier wrote:
>> Am 24.11.2021 um 16:17 schrieb Alexander Kanavin:

[snip]

>> Is such an influencing change acceptable or should I move the change to
>> the npm class?
> 
> We don't want to support that in the general case, that needs to be in the npm
> class.

I have test it but this doesn't work for recipetool. Should I add a fix 
to create_npm.py and the npm.bbclass?

Patch

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 05b2d2e924..8ad4e3a5ec 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1554,6 +1554,7 @@  class FetchMethod(object):
         path = data.getVar('PATH')
         if path:
             cmd = "PATH=\"%s\" %s" % (path, cmd)
+        cmd += " && chmod -R +X %s" % (unpackdir)
         bb.note("Unpacking %s to %s/" % (file, unpackdir))
         ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True, cwd=unpackdir)