]> code.ossystems Code Review - openembedded-core.git/commitdiff
reproducible: Refactor: Break out fixed_source_date_epoch() function
authorDouglas Royds <douglas.royds@taitradio.com>
Thu, 22 Nov 2018 20:41:56 +0000 (09:41 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 8 Jan 2019 20:12:01 +0000 (20:12 +0000)
(From OE-Core rev: 4eb6def4fe82959c2a348142b9eada27d3354aef)

Signed-off-by: Douglas Royds <douglas.royds@taitradio.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
meta/classes/reproducible_build.bbclass

index 0eb696ac78f4d4cdaba69716f75f6628cb90a724..a0fd4d656bf8ca57979ac99805033c85b14619db 100644 (file)
@@ -128,6 +128,10 @@ def get_source_date_epoch_from_youngest_file(d, sourcedir):
         bb.debug(1, "Newest file found: %s" % newest_file)
     return source_date_epoch
 
+def fixed_source_date_epoch():
+    bb.debug(1, "No tarball or git repo found to determine SOURCE_DATE_EPOCH")
+    return 0
+
 python do_create_source_date_epoch_stamp() {
     epochfile = d.getVar('SDE_FILE')
     if os.path.isfile(epochfile):
@@ -139,11 +143,8 @@ python do_create_source_date_epoch_stamp() {
         get_source_date_epoch_from_git(d, sourcedir) or
         get_source_date_epoch_from_known_files(d, sourcedir) or
         get_source_date_epoch_from_youngest_file(d, sourcedir) or
-        0       # Last resort
+        fixed_source_date_epoch()       # Last resort
     )
-    if source_date_epoch == 0:
-        # empty folder, not a single file ...
-        bb.debug(1, "No files found to determine SOURCE_DATE_EPOCH")
 
     bb.debug(1, "SOURCE_DATE_EPOCH: %d" % source_date_epoch)
     bb.utils.mkdirhier(d.getVar('SDE_DIR'))