return build->flags & flag;
}
+static int __pakfire_build_setup_repo(struct pakfire* pakfire,
+ struct pakfire_repo* repo, void* p) {
+ char path[PATH_MAX];
+ FILE* f = NULL;
+ int r;
+
+ struct pakfire_build* build = (struct pakfire_build*)p;
+
+ // Skip processing the installed repository
+ if (pakfire_repo_is_installed_repo(repo))
+ return 0;
+
+ // Skip processing any other internal repositories
+ if (pakfire_repo_is_internal(repo))
+ return 0;
+
+ const char* name = pakfire_repo_get_name(repo);
+
+ DEBUG(pakfire, "Exporting repository configuration for '%s'\n", name);
+
+ // Make path for configuration file
+ r = pakfire_path(build->pakfire, path, PAKFIRE_CONFIG_DIR "/repos/%s.repo", name);
+ if (r) {
+ ERROR(pakfire, "Could not make repository configuration path for %s: %m\n", name);
+ goto ERROR;
+ }
+
+ // Open the repository configuration
+ f = fopen(path, "w");
+ if (!f) {
+ ERROR(pakfire, "Could not open %s for writing: %m\n", path);
+ goto ERROR;
+ }
+
+ // Write repository configuration
+ r = pakfire_repo_write_config(repo, f);
+ if (r) {
+ ERROR(pakfire, "Could not write repository configuration for %s: %m\n", name);
+ goto ERROR;
+ }
+
+ // Bind-mount any local repositories
+ if (pakfire_repo_is_local(repo)) {
+ const char* _path = pakfire_repo_get_path(repo);
+
+ // Bind-mount the repository data read-only
+ r = pakfire_jail_bind(build->jail, _path, _path, MS_RDONLY);
+ if (r) {
+ ERROR(pakfire, "Could not bind-mount the repository at %s: %m\n", _path);
+ goto ERROR;
+ }
+ }
+
+ERROR:
+ if (f)
+ fclose(f);
+
+ return r;
+}
+
/*
This function enables the local repository so that it can be accessed by
a pakfire instance running inside the chroot.
*/
static int pakfire_build_enable_repos(struct pakfire_build* build) {
- return 0;
+ return pakfire_repo_walk(build->pakfire, __pakfire_build_setup_repo, build);
}
/*