Commit Graph

50 Commits

Author SHA1 Message Date
Joshua Lock cc2744267f meta: replace uses of bb.data.expand(VARNAME, d) with d.expand(VARNAME)
bb.data.expand(x, d) is deprecated API.

[YOCTO #10678]

(From OE-Core rev: a361babe443da635aed83be46679067457fd6a58)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-22 11:35:19 +00:00
Dominic Sacré 73e811190b lib/oe/patch: Support xz-compressed patches
Add .xz to the list of extensions recognized by patch_path(), so that
compressed patches ending in .patch.xz or .diff.xz are automatically
applied.

(From OE-Core rev: f1a2c45765d14d3ca09657ad1f6b526554af2bb6)

(From OE-Core rev: f50fd7f247d5bb05bc7d1109c574a682067688da)

Signed-off-by: Dominic Sacré <dominic.sacre@gmx.de>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-23 12:49:48 -08: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
Paul Eggleton 275b3fe5f4 classes/patch: move several functions to oe.patch
Move patch_path(), src_patches() and should_apply() to oe.patch, making
them easier to call from elsewhere (particularly across the
UI/server boundary).

(From OE-Core rev: 2724511e18810cc8082c1b028e3b7c8a8b5def56)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14 12:30:50 +00:00
Paul Eggleton d316363b7b lib/oe/patch: fix handling of patches with no header
If a patch applied by a recipe has no header and we turn the recipe's
source into a git tree (when PATCHTOOL = "git" or when using devtool
extract / modify / upgrade), the commit message ends up consisting only
of the original filename marker ("%% original patch: filename.patch").
When we come to do turn the commits back into a set of patches in
extractPatches(), this first line ends up in the "Subject: " part of
the file, but we were ignoring it because the line didn't start with the
marker text. The end result was we weren't able to get the original
patch name. Strip off any "Subject [PATCH x/y]" part before looking for
the marker text to fix.

This caused "devtool modify openssl" followed by "devtool update-recipe
openssl" (without any changes in-between) to remove version-script.patch
because that patch has no header and we weren't able to determine the
original filename.

(From OE-Core rev: d9971f5dc8eb7de551fd6f5e058fd24770ef5d78)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-23 11:10:12 +00:00
Paul Eggleton 7caf628e83 lib/oe/patch: improve accuracy of patch header extraction
When PATCHTOOL = "git", if we need to manually apply a patch and then
commit it (i.e. when git am doesn't work) we try to extract the author /
date / shortlog from the patch header. Make the following improvements
to that extraction process:

* If there's no explicit Subject: but the first line is followed by a
  blank line, isn't an Upstream-Status: or Index: marker and isn't too
  long, then assume it's good enough to be the shortlog. This avoids
  having too many patches with "Upgrade to version x.y" as the shortlog
  (since that is often when patches get added).
* Add --follow to the command we use to find the commit that added the
  patch, so we mostly get the commit that added the patch rather than
  getting stuck on upgrade commits that last moved/renamed the patch
* Populate the date from the commit that added the patch if we were able
  to get the author but not the date from the patch (otherwise you get
  today's date which is less useful).

(From OE-Core rev: 896cfb10ec166a677cbb3b4f8643719cabeb7663)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-24 07:30:09 +01:00
Paul Eggleton f6928407ed lib/oe/patch: exclude "From <hash>" from commit message when PATCHTOOL is "git"
If you leave "From <hash>" lines in the commit message it can actually
break git rebase because it tries to interpret the line in the context
of the current repository, and if the hash is invalid then a rebase
will blow up with:

  fatal: git cat-file: could not get object info

or in newer git versions:

  error: unable to find <hash>
  fatal: git cat-file <hash>: bad file

(I hit this when I tried to do a devtool upgrade on openssl to 1.0.2i
the first time I did "git rebase --skip")

(From OE-Core rev: 19a6b18ac23cb2d7bb89203f774b2bee7f0cb03c)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-24 07:30:09 +01:00
Paul Eggleton 94aefd9a39 lib/oe/patch: handle non-UTF8 encoding when reading patches
When extracting patches from a git repository with PATCHTOOL = "git" we
cannot assume that all patches will be UTF-8 formatted, so as with other
places in this module, try latin-1 if utf-8 fails.

This fixes UnicodeDecodeError running devtool update-recipe or devtool
finish on the openssl recipe.

(From OE-Core rev: 579e4d54a212d04cfece2c9fc0635d7ac1644058)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-08 00:36:48 +01:00
Paul Eggleton 4b4387455c lib/oe/patch: commit with a dummy user/email when PATCHTOOL=git
When using PATCHTOOL = "git", the user of the system is not really the
committer - it's the build system itself. Thus, specify "dummy" values
for username and email instead of using the user's configured values.
Various parts of the devtool code that need to make commits have also
been updated to use the same logic.

This allows PATCHTOOL = "git" and devtool to be used on systems where
git user.name / user.email has not been set (on versions of git where
it doesn't default a value under this circumstance).

If you want to return to the old behaviour where the externally
configured user name / email are used, set the following in your
local.conf:

PATCH_GIT_USER_NAME = ""
PATCH_GIT_USER_EMAIL = ""

Fixes [YOCTO #8703].

(From OE-Core rev: 765a9017eaf77ea3204fb10afb8181629680bd82)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-03 23:45:52 +01:00
Paul Eggleton 029e3ebcb2 lib/oe/patch: handle encoding differences in patch files
With Python 3, the encoding of a file is significant; several recipes in
OE-Core have patches which are not fully utf-8 decodable e.g. man,
lrzsz, and gstreamer1.0-libav, leading to errors when using devtool's
modify, upgrade or extract subcommands on these recipes. To work around
this, try reading the patch file as utf-8 first and if that fails try
latin-1 before giving up.

(From OE-Core rev: 7f4d7a6f51569954e204f110827a8ce256bcdc68)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-12 23:10:16 +01:00
Ed Bartosh 3ee70cb725 scripts: Fix encoding errors for python3
Moved call of decode('utf-8') as close as possible to
call of subprocess API to avoid calling it in a lot of
other places.

Decoded binary data to utf-8 where appropriate to fix devtool
and recipetool tests in python 3 environment.

(From OE-Core rev: 30d02e2aa2d42fdf76271234b2dc9f37bc46b250)

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
Richard Purdie 297438e965 classes/lib: Convert to use python3 octal syntax
The syntax for octal values changed in python3, adapt to it.

(From OE-Core rev: 737a095fcde773a36e0fee1f27b74aaa88062386)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02 08:24:00 +01:00
Markus Lehtonen fc8b24d8e0 oe/patch: print cleaner error message when patch fails to apply
[YOCTO #9344]

(From OE-Core rev: 574405a97f956278d31d52cfc934be2840cf2fa6)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-03 15:51:36 +01:00
Markus Lehtonen bf140145a0 oe/patch: more detailed error reporting
Show the actual command that failed when raising a CmdError. Makes
figuring out what actually failed much easier.

[YOCTO #9344]

(From OE-Core rev: 8e9c03df1810daab7171733f1713ef94d3a18ab2)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-03 15:51:36 +01:00
Paul Eggleton ddfe74447b devtool: commit for extra tasks that modify source when extracting
When extracting source for a recipe, if there are additional custom
tasks run that make changes to the source, create a commit in the
generated git branch so they are contained. This is particularly
useful for tasks that come before do_patch since otherwise the changes
might get incorporated in the first applied patch, but otherwise it
helps avoid the tree being dirty at any point.

Fixes [YOCTO #7626].

(From OE-Core rev: 997a77d9b20af1778b804778e5d8c8a7424f7582)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-11 12:33:02 +00:00
Peter Kjellerstedt eb7e554cbd lib/oe/patch: Make GitApplyTree._applypatch() support read-only .git/hooks
Rather than modifying files in .git/hooks, which can be read-only
(e.g., if it is a link to a directory in /usr/share), move away the
entire .git/hooks directory temporarily.

(From OE-Core rev: a88d603b51a9ebb39210d54b667519acfbe465c3)

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>
2016-01-30 11:37:01 +00:00
Paul Eggleton a360fa7d51 lib/oe/patch: improve extraction of patch header
For patches that we have to extract the header information by hand (i.e.
will not apply with "git am"), make the following improvements:

* If we can't extract author/date/subject, then try to do so from the
  commit that added the patch in git (assuming the metadata is tracked
  by git)
* Take only first Signed-off-by line instead of last
* Accept any case for "Signed-off-by" in case author has typed it by
  hand
* Improve conditional - we can skip the other cases if one matches

Implements [YOCTO #7624].

(From OE-Core rev: 13ec296b5c35aefa2c44f64f8bd1ef54c4a0a731)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-01 21:32:03 +00:00
Markus Lehtonen 31c3078a63 oe.patch.GitApplyTree: add paths argument to extractPatches
Makes it possible to define which paths are included in the patches.

(From OE-Core rev: 640e57b423e5a8f0e4572eac985f87139780f247)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-10-01 07:43:31 +01:00
Paul Eggleton e0b9a96002 lib/oe/patch: fix for git am not cleaning up after itself
Unfortunately it appears that under certain circumstances, a failed
git am followed by git am --abort won't clean up any changes the patch
might have made - this was seen when running "devtool extract" on the
unzip recipe; unzip-6.0_overflow3.diff has a malformed date as far as
git am is concerned but it triggers this condition. Add a
git reset --hard HEAD followed by git clean -f in order to recover from
this scenario.

(From OE-Core rev: 21fdbd76f458b70a6646dd6d0749e3a465ebd320)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-23 09:53:13 +01:00
Paul Eggleton 9253e927d7 lib/oe/patch: handle patches that delete files with older git
When running "git add" on a directory with older git versions, deleted
files aren't added to what is to be committed unless you explicitly
specify the -A option. The result of this is that when applying a patch
from a recipe which doesn't apply with "git am" (and we fall back to
applying the patch through other means then "git add" following by
a "git commit") these deletes weren't committed with the patch, leaving
them sitting deleted but not committed at the end.

This should fix test_devtool_modify_native (which unwittingly exercises
this scenario by attempting to run "devtool modify" on apt-native) on
machines with older git versions.

(From OE-Core rev: 367ffba394bb815d776f48a367d5d7e5ea9b3bba)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-30 12:36:02 +01:00
Richard Purdie d85231ef14 lib/oe/patch: Fix git patch application for source in subdirectory
Similarly to:
http://git.yoctoproject.org/cgit.cgi/poky/commit/meta/lib/oe/patch.py?id=f205ccaf48ac36f4b26efc4aeb2e9d2939b28646
we need to fix patch application for source which is in a subdirectory.

Passing "." as the git directory or work-dir appears to work (or is ignored)
in some versions of git but does not work in others, probably quite correctly.

Since we have reporoot from the above patch, pass this in directly.

This bug caused this sanity test failure on some machines:

FAIL: test_devtool_modify_git (oeqa.selftest.devtool.DevtoolTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/devtool.py", line 390, in test_devtool_modify_git
    self.assertEqual(result.output.strip(), "", 'Created git repo is not clean')
AssertionError: '?? util/mkelfImage/patches/' != '' : Created git repo is not clean

since git apply would fail, it would then fall back to quilt
and the git tree would be left unclean.

[YOCTO #7911]

(From OE-Core rev: 91d76e632336d6af96f24bcf92be25f41a216856)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-26 09:27:30 +01:00
Paul Eggleton fbfc06a969 recipetool: add appendfile subcommand
Locating which recipe provides a file in an image that you want to
modify and then figuring out how to bbappend the recipe in order to
replace it can be a tedious process. Thus, add a new appendfile
subcommand to recipetool, providing the ability to create a bbappend
file to add/replace any file in the target system. Without the -r
option, it will search for the recipe packaging the specified file
(using pkgdata from previously built recipes). The bbappend will be
created at the appropriate path within the specified layer directory
(which may or may not be in your bblayers.conf) or if one already exists
it will be updated appropriately.

Fairly extensive oe-selftest tests are also provided.

Implements [YOCTO #6447].

(From OE-Core rev: dd2aa93b3c13d2c6464ef0fda59620c7dba450bb)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-20 21:41:04 +01:00
Paul Eggleton 2298b4a03e lib/oe/patch: use with open() for all file operations
with open(...)... is preferred for reading/writing files as it is neater
and takes care of closing the file for you.

(From OE-Core rev: 99ac382d84667eb496dc510d3277b8c55b237738)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-20 21:41:04 +01:00
Paul Eggleton f205ccaf48 lib/oe/patch: fix PATCHTOOL = "git" with source in a subdirectory
For recipes that have their actual source in a subdirectory of what is
fetched (e.g. mkelfimage), we need to find the root of the repository
within the GitApplyTree code that attempts to set up the required git
hooks and use that, rather than expecting the root to be the same as
${S}.

(From OE-Core rev: d820303f64ea610338ec11ffd79269e7831d1da9)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-23 17:35:27 +00:00
Paul Eggleton 12bb32e766 lib/oe/patch: add support for extracting patches from git tree
When patches from a recipe have been written out to a git tree, we also
want to be able to do the reverse so we can update the patches next to
the recipe. This is implemented by adding a comment to each commit
message (using git hooks) which we can extract later on.

(From OE-Core rev: 765b7bad50eae5b79d13a3f4988dc440c3d9787f)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-12-21 12:37:56 +00:00
Paul Eggleton 50e771d114 lib/oe/patch.py: abort "git am" if it fails
If we don't do this, you may still be in the git am resolution mode at
the end of applying patches, which is not desirable.

(From OE-Core rev: 630a393d01950a0d00b5d30ac376472911e50ff9)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-12-21 12:37:56 +00:00
Paul Eggleton 37db9e62f0 lib/oe/patch: use --keep-cr with git am
Preserving carriage returns is important where the patch contains them.

(From OE-Core rev: 1cfcae0cd0bc776f5bb91a75bb8ffdad3d7bf200)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-12-21 12:37:56 +00:00
Paul Eggleton 400933b050 lib/oe/patch: auto-commit when falling back from git am
When PATCHTOOL = "git", if we're not able to use "git am" to apply a
patch and fall back to "git apply" or "patch", it is desirable to
actually commit the changes, attempting to preserve (and interpret) the
patch header as part of the commit message if present. As a bonus, the
code for extracting the commit message is callable externally in case it
is useful elsewhere.

(From OE-Core rev: 8c522846093809a8deb866079e73fa317266c80e)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-12-21 12:37:56 +00:00
Paul Eggleton e03c04758b lib/oe/patch: fall back to patch if git apply fails
When PATCHTOOL = "git", git apply doesn't support fuzzy application, so
if a patch requires that it's better to be able to apply it rather than
just failing.

(From OE-Core rev: a8143f33d3104adcd10968e3b05df2024e723f5a)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-12-21 12:37:56 +00:00
Laszlo Papp 909486e124 lib/oe/patch.py: Prefer "git am" over "git apply" when applying git patches
It is better to use "git am" when possible to preserve the commit messages and
the mail format in general for patches when those are present. A typical use
case is when developers would like to keep the changes on top of the latest
upstream, and they may occasionally need to rebase. This is not possible with
"git diff" and "diff" generated patches.

Since this is not always the case, the fallback would be the "git apply"
operation which is currently available.

(From OE-Core rev: 3a14b0943731822905e6d45b13d08a6e8237e2fe)

Signed-off-by: Laszlo Papp <lpapp@kde.org>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-28 00:52:32 +00: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
Richard Purdie b54339d633 classes/lib: Fix getcmdstatus breakage
I mistakenly thought subprocess had getcmdstatus in python 2. It doesn't so lets
add a wrapper and have this work in both worlds.

(From OE-Core rev: 2253e9f12734c6e6aa489942b5e4628eca1fa29d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09 16:05:08 +01:00
Richard Purdie e16faa55da sanity/patch.py: Remove commands module usage
The commands module is removed in python3. Use the subprocess module instead
and the pipes module to replace the mkargs usage.

(From OE-Core rev: e2e1dcd74bc45381baccf507c0309dd792229afe)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09 14:06:51 +01:00
Richard Purdie 2ac4f8b397 clases/lib: Use modern exception syntax
Update older code to use modern exception handling syntax which
is the form accepted by python 3.

(From OE-Core rev: b010501cd089e649a68f683be0cf4d0aac90fbe3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09 14:06:50 +01:00
Richard Purdie e651c1a109 lib/oe/patch: Use force option when creating symlinks to patches
Under the scenario where you have an existing source tree and you then
change one of the patches, maybe to be architecture or machine specific,
then rebuild, the build will fail since the symlink already exists
but should now point at a different file.

The easiest fix is to tell the system to remove and recreate the link
which is done with the force option.

(From OE-Core rev: 4741b90b170bc96e3a24f9c1dce871af060bc4d5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-17 17:24:57 +00: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 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 d1168cc12a lib/oe/patch.py: Fix and improve PatchTree() resolver logic
Currently, if PATCHRESOLVE is user and and PatchTree() is being used, you can
get backtraces if patch application fails. This is because even in the failure
case, self._current is incremented, meaning second time around, there are array
range issues.

This patch changes the code so _current is only incremented upon successful
patch application, thereby resolving this failure.

Secondly, if you bitbake -c patch -f a recipe using PatchTree(), the
clean method was unimplemented leading to patch failures.

The other part of this patch changes the logic so a series file and
set of applied patches are maintained in a quilt like fashion. This
means a the Clean method can be implemented correctly and rerunning
the patch task of an existing patches source now works reliably.

[YOCTO #2043 partially]

(From OE-Core rev: f0fc47aea37793a62c43f10eea27ca014c420924)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-02 16:22:48 +00:00
Paul Eggleton 11e5d7bc81 classes/patch: avoid backtrace when patch does not apply
We don't need to see a Python stack backtrace when a patch does not
apply, just the error output from patch, so trap these kinds of errors
and ensure that we display the message and fail the task and nothing
else.

Fixes [YOCTO #1143]

(From OE-Core rev: ce6c80a1e68c2af0b4b5fa27582ad9c9f119e5c1)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-19 14:34:34 +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 9d1f10ed01 patch: Convert to use oe_terminal
Unfortunately we can't access oe_terminal directly from patch.py
so we have to pass in the correct terminal function pointer.

[YOCTO #1587]

(From OE-Core rev: 9e0a21dda24f285a1c4878488e887485a749f3f2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-04 17:05:32 +00:00
Samuel Stirtzel fb8483e216 patch.py: fixed message domain errors
The dynamic message domain was introduced by Richard Purdie with the following patch:
http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=a6c48298b17e6a5844b3638b422fe226e3b67b89

(From OE-Core rev: 2383e06c8ed7c15aa148b9dbe40445e7095b6f57)

Signed-off-by: Samuel Stirtzel <s.stirtzel@googlemail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-10-14 14:36:58 +01:00
Khem Raj 7a78b2104c oe/patch.py: Remove series file during Clean()
Currently if there is a failed do_patch the series files get appended
so if there were two patches

a.patch
b.patch
and b.patch failed during next run it would append a.patch again
a.patch
b.patch
a.patch

and this would keep growing.

We can remove series file in Clean() because we populate it in Import()
anyway

(From OE-Core rev: fd07744ae549c2f43b18d53e6ed16c20df6b4ef3)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Chris Larson <chris_larson@mentor.com>
Acked-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-05-10 09:57:09 +01:00
Khem Raj 7eab4aee68 lib/oe/patch.py: Cosmetic change to avoid bitbake warning
bb.mkdirhier should be bb.utils.mkdirhier

(From OE-Core rev: cd28d5f5ad7855d0d6a15bec5317c942e2462065)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-03-23 15:43:56 +00:00
Chris Larson 21a3b6de9d oe.patch: add missing imports
(From OE-Core rev: cefbf3a14fcf87e18f7a63a1f55904d9d612ed3e)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-03-23 15:43:54 +00:00
Richard Purdie 984e90f4d7 meta/classes: Update classes to use new fetcher API
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:37 +00:00
Joshua Lock 1fbcd2ca17 lib/oe: sync with OE.dev
Most notable change is the move to creating symlinks to patches in the metadata
tree rather than copying them.

Signed-off-by: Joshua Lock <josh@linux.intel.com>
2010-08-04 11:43:12 +01:00
Richard Purdie beef002bb4 lib/oe/patch.py: Fix patch application failure interaction handling
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-06-10 20:22:41 +01:00
Richard Purdie 1de1ac2eb2 lib/oe/patch.py: Fix datastore references in error paths
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-05-27 15:58:00 +01:00
Joshua Lock ac023d775b lib/oe: Import oe lib from OE.dev
This library moves the common Python methods into modules of an 'oe' Python
package.

Signed-off-by: Joshua Lock <josh@linux.intel.com>
2010-05-06 12:48:05 +01:00