[OE-core] [PATCH 1/1] archiver.bbclass: add revision to git tarfile name

Joe Slater jslater at windriver.com
Tue Aug 26 17:18:19 UTC 2014


When archiving original source, insert the first 10
characters of srcrev, after stripping off any
AUTOINC+, into the filename for tarfiles created
from directories.

Signed-off-by: Joe Slater <jslater at windriver.com>
---
 meta/classes/archiver.bbclass |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index 35e5411..9f0ed57 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -136,7 +136,7 @@ python do_ar_original() {
     bb.note('Archiving the original source...')
     fetch = bb.fetch2.Fetch([], d)
     for url in fetch.urls:
-        local = fetch.localpath(url).rstrip("/");
+        local = fetch.localpath(url)
         if os.path.isfile(local):
             shutil.copy(local, ar_outdir)
         elif os.path.isdir(local):
@@ -146,7 +146,12 @@ python do_ar_original() {
             fetch.unpack(tmpdir, (url,))
 
             os.chdir(tmpdir)
-            tarname = os.path.join(ar_outdir, basename + '.tar.gz')
+            # We split on '+' to chuck any annoying AUTOINC+ in the revision.
+            try:
+                src_rev = bb.fetch2.get_srcrev(d).split('+')[-1][:10]
+            except:
+                src_rev = 'NOREV'
+            tarname = os.path.join(ar_outdir, basename + '.' + src_rev + '.tar.gz')
             tar = tarfile.open(tarname, 'w:gz')
             tar.add('.')
             tar.close()
-- 
1.7.3.4




More information about the Openembedded-core mailing list