Add the ability to specify a umask per task
cover Add the ability to specify a umask per task
Add the ability to spcify a umask per-task.
The following changes since commit 5481cc90645e13c4e3cdea41e8e369528a0b1649:
doc/usermanual.xml: Tweaks for the manual (2011-06-22 16:30:26 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib mhatle/bitbake
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=mhatle/bitbake
Mark Hatle (1):
runqueue.py: Add umask task control
lib/bb/build.py | 1 + lib/bb/runqueue.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.3.4
PATCH 1/1 runqueue.py: Add umask task control
The umask for a task can now be set as:
task[umask] = 022
task[umask] = '022'
If specified as a text string, it must be octal. (This is due to recipe parsing where it's always set to a string.)
--- lib/bb/build.py | 1 + lib/bb/runqueue.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-)
lib/bb/build.py +1 -0
@@ -465,6 +465,7 @@ def add_tasks(tasklist, d): getTask('nostamp') getTask('fakeroot') getTask('noexec') + getTask('umask') task_deps['parents'][task] = [] for dep in flags['deps']: dep = data.expand(dep, d)
lib/bb/runqueue.py +12 -0
@@ -1063,8 +1063,17 @@ class RunQueueExecute: # a fork() or exec*() activates PSEUDO... envbackup = {} + umask = -1 taskdep = self.rqdata.dataCache.task_deps[fn] + if 'umask' in taskdep and taskname in taskdep['umask']: + # umask might come in as a number or text string.. + try: + umask = int(taskdep['umask'][taskname],8) + except TypeError: + umask = taskdep['umask'][taskname] + logger.warning("Using umask 0%o %s, %s" % (umask, fn, taskname)) + if 'fakeroot' in taskdep and taskname in taskdep['fakeroot']: envvars = (self.rqdata.dataCache.fakerootenv[fn] or "").split() for key, value in (var.split('=') for var in envvars):
@@ -1103,6 +1112,9 @@ class RunQueueExecute: newsi = os.open(os.devnull, os.O_RDWR) os.dup2(newsi, sys.stdin.fileno()) + if umask != -1: + os.umask(umask) + bb.data.setVar("BB_WORKERCONTEXT", "1", self.cooker.configuration.data) bb.data.setVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY", self, self.cooker.configuration.data) bb.data.setVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY2", fn, self.cooker.configuration.data)
Signature · 1 line
1.7.3.4
Re: [PATCH 1/1] runqueue.py: Add umask task control
I just noticed I left in some debug below..
The line:
logger.warning("Using umask 0%o %s, %s" % (umask, fn, taskname))
should be either commented out or removed. I'd be happy to re-send the pull request if this is easier.
--Mark
Quoted 58 lines · Mark Hatle
The umask for a task can now be set as:
task[umask] = 022
task[umask] = '022'If specified as a text string, it must be octal. (This is due to recipe parsing where it's always set to a string.)
Signed-off-by Mark Hatle <[email protected]>--- lib/bb/build.py | 1 + lib/bb/runqueue.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-)lib/bb/build.py +1
-0@@ -465,6 +465,7 @@ def add_tasks(tasklist, d): getTask('nostamp') getTask('fakeroot') getTask('noexec') + getTask('umask') task_deps['parents'][task] = [] for dep in flags['deps']: dep = data.expand(dep, d)lib/bb/runqueue.py +12
-0@@ -1063,8 +1063,17 @@ class RunQueueExecute: # a fork() or exec*() activates PSEUDO... envbackup = {} + umask = -1 taskdep = self.rqdata.dataCache.task_deps[fn] + if 'umask' in taskdep and taskname in taskdep['umask']: + # umask might come in as a number or text string.. + try: + umask = int(taskdep['umask'][taskname],8) + except TypeError: + umask = taskdep['umask'][taskname] + logger.warning("Using umask 0%o %s, %s" % (umask, fn, taskname)) + if 'fakeroot' in taskdep and taskname in taskdep['fakeroot']: envvars = (self.rqdata.dataCache.fakerootenv[fn] or "").split() for key, value in (var.split('=') for var in envvars):@@ -1103,6 +1112,9 @@ class RunQueueExecute: newsi = os.open(os.devnull, os.O_RDWR) os.dup2(newsi, sys.stdin.fileno()) + if umask != -1: + os.umask(umask) + bb.data.setVar("BB_WORKERCONTEXT", "1", self.cooker.configuration.data) bb.data.setVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY", self, self.cooker.configuration.data) bb.data.setVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY2", fn, self.cooker.configuration.data)
Re: [PATCH 1/1] runqueue.py: Add umask task control
In reply to Mark HatleQuoted 35 lines · Mark Hatle
The umask for a task can now be set as:
task[umask] = 022
task[umask] = '022'If specified as a text string, it must be octal. (This is due to recipe parsing where it's always set to a string.)
Signed-off-by Mark Hatle<[email protected]>--- lib/bb/build.py | 1 + lib/bb/runqueue.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-)lib/bb/build.py +1
-0@@ -465,6 +465,7 @@ def add_tasks(tasklist, d): getTask('nostamp') getTask('fakeroot') getTask('noexec') + getTask('umask') task_deps['parents'][task] = [] for dep in flags['deps']: dep = data.expand(dep, d)lib/bb/runqueue.py +1
-0@@ -1063,8 +1063,17 @@ class RunQueueExecute: # a fork() or exec*() activates PSEUDO... envbackup = {} + umask = -1
lib/bb/runqueue.py class RunQueueExecute: · line 1076
Quoted 10 lines
lib/bb/runqueue.py +8
-0taskdep = self.rqdata.dataCache.task_deps[fn] + if 'umask' in taskdep and taskname in taskdep['umask']: + # umask might come in as a number or text string.. + try: + umask = int(taskdep['umask'][taskname],8) + except TypeError: + umask = taskdep['umask'][taskname] + logger.warning("Using umask 0%o %s, %s" % (umask, fn, taskname)) +
this will be annoying. It should be made part of verbose messages though
Quoted 13 lines
lib/bb/runqueue.py +3
-0if 'fakeroot' in taskdep and taskname in taskdep['fakeroot']: envvars = (self.rqdata.dataCache.fakerootenv[fn] or "").split() for key, value in (var.split('=') for var in envvars):@@ -1103,6 +1112,9 @@ class RunQueueExecute: newsi = os.open(os.devnull, os.O_RDWR) os.dup2(newsi, sys.stdin.fileno()) + if umask != -1: + os.umask(umask) + bb.data.setVar("BB_WORKERCONTEXT", "1", self.cooker.configuration.data) bb.data.setVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY", self, self.cooker.configuration.data) bb.data.setVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY2", fn, self.cooker.configuration.data)
Re: [PATCH 1/1] runqueue.py: Add umask task control
Quoted 37 lines · Khem Raj
Quoted 36 lines · Mark Hatle
The umask for a task can now be set as:
task[umask] = 022
task[umask] = '022'If specified as a text string, it must be octal. (This is due to recipe parsing where it's always set to a string.)
Signed-off-by Mark Hatle<[email protected]>--- lib/bb/build.py | 1 + lib/bb/runqueue.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-)lib/bb/build.py +1
-0@@ -465,6 +465,7 @@ def add_tasks(tasklist, d): getTask('nostamp') getTask('fakeroot') getTask('noexec') + getTask('umask') task_deps['parents'][task] = [] for dep in flags['deps']: dep = data.expand(dep, d)lib/bb/runqueue.py +1
-0@@ -1063,8 +1063,17 @@ class RunQueueExecute: # a fork() or exec*() activates PSEUDO... envbackup = {} + umask = -1
Quoted 11 lines
lib/bb/runqueue.py class RunQueueExecute: · line 1076
Quoted 9 lines
lib/bb/runqueue.py +8
-0taskdep = self.rqdata.dataCache.task_deps[fn] + if 'umask' in taskdep and taskname in taskdep['umask']: + # umask might come in as a number or text string.. + try: + umask = int(taskdep['umask'][taskname],8) + except TypeError: + umask = taskdep['umask'][taskname] + logger.warning("Using umask 0%o %s, %s" % (umask, fn, taskname)) +this will be annoying. It should be made part of verbose messages though
That was a mistake, debugging message that ended up in the pull request.
Quoted 20 lines
Quoted 5 lines
lib/bb/runqueue.py +0
-0if 'fakeroot' in taskdep and taskname in taskdep['fakeroot']: envvars = (self.rqdata.dataCache.fakerootenv[fn] or "").split() for key, value in (var.split('=') for var in envvars):lib/bb/runqueue.py class RunQueueExecute: · line 1120
Quoted 9 lines
lib/bb/runqueue.py +3
-0@@ -1103,6 +1112,9 @@ class RunQueueExecute: newsi = os.open(os.devnull, os.O_RDWR) os.dup2(newsi, sys.stdin.fileno()) + if umask != -1: + os.umask(umask) + bb.data.setVar("BB_WORKERCONTEXT", "1", self.cooker.configuration.data) bb.data.setVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY", self, self.cooker.configuration.data) bb.data.setVar("__RUNQUEUE_DO_NOT_USE_EXTERNALLY2", fn, self.cooker.configuration.data)_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/bitbake-devel