Browse Source

misc updates

master
dave 1 year ago
parent
commit
0d6c37d0f8
4 changed files with 22 additions and 10 deletions
  1. +5
    -5
      Dockerfile
  2. +3
    -0
      README.md
  3. +12
    -4
      repobot/aptprovider.py
  4. +2
    -1
      setup.py

+ 5
- 5
Dockerfile View File

@@ -1,15 +1,15 @@
FROM ubuntu:bionic

RUN apt-get update && \
apt-get install -y python3-pip gpgv1 gnupg1 gpg sudo wget git
apt-get install -y python3-pip gpgv1 gnupg1 gpg sudo wget git && \
useradd artifactd

ADD . /tmp/code

RUN cd /tmp/code && \
pip3 install -r requirements.txt && \
python3 setup.py install && \
useradd repobot
python3 setup.py install

USER repobot
USER artifact

ENTRYPOINT ["repobotd"]
ENTRYPOINT ["artifactd"]

+ 3
- 0
README.md View File

@@ -84,6 +84,7 @@ Todo

* CLI tool (for adding packages only)
* 'Simple' cli tool (shell script fetchable from the server for adding packages)
* Centralize deleting packages
* Rpm Support
* Auth
* Support using existing GPG keys for apt
@@ -100,3 +101,5 @@ Todo
* Standardize what is returned from provider's web_addpkg
* Standardize some fields of provider's schema (name, version)
* Delete repos if empty (with option to disable per provider)
* Centralize the jinja template environment
* need a way for providers to register jinja filters though

+ 12
- 4
repobot/aptprovider.py View File

@@ -422,12 +422,17 @@ class AptFiles(object):
raise cherrypy.HTTPError(404)

dpath = os.path.join(self.base.basepath, package.blobpath)
response = self.base.s3.get_object(Bucket=self.base.bucket, Key=dpath)

print("reading ", dpath)
if cherrypy.request.method == "DELETE":
db().delete(package)
self.base.s3.delete_object(Bucket=self.base.bucket, Key=dpath)
db().commit()
return

cherrypy.response.headers["Content-Type"] = "application/x-debian-package"
cherrypy.response.headers["Content-Length"] = response["ContentLength"]
elif cherrypy.request.method not in ("GET", "HEAD"):
raise cherrypy.HTTPError(405)

response = self.base.s3.get_object(Bucket=self.base.bucket, Key=dpath)

def stream():
while True:
@@ -436,6 +441,9 @@ class AptFiles(object):
return
yield data

cherrypy.response.headers["Content-Type"] = "application/x-debian-package"
cherrypy.response.headers["Content-Length"] = response["ContentLength"]

return stream()

__call__._cp_config = {'response.stream': True}

+ 2
- 1
setup.py View File

@@ -17,7 +17,8 @@ setup(name='repobot',
packages=['repobot'],
entry_points={
"console_scripts": [
"repobotd = repobot.server:main",
"repobotd = repobot.server:main", # legacy
"artifactd = repobot.server:main",
"rpcli = repobot.cli:main"
]
},


Loading…
Cancel
Save