aboutsummaryrefslogtreecommitdiffstats
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)
downloadopenembedded-core-contrib-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):
: "3.82+dbg0.9",
}
+ test_wget_uris = {
+ # packages with versions inside directory name
+ ("util-linux", "http://kernel.org/pub/linux/utils/util-linux/v2.23/util-linux-2.24.2.tar.bz2", "", "")
+ : "2.24.2",
+ ("enchant", "http://www.abisource.com/downloads/enchant/1.6.0/enchant-1.6.0.tar.gz", "", "")
+ : "1.6.0",
+ ("cmake", "http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz", "", "")
+ : "2.8.12.1",
+ # packages with versions only in current directory
+ ("eglic", "http://downloads.yoctoproject.org/releases/eglibc/eglibc-2.18-svnr23787.tar.bz2", "", "")
+ : "2.19",
+ ("gnu-config", "http://downloads.yoctoproject.org/releases/gnu-config/gnu-config-20120814.tar.bz2", "", "")
+ : "20120814",
+ # packages with "99" in the name of possible version
+ ("pulseaudio", "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-4.0.tar.xz", "", "")
+ : "5.0",
+ ("xserver-xorg", "http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.15.1.tar.bz2", "", "")
+ : "1.15.1",
+ # packages with valid REGEX_URI and REGEX
+ ("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")
+ : "2.0.0",
+ ("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")
+ : "6.1.19",
+ }
+
def test_git_latest_versionstring(self):
for k, v in self.test_git_uris.items():
self.d.setVar("SRCREV", k[2])
@@ -609,3 +634,13 @@ class FetchMethodTest(FetcherTest):
print("Package %s, version: %s <= %s" % (k[0], v, verstring))
r = bb.utils.vercmp_string(v, verstring)
self.assertTrue(r == -1 or r == 0)
+
+ def test_wget_latest_versionstring(self):
+ for k, v in self.test_wget_uris.items():
+ self.d.setVar("REGEX_URI", k[2])
+ self.d.setVar("REGEX", k[3])
+ ud = bb.fetch2.FetchData(k[1], self.d)
+ verstring = ud.method.latest_versionstring(ud, self.d)
+ print("Package %s, version: %s <= %s" % (k[0], v, verstring))
+ r = bb.utils.vercmp_string(v, verstring)
+ self.assertTrue(r == -1 or r == 0)