#include <pakfire/constants.h>
#include <pakfire/db.h>
#include <pakfire/dependencies.h>
+#include <pakfire/dist.h>
#include <pakfire/logging.h>
#include <pakfire/mount.h>
#include <pakfire/package.h>
return pakfire_repo_create_from_repo(pakfire, pakfire->pool->installed);
}
+/*
+ Convenience function to dist() a package on the fly
+*/
+static int pakfire_commandline_dist(struct pakfire* pakfire, struct pakfire_repo* repo,
+ const char* path, struct pakfire_package** package) {
+ char* result = NULL;
+ int r;
+
+ // XXX result is not unique!
+
+ // Run dist()
+ r = pakfire_dist(pakfire, path, PAKFIRE_TMP_DIR, &result);
+ if (r)
+ goto ERROR;
+
+ // Try to add the package to the repository
+ r = pakfire_repo_add(repo, result, package);
+
+ERROR:
+ if (result)
+ free(result);
+
+ return r;
+}
+
/*
Convenience function to add a package to the @commandline repository
*/
// Add the package
r = pakfire_repo_add(repo, path, package);
- if (r)
- goto ERROR;
+ switch (-r) {
+ case ENOMSG:
+ r = pakfire_commandline_dist(pakfire, repo, path, package);
+ break;
+
+ default:
+ goto ERROR;
+ }
ERROR:
if (repo)