Add Debian automation (closes #42)
Use www.debian.org source repository to fetch versions.
This commit is contained in:
102
releases/debian.json
Normal file
102
releases/debian.json
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
{
|
||||||
|
"10.1": "2019-09-07",
|
||||||
|
"10.10": "2021-06-19",
|
||||||
|
"10.11": "2021-10-09",
|
||||||
|
"10.12": "2022-03-26",
|
||||||
|
"10.13": "2022-09-10",
|
||||||
|
"10.2": "2019-11-16",
|
||||||
|
"10.3": "2020-02-08",
|
||||||
|
"10.4": "2020-05-09",
|
||||||
|
"10.5": "2020-08-01",
|
||||||
|
"10.6": "2020-09-26",
|
||||||
|
"10.7": "2020-12-05",
|
||||||
|
"10.8": "2021-02-06",
|
||||||
|
"10.9": "2021-03-27",
|
||||||
|
"11.1": "2021-10-09",
|
||||||
|
"11.2": "2021-12-18",
|
||||||
|
"11.3": "2022-03-26",
|
||||||
|
"11.4": "2022-07-09",
|
||||||
|
"11.5": "2022-09-10",
|
||||||
|
"11.6": "2022-12-17",
|
||||||
|
"2.2r5": "2002-01-10",
|
||||||
|
"2.2r6": "2002-04-03",
|
||||||
|
"2.2r7": "2002-07-13",
|
||||||
|
"3.0r1": "2002-12-16",
|
||||||
|
"3.0r2": "2003-11-21",
|
||||||
|
"3.0r3": "2004-10-26",
|
||||||
|
"3.0r4": "2005-01-01",
|
||||||
|
"3.0r5": "2005-04-16",
|
||||||
|
"3.0r6": "2005-06-02",
|
||||||
|
"3.1r1": "2005-12-20",
|
||||||
|
"3.1r2": "2006-04-19",
|
||||||
|
"3.1r3": "2006-09-01",
|
||||||
|
"3.1r4": "2006-11-06",
|
||||||
|
"3.1r5": "2007-02-18",
|
||||||
|
"3.1r6": "2007-04-07",
|
||||||
|
"3.1r7": "2007-12-28",
|
||||||
|
"3.1r8": "2008-04-13",
|
||||||
|
"4.0r1": "2007-08-17",
|
||||||
|
"4.0r2": "2007-12-27",
|
||||||
|
"4.0r3": "2008-02-17",
|
||||||
|
"4.0r4": "2008-07-26",
|
||||||
|
"4.0r5": "2008-10-23",
|
||||||
|
"4.0r6": "2008-12-18",
|
||||||
|
"4.0r7": "2009-02-10",
|
||||||
|
"4.0r8": "2009-04-08",
|
||||||
|
"4.0r9": "2010-05-22",
|
||||||
|
"5.0.1": "2009-04-11",
|
||||||
|
"5.0.10": "2012-03-10",
|
||||||
|
"5.0.2": "2009-06-27",
|
||||||
|
"5.0.3": "2009-09-05",
|
||||||
|
"5.0.4": "2010-01-30",
|
||||||
|
"5.0.5": "2010-06-26",
|
||||||
|
"5.0.6": "2010-09-04",
|
||||||
|
"5.0.7": "2010-11-27",
|
||||||
|
"5.0.8": "2011-01-22",
|
||||||
|
"5.0.9": "2011-10-01",
|
||||||
|
"6.0.1": "2011-03-19",
|
||||||
|
"6.0.10": "2014-07-19",
|
||||||
|
"6.0.2": "2011-06-25",
|
||||||
|
"6.0.3": "2011-10-08",
|
||||||
|
"6.0.4": "2012-01-28",
|
||||||
|
"6.0.5": "2012-05-12",
|
||||||
|
"6.0.6": "2012-09-29",
|
||||||
|
"6.0.7": "2013-02-23",
|
||||||
|
"6.0.8": "2013-10-20",
|
||||||
|
"6.0.9": "2014-02-15",
|
||||||
|
"7.1": "2013-06-15",
|
||||||
|
"7.10": "2016-04-02",
|
||||||
|
"7.11": "2016-06-04",
|
||||||
|
"7.2": "2013-10-12",
|
||||||
|
"7.3": "2013-12-14",
|
||||||
|
"7.4": "2014-02-08",
|
||||||
|
"7.5": "2014-04-26",
|
||||||
|
"7.6": "2014-07-12",
|
||||||
|
"7.7": "2014-10-18",
|
||||||
|
"7.8": "2015-01-10",
|
||||||
|
"7.9": "2015-09-05",
|
||||||
|
"8.1": "2015-06-06",
|
||||||
|
"8.10": "2017-12-09",
|
||||||
|
"8.11": "2018-06-23",
|
||||||
|
"8.2": "2015-09-05",
|
||||||
|
"8.3": "2016-01-23",
|
||||||
|
"8.4": "2016-04-02",
|
||||||
|
"8.5": "2016-06-04",
|
||||||
|
"8.6": "2016-09-17",
|
||||||
|
"8.7": "2017-01-14",
|
||||||
|
"8.8": "2017-05-06",
|
||||||
|
"8.9": "2017-07-22",
|
||||||
|
"9.1": "2017-07-22",
|
||||||
|
"9.10": "2019-09-07",
|
||||||
|
"9.11": "2019-09-08",
|
||||||
|
"9.12": "2020-02-08",
|
||||||
|
"9.13": "2020-07-18",
|
||||||
|
"9.2": "2017-10-07",
|
||||||
|
"9.3": "2017-12-09",
|
||||||
|
"9.4": "2018-03-10",
|
||||||
|
"9.5": "2018-07-14",
|
||||||
|
"9.6": "2018-11-10",
|
||||||
|
"9.7": "2019-01-23",
|
||||||
|
"9.8": "2019-02-16",
|
||||||
|
"9.9": "2019-04-27"
|
||||||
|
}
|
||||||
68
src/debian.py
Normal file
68
src/debian.py
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
import json
|
||||||
|
import pathlib
|
||||||
|
import subprocess
|
||||||
|
from hashlib import sha1
|
||||||
|
from os.path import exists
|
||||||
|
from subprocess import call
|
||||||
|
|
||||||
|
"""Fetch Debian versions with their dates from www.debian.org source repository.
|
||||||
|
"""
|
||||||
|
|
||||||
|
PRODUCT = "debian"
|
||||||
|
REPO_URL = "https://salsa.debian.org/webmaster-team/webwml.git"
|
||||||
|
REPO_SHA1 = sha1(REPO_URL.encode()).hexdigest()
|
||||||
|
REPO_DIR = pathlib.Path(f"~/.cache/git/debian.md_{REPO_SHA1}").expanduser()
|
||||||
|
|
||||||
|
|
||||||
|
# Checkout the Debian website repository.
|
||||||
|
def clone_repository():
|
||||||
|
git_opts = f"--git-dir={REPO_DIR}/.git --work-tree={REPO_DIR}"
|
||||||
|
REPO_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
if not exists(f"{REPO_DIR}/.git"):
|
||||||
|
call(f"git {git_opts} init", shell=True)
|
||||||
|
call(f"git {git_opts} remote add origin {REPO_URL}", shell=True)
|
||||||
|
|
||||||
|
call(f"git {git_opts} config core.sparseCheckout true", shell=True)
|
||||||
|
with open(f"{REPO_DIR}/.git/info/sparse-checkout", "w") as f:
|
||||||
|
f.write("english/News/")
|
||||||
|
|
||||||
|
ret_code = call(f"git {git_opts} pull --depth 1 origin master", shell=True)
|
||||||
|
exit(-ret_code) if ret_code < 0 else None
|
||||||
|
|
||||||
|
|
||||||
|
def extract_releases():
|
||||||
|
child = subprocess.Popen(
|
||||||
|
f"grep -Rh -B 10 '<define-tag revision>' {REPO_DIR}/english/News "
|
||||||
|
"| grep -Eo '(release_date>(.*)<|revision>(.*)<)' "
|
||||||
|
"| cut -d '>' -f 2,4 "
|
||||||
|
"| tr -d '<' "
|
||||||
|
"| sed 's/[[:space:]]+/ /' "
|
||||||
|
"| paste -d ' ' - -",
|
||||||
|
shell=True, stdout=subprocess.PIPE)
|
||||||
|
output = child.communicate()[0].decode('utf-8')
|
||||||
|
|
||||||
|
releases = {}
|
||||||
|
for line in output.split('\n'):
|
||||||
|
if line:
|
||||||
|
parts = line.split(' ')
|
||||||
|
date = parts[0]
|
||||||
|
version = parts[1]
|
||||||
|
print(f"{date} : {version}")
|
||||||
|
releases[version] = date
|
||||||
|
|
||||||
|
return dict(sorted(releases.items()))
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
print(f"::group::{PRODUCT}")
|
||||||
|
clone_repository()
|
||||||
|
releases = extract_releases()
|
||||||
|
print("::endgroup::")
|
||||||
|
|
||||||
|
with open(f"releases/{PRODUCT}.json", "w") as f:
|
||||||
|
f.write(json.dumps(releases, indent=2))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user