From: Scott Worley Date: Thu, 9 Apr 2020 00:36:38 +0000 (-0700) Subject: Extract release name X-Git-Tag: 1.0~22 X-Git-Url: http://git.scottworley.com/pinch/commitdiff_plain/3e6421c4c43619da3b8b2501f262c86987f6d1cf?hp=73bec7e8e5b260f38f7a907ad1b5e17457596dbf Extract release name & print out what's been extracted or being worked on --- diff --git a/pinch.py b/pinch.py index dfdedac..f22a1c3 100644 --- a/pinch.py +++ b/pinch.py @@ -36,6 +36,7 @@ class Info(types.SimpleNamespace): channel_html: bytes forwarded_url: str git_revision: str + release_name: str table: Dict[str, InfoTableEntry] url: str @@ -124,9 +125,18 @@ def parse_table(v: Verification, info: Info) -> None: d = xml.dom.minidom.parseString(info.channel_html) v.ok() - v.status('Extracting git commit') + v.status('Extracting release name:') + title_name = d.getElementsByTagName( + 'title')[0].firstChild.nodeValue.split()[2] + h1_name = d.getElementsByTagName('h1')[0].firstChild.nodeValue.split()[2] + v.status(title_name) + v.result(title_name == h1_name) + info.release_name = title_name + + v.status('Extracting git commit:') git_commit_node = d.getElementsByTagName('tt')[0] info.git_commit = git_commit_node.firstChild.nodeValue + v.status(info.git_commit) v.ok() v.status('Verifying git commit label') v.result(git_commit_node.previousSibling.nodeValue == 'Git commit ') @@ -198,7 +208,7 @@ def fetch_resources(v: Verification, info: Info) -> None: def extract_channel(v: Verification, info: Info) -> None: with tempfile.TemporaryDirectory() as d: - v.status('Extracting nixexprs.tar.xz') + v.status('Extracting %s' % info.table['nixexprs.tar.xz'].file) shutil.unpack_archive(info.table['nixexprs.tar.xz'].file, d) v.ok() v.status('Removing temporary directory')