Commit Graph

226 Commits

Author SHA1 Message Date
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
Stefan Stanacar 83b90e54be classes/package_rpm: remove unsed outdir variable
Not only outdir had the wrong value, it wasn't used actually used in that function.

(From OE-Core rev: 5db4b53e5d969a6da314904fa2335462947c97ea)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-11 23:31:00 +01:00
Mark Hatle 4b2d9acda8 python-smartpm: Add an attempt install mode
[ YOCTO #3723 ]

Add a mode to smart that will allow an installation to continue, instead of
failure in the case that one or more items is uninstallable.

Uninstallable packages are simply ignored, and no error is generated.

(From OE-Core rev: bdf07b1698d228dc7ff555199a269b1ff8ceca19)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-11 11:06:11 +01:00
Mark Hatle 12223c038c package_rpm.bbclass: Fix no_recommendations and package_exclude
When the code was refactored to address review comments, the wrong version
was sent to the community.  Replace the $1 with ${target_rootfs}

Fix identified by: Yue Tao <yue.tao@windriver.com>

(From OE-Core rev: a04f4fe8db425f0ea87a67b5c72d61816b8d53e2)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-06 23:04:48 +01:00
Richard Purdie 554c892ccf meta: Don't use deprecated bitbake API
These have been deprecated for a long time, convert the remaining
references to the correct modules and prepare for removal of the
compatibility support from bitbake.

(From OE-Core rev: 6a39835af2b2b3c7797fe05479341d71a3f3aaf6)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-01 15:51:42 +01:00
Mark Hatle 7ba54b91f8 package_rpm.bbclass: NO_RECOMMENDATIONS support
Add NO_RECOMMENDATIONS support.  A way to disable all recommended
packages from being installed.  This will help shrink the size of
the resulting filesystem.

Add documentation on NO_RECOMMENDATIONS and BAD_RECOMMENDATIONS.

Note, using NO_RECOMMENDATIONS has side effects such that kernel-modules may
not have been installed.  A user will need to manually add to their image
any kernel-modules required to be on the image for functionality.

(From OE-Core rev: 0341bfa886ea851f5a394051545b4e624d8003dd)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-22 18:30:00 +01:00
Mark Hatle 479fc7c226 package_rpm.bbclass: Add support for PACKAGE_EXCLUDE to RPM installs
Using the new smart exclude mechanism an error will be generated in the
excluded package is required for the image to be generated.

(From OE-Core rev: 238c46c03d0d9c35523c78b94bfebb57904bac5a)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-22 18:29:59 +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 f629afe153 classes/rootfs_rpm: implement BAD_RECOMMENDATIONS for RPM
Add support for the BAD_RECOMMENDATIONS variable that can be used to
prevent specific packages from being installed via an RRECOMMENDS
relationship when using the RPM backend. (Previously this
functionality was only available when using ipk packaging.)

In the process this moves the defaulting of BAD_RECOMMENDATIONS (as
empty) to bitbake.conf since it is no longer specific to the ipk
backend, as well as unifying some of the code that creates the
configuration for smart for use on the host and target.

Fixes [YOCTO #3916].

(From OE-Core rev: 4e85129a7d47baf3e32b815cbc277bff84e085a0)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-29 13:09:15 +01:00
Bian Naimeng 63645af528 package_rpm.bbclass: remove xx.spec before doing rpmbuild xx.src.rpm
If the spec file already exist, and has not been stored into pseudo's files.db,
it maybe cause rpmbuild src.rpm fail, so remove it before doing rpmbuild src.rpm.

(From OE-Core rev: 760af902a98b350a2f1f3203fa0096965924a83d)

Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-13 18:23:33 +01:00
Robert Yang 477b2c9860 package_rpm.bbclass: make DESCRIPTION support newline
The recipe's DESCRIPTION is wrapped automatically by textwrap, make it
support newline ("\n") to let the user can wrap it manually, e.g.:

DESCRIPTION = "Foo1\nFoo2"

In the past, it would be:
Foo1\nFoo2

Now:
Foo1
Foo2

[YOCTO #4348]

(From OE-Core rev: 503b6370080fcbcd99305eac846c6dfbdd07c5df)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-10 09:42:02 +01:00
Laurentiu Palcu 75070d7032 package_rpm.bbclass: handle pre/post remove scriptlets
Currently the scriptlet_wrapper is designed to handle only pre/post
install scriptlets. This patch will slightly change the wrapper script
to handle also pre/post remove scriptlets when we want to remove
packages from the final image.

(From OE-Core rev: aea47c77d69407b2e62f151cabba35293d179f0c)

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-11 15:38:05 +01:00
Richard Purdie 950b505ca1 package_*.bbclass: Drop fakeroot from setscene calls
Back in 2010, I added these in commit: http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=36f1ae42fe13dae174b7fb5eb85dc49d7d7b516b
however the package_write tasks sstate only consists of package files and no
fakeroot privileges are needed to write these out, only originally create them.

We can therefore drop these for some small performance gains and a less
convoluted depenency chain.

(From OE-Core rev: 3c760ce4dc15d85be07aafbfea896e7276e0c2c4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-07 16:48:31 +01:00
Robert Yang 51c3e9df28 bbclass: bb.fatal() clean up
The bb.fatal() is defined as:

def fatal(*args):
    logger.critical(''.join(args))
    sys.exit(1)

So anything after bb.fatal() in the same code block doesn't have any
effect, e.g.:

    bb.fatal("%s_%s: %s" % (var, pkg, e))
    raise e

The "raise e" should be removed.

I searched all the files which use bb.fatal(), only the following 3
classes have this issues:

  insane.bbclass
  package.bbclass
  package_rpm.bbclass

[YOCTO #4461]

(From OE-Core rev: 4c47525c5a171b1282615c9fbc7d84addef85f92)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-16 00:09:47 +03:00
Richard Purdie 566628d8cd class/lib: Fix up various file access methods
There are various bits of cruft that have built up around our file accesses. This patch
cleans some of them up, specifically:

 * Remove pointless "from __builtin__ import file"
 * Use open(), not file()
 * Wrap file usage in a with container to ensure files are closed
 * Add missing .close() calls in some cases

(From OE-Core rev: a43e0a8ecd0441131e929daf998c3cd454d9c8f3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09 22:28:04 +01:00
Hongxu Jia c567366d3b package_rpm.bbclass: fix build multilib image failed when PR Server enabled
1, In bitbake.conf
   PKGR ?= "${PR}${EXTENDPRAUTO}"
   EXTENDPKGV ?= "${EXTENDPKGEVER}${PKGV}-${PKGR}"
   RDEPENDS_${PN}-dev = "${PN} (= ${EXTENDPKGV})"

2, When PR Server is enabled, EXTENDPRAUTO is not none which means PKGR and PR
don't have the same value.

3, When multilib is enabled, RDEPENDS_${PN}-dev is not expanded correctly
which uses PR rather than PKGR in the versioned dependency string.

4, Make sure PKGR rather than PR in version string when do_package_rpm.

[YOCTO #4050]

(From OE-Core rev: cf53c606fc1bc81abb68b6851ae68916f92e1d84)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-04-11 14:02:27 +01:00
Richard Purdie 554e3d2540 package/populate_sdk: Move functions from package_* to populate_sdk_*
This fixes build failures introduced with "classes/buildhistory: implement history
collection for SDK" by moving the functions to files where only the specific image
type which is enabled is inherited. The failures occured when multiple PACKAGE_CLASSES
were enabled.

(From OE-Core rev: 9a414a57ad69a426a8d8a2970c42ca7427240615)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-23 17:40:27 +00:00
Paul Eggleton 59e4815387 classes/buildhistory: implement history collection for SDKs
SDKs are constructed in a similar manner to images, and the contents can
be influenced by a number of different factors, thus tracking the
contents of produced SDKs when buildhistory is enabled can help detect
the same kinds of issues as with images.

This required adding POPULATE_SDK_POST_HOST_COMMAND and
SDK_POSTPROCESS_COMMAND variables so that data collection functions can
be injected at the appropriate points in the SDK construction process,
as well as moving the list_installed_packages and
rootfs_list_installed_depends functions from the rootfs_{rpm,ipk,deb} to
the package_{rpm,ipk,deb} classes so they can also be called during
do_populate_sdk as well as do_rootfs.

Implements [YOCTO #3964].

(From OE-Core rev: c3736064483d4840e38cb1b8c13d2dd3a26b36aa)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-23 11:41:13 +00:00
Christopher Larson b10f2a74e4 package_{ipk, deb, rpm}: drop the TARGET_OS conditional
The tclibc file for uclibc already empties IMAGE_LINGUAS, so there's no point
to this conditional as far as I can tell, and it can cause issues for certain
values of TARGET_OS.

(From OE-Core rev: 0fdda5840452c7715ed775d5d18d9f850396f483)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-22 16:54:38 +00:00
Richard Purdie b5e5d25c25 package_rpm: Ensure PV manipulations are correct
The previous change to this function fixed one manipuation at
the expense of the other, depending on ow expanded the versioned
dependency string was when the AUTOINC substitution was made.

This update ensures we cover both cases and ensures the classextended
version works as as well as the normal case.

(From OE-Core rev: 0f8447a7d99d2645b932eac1c24149f0c2d3791e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-16 17:08:25 +00:00
Richard Purdie 7803f5f98c package_rpm: Ensure package dependencies have correct version numbers
If a recipe has versioned dependencies on another package within
the same recipe, there are potentially races where the version
remapping may not happen correctly.

This issue triggered with neard in multilib builds since it
uses a "-" character in its PV which is illegal in an rpm version
field. The remapping to "+" was not occuring.

It only triggers in the multilib case since in this case, expansion
of the datastore happens at slightly different points.

The correct fix is to search for PV, not PKGV but substitute the
PV value.

(From OE-Core rev: bd03014c8fd080e04dd0a96a6b4b9211568c1cf1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-14 16:37:09 +00:00
Richard Purdie b24ef37460 package_rpm.bbclass: Optimise per file dependency handling
Currently the process for injecting the per file rpm dependencies into
rpmbuild is painfully slow. Its done through the repeated execution of
a script which has to return the correct value in each case. This continual
execution means the CPU usage of rpmbuild is low.

This patch allows the option of collapsing the per file dependencies to
a per package basis and injecting them through the .spec file. This removes
the execution overhead and allows rpmbuild to run at 100% of cpu.

Ultimately it would be nice to inject the per file dependencies through
the .spec file however that is not currently possible.

Since few people use the per file dependency information, this patch
goes for the faster approach. It can be enabled if anyone needs it although
I'd mention that its being used to us as this code may well go away in
the future if nobody complains.

(From OE-Core rev: be40f6d0bb80274366af00461112af65687a4de8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-05 13:14:51 +00:00
Mark Hatle fe39685c0c package_rpm.bbclass: Fix translate_smart_to_oe arch comparison
When the OE arch is of the format "foo_bar-foobar" the previous
comparison routine did not selectively translate the '-' causing
a failed comparison.

In order to work around this issue, we -always- compare the
RPM translated version of the package architectures.

(From OE-Core rev: caf798da9502c1c4967d13a4450fe02b1e7b4850)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-02 12:59:05 +00:00
Kang Kai 8506e4f454 package_rpm.bbclass: add more description for pre/post scriptlets
When write rpm spec file, one description line

"# pkgname - script_type"

is added to pre/post scriptlets for base package but no such line
writted for subpackage.

Add similiar line to subpackage to facilitate handling the pre/post
scriptlets.

(From OE-Core rev: 34f3926f1787f9a2efa2257a2aaea6ee92adf8a3)

Signed-off-by: Kang Kai <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-01 13:03:29 +00:00
Kang Kai b7cb380930 package_rpm.bbclass: name postinst files with package name
When create rootfs, some post install scripts need be run on device.
They are saved under directory /etc/rpm-postinst and named with numbers
such as 100, 101 etc.

Update to name the postinst script file with its package name instead of
just number. That may be more easy to debug when there is a error.

[YOCTO #3218]

(From OE-Core rev: 9b2a008c25a7a3152ae2d8c64ae8de2534471d47)

Signed-off-by: Kang Kai <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-01 13:03:29 +00:00
Mark Hatle c6209c96d9 rootfs_rpm.bbclass: Handle multilib configures with different OS values
[ CQID: WIND00404082 ]

It is possible for the TARGET_OS to change dependending on the multilib used
for a given package build.  mips64 has two potential TARGET_OS values: linux
and linux-gnun32.  The RPM and Smart setup needs to distinguish between the
two otherwise packages of the "non-default" TARGET_OS may be ignored as
incompatible.

(From OE-Core rev: aa760ff7dee4029c30c9de9fc0b640149e4a4c77)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-22 06:39:07 -08:00
Richard Purdie ba110d3b69 package_rpm/dev/ipk/tar: Drop unused functions
The package_xxx_install functions date from a different era and are not used by
anything. In the rpm case, they're simply unimplemented, in the tar case they're
using broken whitespace and deprecated functions. We might as well clean
out the old broken unused code.

(From OE-Core rev: 3684036213c9b1c27389260b7a1e3441c6bd659d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-17 22:32:03 +00:00
Richard Purdie 74938e387c package_rpm/deb/ipk: Error if we don't find packages when creating the package index
If for whatever reason the package directory is empty of packages, it
makes sense to error early rather than later in what become much
more obtuse errors. This adds in a sanity check to each of the packaging
backends. It also removes the duplicate createrepo call since the
core index creation function now uses this directly after the switch
to smart.

(From OE-Core rev: 721ef058b37604e100021ec7a90ad2f745d83916)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-17 22:32:03 +00:00
Richard Purdie c9ea3c27e1 package_ipk/deb/rpm: Ensure deploy staging directory is empty before rerunning task
If we don't do this, stale files can build up, particularly with the PR
server.

(From OE-Core rev: c30ae39229b35d72e2205040d76754b5120fa878)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-30 14:09:09 +00:00
Richard Purdie 3247292683 Split do_packagedata task from do_package
Currently, do_rootfs has a dependency on all the do_package output being present
due to its usage of the pkgdata directories. This means that if you run:

bitbake xxxx-image -c rootfs

you end up having to fetch and unpack all the do_package data which is usually
large and inefficient. It also means rm_work has to leave all the do_package
data lying around so rootfs works.

This patch splits the actual creation of the pkgdata directory off into a separate
task, "packagedata" which happens immediately after do_package. We can then remap
the dependencies so this task is depended upon, not do_package. Sstate can then be
programmed not to require do_package at the appropriate times.

Whilst this patch doesn't do so, it opens the possibility of rm_work wiping
out the do_package output from WORKDIR as long as it also removed the do_package
stamp (both normal and setscene variants) and allowing more space savings
with rm_work which has been regularly requested.

(From OE-Core rev: 6107ee294afde395e39d084c33e8e94013c625a9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-25 12:42:47 +00:00
Mark Hatle 1874c8d7e2 package_rpm.bbclass: Refactor the attempt only install
Smart does not have a method to perform an install, but ignore failures.

There was a class of failures that stopped Smart from processing
attemptonly installs.  To work around this we need to iterate over the to
be attempted list.

(From OE-Core rev: 7c11ab93242ad3453b730da79a641479de588227)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-19 17:55:00 +00:00
Paul Eggleton 84a5c63a57 classes/image: handle multilibs in complementary package lookup
For multilib the vendor string is altered, so we need to iterate over
all of the multilib vendors when we do the glob processing for
complementary packages.

(From OE-Core rev: ff01518c6667e1b6e87df4e5a435a701d0f38fa7)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>

In addition, the RPM package arch have been munged by adding the multilib
identifier.  This identifier needs to be stripped when generating the
installed_packages list for the complementary lookup code to work.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-19 17:55:00 +00:00
Mark Hatle 3fa98d1dd3 package_rpm: Workaround for 'all' arch multilib package naming
[YOCTO #3565]

All packages should not be multilib specific, however when the multilib
rules run, they automatically rename the 'all' target recipes.  As such
there is no way to know if an 'all' package should or should not contain
the multilib prefix.  We workaround this issue in the translate function
by checking to see if the runtime-reverse file exists or not.

The workaround should be removed once a proper solution to the architectural
issue is in place.

(From OE-Core rev: ea4b8c73a7f807ccd9aa22dfcf41285145a9dd2e)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-17 17:24:53 +00:00
Mark Hatle 2173ca2fb1 package_rpm.bbclass: Add a simply way to enable RPM debugging
(From OE-Core rev: 08b980da3caafc331fef457a16466eda98139bb4)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-17 17:24:52 +00:00
Mark Hatle 8b671644e1 package_rpm.bbclass: Add additional install error detection
There is a condition where the package will fail to install, but smart does
not capture the error.  Add the error string to the scan list.

(From OE-Core rev: 230068110e1cda349f9bf3886d8d06ac46deea37)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-17 17:24:52 +00:00
Mark Hatle 4a7151b971 package_rpm.bbclass: Add support for incremental installs
(From OE-Core rev: 140750f9c334ba9abb1f5c89fc28ef9b866c605b)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-17 17:24:52 +00:00
Mark Hatle f946417623 package_rpm.bbclass: Add additional logging
(From OE-Core rev: 2a21e63869ec9541dd338df1d86ef2ca01762bfe)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-17 17:24:52 +00:00
Mark Hatle 06afdb8928 package_rpm.bbclass: Fix the way the RPM platform file is generated
When generating an SDK, we need to use either the SDK or TARGET version
of the OS.  They are not interchangable!

(From OE-Core rev: 8f6e33231439c9c2c1584b2790f62f833439e3c1)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-17 17:24:51 +00:00
Mark Hatle a6aa74817c package_rpm: Update the way the multilib package names are translated
The variable MULTILIB_PACKAGE_ARCHS has been removed in favor of a
repurposed MULTILIB_PREFIX_LIST.  The format of this item is now
<libid>:<arch>:<arch1>:...:<archN>.  This ensures that we can correctly
translate the libid to one of the supported archs in a tri-lib system.

All of the users of MULTILIB_PREFIX_LIST and MULTILIB_PACKAGE_ARCHS have
been modified accordingly.

Also change the way attempted packages are installed, verify the package
exists in the translate functions, then perform the install in one single
operation.  This results in a significantly faster install time.

(From OE-Core rev: ffe6cf3a1c57defdbe8531bdeb588e199177bb6c)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-17 17:24:51 +00:00
Paul Eggleton 019ba25654 classes/*_rpm: integrate Smart into RPM filesystem construction
Use Smart to construct the root filesystem for images and the contents
of SDKs rather than the custom scripts around rpm we had previously.
This ensures the result when producing an updated image will be the
same as upgrading to the same package versions from an older image on
the target, as well as allowing us to remove a substantial amount of
code making the rpm classes much easier to follow.

Some bugfixes from Bogdan Marinescu <bogdan.marinescu@intel.com>.
SDK implementation and testing as well as a number of bugfixes from
Mark Hatle <mark.hatle@windriver.com>.

(From OE-Core rev: a726ae7c032fac1aa49ce34180fa2ed2dcaf87d3)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-17 17:24:50 +00:00
Laurentiu Palcu fd401f292e rootfs generation: export two new variables to postinst scriptlets
In order for the postinst scriptlets to be able to run once we need to
export the location of the intercept scripts and also the location of
native sysrootfs. The gdk-pixbuf binaries will need the latter because
in order to generate the loaders.cache it will need to scan some shared
libraries that must be native. Even though the output is a text file.

(From OE-Core rev: 927fabf549bb79cc179d2cb0a953dcd515acf464)

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-06 12:31:09 +00:00
Mark Hatle 80ad2af71b package_rpm.bbclass: Add the runtime dependencies to the pre/post scriptlets
When the scriptlets are processed in RPM, they have a different dependency
set then the core package.  OE has no way to specify dependencies for the
pre/post scriptlists, so we simply make the runtime dependencies scriptlets
as well.

(From OE-Core rev: c1acac8c46aa75d78634c30de773b28a1466070c)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-06 12:31:03 +00:00
Mark Hatle d3b08b4272 package_rpm.bbclass: Fix an issue where complementary installs fail
Also ensure that we always cleanup the temporary install manifest files,
some of them will cause problems if they exist in multiple install
attempts.

Finally verify that the lists remain uniquely sorted otherwise the
complementary install may install the same files numerous times,
triggering a failure.

(From OE-Core rev: 4f2a290cbcc6c21afbb2a6e6148efdef4d135b41)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-10-07 13:14:59 +01:00
Richard Purdie 5fdbda6922 classes: Update to use corrected bb.utils.explode_dep_versions2 API
The bb.utils.explode_dep_versions function has issues where dependency information
can be lost. The API doesn't support maintaining the correct information so this
changes to use a new function which correctly handles the data.

This patch also fixes various points in the code to ensure that we do not have any
duplicates in things that use explode_dep_versions.

A new sanity test to test the contents of the R* variables is also added.

[Some changes from Mark Hatle <mark.hatle@windriver.com>]

(From OE-Core rev: 16a892431d0c0d03f8b561b92909cf2f11af4918)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-10-02 11:40:53 +01:00
Robert Yang 0c7ef5214d package_rpm.bbclass: change the arch's "-" to "_" for platform
The platform and platform_extra will be written to /etc/rpm/platform,
the rpm's arch has changed the "-" to "_", so the value in platform
should also be updated.

[YOCTO #3159]

(From OE-Core rev: 9880a5261ca509c69efbafa27cddd9b2b8ca08f0)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-26 15:02:29 +01:00
Robert Yang 598528484c package_rpm.bbclass: no initial_solution in the second build
There is no initial_solution.manifest in the second build when
incremental rpm image generation, since the initial solution has been
skipped. So we should check it before cat it.

[YOCTO #3128]

(From OE-Core rev: ad17fa82a481ab3c9f17a8338ebad1eb07c0f9d8)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-26 15:02:29 +01:00
Andrei Gherzan 42d91a7db4 Replace "echo -e" with "printf" to have the same behavior in dash or bash
oe-core removed the prerequisite to have sh as bash. POSIX doesn't define
any options and furthermore allows 'echo -e' to be the default behavior.
This means that in dash 'echo -e' will actually print '-e' and interpret
backslashes by default. We use instead 'printf' builtin command with or
without '\n' to simulate 'echo -e' or 'echo -n'.
'printf' needs format while 'echo' can be used without any arguments. So
'echo >' was replaced by 'printf "" >'.
'echo' without '-n' flag adds a new line by default so to keep the same
behavior of two new lines while using 'echo "\n"', 'printf "\n\n"' is
used.

[YOCTO #3138]

(From OE-Core rev: a19880ad10ccb5d7d909dcf9de5c3dc58a0ebcd3)

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-20 13:33:50 +01:00
Mark Hatle 03109ba97d package_rpm.bbclass: Avoid unnecessary installs in complementary pass
When called with the complementary install option, the first step is to
backup the install manifest so that we can avoid installing items previously
installed.  However, this backup process skipped the initial_install portion
of the manifest, causing early install items like libc6, bash, and base-files
to be installed a second time.

Fix this by cating the files to original_solution.  This is done as an append to
allow multiple calls to package_install_internal_rpm to work.

(From OE-Core rev: af9fd7566a5de4716a202922f5eabb13a412f2fb)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-12 15:13:35 +01:00
Robert Yang 092895cdb1 package_rpm.bbclass: fix incremental rpm image generation
* Check ${target_rootfs}/etc/passwd rather than
  ${target_rootfs}${rpmlibdir} to make sure that it has been previously
  installed.

* Remove the "--nodeps" when incremental image generation, it should
  take care of the dependencies. Still use "--replacefiles --replacepkgs" in
  case there are conflicts.

[YOCTO #3047]

(From OE-Core rev: 2b3df2ec7979a49842df172be442a8794fe68fff)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-10 13:01:48 +01:00
Robert Yang 4a015e57cc package_rpm.bbclass: fix the arch (replace "-" with "_")
rpm can't use the "-" as the arch, which causes problem, e.g., when
MACHINE = "beagleboard":

* The arch should be armv7a-vfp-neon, but rpm only takes the armv7a,
  this is incorrect since it is mixed with real arch armv7a.

* The nativesdk's arch should be i686-nativesdk (or x86_64-nativesdk),
  but rpm only takes the i686 (or x86_64), this in incorrect since it is
  mixed with the arch i686 (or x86_64).

Replace "-" with "_" when rpm package and the rootfs generation would
fix the problem, I think this is fine since it doesn't change the tune's
arch, the package manager doesn't care about the arch's name, but it
needs a unify arch system to avoid confusing. This is similar to what we
have done on the deb which fixed the arch i486, i586 and so on to i386.

[YOCTO #2328]

(From OE-Core rev: fc985f511da86400e4fa7d17555216c12eb51666)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-10 13:01:45 +01:00
Richard Purdie ad23395cd1 nativesdk: Switch to using nativesdk as a prefix, not a suffix
As discussed on the mailing lists, using a suffix to package names is
hard and has lead to many recipes having to do PKGSUFFIX games. Its
looking extremely hard to scale nativesdk much further without hacking
many recipes.

By comparison, using a prefix like multilib does works much better and
doesn't involve "hacking" as many recipes. This change converts nativesdk
to use a prefix using the existing multilib infrastructure.

(From OE-Core rev: 81813c0e322dc04ce4b069117188d8a54dfddb8c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-02 05:52:06 -07:00
Robert Yang 44b8c1bb30 archiver.bbclass: fix the remove error
* The "tar-package" is used for saving the "Source" list for rpmbuild,
  there is no such a file when "ARCHIVER_MODE[type] ?= srpm", and there
  would be errors, it hadn't happen before was becuase that the remove
  function didn't work. Let the "rpmbuild --rmsource" to remove the
  Sources, and the remove function will just remove the tar-package file.

* Remove several unwanted "try ... exception" sentences, let the error
  raise rather than ignore them when the error happens.

* Remove several un-needed code.

[YOCTO #2619]

(From OE-Core rev: 6ac3e8be0307ecaea5e92f8bda94f1cd2193a47a)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-29 16:02:09 -07:00
Robert Yang 436211f052 archiver.bbclass: remove the "upper()" function
The configuration value from the conf file is lower case, e.g. srpm,
tar, so there is no reason to use the upper case which makes things
complicated.

[YOCTO #2619]

(From OE-Core rev: 036a2502689092bb278b929f6e8ef2a119c1cf35)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-29 16:02:08 -07:00
Robert Yang 3883f82926 archiver.bbclass: fix the fakeroot and other issues
* Fix the fakeroot issue
  The archiver.bbclass is used for archiving sources, patches, and logs,
  it uses the "rpmbuild -bs" from the package_rpm.bbclass to generate the
  .src.rpm, but it didn't work (it's not easy to explain it clearly):

  Reason:
  - It directly used the "fakeroot" command, we don't have such a
    command in native tools, so it would use the fakeroot from the host,
    and it would fail when there is no fakeroot on the host.

  - The "rpmbuild -bs" doesn't need to work under root, but it is in the
    function do_package_write_rpm which is running under fakeroot, and
    "rpmbuild" needs to know the source file's user/group name, the source
    file is the tarball which is created by the postfuncs of do_unpack
    or do_patch which doesn't use the fakeroot, so the created file's
    owner would be the real user, e.g.: robert, but there is no such a
    user under our native tools' fakeroot(pseudo), then the rpmbuild would
    fail. It worked when use the host's fakeroot in the past was because
    that the host's fakeroot knows the users on the host.

  Fix:
  - Remove the incorrect "fakeroot".

  - Change the source file's owner to root.root under fakeroot will fix the
    problem.

* Other fixes:
  - The typo: "do_remove_taball -> do_remove_tarball" which will cause the
    tarball is not removed.

  - Add the _sourcedir defination to the rpmbuild command since the the
    SOURCES would be added to the specfile when archiver.bbclass is
    inherited, otherwise there would be errors when "rpmbuild -bb", though
    the build is OK. It only added the defination to "rpmbuild -bs",
    didn't add to "rpmbuild -bb".

[YOCTO #2619]

(From OE-Core rev: ac152f277fdff256def01af4268215a05685a0f7)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-29 16:02:08 -07:00
Robert Yang c96f6ee659 archiver.bbclass: indent fixes
Several fixes:
* It uses mixed tab and whitespace as the indent in one function,
  Fix them to use "4 spaces" as the indent.

* Remove the unwanted blank, for example, more than one blank lines
  appeared together.

* Remove the tail whitespace.

[YOCTO #2619]

(From OE-Core rev: 5eacbcdf306d9e743164a1563559cd24eb5fffe0)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-29 16:02:07 -07:00
Robert Yang 46b3ab1f2b package_rpm.bbclass: fix and enhance the incremental rpm generation
The incremental rpm generation usually broke when package_rpm.bbclass
changed, change its implementation to make it more stable:

* It depended on the previous and current saved manifest files in
  the past, it would break when the manifest changed. Now query the
  previous and current installed pkgs from rootfs/var/lib and
  rootfs/install/, this would be more reliable, the manifest's change
  would not affect it any more.

* Add explanations before package_install_internal_rpm to explain what
  does the function do.

* Remove an unwanted "awk '{print $1}'".

[YOCTO #2906]

(From OE-Core rev: 5d8ca498e09438bd91654fa8b8b2c970956d88e3)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-21 12:15:31 +01:00
Richard Purdie 48619958d5 meta/classes: Various python whitespace fixes
It was pointed out we have a number of weird indentations in the python functions.
This patch cleans up 3, 7 and other weird indentations for the core bbclass files.

It also fixes some wierd (odd) shell function indentation which my searches picked up.

(From OE-Core rev: 8385d6d74624000d68814f4e3266d47bc8885942)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-21 12:15:30 +01:00
Mark Hatle bfa522b2b5 package_rpm.bbclass: Fix attemptonly install failures
During an attemptonly install, if you try to install two packages that
conflict with each other, a message is generated:

 error: Failed dependencies:
     dropbear conflicts with openssh-6.0p1-r4.ppc603e
     dropbear conflicts with openssh-sshd-6.0p1-r4.ppc603e

This is placed onto stderr (vs stdout), which was not being redirected.
This allowed the log-check code to find the magic key of "Failed" causing
the package installation process to fail.  Instead the proper behavior is to
simply ignore the error and proceed with the install.

(From OE-Core rev: 16d8d7fdda4ae7d108f5d50cde3f6104e231bd23)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-17 18:04:18 +01:00
Paul Eggleton 1ce0f3f867 rpmresolve: improve debug output
Rename rpmresolve's -d option to -t and make -d enable debug output;
add a -o option to specify the output file (so rpm debug output doesn't
go to the output file) and also add a little more detail to some of the
error messages.

(From OE-Core rev: 163dd734d79fd7040b48b10bca6fde28460ac20c)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-15 14:26:43 +01:00
Khem Raj 3309cf42d3 package_rpm.bbclass: Accomodate dash when using arrays
we were assigning local variable to an array coming through
positional arguments. local is a non posix contruct thats
also supported by dash luckily but operates differently in this
case it exapnds the array before assignment. so

local pkgs="$@"

turns into pkgs=locale-base-en-us locale-base-en-gb

ant we see errors

run.do_rootfs.25593: 932: local: locale-base-en-gb: bad variable name

So lets not use defining and assigning local in one go
first define a local and then the assignment

(From OE-Core rev: 4029ce1a15e1dbd374444ee77ccf2a915e463b7b)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-31 12:22:10 +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
Paul Eggleton a73c25d2de classes/rootfs_rpm: improve speed of RPM rootfs construction
Improve the performance of the RPM backend during do_rootfs by
performing most of the package name to file resolution in a separate
utility written in C, processing the entire list of packages at once
rather than running rpm on the command line which loads the RPM database
for every package.

(From OE-Core rev: 9135d351ba7cb21e50239d2b310565680bd4fdca)

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
Robert Yang eb5522e9b0 package_rpm: DEPLOY_DIR_RPM must exist before make index
There is a package-index.bb which will update the index, but the
DEPLOY_DIR_RPM may not exist, for example, when "bitbake package-index"
in a fresh build.

Only the package_rpm.bbclass needs this, the package_ipk.bbclass and
package_deb.bbclass doesn't need.

[YOCTO #2753]

(From OE-Core rev: 72e18bb4171698a386b277b12d973e3d0fd7c4cc)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-20 12:32:52 +01:00
Richard Purdie 73cf0335c4 Remove a number of unneeded import os/bb calls
The bb and os modules are always imported so having these extra import calls
are a waste of space/execution time. They also set a bad example for people
copy and pasting code so clean them up.

(From OE-Core rev: 7d674820958be3a7051ea619effe1a6061d9cbe2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-19 12:24:50 +01:00
Richard Purdie bfd279de32 Convert tab indentation in python functions into four-space
(From OE-Core rev: 604d46c686d06d62d5a07b9c7f4fa170f99307d8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-19 10:24:50 +01:00
Mark Hatle f40ce3e1f4 package_rpm: Avoid duplicate package generation failures
When constructing a multilib based image, it's possible to end up with
the same package listed in multiple steps of the install.  During resolution
we use the --replacepkgs option to avoid errors, as the resulting install
solution will be as expected.  (We do not enable the replacepkgs option
for the final install step, only the generation of the install solution.)

(From OE-Core rev: 68ea7d827710ae7c5cf402887d4c12319038e064)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-09 11:38:02 +01:00
Mark Hatle 9870fbc9f8 Fix manual log file paths
When a recent change, the path to log files may be contained within an
arbitrary directory.  To generate the manual log files in the correct path
we should be using the ${BB_LOGFILE}'s path instead of always assuming the
logs go into ${WORKDIR}/temp.

(From OE-Core rev: 779db325d407f0bade84572ef99fdad4d0c88011)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-03 14:54:57 +01:00
Robert Yang 9b8daa906f package_rpm.bbclass: fix incremental rpm generation
Fixes:
* Remove the "echo '# Remove manifest padding....' > remove.manifest,
  The remove.manifest would be used via "rpm -e `remove.manifest`",
  there would be error since there is no pkg called: Remove, manifest or
  padding

* The incremental.manifest can't be null when used by rpm, so check it
  before use.

* The rpm needs:
	--root "${target_rootfs}/install"
  when use:
	-D "_dbpath ${target_rootfs}/install"
  Otherwise it would use the ${target_rootfs} as the root, and use the
  ${target_rootfs}/var/lib/rpm as the dbpath, this is OK in a fresh
  installation, but there would be errors when increment rpm generation.

[YOCTO #2617]

(From OE-Core rev: 7d702c637b84c028c9763246b3ac355d10083ea3)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-21 13:03:03 +01:00
Mark Hatle 9786663f9c package_rpm: Verify that the package manifests are not empty
An empty manifest will cause a failure condition.  We ensure that any install
actions occur only with a manifest larger then size 0.  Also ensure that padding
is added to the end of the manifest, instead of the beginning to enable this
size check.  (Padding is required for very small manifest files..)

(From OE-Core rev: 9b115181a8b10ec1eb8eac355405695f63e2e011)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-12 11:10:36 +01:00
Mark Hatle 43dd3512aa rootfs_rpm.bbclass: Update database configuration file
Move the creation of the database configuration files to just before we
perform the install actions.  This ensures they will exist even in SDK or
other non-target filesystem images.

(From OE-Core rev: 113e015afd46e46c9ba0413ca15f0316fa2eec24)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-12 11:10:35 +01:00
Mark Hatle 75c302ca80 package_rpm: Add capability to directly query packageorigin
Add functionality to RPM to directly query the packageorigin (path) from
the resolver database, instead of having to do this via an indirect method.

This results in a minor performance improvement.

(From OE-Core rev: a8ff3141fd78442bf328c9d3a489db88ad27486b)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-12 11:10:35 +01:00
Mark Hatle 6ac7e9b598 update-alternatives.bbclass: Refactor the implementation
Refactor in order to:
  * Deprecate the old interfaces, but keep them for compatibility
  * Provide a new, interface -- capable of working with split packages
  * Each update-alternative will now set proper "per-file" provides

Note: this adds a warning message when the older deprecated behavior is
used.  The older behavior has been fully tested using oe-core.

(From OE-Core rev: 309117d26de6a87b16406a44a0cefcbaaf7b5d7a)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-30 12:04:37 +01:00
Robert Yang 73538f548c package_rpm.bbclass: Fix incremental rpm image generation
Fix the incremental rpm image generation, it didn't work since the code
has been changed.

The btmanifest should have a ".manifest" suffix, so that it can be moved
to ${T} by rootfs_rpm.bbclass:
mv ${IMAGE_ROOTFS}/install/*.manifest ${T}/

Note: The locale pkgs would always be re-installed.

[YOCTO #2440]

(From OE-Core rev: 5149630746626c6d416f26ab9dd1c7213fcd8c50)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-24 08:51:37 +01:00
Richard Purdie a246af9bf7 package.bbclass: Drop EXPORT_FUNCTIONS use against mapping_rename_hook
The usage of this function renaming and it being called using
bb.build.exec_func() causes needless indirection loops, confusing log
files and seems generally pointless.

This simplification makes the process much simpler and faster. I can't
come up with a good reason why the export_functions functionality is
needed for this function.

(From OE-Core rev: 74daad03ca29a03b0005f7d2b90a0347d5b583a5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-11 18:03:31 +01:00
Richard Purdie 4a0c704c80 package_rpm: Only rebuild the indexes if the packages have changed
This change farms the solvedb creation out to a separate script which
handles creation of the index, only if mtime of any of the packages
has changed.

For a core-image-minimal set of rpm's this saves ~20s of a 45s rootfs
build. For core-image-sato it saves 1 minute of a 5 minute rootfs build.
The more packages in the system, the bigger the saving will be.

(From OE-Core rev: 3021136e7b42ab64ca16f30c88467c4b00d51ee0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-30 11:37:30 +01:00
Richard Purdie b67fccc81e package_rpm.bbclass: Replace shell provides/requires script with python version
The existing shell script is a fork bomb and forks off hundreds of
grep/cur/wc calls as it reads from its input stream and iterates over
the file data table for each line of input. This patch replaces the
shell code with python code which doesn't exec anything and hence runs
much faster without the exec() overhead. This speeds up rpm packaging
considerably, as can be measured simply by timing it, or watching the
processor utilisation.

(From OE-Core rev: 2fb5f72b47840ed7f540df181595878e3f5ba4c6)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-30 11:37:28 +01:00
Richard Purdie 6703173449 package_rpm.bbclass: Set tmppath for rpm to somewhere which won't conflict with the rootfs
If the rootfs has a specific layout in mind for /var/tmp, it should be
free to create this. Preinst scripts trigger rpm to create its tmppath
directory which could potentially conflict with this.

We're seeing issues if the provider of the /var/tmp wants to use a symlink
and a preinst script executes before it has been installed. This change
places tmppath as used by rpm somewhere safe which is already automatically
cleaned up too.

(From OE-Core rev: 71e95c744eaa4dda1b3237db2e13f666f121c92b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-12 21:25:10 +01:00
Richard Purdie 58d2ff3955 package_rpm.bbclass: Use the correct macros file to avoid empty solvedb path issues
(From OE-Core rev: f714f54df01e02a1115b42f3637f74a11eb51edb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-12 08:22:00 +01:00
Richard Purdie 0923ee40ae package_rpm: Fix useradd preinst ordering issues
We were already having occasional ordering issues with package_rpm.
Fixing the ldconfig postinstall issue pushed rpm over the cliff and
totally broke rpm builds with the packages getting installed in
effectively a random order and the useradd preinstalls getting executed
out of order and breaking.

The only explanation I can find for this is that rpm is special. It will
happily run a preinst for a package without any of that package's
dependencies being present regardless of whether there are any circular
dependency issues or not. I attempted various ways of solving this such
as ordering the total_solution.manifest in creative ways but the bottom
line is RPM ignores this. It takes little account of any request to
ignore /bin/sh dependencies for the purposes of constructing the final
image.

The end result is we're having to install the base-passwd, base-files
and shadow packages first (if there is a request to install them), then
install any other packages.

It this wasn't in the middle of a release I'd be rewriting this bbclass
file, its horrible.

(From OE-Core rev: 2c136255a7db8c57ab595a9c2ee1f32aebefc480)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-12 00:24:35 +01:00
Andreas Oberritter 8b797c6b6e package_{deb,ipk,rpm}: apply umask to files generated in do_package_write_{deb,ipk,rpm}
* Explicitly set umask to 022. Otherwise the build system's
  umask may leak into the image.

(From OE-Core rev: d2a54427481856238bdfec9723cf575088320512)

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-04 17:17:51 +01:00
Xiaofeng Yan 6a99e0f8fb package_rpm: Add srpm function to this bbclass
Add a new function to archive source, patches and logs to a source rpm
package. Every source rpm package will be deployed to
${DEPLOY_DIR}/sources/deploy-srpm

[YOCTO #1977]

(From OE-Core rev: be2db850fbe516b92a3991a5eaf646c4a2b8a1b9)

Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-26 23:13:20 +01:00
Jessica Zhang 53f1446ce4 Fix empty file case that caused build error at do_rootfs
(From OE-Core rev: 2035ce464cc41672c98f7efb8c4a966f93aa7bd0)

Signed-off-by: Jessica Zhang <jessica.zhang@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-26 23:08:19 +01:00
Scott Garman c65d82a88a package_rpm.bbclass: ensure base-passwd and shadow get installed first
When generating images, we need to make sure that base-passwd and
shadow get installed before other packages, which might need to create
custom user accounts.

Thanks to Richard Purdie for the initial version of this fix.

This fixes [YOCTO #2127]

(From OE-Core rev: 3d2d3cb379608301b17ce57787d324c2f06bf4f9)

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-23 12:13:07 +00:00
Otavio Salvador 2082a205f2 package_rpm.bbclass: fix bashims at rpm_common_comand() method
(From OE-Core rev: 43d48d60613418acbaf671c7e8c6cd7d1f6b176b)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Cc: Daiane Angolini <daiane.angolini@freescale.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-19 20:28:47 +00:00
Richard Purdie b1aeaa8b0d meta: Replace bb.data.expand(xxx, d) -> d.expand(xxx)
sed \
 -e 's:bb.data.\(expand([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
 -i `grep -ril bb.data.expand *`

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-05 10:23:53 -08:00
Richard Purdie 06f2f8ce0a meta: Convert getVar/getVarFlag(xxx, 1) -> (xxx, True)
Using "1" with getVar is bad coding style and "True" is preferred.
This patch is a sed over the meta directory of the form:

sed \
 -e 's:\(\.getVar([^,()]*, \)1 *):\1True):g' \
 -e 's:\(\.getVarFlag([^,()]*, [^,()]*, \)1 *):\1True):g' \
 -i `grep -ril getVar *`

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-05 10:22:56 -08:00
Richard Purdie d01dadfb87 meta/classes: Convert to use appendVar and appendVarFlags
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-05 10:22:36 -08:00
Koen Kooi ae3184c96e classes: replace 'Poky' with 'OE-core'
(From OE-Core rev: 1fdcd32520a05465b0d54c062f28bac9cdf74a20)

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-01 15:07:42 +00:00
Mark Hatle 5724ee9c3a package_rpm.bbclass: Add support for filenames with spaces
Files with spaces must be fully quoted in an RPM spec file.  It was
easier to quote all file paths, then to do it selectively.

(From OE-Core rev: a0f5dd25a37fe3b8664c2133e80b6214559f93f6)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-17 16:20:54 +00:00
Robert Yang 9d1823b2a0 Incremental rpm image generation
Incremental rpm image generation, the rootfs would be totally removed and
re-created in the second generation by default, but with
INC_RPM_IMAGE_GEN = "1", the rpm based rootfs would be kept, and will do
update(remove/add some pkgs) on it.

NOTE: This is not suggested when you want to create a productive rootfs

For example:
  1) Add the follow config option to a conf file:
     INC_RPM_IMAGE_GEN = "1"

  2) bitbake core-image-sato
     modify a package
     bitbake core-image-sato

The rootfs would not be totally removed and re-created in the second
generation, it would be simply updated based on the "package".

Implatation:
1) Figure out the pkg which need to be removed or re-installed, then use
'rpm -e to remove the old one. Use the rpm's BUILDTIME to determine
which pkg has been rebuilt.

2) Figure out the pkg which is newly added, and use 'rpm -U' to install
it.

This only for the rpm based rootfs, the deb and ipk based rootfs would
be done later.

[YOCTO #1651]

(From OE-Core rev: 575ba3c9e153a1d8ac228a99a03ca2df5fbca151)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-11 10:36:22 +00:00
Mark Hatle 71ed507f88 package_rpm.bbclass: Add RPMSPEC_PREAMBLE
Add a way to add arbitrary text to the top of a spec file.  This
can be useful for adding specific tags to the produced binaries for
tracking purposes.

(From OE-Core rev: c01a92408d267bcc5365bf8495035f6021a49ced)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-24 10:05:45 +00:00
Mark Hatle 77edb006bb package.bbclass: Adjust RPM call to use dynamic location for magic files
The magic file could be installed somewhere else if the system native prefix
settings are changed.  Adjust the packaging files to compensate for this.

(From OE-Core rev: 93c0e9915b5c9bf8b0877c76f89de721adfbfd66)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-24 10:05:44 +00:00
Richard Purdie 0a434ac101 getVar/setVar cleanups
Complete the bb.data.getVar/setVar replacements with accesses
directly to the data store object.

(From OE-Core rev: 2864ff6a4b3c3f9b3bbb6d2597243cc5d3715939)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-27 10:25:34 +00:00
Richard Purdie c2ce6387bd package_rpm: Set _tmppath to avoid races over tmp files
Occasionally we keep seeing "unable to open temp file" messages during
do_package_write_rpm tasks. This appears to happen when multiple
processes are writing rpm files and is likely due to using the
shared system temp directory. This patch changes the tmp path
to the package work directory meaning conflicts should become
a non-issue.

(From OE-Core rev: b2ef543284c8c8d0d3badb2e1bcadad1106982d2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-18 10:47:14 +00:00
Mark Hatle ef1d61d711 rootfs_rpm.bbclass: Enable pre and post install scripts
[YOCTO #1755]

We change the want the RPM rootfs install works to install pre and post install
scripts.  The new method uses a script helper that is invoked by RPM outside
of the normal chroot.

The wrapper is dynamically generated prior to the install starting.  It will
check the return code of the script.  If the script fails, it will store a copy
to be executed on the first system boot.  This is similar to the previous
mechanism.

In addition, a line of debug was added to the scripts as written by package_rpm
to list which package and which script for later debugging, if necessary.

(From OE-Core rev: 3e7120d6a9fd5e46214673d0a6e1085a7314ff42)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-11 11:01:07 +00:00
Richard Purdie c8dee9b92d Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:

sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`

(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-10 11:51:19 +00:00
Richard Purdie c96e4990fe classes: Remove various bashisms
(From OE-Core rev: a057adfbb72454e28294f00075a69e0e7c699bec)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-10 11:51:18 +00:00
Paul Eggleton 7b645cac3f classes/package_rpm: disable uninstall scripts for upgrades
Our current assumption (based on the behaviour of opkg) when writing
recipes is that prerm and postrm do not get called during an upgrade.
When using rpm however, these are mapped to the rpm "preun" and "postun"
events which occur after postinst for upgrades, and when these contain
removal type operations (such as update-alternatives --remove) this
causes problems.

This patch wraps each preun and postun script for rpm in a check that
determines whether or not the script is being called during an upgrade,
and skips the entire script if it is, which mimics the behaviour of opkg
under the same conditions.

Fixes [YOCTO #1760]

(From OE-Core rev: 1d3f37dc9a43ba6d6beb7b4530c077f239032b99)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-10 11:37:10 +00:00
Dongxiao Xu 1ef442561d multilib: Drop MULTILIB_IMAGE_INSTALL
There should just be a single IMAGE_INSTALL variable. If the package
backends need this split into different multilib components they should
be responsible for doing this, not the user.

This commit removes the MULTILIB_IMAGE_INSTALL variable.

[YOCTO #1564]

(From OE-Core rev: 7736862a74c92fe1afe42e170822be13117575c2)

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-08 14:32:55 +00:00
Richard Purdie fbf50a71e8 package_rpm: Ensure multilib code is only called in the multilib case
This fixes some error messages in the do_rootfs logs of non-multilib
builds.

(From OE-Core rev: 439867efcc9a7df6062fdb8dae85004b1e9ed08c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-10-04 13:46:24 +01:00