diff options
Diffstat (limited to 'meta/lib/oe/recipeutils.py')
-rw-r--r-- | meta/lib/oe/recipeutils.py | 44 |
1 files changed, 18 insertions, 26 deletions
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 |