Commit Graph

36 Commits

Author SHA1 Message Date
Peter Kjellerstedt b085162a8e oe-pkgdata-util: package-info: Allow extra variables to be displayed
By specifying the -e <var> option one or multiple times, extra
variables available in the pkgdata can be displayed, e.,g,
`oe-pkgdata-util package-info -e SUMMARY -e LICENSE ...`. The extra
variables displayed are quoted since some of them may contain
whitespace.

(From OE-Core rev: 265db40c75b6a4b9a666e49dd1739423eb711695)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-05 22:39:47 +00:00
Joshua Lock c0f2890c01 scripts: remove True option to getVar calls
getVar() now defaults to expanding by default, thus remove the True
option from getVar() calls with a regex search and replace.

Search made with the following regex: getVar ?\(( ?[^,()]*), True\)

(From OE-Core rev: 0a36bd96e6b29fd99a296efc358ca3e9fb5af735)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-16 10:23:23 +00:00
Ola x Nilsson d65886bb69 oe-pkgdata-util: Make read-value handle override variables
Some variables in pkgdata files have a package-name override.  When
the bare variable can not be found, try with the override-variant.

PKGSIZE is one such variable, and already had special code to handle this.

Test included.

(From OE-Core rev: 6df99cda894033cba68bc6ab91e47f67e0d788a5)

Signed-off-by: Ola x Nilsson <ola.x.nilsson@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:30:49 +00:00
Robert P. J. Day 3d00fa90b7 oe-pkgdata-util: Use standard verb form in help info.
"Shows" -> "Show", to be consistent with standard form of help output.

(From OE-Core rev: 5a7994df6cdb5af8d240e2802e6bb3d9671f17e3)

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-06 23:35:35 +00:00
Paul Eggleton e616beba1c scripts: ensure tinfoil is shut down correctly
We should always shut down tinfoil when we're finished with it, either
by explicitly calling the shutdown() method or by using it as a
context manager ("with ...").

(From OE-Core rev: 5ec6d9ef309b841cdcbf1d14ac678d106d5d888a)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-03 23:45:54 +01:00
Alexander D. Kanevskiy 61ba9308d1 oe-pkgdata-util: new option to provide full info for binary package(s)
New option can be used for displaying full information about binary
package(s), including name, full version, recipe name, recipe full
version and package size.

This information can be useful inside custom buildhistory class
to produce detailed image manifest for further analysis.

List of packages can be specified as command line arguments or can
be read from file (e.g. from existing image manifest).

Warning: In case of image manifest is used as input outside of build
process, be aware that pkgdata might change since the time image
was built.

Output format:
{PKG} [PKGE:]{PKGV}[-{PKGR}] {PN} [PE:]{PV}[-{PR}] {PKGSIZE}

(From OE-Core rev: bc0cdaa927124150a6c38cd47977ee4da8dd440e)

Signed-off-by: Alexander D. Kanevskiy <kad@kad.name>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-12 23:47:17 +01:00
Ed Bartosh db7ec6c1ab oe-pkgdata-util: fix AttributeError
The default arparse behaviour in Python 2 and early versions of Python 3
was to print usage message if no subcommands provided by user.
In Python >= 3.2.3 subparser has to have attribute 'required' set to
True to behave similar way.

By default subparser.required attribute is set to False, usage message is
not printed and code continues to be executed.

oe-pkgdata-util code raises AttributeError exception in
this case:
    AttributeError: 'Namespace' object has no attribute 'func'

Fixed this by setting subparser.required to True.

