Solve Bug 2205 - package.bbclass/linux_so never calls ldconfig
cover Solve Bug 2205 - package.bbclass/linux_so never calls ldconfig
This is because needs_ldconfig is a local function variable. A way to solve would be to define this variable global but this is a discouraged. Another solution would be to return this value in linux_so and i will patch the package class with this fix.
The following changes since commit 190f6d791d51aaa4cfb9f1cf932bc205ff674fb5:
runqemu-internal: Add console=tty for qemuppc and NFS (2012-04-06 01:12:47 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib ag/linux_so
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ag/linux_so
Andrei Gherzan (1):
package.bbclass: needs_ldconfig from linux_so is needed in global
namespace
meta/classes/package.bbclass | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/1 package.bbclass: needs_ldconfig from linux_so is needed in global namespace
"The suite of statements in a function definition executes with a local namespace that is different from the global namespace. This means that all variables created within a function are local to that function. When the suite finishes, these working variables are discarded."
In this way the needs_ldconfig variable in linux_so never gets True in the statements below this function. As global statement is generally discouraged, a return value would be a clean and fast way to solve this issue.
[YOCTO #2205]
--- meta/classes/package.bbclass | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
meta/classes/package.bbclass +3 -1
@@ -1263,6 +1263,7 @@ python package_do_shlibs() { lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}")) def linux_so(root, path, file): + needs_ldconfig = False cmd = d.getVar('OBJDUMP', True) + " -p " + pipes.quote(os.path.join(root, file)) + " 2>/dev/null" cmd = "PATH=\"%s\" %s" % (d.getVar('PATH', True), cmd) fd = os.popen(cmd)
@@ -1283,6 +1284,7 @@ python package_do_shlibs() { needs_ldconfig = True if snap_symlinks and (file != this_soname): renames.append((os.path.join(root, file), os.path.join(root, this_soname))) + return needs_ldconfig def darwin_so(root, path, file): fullpath = os.path.join(root, file)
@@ -1382,7 +1384,7 @@ python package_do_shlibs() { if targetos == "darwin" or targetos == "darwin8": darwin_so(root, dirs, file) elif os.access(path, os.X_OK) or lib_re.match(file): - linux_so(root, dirs, file) + needs_ldconfig = linux_so(root, dirs, file) for (old, new) in renames: bb.note("Renaming %s to %s" % (old, new)) os.rename(old, new)
Signature · 1 line
1.7.5.4
Re: [PATCH 1/1] package.bbclass: needs_ldconfig from linux_so is needed in global namespace
Quoted 37 lines · Andrei Gherzan
"The suite of statements in a function definition executes with a local namespace that is different from the global namespace. This means that all variables created within a function are local to that function. When the suite finishes, these working variables are discarded."
In this way the
needs_ldconfigvariable inlinux_sonever gets True in the statements below this function. As global statement is generally discouraged, a return value would be a clean and fast way to solve this issue.[YOCTO #2205]
Signed-off-by Andrei Gherzan <[email protected]>--- meta/classes/package.bbclass | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)meta/classes/package.bbclass +2
-0@@ -1263,6 +1263,7 @@ python package_do_shlibs() { lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}")) def linux_so(root, path, file): + needs_ldconfig = False cmd = d.getVar('OBJDUMP', True) + " -p " + pipes.quote(os.path.join(root, file)) + " 2>/dev/null" cmd = "PATH=\"%s\" %s" % (d.getVar('PATH', True), cmd) fd = os.popen(cmd)@@ -1283,6 +1284,7 @@ python package_do_shlibs() { needs_ldconfig = True if snap_symlinks and (file != this_soname): renames.append((os.path.join(root, file), os.path.join(root, this_soname))) + return needs_ldconfig def darwin_so(root, path, file): fullpath = os.path.join(root, file)
meta/classes/package.bbclass python package_do_shlibs() { · line 1387
Quoted 5 lines
meta/classes/package.bbclass +1
-1@@ -1382,7 +1384,7 @@ python package_do_shlibs() { if targetos == "darwin" or targetos == "darwin8": darwin_so(root, dirs, file) elif os.access(path, os.X_OK) or lib_re.match(file): - linux_so(root, dirs, file) + needs_ldconfig = linux_so(root, dirs, file)
Shouldn't this be something like:
ldconfig = linux_so(root, dirs, file)needs_ldconfig = needs_ldconfig or ldconfig
or can this only get called once?
Cheers,
Richard
Re: [PATCH 1/1] package.bbclass: needs_ldconfig from linux_so is needed in global namespace
Quoted 52 lines · Richard Purdie
Quoted 1 line · Andrei Gherzan
"The suite of statements in a function definition executes with a local
namespace
Quoted 1 line
that is different from the global namespace. This means that all
variables created
Quoted 1 line
within a function are local to that function. When the suite finishes,
these
Quoted 3 lines
working variables are discarded."
In this way the
needs_ldconfigvariable inlinux_sonever gets True inthe statements
Quoted 1 line
below this function. As global statement is generally discouraged, a
return value
Quoted 14 lines
would be a clean and fast way to solve this issue.
[YOCTO #2205]
Signed-off-by Andrei Gherzan <[email protected]>--- meta/classes/package.bbclass | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)meta/classes/package.bbclass +0
-0meta/classes/package.bbclass python package_do_shlibs() { · line 1267
Quoted 5 lines
meta/classes/package.bbclass +1
-0@@ -1263,6 +1263,7 @@ python package_do_shlibs() { lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}")) def linux_so(root, path, file): + needs_ldconfig = False cmd = d.getVar('OBJDUMP', True) + " -p " +
pipes.quote(os.path.join(root, file))+ " 2>/dev/null"meta/classes/package.bbclass python package_do_shlibs() { · line 1286
Quoted 6 lines
meta/classes/package.bbclass +0
-0cmd = "PATH=\"%s\" %s" % (d.getVar('PATH', True), cmd) fd = os.popen(cmd)@@ -1283,6 +1284,7 @@ python package_do_shlibs() { needs_ldconfig = True if snap_symlinks and (file != this_soname): renames.append((os.path.join(root,file),
os.path.join(root, this_soname)))meta/classes/package.bbclass python package_do_shlibs() { · line 1384
Quoted 6 lines
meta/classes/package.bbclass +1
-0+ return needs_ldconfig def darwin_so(root, path, file): fullpath = os.path.join(root, file)@@ -1382,7 +1384,7 @@ python package_do_shlibs() { if targetos == "darwin" or targetos =="darwin8":
meta/classes/package.bbclass python package_do_shlibs() { · line 1386
Quoted 2 lines
meta/classes/package.bbclass +0
-0darwin_so(root, dirs, file) elif os.access(path, os.X_OK) or
lib_re.match(file):meta/classes/package.bbclass python package_do_shlibs() { · line 1387
Quoted 2 lines
meta/classes/package.bbclass +1
-1- linux_so(root, dirs, file) + needs_ldconfig = linux_so(root,
Quoted 10 lines
dirs, file)
Shouldn't this be something like:
ldconfig =
linux_so(root, dirs, file)needs_ldconfig=needs_ldconfigor ldconfigor can this only get called once?
As i recall this is called once but if you want i can amend with your hint.
@g
Re: [PATCH 1/1] package.bbclass: needs_ldconfig from linux_so is needed in global namespace
Quoted 65 lines · Andrei Gherzan
On Tue, Apr 10, 2012 at 12:02, Richard Purdie <[email protected]> wrote:
On Fri, 2012-04-06 at 16:57 +0300, Andrei Gherzan wrote:
> "The suite of statements in a function definition executes with a local namespace
> that is different from the global namespace. This means that all variables created
> within a function are local to that function. When the suite finishes, these
> working variables are discarded."
>
> In this way theneeds_ldconfigvariable inlinux_sonever gets True in the statements
> below this function. As global statement is generally discouraged, a return value
> would be a clean and fast way to solve this issue. >
> [YOCTO #2205]
>
> Signed-off-by: Andrei Gherzan <[email protected]> > ---
> meta/classes/package.bbclass | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-) >
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index d35667a..c98e8fa 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -1263,6 +1263,7 @@ pythonpackage_do_shlibs(){
> lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"))
>
> deflinux_so(root, path, file):
> +needs_ldconfig= False
> cmd =d.getVar('OBJDUMP', True)+ " -p " +
pipes.quote(os.path.join(root, file))+ " 2>/dev/null"
> cmd = "PATH=\"%s\" %s" % (d.getVar('PATH',
True), cmd)
> fd =os.popen(cmd)
> @@ -1283,6 +1284,7 @@ pythonpackage_do_shlibs(){
>needs_ldconfig= True
> ifsnap_symlinksand (file !=
this_soname):
>
renames.append((os.path.join(root, file), os.path.join(root, this_soname)))
> + returnneeds_ldconfig
>
> defdarwin_so(root, path, file):
> fullpath =os.path.join(root, file)
> @@ -1382,7 +1384,7 @@ pythonpackage_do_shlibs(){
> if targetos == "darwin" or
targetos == "darwin8":
> darwin_so(root, dirs,
file)
> elifos.access(path, os.X_OK)
orlib_re.match(file):
> - linux_so(root, dirs,
file)
> +needs_ldconfig=
linux_so(root, dirs, file)Shouldn't this be something like:
Quoted 8 lines
ldconfig =
linux_so(root, dirs, file)needs_ldconfig=needs_ldconfigor ldconfigor can this only get called once?
As i recall this is called once but if you want i can amend with your hint.
I've checked and it is called multiple times as I suspected. It needs the fix I described. I've gone ahead, tweaked and merged this I'd like this fixed in the release.
Cheers,
Richard