summaryrefslogtreecommitdiff
path: root/distributions_versions_fetch_script.py
blob: a102eba63334c0f679cc0282f8ee1a918f923b54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/env python2

import re
from lxml import html
import requests
import datetime

def grep_version_string(repo_listing, pkg_name_prefix):
	regex = pkg_name_prefix + "[0-9.]+"
	p = re.compile(regex)
	match = re.search(p, repo_listing)
	if match is None:
		return None
	first_match = match.group(0)
	if first_match is not None:
		#remove the first package name prefix
		return first_match.strip(pkg_name_prefix)
	return None

def scrap_page(url, xpath, pkg_name_prefix):
	if url is "":
		return "-"
	html_page = requests.get(url)
	tree = html.fromstring(html_page.text)
	html_text = tree.xpath(xpath)[0] # use first node
	pkgversion = grep_version_string(html_text, pkg_name_prefix)
	return pkgversion

def main():
	print "**Last Updated: " + str(datetime.date.today()) + "**"

	distributions_data  = [
		("Debian 6.0.10", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""),
		("Debian 7.8", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""),
		("Debian in development", "https://tracker.debian.org/pkg/efl", "//*[@id=\"dtracker-package-left\"]/div[1]/div[2]/ul/li[2]/div[2]/text()", ""
					, "https://tracker.debian.org/pkg/elementary", "//*[@id=\"dtracker-package-left\"]/div[1]/div[2]/ul/li[2]/div[2]/text()", ""
					, "https://tracker.debian.org/pkg//evas-loaders", "//*[@id=\"dtracker-package-left\"]/div[1]/div[2]/ul/li[2]/div[2]/text()", ""
					, "", "", ""
					, "https://tracker.debian.org/pkg/e17", "//*[@id=\"dtracker-package-left\"]/div[1]/div[2]/ul/li[2]/div[2]/text()", ""
					, "https://tracker.debian.org/pkg/terminology", "//*[@id=\"dtracker-package-left\"]/div[1]/div[2]/ul/li[2]/div[2]/text()", ""
					),
		#("Ubuntu in development", "https://launchpad.net/ubuntu/vivid/amd64/libecore-con1/1.8.6-2.1ubuntu1", "//*[@id=\"portlet-details\"]/div/dl[1]/dd/text()", ""),
		("Fedora in development", "https://apps.fedoraproject.org/packages/efl", "//*[@id=\"package-info-bar\"]/div[1]/div[2]/text()", ""
					, "https://apps.fedoraproject.org/packages/elementary", "//*[@id=\"package-info-bar\"]/div[1]/div[2]/text()", ""
					, "https://apps.fedoraproject.org/packages//evas-generic-loaders", "//*[@id=\"package-info-bar\"]/div[1]/div[2]/text()", ""
					, "", "", ""
					, "https://apps.fedoraproject.org/packages/enlightenment", "//*[@id=\"package-info-bar\"]/div[1]/div[2]/text()", ""
					, "https://apps.fedoraproject.org/packages/terminology", "//*[@id=\"package-info-bar\"]/div[1]/div[2]/text()", ""
					),
		("Elive", "http://repository.elivecd.org/pool/efl/libe/libefl/", "/html/body/pre/a/text()[starts-with(.,'libefl1_')]", "libefl1_"
					, "http://repository.elivecd.org/pool/efl/e/elementary/", "/html/body/pre/a/text()[starts-with(.,'libelementary1_')]", "libelementary1_"
					, "http://repository.elivecd.org/pool/efl/libe/libevas-generic-loaders/", "/html/body/pre/a/text()[starts-with(.,'libevas-generic-loaders1_2.6.3+v')]", "libevas-generic-loaders1_2.6.3+v"
					, "http://repository.elivecd.org/pool/efl/libe/libemotion-generic-players", "/html/body/pre/a/text()[starts-with(.,'libemotion-generic-players1_')]", "libemotion-generic-players1_"
					, "http://repository.elivecd.org/pool/efl/e/e19-plain/", "/html/body/pre/a/text()[starts-with(.,'e19-plain_2.5.6+v')]", "e19-plain_2.5.6+v"
					, "http://repository.elivecd.org/pool/efl/t/terminology/", "/html/body/pre/a/text()[starts-with(.,'terminology_2.6.0+v')]", "terminology_2.6.0+v"
		 ),
		#("Arch", "https://www.archlinux.org/packages/extra/x86_64/efl/", "/html/body/div[@id=\"content\"]/div[@id=\"pkgdetails\"]/h2/text()", "efl "),
		#("openSUSE 13.2", "http://download.opensuse.org/update/13.2/x86_64/", "/html/body/pre/a/text()[starts-with(., 'efl-')]", "efl-"),
		#("Gentoo", "https://packages.gentoo.org/package/dev-libs/efl", "//td[@class=\"ebuild\"][2]/text()", ""),
		#("Tizen:Common", "https://build.tizen.org/package/binaries?package=efl&project=Tizen%3ACommon&repository=x86_64-x11", "//*[@id=\"content\"]/div/ul//li/a/text()[starts-with(., 'efl-')]", "efl-"),
		#("Tizen:Mobile", "https://build.tizen.org/package/binaries?package=efl&project=Tizen%3AMobile&repository=x86_64-x11", "//*[@id=\"content\"]/div/ul//li/a/text()[starts-with(., 'efl-')]", "efl-"),
		#("Tizen:Wearable", "https://build.tizen.org/package/binaries?package=efl&project=Tizen%3AWearable&repository=x86_64-x11", "//*[@id=\"content\"]/div/ul//li/a/text()[starts-with(., 'efl-')]", "efl-"),
		#("Tizen:TV", "https://build.tizen.org/package/binaries?package=efl&project=Tizen%3ATV&repository=x86_64-x11", "//*[@id=\"content\"]/div/ul//li/a/text()[starts-with(., 'efl-')]", "efl-"),
		]

	distributions_data_static  = [
		("Upstream", "https://www.enlightenment.org/download", "//*[@id=\"dtracker-package-left\"]/div[1]/div[2]/ul/li[2]/div[2]/text()", ""),
		("Ubuntu 14.04 (LTS)", "https://launchpad.net/ubuntu/vivid/amd64/libecore-con1/1.8.6-2.1ubuntu1", "//*[@id=\"portlet-details\"]/div/dl[1]/dd/text()", ""),
		("Ubuntu 14.10", "https://launchpad.net/ubuntu/vivid/amd64/libecore-con1/1.8.6-2.1ubuntu1", "//*[@id=\"portlet-details\"]/div/dl[1]/dd/text()", ""),
		("Fedora 21", "https://apps.fedoraproject.org/packages/efl", "//*[@id=\"package-info-bar\"]/div[1]/div[2]/text()", ""),
		("Fedora 22", "https://apps.fedoraproject.org/packages/efl", "//*[@id=\"package-info-bar\"]/div[1]/div[2]/text()", ""),
		("Bodhi 3.0", "", "", ""),
		("Bodhi in development", "", "", ""),
		("Arch AUR", "https://www.archlinux.org/packages/extra/x86_64/efl/", "/html/body/div[@id=\"content\"]/div[@id=\"pkgdetails\"]/h2/text()", "efl "),
		("openSUSE 13.1", "http://download.opensuse.org/update/13.1/x86_64/", "/html/body/pre/a/text()[starts-with(., 'efl-')]", "efl-"),
		("openSUSE Tumbleweed", "http://download.opensuse.org/ports/update/13.2/aarch64/", "/html/body/pre/a/text()[starts-with(., 'efl-')]", "efl-"),
		("openSUSE Development", "http://download.opensuse.org/ports/update/13.2/aarch64/", "/html/body/pre/a/text()[starts-with(., 'efl-')]", "efl-"),
		("openSUSE Weekly Build", "http://download.opensuse.org/ports/update/13.2/aarch64/", "/html/body/pre/a/text()[starts-with(., 'efl-')]", "efl-"),
		("Linux Mint", "", "", ""),
		("Mageia", "", "", ""),
		("Cent OS", "", "", ""),
		("RHEL", "", "", ""),
		("Windows / Win-builds 1.5", "", "", ""),
		("Mac OSX / homewbrew", "http://braumeister.org/formula/efl", "//*[@id=\"basic\"]/h2[1]/div/strong/text()", ""),
		("Tizen:IVI", "https://build.tizen.org/package/binaries?package=efl&project=Tizen%3AIVI&repository=x86_64-x11", "//*[@id=\"content\"]/div/ul//li/a/text()[starts-with(., 'efl-')]", "efl-"),
		("OE/Yocto", "https://build.tizen.org/package/binaries?package=efl&project=Tizen%3ACommon&repository=x86_64-x11", "//*[@id=\"content\"]/div/ul//li/a/text()[starts-with(., 'efl-')]", "efl-"),
		("FreeBSD", "https://build.tizen.org/package/binaries?package=efl&project=Tizen%3ACommon&repository=x86_64-x11", "//*[@id=\"content\"]/div/ul//li/a/text()[starts-with(., 'efl-')]", "efl-"),
		("Buildroot", "//git.buildroot.org/buildroot/tree/package/efl", "//*[@id=\"content\"]/div/ul//li/a/text()[starts-with(., 'efl-')]", "efl-")
		]

	print("Table with automatically fetched versions:\n")
	print("| **Distro / Platform** | **EFL** | **Elementary** | **Evas Generic Loaders** | **Emotion Generic Players** | **Enlightenment** | **Terminology** |")
	print("| **Latest Releases** | **1.13.2** | **1.13.2** | **1.13.2** | **1.13.0** | **0.19.4** | **0.8.0** |")
	for param_set in distributions_data:
		distri = param_set[0]
		efl_url = param_set[1]
		efl_xpath = param_set[2]
		efl_pkg_name_prefix = param_set[3]
		elm_url = param_set[4]
		elm_xpath = param_set[5]
		elm_pkg_name_prefix = param_set[6]
		evas_url = param_set[7]
		evas_xpath = param_set[8]
		evas_pkg_name_prefix = param_set[9]
		emotion_url = param_set[10]
		emotion_xpath = param_set[11]
		emotion_pkg_name_prefix = param_set[12]
		e_url = param_set[13]
		e_xpath = param_set[14]
		e_pkg_name_prefix = param_set[15]
		term_url = param_set[16]
		term_xpath = param_set[17]
		term_pkg_name_prefix = param_set[18]
		print ("| %s | [[%s | %s]] | [[%s | %s]] | [[%s | %s]] | [[%s | %s]] | [[%s | %s]] | [[%s | %s]]|") % (distri,
								efl_url, scrap_page(efl_url, efl_xpath, efl_pkg_name_prefix),
								elm_url, scrap_page(elm_url, elm_xpath, elm_pkg_name_prefix),
								evas_url, scrap_page(evas_url, evas_xpath, evas_pkg_name_prefix),
								emotion_url, scrap_page(emotion_url, emotion_xpath, emotion_pkg_name_prefix),
								e_url, scrap_page(e_url, e_xpath, e_pkg_name_prefix),
								term_url, scrap_page(term_url, term_xpath, term_pkg_name_prefix)
								)

	print("\nTable with manually tracked versions:\n")
	print("| **Distro / Platform** | **EFL** | **Elementary** | **Evas Generic Loaders** | **Emotion Generic Players** | **Enlightenment** | **Terminology** |")
	print("| **Latest Releases** | **1.13.2** | **1.13.2** | **1.13.2** | **1.13.0** | **0.19.4** | **0.8.0** |")
	for param_set in distributions_data_static:
		distri = param_set[0]
		print("| %s | - | - | - | - | - | - |") % (distri)

if __name__ == '__main__':
	main()