"\n" \
"exit 0\n"
+static int pakfire_build_package(Pakfire pakfire, PakfireParser makefile, const char* handle) {
+ int r = 1;
+
+ // Expand the handle into the package name
+ char* name = pakfire_parser_expand(makefile, "packages", handle);
+ if (!name) {
+ ERROR(pakfire, "Could not get package name: %s\n", strerror(errno));
+ goto ERROR;
+ }
+
+ INFO(pakfire, "Building package '%s'...\n", name);
+
+ // XXX actually do all the work
+
+ // Success
+ r = 0;
+
+ERROR:
+ if (name)
+ free(name);
+
+ return r;
+}
+
+static int pakfire_build_packages(Pakfire pakfire, PakfireParser makefile) {
+ DEBUG(pakfire, "Creating packages...");
+ int r = 1;
+
+ // Fetch a list all all packages
+ char** packages = pakfire_parser_list_namespaces(makefile, "packages.package:*");
+ if (!packages) {
+ ERROR(pakfire, "Could not find any packages: %s\n", strerror(errno));
+ goto ERROR;
+ }
+
+ unsigned int num_packages = 0;
+
+ // Count how many packages we have
+ for (char** package = packages; *package; package++)
+ num_packages++;
+
+ DEBUG(pakfire, "Found %d package(s)\n", num_packages);
+
+ // Build packages in reverse order
+ for (int i = num_packages - 1; i >= 0; i--) {
+ r = pakfire_build_package(pakfire, makefile,
+ packages[i] + strlen("packages.package:"));
+ if (r)
+ goto ERROR;
+ }
+
+ // Success
+ r = 0;
+
+ERROR:
+ if (packages)
+ free(packages);
+
+ return r;
+}
+
static int pakfire_build_stage(Pakfire pakfire, PakfireParser makefile, const char* stage,
pakfire_execute_logging_callback logging_callback, void* data) {
char template[1024];
}
}
- // XXX Create the packages
+ // Create the packages
+ r = pakfire_build_packages(pakfire, makefile);
+ if (r) {
+ ERROR(pakfire, "Could not create packages: %s\n", strerror(errno));
+ goto ERROR;
+ }
ERROR:
if (makefile)