raise BuildError, arch
- def build(self, pkg, arch=None, resultdir=None):
+ def build(self, pkg, arch=None, resultdirs=None):
self.check_build_mode()
self.check_host_arch(arch)
+ if not resultdirs:
+ resultdirs = []
+
+ # Always include local repository
+ resultdirs.append(self.repos.local_build.path)
+
b = builder.Builder(pakfire=self, pkg=pkg)
b.extract()
- if not resultdir:
- resultdir = self.config.get("resultdir")
-
try:
b.build()
- b.copy_result(resultdir)
+
+ # Copy-out all resultfiles
+ for resultdir in resultdirs:
+ if not resultdir:
+ continue
+
+ b.copy_result(resultdir)
finally:
b.cleanup()
# XXX walk through the source tree and find a matching makefile
pass
- self.pakfire.build(pkg, arch=self.args.arch, resultdir=self.args.resultdir)
+ self.pakfire.build(pkg, arch=self.args.arch, resultdirs=[self.args.resultdir,])
def handle_shell(self):
print self.args
"debug" : True,
"logfile" : "/var/log/pakfire.log",
"source_download_url" : SOURCE_DOWNLOAD_URL,
+ "local_build_repo_path" : LOCAL_BUILD_REPO_PATH,
}
self._config_repos = {}
CONFIG_FILE = os.path.join(SYSCONFDIR, "pakfire.conf")
CACHE_DIR = "/var/cache/pakfire"
+LOCAL_BUILD_REPO_PATH = "/var/lib/pakfire/local"
PACKAGES_DB = "var/lib/pakfire/packages.db"
REPOSITORY_DB = "index.db"
self.local = LocalRepository(self.pakfire)
self.add_repo(self.local)
+ # If we running in build mode, we include our local build repository.
+ if self.pakfire.build:
+ self.local_build = LocalBuildRepository(self.pakfire)
+ self.add_repo(self.local_build)
+
for repo_name, repo_args in self.config.get_repos():
self._parse(repo_name, repo_args)
# XXX need to implement better get_by_name
+class LocalBuildRepository(LocalRepository):
+ def __init__(self, pakfire):
+ RepositoryFactory.__init__(self, pakfire, "build", "Locally built packages")
+
+ self.path = self.pakfire.config.get("local_build_repo_path")
+ if not os.path.exists(self.path):
+ os.makedirs(self.path)
+
+ self.index = index.DirectoryIndex(self.pakfire, self, self.path)
+
+ @property
+ def priority(self):
+ return 20000
+
class RemoteRepository(RepositoryFactory):
def __init__(self, pakfire, name, description, url, gpgkey, enabled):