Commit Graph

35 Commits

Author SHA1 Message Date
Nathan Rossi 09a253d09f update-alternatives.bbclass: Disable for mingw32 targets
When building for mingw32 targets (e.g. nativesdk cross compiling for
windows), disable the dependency on update-alternatives as the Windows
platform does not support symlinks or package management.

This avoids the complex (partly non-buildable for mingw32) dependency
chain virtual/update-alternatives -> opkg-utils -> python -> ...

(From OE-Core rev: 0131abe2d94d6836a54bc1616566c3bf3f2d6eb0)

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-04 23:18:19 +00:00
Jussi Kukkonen 777ed33f44 update-alternatives.bbclass: Add PACKAGE_WRITE_DEPS for postinst
(From OE-Core rev: 00e1e87d0dcf13f3b30682f1fb066f7fa4eed205)

Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-20 11:53:50 +00:00
David Vincent fc89a3f739 classes: Fix alternatives and rc.d ordering
When using an alternative as an initscript, the ordering between
update-rc.d and update-alternatives tasks during prerm and postinst
tasks must always be the following in order to work:
  * prerm:
    - stop daemon
    - remove alternative

  * postinst:
    - add alternative
    - start daemon

This patchset adds comments to the scripts generated by both classes and
organize the generated sections based on those comments.

[YOCTO #10433]

Changes since v5:
    - Remove boolean in d.getVar() calls

(From OE-Core rev: aa87b1a4dcc14e4dfe719b6c55045c5662bc59c2)

Signed-off-by: David Vincent <freesilicon@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-09 13:39:11 +00:00
Joshua Lock 3c59b1bf93 meta: remove True option to getVarFlag calls
getVarFlag() now defaults to expanding by default, thus remove the
True option from getVarFlag() calls with a regex search and
replace.

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

(From OE-Core rev: 2dea9e490a98377010b3d4118d054814c317a735)

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
Joshua Lock c4e2c59088 meta: 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: 7c552996597faaee2fbee185b250c0ee30ea3b5f)

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
Richard Purdie f49be7e7c9 update-alternatives: Fix determinism issue
getVarFlags returns a dict and there is therefore no sort order. This
means the order of the X_VARDEPS_X variables can change and hence the
task checksums can change. This can lead to rebuilds of any parts of
the system using update-alternatives and their dependees. This is a
particular issue under python v3.

Add in a sort to make the order of the variables deterministic.

