if not package.is_source():
raise RuntimeError("Can only build source packages, not %s" % package.arch)
+ # Check if the package exists
+ if not package.path or not await self.backend.exists(package.path):
+ raise RuntimeError("Package %s does not exist (path = %s)" % (package, package.path))
+
build = self._get_build("""
INSERT INTO
builds
# Fetch the commandline repository
repo = p.get_repo("@commandline")
- # Open the archive
- archive = await asyncio.to_thread(p.open, self.pkg.path)
-
- # Fetch the package
- package = archive.get_package(repo)
-
# Perform the installcheck
try:
+ # Check if the source package exists
+ if not self.pkg.path:
+ raise DependencyError("Source package does not exist")
+
+ # Open the archive
+ archive = await asyncio.to_thread(p.open, self.pkg.path)
+
+ # Fetch the package
+ package = await asyncio.to_thread(archive.get_package, repo)
+
await asyncio.to_thread(package.installcheck)
# Store any dependency errors
log.debug("Importing %s to %s..." % (self, path))
- # Do nothing if the file already exists
- if await self.backend.exists(path):
- return
-
- # Copy the file
- await self.backend.copy(archive.path, path, mode=0o444)
-
# Store the path
self._set_attribute("path", path)
+ # Copy the file if it doesn't exist, yet
+ if not await self.backend.exists(path):
+ await self.backend.copy(archive.path, path, mode=0o444)
+
async def _import_filelist(self, archive):
log.debug("Importing filelist for %s" % self)
packages = self.get_packages(arch)
# Make filelist (if they exist)
- files = [p.path for p in packages if os.path.exists(p.path)]
+ files = [
+ p.path for p in packages \
+ if p.path and await self.backend.exists(p.path)
+ ]
# Write repository metadata
await asyncio.to_thread(p.repo_compose, path=path, key=key, files=files)