Files
dokku/contrib/update-deb-dependencies
Jose Diaz-Gonzalez 31ce5a7c48 fix: install cnb pack from github releases instead of ppa
The ppa:cncf-buildpacks/pack-cli launchpad source is currently down, breaking the runtime image build and any bats run that calls install_pack. Pack is now tracked in contrib/dependencies.json and pulled from the buildpacks/pack GitHub release tarball, matching how other binary deps are managed. update-deb-dependencies gains hyphen-aware word-boundary matching so single-word names like pack cannot accidentally rewrite unrelated debian/control lines, keeping pack out of the package's hard requirements.
2026-05-02 09:12:46 -04:00

32 lines
957 B
Python
Executable File

#!/usr/bin/env python3
import json
import re
def main():
"""
updates the control file with the tested debian dependencies
"""
deps = {}
with open("contrib/dependencies.json", encoding="utf-8") as handle:
deps = json.load(handle)
control_lines = []
with open("debian/control", encoding="utf-8") as handle:
control_lines = [line for line in handle.readlines()]
for key in ["dependencies", "predependencies", "recommendations"]:
for dependency in deps[key]:
name = dependency["name"]
version = dependency["version"]
pattern = re.compile(rf"(?<![\w-]){re.escape(name)}(?![\w-])")
for i, line in enumerate(control_lines):
control_lines[i] = pattern.sub(f"{name} (>= {version})", line)
with open("debian/control", mode="w", encoding="utf-8") as handle:
handle.writelines(control_lines)
if __name__ == "__main__":
main()