// The default target is the local repository path
if (!target) {
- struct pakfire_repo* repo = pakfire_get_repo(pakfire, "@local");
+ struct pakfire_repo* repo = pakfire_get_repo(pakfire, PAKFIRE_REPO_LOCAL);
if (repo) {
target = pakfire_repo_get_path(repo);
pakfire_repo_unref(repo);
int r = 0;
// Fetch local repository
- local = pakfire_get_repo(pakfire, "@local");
+ local = pakfire_get_repo(pakfire, PAKFIRE_REPO_LOCAL);
if (!local) {
- ERROR(pakfire, "Could not find local repository: %m\n");
+ ERROR(pakfire, "Could not find repository %s: %m\n", PAKFIRE_REPO_LOCAL);
goto ERROR;
}
#include <pakfire/downloader.h>
#include <pakfire/package.h>
+#define PAKFIRE_REPO_LOCAL "local"
+#define PAKFIRE_REPO_LOCAL_PATH "file://" PAKFIRE_PRIVATE_DIR "/local/%{distro}/%{version}"
+#define PAKFIRE_REPO_LOCAL_PRIORITY 1000
+
int pakfire_repo_import(struct pakfire* pakfire, struct pakfire_config* config);
const char* pakfire_repo_get_path(struct pakfire_repo* repo);
pakfire_repo_unref(repo);
}
+ // Add local repository (in build mode)
+ if (pakfire_has_flag(pakfire, PAKFIRE_FLAGS_BUILD)) {
+ // Does this repository exist already?
+ repo = pakfire_get_repo(pakfire, PAKFIRE_REPO_LOCAL);
+
+ // Create it if it doesn't exist, yet
+ if (!repo) {
+ r = pakfire_repo_create(&repo, pakfire, PAKFIRE_REPO_LOCAL);
+ if (r) {
+ ERROR(pakfire, "Could not create repository %s: %m\n", PAKFIRE_REPO_LOCAL);
+ goto ERROR;
+ }
+
+ // Set description
+ pakfire_repo_set_description(repo, _("Locally built packages"));
+
+ // Set path
+ pakfire_repo_set_baseurl(repo, PAKFIRE_REPO_LOCAL_PATH);
+
+ // Set priority
+ pakfire_repo_set_priority(repo, PAKFIRE_REPO_LOCAL_PRIORITY);
+
+ pakfire_repo_unref(repo);
+ }
+ }
+
ERROR:
for (char** section = sections; *section; section++)
free(*section);
if (!url)
return NULL;
- const char* arch = pakfire_get_arch(repo->pakfire);
- const char* name = pakfire_repo_get_name(repo);
-
const struct replacement {
const char* pattern;
const char* replacement;
} replacements[] = {
- { "%{name}", name },
- { "%{arch}", arch },
+ { "%{name}", pakfire_repo_get_name(repo) },
+ { "%{arch}", pakfire_get_arch(repo->pakfire) },
+ { "%{distro}", pakfire_get_distro_id(repo->pakfire) },
+ { "%{version}", pakfire_get_distro_version_id(repo->pakfire) },
{ NULL, NULL },
};