diff options
author | Mei Lei <lei.mei@intel.com> | 2011-03-04 17:17:05 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-03-04 22:26:35 +0000 |
commit | 8af386867081791aa5ccc6eaf56f5532d81025a8 (patch) | |
tree | f7138722c4a6c3cf2145226f7a50d2db3f5e95cf | |
parent | 4e1ba86c5a6c51ed1186c2778661c006f121ce70 (diff) | |
download | poky-8af386867081791aa5ccc6eaf56f5532d81025a8.tar.gz |
distrodata.bbclass: Get git repo tag information
For those recipes which use git repo and have tag information, we can use tag to trace the version change. For other no tag recipes, we still use their
commit checksum to trace their version change.
(From OE-Core rev: 30343a72b89167b46ff4cc33be6ada2fd4b13a59)
Signed-off-by: Mei Lei <lei.mei@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/distrodata.bbclass | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass index d84b306226..e2cc8fa049 100644 --- a/meta/classes/distrodata.bbclass +++ b/meta/classes/distrodata.bbclass | |||
@@ -347,7 +347,6 @@ python do_checkpkg() { | |||
347 | f = tempfile.NamedTemporaryFile(delete=False, prefix="%s-1-" % pn) | 347 | f = tempfile.NamedTemporaryFile(delete=False, prefix="%s-1-" % pn) |
348 | status = internal_fetch_wget(url, d, f) | 348 | status = internal_fetch_wget(url, d, f) |
349 | fhtml = f.read() | 349 | fhtml = f.read() |
350 | |||
351 | if status == "SUCC" and len(fhtml): | 350 | if status == "SUCC" and len(fhtml): |
352 | newver = parse_inter(curver) | 351 | newver = parse_inter(curver) |
353 | 352 | ||
@@ -436,6 +435,10 @@ python do_checkpkg() { | |||
436 | else: | 435 | else: |
437 | """newver still contains a full package name string""" | 436 | """newver still contains a full package name string""" |
438 | status = re.search("(\d+[\.\-_])*(\d+[0-9a-zA-Z]*)", newver[1]).group() | 437 | status = re.search("(\d+[\.\-_])*(\d+[0-9a-zA-Z]*)", newver[1]).group() |
438 | if "_" in status: | ||
439 | status = re.sub("_",".",status) | ||
440 | elif "-" in status: | ||
441 | status = re.sub("-",".",status) | ||
439 | elif not len(fhtml): | 442 | elif not len(fhtml): |
440 | status = "ErrHostNoDir" | 443 | status = "ErrHostNoDir" |
441 | 444 | ||
@@ -531,6 +534,12 @@ python do_checkpkg() { | |||
531 | 534 | ||
532 | alturi = bb.encodeurl([type, host, altpath, user, pswd, {}]) | 535 | alturi = bb.encodeurl([type, host, altpath, user, pswd, {}]) |
533 | newver = check_new_version(alturi, curname, d) | 536 | newver = check_new_version(alturi, curname, d) |
537 | while(newver == "ErrHostNoDir"): | ||
538 | if alturi == "/download": | ||
539 | break | ||
540 | else: | ||
541 | alturi = "/".join(alturi.split("/")[0:-2]) + "/download" | ||
542 | newver = check_new_version(alturi, curname, d) | ||
534 | if not re.match("Err", newver): | 543 | if not re.match("Err", newver): |
535 | pupver = newver | 544 | pupver = newver |
536 | if pupver != pcurver: | 545 | if pupver != pcurver: |
@@ -550,13 +559,38 @@ python do_checkpkg() { | |||
550 | gitproto = parm['protocol'] | 559 | gitproto = parm['protocol'] |
551 | else: | 560 | else: |
552 | gitproto = "rsync" | 561 | gitproto = "rsync" |
553 | 562 | gitcmd = "git ls-remote %s://%s%s%s *tag* 2>&1" % (gitproto, gituser, host, path) | |
554 | gitcmd = "git ls-remote %s://%s%s%s HEAD 2>&1" % (gitproto, gituser, host, path) | 563 | gitcmd2 = "git ls-remote %s://%s%s%s HEAD 2>&1" % (gitproto, gituser, host, path) |
555 | print gitcmd | 564 | tmp = os.popen(gitcmd).read() |
556 | ver = os.popen(gitcmd).read() | 565 | tmp2 = os.popen(gitcmd2).read() |
557 | if ver and re.search("HEAD", ver): | 566 | #This is for those repo have tag like: refs/tags/1.2.2 |
558 | pupver = ver.split("\t")[0] | 567 | if tmp: |
559 | if pcurver == pupver: | 568 | tmpline = tmp.split("\n") |
569 | verflag = 0 | ||
570 | for line in tmpline: | ||
571 | if len(line)==0: | ||
572 | break; | ||
573 | puptag = line.split("/")[-1] | ||
574 | puptag = re.search("[0-9][0-9|\.|_]+[0-9]", puptag) | ||
575 | if puptag == None: | ||
576 | continue; | ||
577 | puptag = puptag.group() | ||
578 | puptag = re.sub("_",".",puptag) | ||
579 | plocaltag = pversion.split("+")[0] | ||
580 | if "git" in plocaltag: | ||
581 | plocaltag = plocaltag.split("-")[0] | ||
582 | result = bb.utils.vercmp(("0", puptag, ""), ("0", plocaltag, "")) | ||
583 | if result > 0: | ||
584 | verflag = 1 | ||
585 | pstatus = "UPADTE" | ||
586 | pupver = puptag | ||
587 | elif verflag == 0 : | ||
588 | pupver = plocaltag | ||
589 | pstatus = "MATCH" | ||
590 | #This is for those no tag repo | ||
591 | elif tmp2: | ||
592 | pupver = tmp2.split("\t")[0] | ||
593 | if pupver in pversion: | ||
560 | pstatus = "MATCH" | 594 | pstatus = "MATCH" |
561 | else: | 595 | else: |
562 | pstatus = "UPDATE" | 596 | pstatus = "UPDATE" |
@@ -580,7 +614,7 @@ python do_checkpkg() { | |||
580 | for line in svninfo.split("\n"): | 614 | for line in svninfo.split("\n"): |
581 | if re.search("^Last Changed Rev:", line): | 615 | if re.search("^Last Changed Rev:", line): |
582 | pupver = line.split(" ")[-1] | 616 | pupver = line.split(" ")[-1] |
583 | if pcurver == pupver: | 617 | if pupver in pversion: |
584 | pstatus = "MATCH" | 618 | pstatus = "MATCH" |
585 | else: | 619 | else: |
586 | pstatus = "UPDATE" | 620 | pstatus = "UPDATE" |