summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/fetch.py
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2014-11-05 12:10:29 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-12 15:25:17 +0000
commit6bb241a278135e760d50380fd3f7b0ff52414328 (patch)
tree44a501e079b5f64d7b7e0244428218d67fff8e65 /bitbake/lib/bb/tests/fetch.py
parent7587877e5d683a30c2bd5e1ac1c4e327fac1ee1c (diff)
downloadpoky-6bb241a278135e760d50380fd3f7b0ff52414328.tar.gz
bitbake: fetch/wget: Add latest_versionstring method
Being able to query whether updated versions of a url are available is useful, not least for the package reporting system. Since such code is closely linked to the url type and the url itself, the fetcher makes a locical place to contain this code. For wget based urls this means taking upstream directory listings and searching those for later versions, returning those that are found. The patch also adds unittests for this function so that if improvements are made, the original test urls can be used to evaulate the those changes. This is based on code from Irina Patru <irina.patru@intel.com>. (Bitbake rev: a8272e22b7819e0e8afd8e291d276f5f28fc0007) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
-rw-r--r--bitbake/lib/bb/tests/fetch.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index aa9b222612..9d45743fdf 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -600,6 +600,31 @@ class FetchMethodTest(FetcherTest):
600 : "3.82+dbg0.9", 600 : "3.82+dbg0.9",
601 } 601 }
602 602
603 test_wget_uris = {
604 # packages with versions inside directory name
605 ("util-linux", "http://kernel.org/pub/linux/utils/util-linux/v2.23/util-linux-2.24.2.tar.bz2", "", "")
606 : "2.24.2",
607 ("enchant", "http://www.abisource.com/downloads/enchant/1.6.0/enchant-1.6.0.tar.gz", "", "")
608 : "1.6.0",
609 ("cmake", "http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz", "", "")
610 : "2.8.12.1",
611 # packages with versions only in current directory
612 ("eglic", "http://downloads.yoctoproject.org/releases/eglibc/eglibc-2.18-svnr23787.tar.bz2", "", "")
613 : "2.19",
614 ("gnu-config", "http://downloads.yoctoproject.org/releases/gnu-config/gnu-config-20120814.tar.bz2", "", "")
615 : "20120814",
616 # packages with "99" in the name of possible version
617 ("pulseaudio", "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-4.0.tar.xz", "", "")
618 : "5.0",
619 ("xserver-xorg", "http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.15.1.tar.bz2", "", "")
620 : "1.15.1",
621 # packages with valid REGEX_URI and REGEX
622 ("cups", "http://www.cups.org/software/1.7.2/cups-1.7.2-source.tar.bz2", "http://www.cups.org/software.php", "/software\.php\?VERSION=2\.0\.0&FILE=2\.0\.0/(?P<name>cups\-)(?P<pver>((\d+[\.\-_]*)+))\-source\.tar\.gz")
623 : "2.0.0",
624 ("db", "http://download.oracle.com/berkeley-db/db-5.3.21.tar.gz", "http://www.oracle.com/technetwork/products/berkeleydb/downloads/index-082944.html", "http://download.oracle.com/otn/berkeley-db/(?P<name>db-)(?P<pver>((\d+[\.\-_]*)+))\.tar\.gz")
625 : "6.1.19",
626 }
627
603 def test_git_latest_versionstring(self): 628 def test_git_latest_versionstring(self):
604 for k, v in self.test_git_uris.items(): 629 for k, v in self.test_git_uris.items():
605 self.d.setVar("SRCREV", k[2]) 630 self.d.setVar("SRCREV", k[2])
@@ -609,3 +634,13 @@ class FetchMethodTest(FetcherTest):
609 print("Package %s, version: %s <= %s" % (k[0], v, verstring)) 634 print("Package %s, version: %s <= %s" % (k[0], v, verstring))
610 r = bb.utils.vercmp_string(v, verstring) 635 r = bb.utils.vercmp_string(v, verstring)
611 self.assertTrue(r == -1 or r == 0) 636 self.assertTrue(r == -1 or r == 0)
637
638 def test_wget_latest_versionstring(self):
639 for k, v in self.test_wget_uris.items():
640 self.d.setVar("REGEX_URI", k[2])
641 self.d.setVar("REGEX", k[3])
642 ud = bb.fetch2.FetchData(k[1], self.d)
643 verstring = ud.method.latest_versionstring(ud, self.d)
644 print("Package %s, version: %s <= %s" % (k[0], v, verstring))
645 r = bb.utils.vercmp_string(v, verstring)
646 self.assertTrue(r == -1 or r == 0)