2024-07-15 13:55:56 +02:00
|
|
|
#! /bin/python3
|
|
|
|
|
|
|
|
import os, errno
|
|
|
|
import json
|
2024-07-21 13:45:31 +02:00
|
|
|
import subprocess
|
2024-07-15 13:55:56 +02:00
|
|
|
|
2024-07-31 13:43:29 +02:00
|
|
|
_APT_CONFIG_PIN="""
|
|
|
|
Package: *
|
|
|
|
Pin: release a=experimental
|
|
|
|
Pin-Priority: 390
|
|
|
|
|
|
|
|
Package:{PACKAGES}
|
2024-07-15 13:55:56 +02:00
|
|
|
Pin: release a=experimental
|
2024-07-21 13:45:31 +02:00
|
|
|
Pin-Priority: 600
|
2024-07-15 13:55:56 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
def silentremove(filename):
|
|
|
|
try:
|
|
|
|
os.remove(filename)
|
|
|
|
except OSError as e: # this would be "except OSError, e:" before Python 2.6
|
|
|
|
if e.errno != errno.ENOENT: # errno.ENOENT = no such file or directory
|
|
|
|
raise # re-raise exception if a different error occurred
|
|
|
|
|
|
|
|
current_path = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
|
|
|
|
srcnames_files = [open(current_path + "/package_srcnames/" + filename) for filename in os.listdir(current_path + "/package_srcnames/")]
|
|
|
|
srcname_lines = []
|
|
|
|
pkgname_lines = []
|
|
|
|
for file in srcnames_files:
|
|
|
|
for line in file.readlines():
|
|
|
|
srcname = line.strip()
|
|
|
|
srcname_lines.append(srcname)
|
2024-07-31 13:50:03 +02:00
|
|
|
result = subprocess.run([current_path + '/get-bin-name-from-src.sh', srcname], stdout=subprocess.PIPE)
|
2024-07-21 14:40:12 +02:00
|
|
|
stdout = result.stdout.decode('utf-8')
|
|
|
|
for line in stdout.splitlines():
|
2024-07-21 14:43:23 +02:00
|
|
|
if line != "":
|
|
|
|
pkgname_lines.append(line)
|
|
|
|
pkgname_lines.append(line+"t64")
|
2024-07-15 13:55:56 +02:00
|
|
|
file.close()
|
|
|
|
|
2024-07-15 14:43:02 +02:00
|
|
|
with open (current_path + "/package_pkgnames_overrides") as file:
|
2024-07-15 14:41:11 +02:00
|
|
|
lines = file.readlines()
|
|
|
|
for line in lines:
|
|
|
|
pkgname_lines.append(line.strip())
|
|
|
|
file.close()
|
|
|
|
|
2024-07-15 13:55:56 +02:00
|
|
|
src_data = {
|
|
|
|
'source_names': [source_name for source_name in srcname_lines],
|
|
|
|
}
|
|
|
|
|
|
|
|
pkg_data = {
|
|
|
|
'package_names': [pkg_name for pkg_name in pkgname_lines]
|
|
|
|
}
|
|
|
|
|
|
|
|
apt_pin_packages = ""
|
|
|
|
|
2024-09-05 20:20:36 +02:00
|
|
|
for pkg in srcname_lines:
|
2024-07-15 14:52:25 +02:00
|
|
|
apt_pin_packages += (" " + pkg)
|
2024-07-15 13:55:56 +02:00
|
|
|
|
|
|
|
silentremove("0-debian-exp-overrides")
|
|
|
|
with open("0-debian-exp-overrides", "w") as file:
|
|
|
|
debian_exp_override_file = _APT_CONFIG_PIN.format(
|
|
|
|
PACKAGES=apt_pin_packages,
|
|
|
|
)
|
|
|
|
file.write(debian_exp_override_file)
|
|
|
|
|
|
|
|
silentremove("exp_src_names.json")
|
|
|
|
with open("exp_src_names.json", "w") as twitterDataFile:
|
|
|
|
twitterDataFile.write(
|
|
|
|
json.dumps(src_data, indent=4)
|
|
|
|
)
|
|
|
|
|
|
|
|
silentremove("exp_pkg_names.json")
|
|
|
|
with open("exp_pkg_names.json", "w") as twitterDataFile:
|
|
|
|
twitterDataFile.write(
|
|
|
|
json.dumps(pkg_data, indent=4)
|
|
|
|
)
|
2024-07-21 13:53:40 +02:00
|
|
|
|