somewhat better arch handling on apt

This commit is contained in:
dave 2020-10-26 21:19:24 -07:00
parent 1345d750b4
commit 3533fffa61
3 changed files with 23 additions and 6 deletions

View File

@ -1 +1,4 @@
import os
__version__ = "0.3.2"
APPROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))

View File

@ -181,6 +181,8 @@ class AptProvider(object):
print("Generating metadata for repo:{} dist:{}".format(dist.repo.name, dist.name))
str_packages = ""
arches = set()
ignored_arches = set(["all"])
for package in session.query(AptPackage) \
.filter(AptPackage.repo == dist.repo,
@ -197,25 +199,39 @@ class AptProvider(object):
str_packages += "\n"
if AptPackage.arch and AptPackage.arch not in ignored_arches:
arches.update([package.arch])
dist.packages_cache = str_packages.encode("utf-8")
release_hashes = hashmany(dist.packages_cache)
if arches:
arch = arches.pop()
if arches:
print("multiple arches in one dist/repo is not supported")
else:
arch = "all" # TODO is this correct?
str_release = """Origin: . {dist}
Label: . {dist}
Suite: {dist}
Codename: {dist}
Date: {time}
Architectures: amd64
Architectures: {arch}
Components: main
Description: Generated by Repobot
""".format(dist=dist.name, time=datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S UTC"))
""".format(
dist=dist.name,
arch=arch,
time=datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S UTC")
)
for algo, algoname in algos.items():
str_release += "{}:\n {} {} {}/{}/{}\n".format(algoname,
release_hashes[algo],
len(dist.packages_cache),
"main", #TODO component
"binary-amd64", #TODO whatever this was
"binary-{}".format(arch), #TODO whatever this was
"Packages")
dist.release_cache = str_release.encode("utf-8")

View File

@ -11,9 +11,7 @@ from sqlalchemy.types import String, Integer, Text
from tempfile import TemporaryDirectory
from wheel import wheelfile
from repobot.tables import Base, db
APPROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))
from repobot import APPROOT
def parse_wheel(path):