somewhat better arch handling on apt
This commit is contained in:
parent
1345d750b4
commit
3533fffa61
|
@ -1 +1,4 @@
|
||||||
|
import os
|
||||||
|
|
||||||
__version__ = "0.3.2"
|
__version__ = "0.3.2"
|
||||||
|
APPROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))
|
||||||
|
|
|
@ -181,6 +181,8 @@ class AptProvider(object):
|
||||||
print("Generating metadata for repo:{} dist:{}".format(dist.repo.name, dist.name))
|
print("Generating metadata for repo:{} dist:{}".format(dist.repo.name, dist.name))
|
||||||
|
|
||||||
str_packages = ""
|
str_packages = ""
|
||||||
|
arches = set()
|
||||||
|
ignored_arches = set(["all"])
|
||||||
|
|
||||||
for package in session.query(AptPackage) \
|
for package in session.query(AptPackage) \
|
||||||
.filter(AptPackage.repo == dist.repo,
|
.filter(AptPackage.repo == dist.repo,
|
||||||
|
@ -197,25 +199,39 @@ class AptProvider(object):
|
||||||
|
|
||||||
str_packages += "\n"
|
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")
|
dist.packages_cache = str_packages.encode("utf-8")
|
||||||
|
|
||||||
release_hashes = hashmany(dist.packages_cache)
|
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}
|
str_release = """Origin: . {dist}
|
||||||
Label: . {dist}
|
Label: . {dist}
|
||||||
Suite: {dist}
|
Suite: {dist}
|
||||||
Codename: {dist}
|
Codename: {dist}
|
||||||
Date: {time}
|
Date: {time}
|
||||||
Architectures: amd64
|
Architectures: {arch}
|
||||||
Components: main
|
Components: main
|
||||||
Description: Generated by Repobot
|
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():
|
for algo, algoname in algos.items():
|
||||||
str_release += "{}:\n {} {} {}/{}/{}\n".format(algoname,
|
str_release += "{}:\n {} {} {}/{}/{}\n".format(algoname,
|
||||||
release_hashes[algo],
|
release_hashes[algo],
|
||||||
len(dist.packages_cache),
|
len(dist.packages_cache),
|
||||||
"main", #TODO component
|
"main", #TODO component
|
||||||
"binary-amd64", #TODO whatever this was
|
"binary-{}".format(arch), #TODO whatever this was
|
||||||
"Packages")
|
"Packages")
|
||||||
|
|
||||||
dist.release_cache = str_release.encode("utf-8")
|
dist.release_cache = str_release.encode("utf-8")
|
||||||
|
|
|
@ -11,9 +11,7 @@ from sqlalchemy.types import String, Integer, Text
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
from wheel import wheelfile
|
from wheel import wheelfile
|
||||||
from repobot.tables import Base, db
|
from repobot.tables import Base, db
|
||||||
|
from repobot import APPROOT
|
||||||
|
|
||||||
APPROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))
|
|
||||||
|
|
||||||
|
|
||||||
def parse_wheel(path):
|
def parse_wheel(path):
|
||||||
|
|
Loading…
Reference in New Issue