]> git.ipfire.org Git - people/ms/pakfire.git/blobdiff - src/libpakfire/build.c
pakfire: Replace pakfire_make_path with something easier
[people/ms/pakfire.git] / src / libpakfire / build.c
index fe4c96c747636bcc09ef112349e643e6ae5b64cd..92a6fde8dbb9fece5badf520f7b68b23cb61d28d 100644 (file)
@@ -127,9 +127,9 @@ static int pakfire_build_enable_repos(struct pakfire_build* build) {
        }
 
        // Make path for configuration file
-       r = pakfire_make_path(build->pakfire, repopath,
-               PAKFIRE_CONFIG_DIR "/repos/" PAKFIRE_REPO_LOCAL ".repo");
-       if (r < 0)
+       r = pakfire_path(build->pakfire, repopath,
+               "%s", PAKFIRE_CONFIG_DIR "/repos/" PAKFIRE_REPO_LOCAL ".repo");
+       if (r)
                goto ERROR;
 
        // Write repository configuration
@@ -206,8 +206,8 @@ static int pakfire_build_find_dependencies(struct pakfire_build* build,
        char path[PATH_MAX];
 
        // Allocate path to write the filelist to
-       int r = pakfire_make_path(build->pakfire, path, "/var/tmp/.pakfire-filelist.XXXXXX");
-       if (r < 0)
+       int r = pakfire_path(build->pakfire, path, "%s", "/var/tmp/.pakfire-filelist.XXXXXX");
+       if (r)
                return 1;
 
        // Create a temporary file
@@ -302,7 +302,6 @@ static int pakfire_build_package_add_files(struct pakfire_build* build,
                struct pakfire_parser* makefile, const char* buildroot, const char* namespace,
                struct pakfire_package* pkg, struct pakfire_packager* packager) {
        struct pakfire_filelist* filelist = NULL;
-       char path[PATH_MAX];
        int r = 1;
 
        char** files = NULL;
@@ -316,9 +315,6 @@ static int pakfire_build_package_add_files(struct pakfire_build* build,
        if (!files)
                return 0;
 
-       // Convert to absolute path
-       pakfire_make_path(build->pakfire, path, buildroot);
-
        // Split into includes and excludes
        for (char** file = files; *file; file++) {
                if (**file == '!')
@@ -335,7 +331,7 @@ static int pakfire_build_package_add_files(struct pakfire_build* build,
                goto ERROR;
 
        // Scan for files
-       r = pakfire_filelist_scan(filelist, path, includes, excludes);
+       r = pakfire_filelist_scan(filelist, build->buildroot, includes, excludes);
        if (r)
                goto ERROR;
 
@@ -404,8 +400,8 @@ static int pakfire_build_add_scriptlet_requires(struct pakfire_build* build,
        const char* root = pakfire_get_path(build->pakfire);
 
        // Make filename
-       r = pakfire_make_path(build->pakfire, path, "/var/tmp/.pakfire-scriptlet.XXXXXX");
-       if (r < 0)
+       r = pakfire_path(build->pakfire, path, "%s", "/var/tmp/.pakfire-scriptlet.XXXXXX");
+       if (r)
                return r;
 
        // Fetch scriptlet payload
@@ -1141,7 +1137,6 @@ static int pakfire_build_init(struct pakfire_build* build) {
 
 static int pakfire_build_read_makefile(struct pakfire_build* build,
                struct pakfire_parser** parser, struct pakfire_package* package) {
-       char makefile[PATH_MAX];
        char path[PATH_MAX];
        int r;
 
@@ -1151,12 +1146,7 @@ static int pakfire_build_read_makefile(struct pakfire_build* build,
        const char* name  = pakfire_package_get_name(package);
 
        // Compose path to makefile
-       r = pakfire_string_format(makefile, "/usr/src/packages/%s/%s.nm", nevra, name);
-       if (r)
-               return r;
-
-       // Make it absolute
-       r = pakfire_make_path(build->pakfire, path, makefile);
+       r = pakfire_path(build->pakfire, path, "/usr/src/packages/%s/%s.nm", nevra, name);
        if (r < 0)
                return 1;
 
@@ -1233,7 +1223,9 @@ PAKFIRE_EXPORT int pakfire_build_exec(struct pakfire_build* build, const char* p
        int r;
 
        // Set buildroot
-       pakfire_make_path(build->pakfire, build->buildroot, "/var/tmp/.pakfire-buildroot.XXXXXX");
+       r = pakfire_path(build->pakfire, build->buildroot, "%s", "/var/tmp/.pakfire-buildroot.XXXXXX");
+       if (r)
+               goto ERROR;
 
        // Open source archive
        r = pakfire_archive_open(&archive, build->pakfire, path);