2013-02-01 15:03:41 +00:00
|
|
|
def runstrip(arg):
|
|
|
|
# Function to strip a single file, called from split_and_strip_files below
|
|
|
|
# A working 'file' (one which works on the target architecture)
|
|
|
|
#
|
|
|
|
# The elftype is a bit pattern (explained in split_and_strip_files) to tell
|
|
|
|
# us what type of file we're processing...
|
|
|
|
# 4 - executable
|
|
|
|
# 8 - shared library
|
|
|
|
# 16 - kernel module
|
|
|
|
|
2016-05-20 10:57:44 +00:00
|
|
|
import stat, subprocess
|
2013-02-01 15:03:41 +00:00
|
|
|
|
|
|
|
(file, elftype, strip) = arg
|
|
|
|
|
|
|
|
newmode = None
|
|
|
|
if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
|
|
|
|
origmode = os.stat(file)[stat.ST_MODE]
|
|
|
|
newmode = origmode | stat.S_IWRITE | stat.S_IREAD
|
|
|
|
os.chmod(file, newmode)
|
|
|
|
|
2016-12-06 15:30:59 +00:00
|
|
|
stripcmd = [strip]
|
2013-02-01 15:03:41 +00:00
|
|
|
|
|
|
|
# kernel module
|
|
|
|
if elftype & 16:
|
2016-12-06 15:30:59 +00:00
|
|
|
stripcmd.extend(["--strip-debug", "--remove-section=.comment",
|
|
|
|
"--remove-section=.note", "--preserve-dates"])
|
2013-02-01 15:03:41 +00:00
|
|
|
# .so and shared library
|
|
|
|
elif ".so" in file and elftype & 8:
|
2016-12-06 15:30:59 +00:00
|
|
|
stripcmd.extend(["--remove-section=.comment", "--remove-section=.note", "--strip-unneeded"])
|
2013-02-01 15:03:41 +00:00
|
|
|
# shared or executable:
|
|
|
|
elif elftype & 8 or elftype & 4:
|
2016-12-06 15:30:59 +00:00
|
|
|
stripcmd.extend(["--remove-section=.comment", "--remove-section=.note"])
|
2013-02-01 15:03:41 +00:00
|
|
|
|
2016-12-06 15:30:59 +00:00
|
|
|
stripcmd.append(file)
|
2013-02-01 15:03:41 +00:00
|
|
|
bb.debug(1, "runstrip: %s" % stripcmd)
|
|
|
|
|
2015-04-28 16:09:58 +00:00
|
|
|
try:
|
2016-12-06 15:30:59 +00:00
|
|
|
output = subprocess.check_output(stripcmd, stderr=subprocess.STDOUT)
|
2015-04-28 16:09:58 +00:00
|
|
|
except subprocess.CalledProcessError as e:
|
|
|
|
bb.error("runstrip: '%s' strip command failed with %s (%s)" % (stripcmd, e.returncode, e.output))
|
2013-02-01 15:03:41 +00:00
|
|
|
|
|
|
|
if newmode:
|
|
|
|
os.chmod(file, origmode)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
2013-02-01 13:50:38 +00:00
|
|
|
|
|
|
|
def file_translate(file):
|
|
|
|
ft = file.replace("@", "@at@")
|
|
|
|
ft = ft.replace(" ", "@space@")
|
|
|
|
ft = ft.replace("\t", "@tab@")
|
|
|
|
ft = ft.replace("[", "@openbrace@")
|
|
|
|
ft = ft.replace("]", "@closebrace@")
|
|
|
|
ft = ft.replace("_", "@underscore@")
|
|
|
|
return ft
|
|
|
|
|
|
|
|
def filedeprunner(arg):
|
2014-02-23 10:44:22 +00:00
|
|
|
import re, subprocess, shlex
|
2013-02-01 13:50:38 +00:00
|
|
|
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
(pkg, pkgfiles, rpmdeps, pkgdest) = arg
|
2013-02-01 13:50:38 +00:00
|
|
|
provides = {}
|
|
|
|
requires = {}
|
|
|
|
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
file_re = re.compile(r'\s+\d+\s(.*)')
|
|
|
|
dep_re = re.compile(r'\s+(\S)\s+(.*)')
|
|
|
|
r = re.compile(r'[<>=]+\s+\S*')
|
2013-02-01 13:50:38 +00:00
|
|
|
|
|
|
|
def process_deps(pipe, pkg, pkgdest, provides, requires):
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
file = None
|
2013-02-01 13:50:38 +00:00
|
|
|
for line in pipe:
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
line = line.decode("utf-8")
|
2013-02-01 13:50:38 +00:00
|
|
|
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
m = file_re.match(line)
|
|
|
|
if m:
|
|
|
|
file = m.group(1)
|
|
|
|
file = file.replace(pkgdest + "/" + pkg, "")
|
|
|
|
file = file_translate(file)
|
|
|
|
continue
|
|
|
|
|
|
|
|
m = dep_re.match(line)
|
|
|
|
if not m or not file:
|
|
|
|
continue
|
|
|
|
|
|
|
|
type, dep = m.groups()
|
|
|
|
|
|
|
|
if type == 'R':
|
2013-02-01 13:50:38 +00:00
|
|
|
i = requires
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
elif type == 'P':
|
2013-02-01 13:50:38 +00:00
|
|
|
i = provides
|
|
|
|
else:
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
continue
|
2013-02-01 13:50:38 +00:00
|
|
|
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
if dep.startswith("python("):
|
|
|
|
continue
|
2013-02-01 13:50:38 +00:00
|
|
|
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
# Ignore all perl(VMS::...) and perl(Mac::...) dependencies. These
|
|
|
|
# are typically used conditionally from the Perl code, but are
|
|
|
|
# generated as unconditional dependencies.
|
|
|
|
if dep.startswith('perl(VMS::') or dep.startswith('perl(Mac::'):
|
2013-02-01 13:50:38 +00:00
|
|
|
continue
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
|
|
|
|
# Ignore perl dependencies on .pl files.
|
|
|
|
if dep.startswith('perl(') and dep.endswith('.pl)'):
|
2013-02-01 13:50:38 +00:00
|
|
|
continue
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
|
|
|
|
# Remove perl versions and perl module versions since they typically
|
|
|
|
# do not make sense when used as package versions.
|
|
|
|
if dep.startswith('perl') and r.search(dep):
|
|
|
|
dep = dep.split()[0]
|
|
|
|
|
|
|
|
# Put parentheses around any version specifications.
|
|
|
|
dep = r.sub(r'(\g<0>)',dep)
|
|
|
|
|
2013-02-01 13:50:38 +00:00
|
|
|
if file not in i:
|
|
|
|
i[file] = []
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
i[file].append(dep)
|
2013-02-01 13:50:38 +00:00
|
|
|
|
|
|
|
return provides, requires
|
|
|
|
|
2014-02-23 10:44:22 +00:00
|
|
|
try:
|
package.bbclass: Restore functionality to detect RPM dependencies
During the transition to dnf and rpm4, the functionality to
automatically make RPM determine dependencies was lost.
Before the transition, an OE specific tool called rpmdeps-oecore had
been added to the rpm suit. It was based on the rpmdeps tool that is
part of rpm. For each file specified on its command line, it would
output the provides and requires that RPM could determine.
During the transition to rpm4, rpmdeps-oecore was replaced with the
standard rpmdeps. However, what no one noticed was that unless rpmdeps
is given options, e.g., -P or -R, to tell it what it should output, it
will not output anything. Thus, it would do all the work to determine
the requirements, but would keep silent about it. And since no output
from rpmdeps is expected unless there are requirements, there were no
warnings indicating that everything was not working as expected.
Porting the old rpmdeps-oecore to work with rpm4 is not really
possible since it relied on being able to access internals of RPM that
are no longer available. However, it turned out that rpmdeps had a
debug option, --rpmfcdebug, that would output exactly the information
that we need, albeit in a different format and to stderr. To make this
usable, rpmdeps has now received a new option, --alldeps, which sends
the information we need to stdout.
Since enabling this may cause packages to break, it is required that
ENABLE_RPM_FILEDEPS_FOR_PYRO is set to "1" to activate it for Pyro.
The name of this variable has been chosen as to indicate that it only
affects Pyro (since releases before and after Pyro has it enabled by
default).
(From OE-Core rev: 1009498f23ad319825c00ba60a4693d15aada553)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 21:21:21 +00:00
|
|
|
dep_popen = subprocess.Popen(shlex.split(rpmdeps) + pkgfiles, stdout=subprocess.PIPE)
|
2014-02-23 10:44:22 +00:00
|
|
|
provides, requires = process_deps(dep_popen.stdout, pkg, pkgdest, provides, requires)
|
|
|
|
except OSError as e:
|
|
|
|
bb.error("rpmdeps: '%s' command failed, '%s'" % (shlex.split(rpmdeps) + pkgfiles, e))
|
|
|
|
raise e
|
2013-02-01 13:50:38 +00:00
|
|
|
|
|
|
|
return (pkg, provides, requires)
|
2014-12-19 11:41:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
def read_shlib_providers(d):
|
|
|
|
import re
|
|
|
|
|
|
|
|
shlib_provider = {}
|
2016-12-14 21:13:04 +00:00
|
|
|
shlibs_dirs = d.getVar('SHLIBSDIRS').split()
|
2014-12-19 11:41:44 +00:00
|
|
|
list_re = re.compile('^(.*)\.list$')
|
|
|
|
# Go from least to most specific since the last one found wins
|
|
|
|
for dir in reversed(shlibs_dirs):
|
|
|
|
bb.debug(2, "Reading shlib providers in %s" % (dir))
|
|
|
|
if not os.path.exists(dir):
|
|
|
|
continue
|
|
|
|
for file in os.listdir(dir):
|
|
|
|
m = list_re.match(file)
|
|
|
|
if m:
|
|
|
|
dep_pkg = m.group(1)
|
2016-07-13 14:34:53 +00:00
|
|
|
try:
|
|
|
|
fd = open(os.path.join(dir, file))
|
|
|
|
except IOError:
|
|
|
|
# During a build unrelated shlib files may be deleted, so
|
|
|
|
# handle files disappearing between the listdirs and open.
|
|
|
|
continue
|
2014-12-19 11:41:44 +00:00
|
|
|
lines = fd.readlines()
|
|
|
|
fd.close()
|
|
|
|
for l in lines:
|
|
|
|
s = l.strip().split(":")
|
|
|
|
if s[0] not in shlib_provider:
|
|
|
|
shlib_provider[s[0]] = {}
|
|
|
|
shlib_provider[s[0]][s[1]] = (dep_pkg, s[2])
|
|
|
|
return shlib_provider
|
2016-03-09 04:48:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
def npm_split_package_dirs(pkgdir):
|
|
|
|
"""
|
|
|
|
Work out the packages fetched and unpacked by BitBake's npm fetcher
|
|
|
|
Returns a dict of packagename -> (relpath, package.json) ordered
|
|
|
|
such that it is suitable for use in PACKAGES and FILES
|
|
|
|
"""
|
|
|
|
from collections import OrderedDict
|
|
|
|
import json
|
|
|
|
packages = {}
|
|
|
|
for root, dirs, files in os.walk(pkgdir):
|
|
|
|
if os.path.basename(root) == 'node_modules':
|
|
|
|
for dn in dirs:
|
|
|
|
relpth = os.path.relpath(os.path.join(root, dn), pkgdir)
|
|
|
|
pkgitems = ['${PN}']
|
|
|
|
for pathitem in relpth.split('/'):
|
|
|
|
if pathitem == 'node_modules':
|
|
|
|
continue
|
|
|
|
pkgitems.append(pathitem)
|
2016-04-12 09:58:39 +00:00
|
|
|
pkgname = '-'.join(pkgitems).replace('_', '-')
|
2017-03-01 17:19:57 +00:00
|
|
|
pkgname = pkgname.replace('@', '')
|
2016-03-09 04:48:52 +00:00
|
|
|
pkgfile = os.path.join(root, dn, 'package.json')
|
|
|
|
data = None
|
|
|
|
if os.path.exists(pkgfile):
|
|
|
|
with open(pkgfile, 'r') as f:
|
|
|
|
data = json.loads(f.read())
|
2016-04-27 13:06:18 +00:00
|
|
|
packages[pkgname] = (relpth, data)
|
2016-03-09 04:48:52 +00:00
|
|
|
# We want the main package for a module sorted *after* its subpackages
|
|
|
|
# (so that it doesn't otherwise steal the files for the subpackage), so
|
|
|
|
# this is a cheap way to do that whilst still having an otherwise
|
|
|
|
# alphabetical sort
|
|
|
|
return OrderedDict((key, packages[key]) for key in sorted(packages, key=lambda pkg: pkg + '~'))
|