summaryrefslogtreecommitdiffstats
path: root/meta/classes/metadata_scm.bbclass
Commit message (Collapse)AuthorAgeFilesLines
* meta: remove True option to getVar callsJoshua Lock2016-12-161-1/+1
| | | | | | | | | | | | | 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>
* metadata_scm.bbclass: Do not assume ${COREBASE} is a Git repoPeter Kjellerstedt2016-05-111-3/+2
| | | | | | | | | | | | | | | | | | | | | The functions base_detect_revision() and base_detect_branch() try to extract SCM meta information from the path returned by base_get_scmbasepath(), which currently returns ${COREBASE}. However, making the assumption that ${COREBASE} contains SCM meta information can be false. It is true for Poky, but not necessarily other environments. A better option is to look for the SCM meta information based on the meta layer. Since this works as expected for Git but not SVN, the call to base_get_metadata_svn_revision() from base_detect_revision() was also removed. This is not expected to affect anyone (partly based on the comment in base_get_metadata_svn_revision()). (From OE-Core rev: 53fd0a4a37023642a770a9fbf3cd5511d3c82af7) 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>
* classes/metadata_scm: fix git errors showing up on non-git repositoriesPaul Eggleton2015-11-241-10/+10
| | | | | | | | | | | | | | | | | | | | | | Fixes the following error showing up for layers that aren't a git repo (or aren't parented by one): fatal: Not a git repository (or any of the parent directories): .git This was because we weren't intercepting stderr. We might as well just use bb.process.run() here which does that and returns stdout and stderr separately. (This was a regression that came in with OE-Core revision 3aac11076e22ac4fea48f5404110bb959547a9fe). Fixes [YOCTO #8661]. (From OE-Core rev: f533c1bf4c6edbecc67f9e2c62fd475d64668e86) 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>
* metadata_scm: rewrite git hash logicRoss Burton2015-10-191-11/+12
| | | | | | | | | | | The code to get the git and branch hash for the current commit in a specific repository was quite complex and prone to breakage, replace it with subprocess and git rev-parse. (From OE-Core rev: bd8ff33cf2439536c6e41cf0ee9dd8fb3b64770a) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* metadata_scm: Fix crash due to uncaught python exceptionMerten Sach2014-12-031-1/+1
| | | | | | | | | | | | | | | | Function base_get_metadata_svn_revision was crashing due to an uncaught IndexError exception. The except notation without parentheses is legacy syntax. It is the equivalent to 'except IOError as IndexError' which is not what we want here. The change catches both exceptions. (From OE-Core rev: 33bea949bae54ddc89aa83cf07d7b1ee62e2b393) Signed-off-by: Merten Sach <msach@mailbox.tu-berlin.de> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* metadata_scm: Avoid crashing on new svn version layoutsRichard Purdie2013-11-241-1/+3
| | | | | | | | | | | | | This avoids crashing on newer svn layouts where the entries files don't contain three lines. If someone wants to fix this to get the right version on newer subversion checkouts, patches welcome but this at least stops things crashing. [YOCTO #5363] (From OE-Core rev: e850c53d4d8cb877a704a23f9ce02d6185ba3ffa) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* class/lib: Fix up various file access methodsRichard Purdie2013-05-091-9/+12
| | | | | | | | | | | | | | 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>
* metadata_scm: Replace deprecated operatorRichard Purdie2013-05-091-2/+2
| | | | | | | | The <> operator is deprecated, use != instead which is equivalent. (From OE-Core rev: dde7af5f6c769eae721b1ee18462b841c8ea3277) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Convert tab indentation in python functions into four-spaceRichard Purdie2012-07-191-51/+51
| | | | | | (From OE-Core rev: 604d46c686d06d62d5a07b9c7f4fa170f99307d8) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Revert "meta: replace os.popen with subprocess.Popen"Richard Purdie2012-05-301-5/+7
| | | | | | | | | This reverts commit e83d8e58a6b107eea87df0ec233a1bc932b2c6e as the conversion is not correct. Its replacing readlines() calls which generate an array with what are effectively strings. There are split("\n") calls missing in many cases so this needs to be reverted until it gets fixed. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* meta: replace os.popen with subprocess.PopenRobert Yang2012-05-301-7/+5
| | | | | | | | | | | | | | | | | | | | | | Replace os.popen with subprocess.Popen since the older function would fail (more or less) silently if the executed program cannot be found There are both bb.process.run() and bb.process.Popen() which wraps the subprocess module, use it for simplifying the code. Note: We don't need the "2>/dev/null" or "2>&1" since bb.process.run() can handle it, it will raise exception when error occurs, we should handle the exception ourselves if we want to ignore the error. More info: http://docs.python.org/library/subprocess.html#subprocess-replacements [YOCTO #2454] (From OE-Core rev: e83d8e58a6b107eea87df0ec233a1bc932b2c6ea) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* meta: Convert getVar/getVarFlag(xxx, 1) -> (xxx, True)Richard Purdie2012-03-051-1/+1
| | | | | | | | | | | | 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>
* Convert to use direct access to the data store (instead of bb.data.*Var*())Richard Purdie2011-11-101-1/+1
| | | | | | | | | | | | | | | | | 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>
* metadata_scm.bbclass: Use COREBASE to grok for SCM operationsKhem Raj2011-05-111-4/+1
| | | | | | | (From OE-Core rev: 17c8c41b837d66bd3cc02c4c60e62dcfc13b80a8) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* metadata_scm: Ensure that if an SCM isn't present, we dont print a revision ↵Richard Purdie2010-10-211-3/+6
| | | | | | of 'fatal:' as it looks bad Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* metadata_scm.bbclass: Make errors quiet if we're not in a git based scmJoe Sauer2010-06-081-2/+2
| | | | Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* base.bbclass: Split up as per the patch in OE.dev by Chris Larson making ↵Richard Purdie2010-03-191-0/+77
code more readable and modularised Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>