Skip to contentSkip to conversation

package.bbclass: Call os.chmod after os.mkdir

PATCH In review Martin Jansa 2 participants 2 messages Sep 8, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package.bbclass: Call os.chmod after os.mkdir

* in 556dee0c4d6d8a87c0cddbd2f60fe5917d009f18 os.chmod was replaced by 2nd param to os.mkdir:

  -      bb.utils.mkdirhier(dest)
  -      fstat = os.stat(src)
  -      os.chmod(dest, fstat.st_mode)
  +      fstat = cpath.stat(src)
  +      os.mkdir(dest, fstat.st_mode)

but fstat in os.mkdir, doesn't work the same as good old os.chmod:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

p='test-p'
os.mkdir(p, 041777)
oct(os.stat(p).st_mode)

'041775'

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

os.chmod(p, 041777)
oct(os.stat(p).st_mode)

'041777'

---
 meta/classes/package.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/classes/package.bbclass +2 -1
index bdac2bd..c96acd2 100644
@@ -988,8 +988,9 @@ python populate_packages () {
             def mkdir(src, dest, p):
                 src = os.path.join(src, p)
                 dest = os.path.join(dest, p)
+                bb.utils.mkdirhier(dest)
                 fstat = cpath.stat(src)
-                os.mkdir(dest, fstat.st_mode)
+                os.chmod(dest, fstat.st_mode)
                 os.chown(dest, fstat.st_uid, fstat.st_gid)
                 if p not in seen:
                     seen.append(p)
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 27 lines · Martin Jansa

* in 556dee0c4d6d8a87c0cddbd2f60fe5917d009f18 os.chmod was replaced by 2nd param to os.mkdir:

  -      bb.utils.mkdirhier(dest)
  -      fstat = os.stat(src)
  -      os.chmod(dest, fstat.st_mode)
  +      fstat = cpath.stat(src)
  +      os.mkdir(dest, fstat.st_mode)

but fstat in os.mkdir, doesn't work the same as good old os.chmod:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

p='test-p'
os.mkdir(p, 041777)
oct(os.stat(p).st_mode)

'041775'

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

os.chmod(p, 041777)
oct(os.stat(p).st_mode)

'041777'

---
 meta/classes/package.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/classes/package.bbclass +0 -0
index bdac2bd..c96acd2 100644

meta/classes/package.bbclass python populate_packages () { · line 996

Quoted 10 lines
meta/classes/package.bbclass +2 -1
@@ -988,8 +988,9 @@ python populate_packages () {
             def mkdir(src, dest, p):
                 src = os.path.join(src, p)
                 dest = os.path.join(dest, p)
+                bb.utils.mkdirhier(dest)
                 fstat = cpath.stat(src)
-                os.mkdir(dest, fstat.st_mode)
+                os.chmod(dest, fstat.st_mode)
                 os.chown(dest, fstat.st_uid, fstat.st_gid)
                 if p not in seen:
                     seen.append(p)

Can we set and then restore the umask to avoid having to do this? I ask since from what I remember, changing things like this is quite expensive performance wise :(

Cheers,

Richard