[YOCTO #9711]

(From OE-Core rev: 207dba5b6eb04c1ae2081bac06724b3b6a198cb3)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-07 21:36:20 +01:00
Ed Bartosh 07c97db272 scripts: python3: convert iterables to lists
Converted return value of items() keys() and values() to
lists when dictionary is modified in the loop and when
the result is added to the list.

(From OE-Core rev: 874a269eb1d70060c2f3b3f8b70800e2aea789f4)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-03 13:13:28 +01:00
Ed Bartosh 52c4b7f247 scripts: use python3 in shebang
As most of oe-test cases work for devtool and recipetool
it makes sense to switch both tools to python 3 by
explicitly referring to python3 in their shebangs.

(From OE-Core rev: dad9617809c60ec5f11d4780b0afa1cffa1efed5)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02 08:24:01 +01:00
Paul Eggleton 4d364f27e7 classes/buildhistory: optimise getting package size list
Invoking oe-pkgdata-util in turn for every package in the list was slow
with a large image. Modify oe-pkgdata-util's read-value command to take
an option to read the list of packages from a file, as well as prefix
the value with the package name; we can then use this to get all of the
package sizes at once. This reduces the time to gather this information
from minutes to just a second or two.

Fixes [YOCTO #7339].

(From OE-Core rev: 51c24904cc1bc823bccc3f179b8d7a192dace168)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-05 14:33:57 +01:00
Paul Eggleton 8e0a84c901 scripts: print usage in argparse-using scripts when a command-line error occurs
For scripts that use Python's standard argparse module to parse
command-line arguments, create a subclass which will show the usage
the usage information when a command-line parsing error occurs. The most
common case would be when the script is run with no arguments; at least
then the user immediately gets to see what arguments they might need to
pass instead of just an error message.

(From OE-Core rev: d62fe7c9bc2df6a4464440a3cae0539074bf99aa)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-28 09:25:12 +00:00
Ross Burton 70d459ceba scripts/oe-pkgdata-util: sort the packages in list-pkg-files
Sort the list of packages in list-pkg-files to make the output easier to read.

(From OE-Core rev: 6c31655c5abf6ad4308848c116444cc7b1e798bb)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-08 10:20:47 +00:00
Richard Purdie 031d464504 scripts/oe-pkgdata-util: Fix variable name in error handling
Fix:
    logger.error('Unable to find pkgdata directory %s' % pkgdata_dir)
NameError: global name 'pkgdata_dir' is not defined

(From OE-Core rev: a1202ed17e11400f08064c9065fdfa996554d4ad)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-10-27 07:24:29 +00:00
Robert Yang c7624b4c49 oe-pkgdata-util: avoid returning skipped packages
The skipped packages may be pulled in by another package, for example,
when libc6-dbg is already installed and should be skipped, but it would
be pulled in by libsegfault, this patch fixes the issue.

(From OE-Core rev: 5040481f33b356d9acfd29a778b13544e27e7bb7)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-24 17:54:32 +01:00
Paul Eggleton fdb5639e90 lib/oe/package_manager: support exclusion from complementary glob process by regex
Sometimes you do not want certain packages to be installed when
installing complementary packages, e.g. when using dev-pkgs in
IMAGE_FEATURES you may not want to install all packages from a
particular multilib. This introduces a new PACKAGE_EXCLUDE_COMPLEMENTARY
variable to allow specifying regexes to match packages to exclude.

(From OE-Core rev: d4fe8f639d87d5ff35e50d07d41d0c1e9f12c4e3)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-17 14:20:45 +00:00
Paul Eggleton cfc12dfc34 oe-pkgdata-util: add list-pkg-files subcommand
Adds a subcommand to list the files in a package, or list the files in
all packages for a recipe.

(From OE-Core rev: 380218d7b963e8931c72596852b1ed2a7f4df61d)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-14 08:41:01 +00:00
Paul Eggleton 8d13d187b5 oe-pkgdata-util: add list-pkgs subcommand
Add a subcommand to list packages, with options to list packages
matching a specification, and packages produced by a particular recipe.

(From OE-Core rev: a6791526fec5b78ddefcf1b6b828bd376d0f2bc0)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-14 08:41:01 +00:00
Paul Eggleton 4b33006379 oe-pkgdata-util: allow reverse package name lookups
Add a -r/--reverse option to the lookup-pkg subcommand to enable looking
up the recipe-space package name for one or more runtime package names.

Also make this subcommand into a function that can be reused elsewhere.

(From OE-Core rev: f0af7471e688047c7bac5130457e5f9cc2fd5107)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-14 08:41:01 +00:00
Paul Eggleton 0f77efe9ae oe-pkgdata-util: fix read-value to handle data with colons in the value
The read-value subcommand was truncating the value if it contained
colons, for example FILES_INFO.

(From OE-Core rev: 77411c775c4bf3fa7897985916c2d4a4af2dda47)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-14 08:41:01 +00:00
Paul Eggleton 1fb1caf15c oe-pkgdata-util: make find-path show a proper error if no package found
(From OE-Core rev: e13e53a30372a4cb3eabdb1b2199ff64c3e85cc3)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-14 08:41:01 +00:00
Paul Eggleton 9f03969994 oe-pkgdata-util: improve command-line usage
* Use argparse instead of optparse for standardised help output, options
  and a much cleaner code structure
* Look up pkgdata directory automatically so the user doesn't have to
  specify it
* Use standard logging

NOTE: this does mean a slight change in syntax - if you do want to
specify the pkgdata directory (usually only necessary if you're calling
it from within the build process) you need to use the parameter -p (or
 --pkgdata-dir) and specify this before the command, not after it.

Examples:

oe-pkgdata-util find-path /sbin/mke2fs
oe-pkgdata-util lookup-recipe libelf1
oe-pkgdata-util read-value PKGSIZE libc6
oe-pkgdata-util -p /home/user/oe/build/tmp/sysroots/qemux86-64/pkgdata read-value PKGSIZE libc6

(From OE-Core rev: 04dc571ac7c26f0dcf1a1fcd466482e22519998d)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-14 08:41:01 +00:00
Paul Eggleton 7f6a92b1c5 oe-pkgdata-util: fix help text
This was copy/pasted from another script and not corrected.

(From OE-Core rev: 65b79e8ffffb20b7dd83213c72774745f18d978d)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-06-25 13:51:45 +01:00
Paul Eggleton f4e91404f8 classes/package: record PKGSIZE as total file size in pkgdata
We were using "du -sk" to collect the total size of all files in each
package for writing out to PKGSIZE in each pkgdata file; however this
reports the total space used on disk not the total size of all files,
which means it is dependent on the block size and filesystem being used
for TMPDIR on the build host. Instead, take the total of the size
reported by lstat() for each packaged file, which we are already
collecting for FILES_INFO in any case.

Note: this changes PKGSIZE to be reported in bytes instead of kilobytes
since this is what lstat reports, but this is really what we should be
storing anyway so that we have the precision if we need it.

Fixes [YOCTO #5334]

(From OE-Core rev: 29615b36fca696822a715ece2afbe0bf9a43ed61)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-03 17:45:49 +00:00
Paul Eggleton 4a75e83b29 classes/package: fix FILES_INFO serialisation in pkgdata
The FILES_INFO entry in each pkgdata file stores the list of files for
each package. Make the following improvements to how this is stored:
* Store paths as they would be seen on the target rather than
  erroneously including the full path to PKGDEST (which is specific to
  the build host the package was built on)
* For simplicity when loading the data, store complete paths for each
  entry instead of trying to break off the first part and use it as the
  dict key
* Record sizes for each file (as needed by Toaster)
* Serialise the value explicitly using json rather than just passing it
  through str().

Fixes [YOCTO #5443].

(From OE-Core rev: ca86603607a69a17cc5540d69de0e242b33382d3)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-03 17:45:49 +00:00
Paul Eggleton d69931da48 scripts/oe-pkgdata-util: fix global name 'debug' is not defined
This global variable is no longer present, so pass in the value
specified via the command line.

(From OE-Core rev: fa90f92e52330a9bf5836c0832412af0927b19a9)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-29 15:24:07 +00:00
Paul Eggleton 6ce287937e scripts/oe-pkgdata-util: add ability to find a recipe from a target package
Add a "lookup-recipe" command to show which recipe produced a particular
package.

(From OE-Core rev: 4ab561ac3df105b4b6487271b6ccc29445518d52)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-29 10:41:35 +00:00
Paul Eggleton 948a714767 scripts/oe-pkgdata-util: add ability to look up runtime package names
Add a "lookup-pkg" command to oe-pkgdata-util that can be used to find
the runtime name of a package (after e.g. Debian library package
renaming).

(From OE-Core rev: d923846d91ae307372f1e48483e86807feeeb09d)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-29 10:41:34 +00:00
Paul Eggleton 48755f1a4a scripts/oe-pkgdata-util: add ability to search for a target path
Add ability to search for a target path in produced packages, in order
to find which package provides a specific file.

(From OE-Core rev: 0824f2f5cf4e05f82b6986ce6fb22fa1392b7776)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-29 10:41:34 +00:00
Paul Eggleton 4ec1f8c018 scripts/oe-pkgdata-util: check path arguments to ensure they exist
Show an error if the specified paths don't exist.

(From OE-Core rev: eff2690f7976664e6257c1c19c89feea9152eb9e)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-29 10:41:34 +00:00
Paul Eggleton 8b42409dca scripts/oe-pkgdata-util: improve help text and command line parsing
* Use optparse to parse command line
* Make help text actually helpful by describing what each command does
* Drop comment at the top listing the commands which is now superfluous

(From OE-Core rev: feb317513fff638ad7abdba8ab34b8413f0ab055)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-29 10:41:33 +00:00
Paul Eggleton 9ce903bd3c scripts/oe-pkgdata-util: remove remnants of former pkgdata structure
OE-Core commit 1b8e4abd2d9c0901d38d89d0f944fe1ffd019379 removed the
vendor-os argument from the command line, and the code using the package
architectures, so clean these items up.

(From OE-Core rev: 8b9ee57afbbcf633cba66e4b6e8ab7339ad6d391)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-29 10:41:33 +00:00
Richard Purdie 8ebe7be3d9 bitbake.conf/package: Collapse PKGDATA_DIR into a single machine specific directory
Currently we have a hierarchy of pkgdata directories and the code has to put together
a search path and look through each in turn until it finds the data it needs.

This has lead to a number of hardcoded paths and file globing which
is unpredictable and undesirable. Worse, certain tricks that should be
easy like a GL specific package architecture become problematic with the
curretn search paths.

With the modern sstate code, we can do better and construct a single pkgdata
directory for each machine in just the same way as we do for the sysroot. This
is already tried and well tested. With such a single directory, all the code that
iterated through multiple pkgdata directories and simply be removed and give
a significant simplification of the code. Even existing build directories adapt
to the change well since the package contents doesn't change, just the location
they're installed to and the stamp for them.

The only complication is the we need a different shlibs directory for each
multilib. These are only used by package.bbclass and the simple fix is to
add MLPREFIX to the shlib directory name. This means the multilib packages will
repackage and the sstate checksum will change but an existing build directory
will adapt to the changes safely.

It is close to release however I believe the benefits this patch give us
are worth consideration for inclusion and give us more options for dealing
with problems like the GL one. It also sets the ground work well for
shlibs improvements in 1.6.

(From OE-Core rev: 1b8e4abd2d9c0901d38d89d0f944fe1ffd019379)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-14 08:21:00 +01:00
Martin Jansa 855b3252d9 classes/buildhistory: record size of installed package not compressed archive
* usually it's more important to know how much space will each
  package take on target device then size of compressed package
* example for libewebkit0 with 4 different architectures, interesting
  that om_gta02 .ipk is bigger but it's smaller when installed

  before:
  MACHINE     DEFAULTTUNE       SIZE (.ipk file)
  om_gta04    cortexa8t-neon    15996 KiB libewebkit0
  qemux86_64  x86-64            16992 KiB libewebkit0
  spitz       xscale            16148 KiB libewebkit0
  om_gta02    arm920t           16260 KiB libewebkit0

  after:
  MACHINE     DEFAULTTUNE       SIZE (installed)
  om_gta04    cortexa8t-neon    60544 KiB libewebkit0
  qemux86_64  x86-64            63720 KiB libewebkit0
  spitz       xscale            60588 KiB libewebkit0
  om_gta02    arm920t           56268 KiB libewebkit0

(From OE-Core rev: 85e4a77138381a6086d5ebd3a28cb5a94bc26a19)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-16 11:44:16 +01:00
Paul Eggleton 61dfb80173 scripts/oe-pkgdata-util: find complementary packages for split packages
Check after getting the original package name (e.g. undoing Debian
renaming) if there is a complementary package for that name, e.g. if
the glob is *-dev, then libudev0 -> libudev -> libudev-dev.

Fixes [YOCTO #4136].

(From OE-Core rev: 84a1c6922934a99e8afee0185e58dc4789b54a22)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-04-08 18:02:47 +01:00
Paul Eggleton ad63b9b11b scripts/oe-pkgdata-util: exclude unpackaged in glob output
Check for .packaged file and exclude packages if this file does not
exist - this avoids attempting to install empty packages during
complementary package installation within do_rootfs that didn't end up
being created (and failing as a result).

(From OE-Core rev: 4a85d8a4026cf1d1603513ed9780f80c603cc611)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-31 12:21:30 +01:00
Paul Eggleton fa5640d143 Rework installation of dev, dbg, doc, and locale packages
Use a similar mechanism that was previously used to install locales at
rootfs generation time to install other "complementary" packages (e.g.
*-dev packages) - i.e. install all of the explicitly requested packages
and their dependencies, then get a list of the packages that were
installed, and use that list to install the complementary packages. This
has been implemented by using a list of globs which should make it
easier to extend in future.

The previous locale package installation code assumed that the locale
packages did not have any dependencies that were not already installed;
now that we are installing non-locale packages this is no longer
correct. In practice only the rpm backend actually made use of this
assumption, so it needed to be changed to call into the existing package
backend code to do the complementary package installation rather than
calling rpm directly.

This fixes the doc-pkgs IMAGE_FEATURES feature to work correctly, and
also ensures that all dev/dbg packages get installed for
dev-pkgs/dbg-pkgs respectively even if the dependency chains between
those packages was not ensuring that already.

The code has also been adapted to work correctly with the new
SDK-from-image functionality. To that end, an SDKIMAGE_FEATURES variable
has been added to allow specifying what extra image features should go
into the SDK (extra, because by virtue of installing all of the packages
in the image into the target part of the SDK, we already include all of
IMAGE_FEATURES) with a default value of "dev-pkgs dbg-pkgs".

Fixes [YOCTO #2614].

(From OE-Core rev: 72d1048a8381fa4a8c4c0d082047536727b4be47)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-29 10:16:14 +01:00