|
|
@ -72,11 +72,11 @@ class AptPackage(Base): |
|
|
|
|
|
|
|
fields = Column(Text()) |
|
|
|
|
|
|
|
__table_args__ = (UniqueConstraint('name', 'version', 'repo_id', 'dist_id', name='apt_unique_repodist'), ) |
|
|
|
__table_args__ = (UniqueConstraint('name', 'version', 'arch', 'repo_id', 'dist_id', name='apt_unique_repodist'), ) |
|
|
|
|
|
|
|
@property |
|
|
|
def blobpath(self): |
|
|
|
return os.path.join("repos", self.repo.name, "packages", self.name[0], self.fname) |
|
|
|
return os.path.join("repos", self.repo.name, "packages", self.dist.name, self.name[0], self.fname) |
|
|
|
|
|
|
|
|
|
|
|
def get_repo(_db, repo_name, create_ok=True): |
|
|
@ -192,7 +192,7 @@ class AptProvider(object): |
|
|
|
for algo, algoname in algos.items(): |
|
|
|
str_packages += "{}: {}\n".format(algoname, getattr(package, algo)) |
|
|
|
|
|
|
|
str_packages += "Filename: packages/{}/{}\n".format(package.fname[0], package.fname) |
|
|
|
str_packages += "Filename: packages/{}/{}/{}\n".format(dist.name, package.fname[0], package.fname) |
|
|
|
str_packages += "Size: {}\n".format(package.size) |
|
|
|
|
|
|
|
str_packages += "\n" |
|
|
@ -276,7 +276,7 @@ Description: Generated by Repobot |
|
|
|
fields = {key: p.message[key] for key in p.message.keys()} |
|
|
|
|
|
|
|
# repos/<reponame>/packages/f/foo.deb |
|
|
|
dpath = os.path.join(self.basepath, "repos", repo.name, "packages", pkgname[0], pkgname) |
|
|
|
dpath = os.path.join(self.basepath, "repos", repo.name, "packages", dist.name, pkgname[0], pkgname) |
|
|
|
files = self.s3.list_objects(Bucket=self.bucket, Prefix=dpath).get("Contents") |
|
|
|
if files: |
|
|
|
print(f"will overwrite: {files}") |
|
|
@ -389,7 +389,8 @@ class AptDists(object): |
|
|
|
body = "" |
|
|
|
for package in db().query(AptPackage).filter(AptPackage.repo == repo, |
|
|
|
AptPackage.dist == dist).order_by(AptPackage.fname).all(): |
|
|
|
body += "<a href='/repo/apt/{reponame}/packages/{fname[0]}/{fname}'>{fname}</a><br />".format(reponame=repo.name, fname=package.fname) |
|
|
|
body += "<a href='/repo/apt/{reponame}/packages/{dist.name}/{fname[0]}/{fname}'>{fname}</a><br />" \ |
|
|
|
.format(reponame=repo.name, dist=dist, fname=package.fname) |
|
|
|
return body |
|
|
|
|
|
|
|
raise cherrypy.HTTPError(404) |
|
|
@ -403,10 +404,12 @@ class AptFiles(object): |
|
|
|
self.base = base |
|
|
|
|
|
|
|
def __call__(self, *segments, reponame=None): |
|
|
|
|
|
|
|
firstletter, pkgname = segments |
|
|
|
distname, firstletter, pkgname = segments |
|
|
|
repo = get_repo(db(), reponame, create_ok=False) |
|
|
|
package = db().query(AptPackage).filter(AptPackage.repo == repo, AptPackage.fname == pkgname).first() |
|
|
|
dist = get_dist(db(), repo, distname, create_ok=False) |
|
|
|
package = db().query(AptPackage).filter(AptPackage.repo == repo, |
|
|
|
AptPackage.dist == dist, |
|
|
|
AptPackage.fname == pkgname).first() |
|
|
|
|
|
|
|
if not package: |
|
|
|
raise cherrypy.HTTPError(404) |
|
|
@ -414,6 +417,8 @@ class AptFiles(object): |
|
|
|
dpath = os.path.join(self.base.basepath, package.blobpath) |
|
|
|
response = self.base.s3.get_object(Bucket=self.base.bucket, Key=dpath) |
|
|
|
|
|
|
|
print("reading ", dpath) |
|
|
|
|
|
|
|
cherrypy.response.headers["Content-Type"] = "application/x-debian-package" |
|
|
|
cherrypy.response.headers["Content-Length"] = response["ContentLength"] |
|
|
|
|
|
|
|