import os
import pakfire
import tempfile
+import urllib.parse
from . import aws
from . import bugtracker
return database.Connection(hostname, name, user=user, password=password)
+ def path_to_url(self, path):
+ """
+ Takes a path to a file on the file system and converts it into a URL
+ """
+ # The base URL
+ baseurl = self.settings.get("baseurl")
+
+ # Path to package
+ path = os.path.join(
+ "files", os.path.relpath(path, PAKFIRE_DIR),
+ )
+
+ # Join it all together
+ return urllib.parse.urljoin(baseurl, path)
+
def pakfire(self, config, offline=True, **kwargs):
"""
Launches a new Pakfire instance with the given configuration
return job
+ # Log
+
+ def has_log(self):
+ if self.log_path:
+ return True
+
+ return False
+
+ @property
+ def log_url(self):
+ return self.backend.path_to_url(self.log_path)
+
+ @property
+ def log_path(self):
+ return self.data.log_path
+
+ @property
+ def log_size(self):
+ return self.data.log_size
+
+ @property
+ def log_digest_blake2s(self):
+ return self.data.log_digest_blake2s
+
async def _import_log(self, upload):
# Create some destination path
path = os.path.join(
"""
assert os.path.exists(filename)
- elif filename.endswith(".%s" % PACKAGE_EXTENSION):
+ if filename.endswith(".%s" % PACKAGE_EXTENSION):
# It is not allowed to upload packages on test builds.
if self.test:
return
@property
def download_url(self):
- # The base URL
- baseurl = self.settings.get("baseurl")
-
- # Path to package
- path = os.path.join(
- "files",
- os.path.relpath(self.path, PAKFIRE_DIR),
- )
-
- # Join it all together
- return urllib.parse.urljoin(baseurl, path)
+ return self.backend.path_to_url(self.path)
@property
def filename(self):
dependency_check_succeeded boolean,
dependency_check_at timestamp without time zone,
deleted boolean DEFAULT false NOT NULL,
- failed boolean DEFAULT false NOT NULL
+ failed boolean DEFAULT false NOT NULL,
+ log_path text,
+ log_size bigint,
+ log_digest_blake2s bytea
);