return build
- def create_from_source_package(self, filename, distro, commit=None, type="release",
+ async def create_from_source_package(self, filename, distro, commit=None, type="release",
arches=None, check_for_duplicates=True, owner=None):
assert distro
return
# Open the package and add it to the database
- pkg = self.backend.packages.create(filename)
+ pkg = await self.backend.packages.create(filename)
# Associate the package to the processed commit
if commit:
uuid,
)
- def create(self, archive):
+ async def create(self, archive):
# Extract package metadata from archive
package = archive.get_package()
pkg._import_filelist(archive.filelist)
# Import package data
- pkg._import_archive(archive)
+ await pkg._import_archive(archive)
# Refresh the search index
self.refresh_search_index()
def filesize(self):
return self.data.filesize
- def _import_archive(self, archive):
+ async def _import_archive(self, archive):
"""
Imports the package into the filesystem
"""
- # Create path to directory
+ # Determine the new path
path = os.path.join(
PACKAGES_DIR,
self.uuid[0:2],
self.uuid[2:4],
self.uuid[4:],
+ "%s.pfm" % self.nevra,
)
- # Create directory
- os.makedirs(path)
-
- # Append package name to path
- path = os.path.join(path, "%s.pfm" % self.nevra)
-
log.debug("Importing %s to %s..." % (self, path))
# Copy the file
- shutil.copyfile(archive.path, path)
-
- # XXX use async copy here
+ await self.backend.copy(archive.path, path)
# Store the path
self._set_attribute("path", path)
repo = self.backend.repos.get_by_id(1)
# Import the package
- package = self.backend.packages.create(archive)
+ package = await self.backend.packages.create(archive)
# Create a new build
build = self.backend.builds.create(repo, package)