(From OE-Core rev: ecd1bfed5534f83b775a6c79092c04bd13c3af0a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-11 10:33:42 +01:00
Ross Burton 063dc3856d update-alternatives: when warning about alt_link==alt_target, say what PN
A warning that doesn't say what the PN is doesn't really help.

(From OE-Core rev: 27ad7f446ff7b6a6a4f8f0d392f03c6707340a21)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-24 09:40:25 +00:00
Maxin B. John a205c4ce1d bbclass: fix spelling mistakes
Fix some spelling mistakes in bbclass files

(From OE-Core rev: ed484c06f436eea62c5d0b1a2964f219f3e5cb61)

Signed-off-by: Maxin B. John <maxin.john@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-11-24 15:50:27 +00:00
Richard Purdie 86d30d756a meta: Add explict getVar param for (non) expansion
Rather than just use d.getVar(X), use the more explict d.getVar(X, False)
since at some point in the future, having the default of expansion would
be nice. This is the first step towards that.

This patch was mostly made using the command:

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

(From OE-Core rev: ab7c1d239b122c8e549e8112c88fd46c9e2b061b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:57:25 +01:00
Andreas Oberritter 2a473ac17a update-alternatives.bbclass: alternatives should be removed in prerm
This behaviour matches dpkg's manpage and fixes deinstalling
alternatives for programs needed by the postrm script, e.g. /bin/sh.

(From OE-Core rev: 2a5484a90513b58c829a916bfe5268a0fde3512a)

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-03-25 12:39:38 +00:00
Richard Purdie 11cff9446f update-alternatives: We now use u-a in nativesdk so make sure the dependency is present
When update-alternatives was part of opkg which got built in most nativesdk
scenarios, this missing dependency wasn't an issue. We now need nativesdk-opkg-utils
so we need to ensure the dependency is present in nativesdk cases.

This avoids build failures with the recent u-a move to opkg-utils.

(From OE-Core rev: 7e0adf676da45e49287b7ce6478a6dbfd8fa117f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-19 16:32:10 +00:00
Richard Purdie e0ffc1f378 update-alternatives: Drop deprecated code, update to show error message
This code has been deprecated for a while and confuses the class, lets drop it
and just give the user hard error messages instead of the current warnings/fixups.

(From OE-Core rev: 72579e1fe49e8bc66c9f5850a2c679ce8941c85d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-22 17:16:55 +01:00
Richard Purdie db8217f6b8 classes: Use modern exception raising syntax
Modern expection rasing syntax is function call format, convert to this
to keep python 3 happy and model correct coding style in the core.

(From OE-Core rev: f4b382754603d3f1caa13824bcc8d06b568bbc59)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09 14:06:50 +01:00
Richard Purdie b45615a6ad update-alternatives: Ensure DEPENDS is correct in multilib case
Ensure that the DEPENDS we're adding is correct in the multilib case by
including MLPREFIX, fixing unnecessary dependencies in those images.

(From OE-Core rev: 1fa8909e24866ffada75daf63225c8daa000b9be)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-04-15 15:57:29 +01:00
Richard Purdie 069a332d1c classes: Drop none package specific packaging variable accesses
(From OE-Core rev: 24cbe88429ba021d7c461e0271b67106d11d5eb2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-17 22:32:03 +00:00
Enrico Scholz a09c5d6673 update-alternatives.bblcass: use oe.path.realpath()
oe.path.realpath() provides are common and more correct implementation
for resolving symlinks within sysroot. Use it.

(From OE-Core rev: 2fa5cc0d08e855e24a4497601d7cc73b9f2aa550)

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-11 14:46:11 +00:00
Richard Purdie 4cae28e309 package.bbclass: Add PACKAGESPLITFUNCS variable
Prepending to populate_packages is rather ugly and means its hard to trace
errors and also profiling informaiton is summed together in one function.

This patch starts to split out the prepends to become separate functions
to avoid these issues. This is generally a neater way to write functions
than prepending to where there can sometimes be variable scope issues
and we've been bitten by whitespace issues in the past.

(From OE-Core rev: 4f9963d1d82ee896fe9491d6a8b32be42cd06f14)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-06 13:13:00 +00:00
Richard Purdie d81aa06ece package.bbclass: Multithread per file dependency generation code
(From OE-Core rev: b659eb0f2070149d9516c129b3853b41fbbd1033)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-06 13:12:59 +00:00
Mark Hatle 59e15f6712 update-alternatives: Add a build-time dependency
We need to add a build time dependency on virtual/update-alternatives,
however we can't just do DEPENDS +=, or we end up with various problems.  To
work around this, in the anonymous python space we ensure we only do the
addition when the package does not provide virtual/update-alternatives and
it is a target package.

Also the system wide PREFERRED_PROVIDER was incorrect.  It references a
runtime package, and not the recipe it should have.  This has been corrected.

[YOCTO #3691]

(From OE-Core rev: 56a59ef12936dcc6464cf1d43dda6957a5aa8c65)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Tested-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-20 13:06:43 +00:00
Christopher Larson 7f8eedaa86 update-alternatives.bbclass: use absolute paths for link targets
This improves compatibility, as both the debian update-alternatives and the
chkconfig alternatives require absolute paths.

(From OE-Core rev: 2b8bf64f1f6999b65ddd3efc2c6ddb7e70fead53)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-07 11:09:40 +00:00
Mark Hatle 1d61099065 update-alternatives.bbclass: Add missing runtime dependency
When using update-alternatives, there should be a runtime dependency on
${VIRTUAL-RUNTIME_update-alternatives}.  Without this, it's possible to
get into a situation where the package is not installable.

(If VIRTUAL-RUNTIME_update-alternatives is not defined, no requirement
is added.)

(From OE-Core rev: 8a4c5765fb56d17c3d82ff6db47863e934c9fcbe)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-07 16:13:46 +00: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
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
Richard Purdie 0b8d5dad9c update-alternatives: Fix absolute symlink handling
After the class changes, absolute symlinks are not being handled correctly
by the class file. This adds handling for absolute symlinks to account for the
pkgdest directory, removing dangling symlink messages from recipes like bzip2.

(From OE-Core rev: ecea2fab2063a3c478a63e62ba0e80305674c5e0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-30 17:32:31 +01:00
Mark Hatle e4449c91fb update-alternatives.bbclass: Change from using PN to BPN
In order to better support multilib processing, switch from PN
to BPN.

(From OE-Core rev: 75f70ab534f6dfef961906fb5c252f9e5310d38f)

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
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
Richard Purdie 6ea6facd66 update-alternatives: Fix for compatibility with multilib recipes
The PN == BPN test was designed to exclude native/nativesdk but also unfortunately
excludes multilib unintentionally. This change fixes this and allows multilib images
with alternatives to funciton correctly.

[YOCTO #2214]

(From OE-Core rev: 2878d19c4e19d76cb8be15825c40ff03f25f35f5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-14 22:54:50 +01: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
Paul Eggleton 464f8478ba classes/update-alternatives: fix typos and grammar
(From OE-Core rev: b63fd2c71b9d5d3bcaa98fe08b2e65db8c2bf6d1)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-05 11:23:11 +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
Kevin Tian ad0e271a03 update-alternatives.bbclass: don't expand var when appending do_install
Or else absolute paths may be expanded which then breaks sstate signature
comparison.

I'm not sure whether pre/post funcs can be expanded or not. They are
invoked at image build or on the target, and thus need be expanded some
place. But if one recipe does use directories under TMP in its postinst
helpers, this would be an issue again.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
2010-11-21 18:17:24 +00:00
Kevin Tian 22cbcd964f update-alternative.bbclass: add batch alternatives support
With new batch ability, we can use below simple 2 lines for multiple alternatives
updates:

ALTERNATIVE_LINKS = "${bindir}/cmd1 {sbindir}/cmd2 ..."
ALTERNATIVE_PRIORITY = "100"

Then for each command "/path/cmd" listed in ALTERNATIVE_LINKS, below is done
automatically:

    ${D}/path/cmd is renamed to ${D}/path/cmd.{PN}
    a new alternative named 'cmd' is created which:
        links /path/cmd to /path/cmd.{PN} with priority specified in ALTERNATIVE_PRIORITY

This way the recipe with multiple alternatives could be simplified a lot. There
are still some cases where above assumptions may break, but I expect more recipes
should benefit from this simple enhancement

Fix [BUGID #257]

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
2010-09-29 16:42:15 +01:00
Richard Purdie c54117458a classes: Remove and sanitise import statements
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2009-11-13 12:15:28 +00:00
Richard Purdie 8aee6b32a0 classes: Standardise whitespace in anonymous python methods and factor out functions for more efficent use by bitbake (as also patched in OE)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@875 311d38ba-8fff-0310-9ca6-ca027cbcb966
2006-11-20 09:16:34 +00:00
Richard Purdie b2f192faab Rename /openembedded/ -> /meta/
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@530 311d38ba-8fff-0310-9ca6-ca027cbcb966
2006-07-21 10:10:31 +00:00