From: Scott Worley Date: Fri, 10 Apr 2020 03:21:15 +0000 (-0700) Subject: Write back to config file X-Git-Tag: 1.0~12 X-Git-Url: http://git.scottworley.com/pinch/commitdiff_plain/e434d96dbe26e90d2e881f052bd0c28b2a04ffc7?ds=sidebyside;hp=5cfa8e119c86e2bf7c315ed1b82a10b7770fcfac Write back to config file --- diff --git a/pinch.py b/pinch.py index 0eafb90..dd70718 100644 --- a/pinch.py +++ b/pinch.py @@ -27,6 +27,7 @@ Digest32 = NewType('Digest32', str) class ChannelTableEntry(types.SimpleNamespace): + absolute_url: str digest: Digest16 file: str size: int @@ -200,8 +201,10 @@ def fetch_with_nix_prefetch_url( def fetch_resources(v: Verification, channel: Channel) -> None: for resource in ['git-revision', 'nixexprs.tar.xz']: fields = channel.table[resource] - url = urllib.parse.urljoin(channel.forwarded_url, fields.url) - fields.file = fetch_with_nix_prefetch_url(v, url, fields.digest) + fields.absolute_url = urllib.parse.urljoin( + channel.forwarded_url, fields.url) + fields.file = fetch_with_nix_prefetch_url( + v, fields.absolute_url, fields.digest) v.status('Verifying git commit on main page matches git commit in table') v.result( open( @@ -370,7 +373,11 @@ def main(argv: List[str]) -> None: fetch_resources(v, channel) git_fetch(v, channel) check_channel_contents(v, channel) - print(channel) + config[section]['git_rev'] = channel.git_revision + config[section]['tarball_url'] = channel.table['nixexprs.tar.xz'].absolute_url + config[section]['tarball_sha256'] = channel.table['nixexprs.tar.xz'].digest + with open(argv[1], 'w') as configfile: + config.write(configfile) main(sys.argv)