summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>2017-11-14 16:57:28 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-30 10:49:22 +0000
commitc5999210254958ff1c3452c92678dfdda3e66aa7 (patch)
tree4e06199a241aeb3ff54699daad17d5fb1b3694c2 /meta
parent4f2b00b67373aed2029b11f1753b0c59107d27fb (diff)
downloadpoky-c5999210254958ff1c3452c92678dfdda3e66aa7.tar.gz
distrodata.bbclass: make upstream version check more useful for git upstreams
Specifically: 1) remove +git${SRCPV} stuff from comparison and output; it's just unnecessary clutter; 2) write the commit id of the latest version tag into the output; this saves quite a bit of trouble of manually checking what that commit id is when doing version updates; 3) when UPSTREAM_CHECK_COMMITS is set, ignore the tags altogether; instead check if the latest commit is different to the one we use, and if so, report that the recipe can be updated to said commit (which is also written into the output, as in 2). Multiple recipes are failing the upstream check because they never issue tags, now we can fix them. (From OE-Core rev: 591d57877d3d3e659d78c0ed33f4c515e3f6f8fb) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/distrodata.bbclass26
-rw-r--r--meta/lib/oe/recipeutils.py44
2 files changed, 26 insertions, 44 deletions
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass
index c85f7b3474..b0f4ecea09 100644
--- a/meta/classes/distrodata.bbclass
+++ b/meta/classes/distrodata.bbclass
@@ -272,24 +272,15 @@ python do_checkpkg() {
272 if upstream_check_unreliable == "1": 272 if upstream_check_unreliable == "1":
273 return "N/A", "CHECK_IS_UNRELIABLE" 273 return "N/A", "CHECK_IS_UNRELIABLE"
274 274
275 try: 275 uv = oe.recipeutils.get_recipe_upstream_version(localdata)
276 uv = oe.recipeutils.get_recipe_upstream_version(localdata) 276 pupver = uv['version'] if uv['version'] else "N/A"
277 pupver = uv['version'] if uv['version'] else "N/A" 277 pversion = uv['current_version']
278 except Exception as e: 278 revision = uv['revision'] if uv['revision'] else "N/A"
279 pupver = "N/A"
280 279
281 if pupver == "N/A": 280 if pupver == "N/A":
282 pstatus = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN" 281 pstatus = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN"
283 else: 282 else:
284 src_uri = (localdata.getVar('SRC_URI') or '').split() 283 cmp = vercmp_string(pversion, pupver)
285 if src_uri:
286 uri_type, _, _, _, _, _ = decodeurl(src_uri[0])
287 else:
288 uri_type = "none"
289 pv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pversion, uri_type)
290 upv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pupver, uri_type)
291
292 cmp = vercmp_string(pv, upv)
293 if cmp == -1: 284 if cmp == -1:
294 pstatus = "UPDATE" if not upstream_version_unknown else "KNOWN_BROKEN" 285 pstatus = "UPDATE" if not upstream_version_unknown else "KNOWN_BROKEN"
295 elif cmp == 0: 286 elif cmp == 0:
@@ -297,7 +288,7 @@ python do_checkpkg() {
297 else: 288 else:
298 pstatus = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN" 289 pstatus = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN"
299 290
300 return pupver, pstatus 291 return pversion, pupver, pstatus, revision
301 292
302 293
303 """initialize log files.""" 294 """initialize log files."""
@@ -334,7 +325,6 @@ python do_checkpkg() {
334 325
335 pdesc = localdata.getVar('DESCRIPTION') 326 pdesc = localdata.getVar('DESCRIPTION')
336 pgrp = localdata.getVar('SECTION') 327 pgrp = localdata.getVar('SECTION')
337 pversion = localdata.getVar('PV')
338 plicense = localdata.getVar('LICENSE') 328 plicense = localdata.getVar('LICENSE')
339 psection = localdata.getVar('SECTION') 329 psection = localdata.getVar('SECTION')
340 phome = localdata.getVar('HOMEPAGE') 330 phome = localdata.getVar('HOMEPAGE')
@@ -345,7 +335,7 @@ python do_checkpkg() {
345 psrcuri = localdata.getVar('SRC_URI') 335 psrcuri = localdata.getVar('SRC_URI')
346 maintainer = localdata.getVar('RECIPE_MAINTAINER') 336 maintainer = localdata.getVar('RECIPE_MAINTAINER')
347 337
348 pupver, pstatus = get_upstream_version_and_status() 338 pversion, pupver, pstatus, prevision = get_upstream_version_and_status()
349 339
350 if psrcuri: 340 if psrcuri:
351 psrcuri = psrcuri.split()[0] 341 psrcuri = psrcuri.split()[0]
@@ -358,7 +348,7 @@ python do_checkpkg() {
358 with open(logfile, "a") as f: 348 with open(logfile, "a") as f:
359 writer = csv.writer(f, delimiter='\t') 349 writer = csv.writer(f, delimiter='\t')
360 writer.writerow([pname, pversion, pupver, plicense, psection, phome, 350 writer.writerow([pname, pversion, pupver, plicense, psection, phome,
361 prelease, pdepends, pbugtracker, ppe, pdesc, pstatus, pupver, 351 prelease, pdepends, pbugtracker, ppe, pdesc, pstatus, prevision,
362 psrcuri, maintainer, no_upgr_reason]) 352 psrcuri, maintainer, no_upgr_reason])
363 f.close() 353 f.close()
364 bb.utils.unlockfile(lf) 354 bb.utils.unlockfile(lf)
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index a1e191afc7..4e0859e6d9 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -900,25 +900,25 @@ def get_recipe_upstream_version(rd):
900 FetchError when don't have network access or upstream site don't response. 900 FetchError when don't have network access or upstream site don't response.
901 NoMethodError when uri latest_versionstring method isn't implemented. 901 NoMethodError when uri latest_versionstring method isn't implemented.
902 902
903 Returns a dictonary with version, type and datetime. 903 Returns a dictonary with version, repository revision, current_version, type and datetime.
904 Type can be A for Automatic, M for Manual and U for Unknown. 904 Type can be A for Automatic, M for Manual and U for Unknown.
905 """ 905 """
906 from bb.fetch2 import decodeurl 906 from bb.fetch2 import decodeurl
907 from datetime import datetime 907 from datetime import datetime
908 908
909 ru = {} 909 ru = {}
910 ru['current_version'] = rd.getVar('PV')
910 ru['version'] = '' 911 ru['version'] = ''
911 ru['type'] = 'U' 912 ru['type'] = 'U'
912 ru['datetime'] = '' 913 ru['datetime'] = ''
913 914 ru['revision'] = ''
914 pv = rd.getVar('PV')
915 915
916 # XXX: If don't have SRC_URI means that don't have upstream sources so 916 # XXX: If don't have SRC_URI means that don't have upstream sources so
917 # returns the current recipe version, so that upstream version check 917 # returns the current recipe version, so that upstream version check
918 # declares a match. 918 # declares a match.
919 src_uris = rd.getVar('SRC_URI') 919 src_uris = rd.getVar('SRC_URI')
920 if not src_uris: 920 if not src_uris:
921 ru['version'] = pv 921 ru['version'] = ru['current_version']
922 ru['type'] = 'M' 922 ru['type'] = 'M'
923 ru['datetime'] = datetime.now() 923 ru['datetime'] = datetime.now()
924 return ru 924 return ru
@@ -927,6 +927,9 @@ def get_recipe_upstream_version(rd):
927 src_uri = src_uris.split()[0] 927 src_uri = src_uris.split()[0]
928 uri_type, _, _, _, _, _ = decodeurl(src_uri) 928 uri_type, _, _, _, _, _ = decodeurl(src_uri)
929 929
930 (pv, pfx, sfx) = get_recipe_pv_without_srcpv(rd.getVar('PV'), uri_type)
931 ru['current_version'] = pv
932
930 manual_upstream_version = rd.getVar("RECIPE_UPSTREAM_VERSION") 933 manual_upstream_version = rd.getVar("RECIPE_UPSTREAM_VERSION")
931 if manual_upstream_version: 934 if manual_upstream_version:
932 # manual tracking of upstream version. 935 # manual tracking of upstream version.
@@ -947,33 +950,22 @@ def get_recipe_upstream_version(rd):
947 ru['datetime'] = datetime.now() 950 ru['datetime'] = datetime.now()
948 else: 951 else:
949 ud = bb.fetch2.FetchData(src_uri, rd) 952 ud = bb.fetch2.FetchData(src_uri, rd)
950 pupver = ud.method.latest_versionstring(ud, rd) 953 if rd.getVar("UPSTREAM_CHECK_COMMITS") == "1":
951 (upversion, revision) = pupver 954 revision = ud.method.latest_revision(ud, rd, 'default')
952 955 upversion = pv
953 # format git version version+gitAUTOINC+HASH 956 if revision != rd.getVar("SRCREV"):
954 if uri_type == 'git': 957 upversion = upversion + "-new-commits-available"
955 (pv, pfx, sfx) = get_recipe_pv_without_srcpv(pv, uri_type) 958 else:
956 959 pupver = ud.method.latest_versionstring(ud, rd)
957 # if contains revision but not upversion use current pv 960 (upversion, revision) = pupver
958 if upversion == '' and revision:
959 upversion = pv
960
961 if upversion:
962 tmp = upversion
963 upversion = ''
964
965 if pfx:
966 upversion = pfx + tmp
967 else:
968 upversion = tmp
969
970 if sfx:
971 upversion = upversion + sfx + revision[:10]
972 961
973 if upversion: 962 if upversion:
974 ru['version'] = upversion 963 ru['version'] = upversion
975 ru['type'] = 'A' 964 ru['type'] = 'A'
976 965
966 if revision:
967 ru['revision'] = revision
968
977 ru['datetime'] = datetime.now() 969 ru['datetime'] = datetime.now()
978 970
979 return ru 971 return ru