libxbps: simplify how configuration files are handled, use cached values if possible.

This commit is contained in:
Juan RP 2011-01-20 02:55:40 +01:00
parent 0a66dbea5f
commit 6f8b2ca33a
3 changed files with 120 additions and 116 deletions

View File

@ -94,11 +94,12 @@ void HIDDEN xbps_fetch_unset_cache_connection(void);
* @private * @private
* From lib/package_config_files.c * From lib/package_config_files.c
*/ */
int HIDDEN xbps_config_file_from_archive_entry(prop_dictionary_t, int HIDDEN xbps_entry_is_a_conf_file(prop_dictionary_t, const char *);
prop_dictionary_t, int HIDDEN xbps_entry_install_conf_file(prop_dictionary_t,
struct archive_entry *, struct archive_entry *,
int *, const char *,
bool *); const char *,
const char *);
/** /**
* @private * @private
* From lib/plist.c * From lib/plist.c

View File

@ -1,5 +1,5 @@
/*- /*-
* Copyright (c) 2009-2010 Juan Romero Pardines. * Copyright (c) 2009-2011 Juan Romero Pardines.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -24,11 +24,9 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h>
#include <xbps_api.h> #include <xbps_api.h>
#include "xbps_api_impl.h" #include "xbps_api_impl.h"
@ -36,14 +34,21 @@
/* /*
* Returns 1 if entry is a configuration file, 0 if don't or -1 on error. * Returns 1 if entry is a configuration file, 0 if don't or -1 on error.
*/ */
static int int HIDDEN
entry_is_conf_file(prop_dictionary_t propsd, struct archive_entry *entry) xbps_entry_is_a_conf_file(prop_dictionary_t propsd,
const char *entry_pname)
{ {
prop_object_t obj; prop_object_t obj;
prop_object_iterator_t iter; prop_object_iterator_t iter;
char *cffile; char *cffile;
int rv = 0; int rv = 0;
assert(propsd != NULL);
assert(entry_pname != NULL);
if (!prop_dictionary_get(propsd, "conf_files"))
return 0;
iter = xbps_get_array_iter_from_dict(propsd, "conf_files"); iter = xbps_get_array_iter_from_dict(propsd, "conf_files");
if (iter == NULL) if (iter == NULL)
return -1; return -1;
@ -55,7 +60,7 @@ entry_is_conf_file(prop_dictionary_t propsd, struct archive_entry *entry)
rv = -1; rv = -1;
goto out; goto out;
} }
if (strcmp(cffile, archive_entry_pathname(entry)) == 0) { if (strcmp(cffile, entry_pname) == 0) {
rv = 1; rv = 1;
free(cffile); free(cffile);
break; break;
@ -68,47 +73,43 @@ out:
return rv; return rv;
} }
/*
* Returns 1 if entry should be installed, 0 if don't or -1 on error.
*/
int HIDDEN int HIDDEN
xbps_config_file_from_archive_entry(prop_dictionary_t filesd, xbps_entry_install_conf_file(prop_dictionary_t filesd,
prop_dictionary_t propsd, struct archive_entry *entry,
struct archive_entry *entry, const char *entry_pname,
int *flags, const char *pkgname,
bool *skip) const char *version)
{ {
prop_dictionary_t forigd; prop_dictionary_t forigd;
prop_object_t obj, obj2; prop_object_t obj, obj2;
prop_object_iterator_t iter, iter2; prop_object_iterator_t iter, iter2;
const char *pkgname, *cffile, *sha256_new = NULL; const char *cffile, *sha256_new = NULL;
char *buf, *sha256_cur = NULL, *sha256_orig = NULL; char *buf, *sha256_cur = NULL, *sha256_orig = NULL;
int rv = 0; int rv = 0;
bool install_new = false;
/* assert(filesd != NULL);
* Check that current entry is really a configuration file. assert(entry != NULL);
*/ assert(pkgname != NULL);
rv = entry_is_conf_file(propsd, entry);
if (rv == -1 || rv == 0)
return rv;
rv = 0;
iter = xbps_get_array_iter_from_dict(filesd, "conf_files"); iter = xbps_get_array_iter_from_dict(filesd, "conf_files");
if (iter == NULL) if (iter == NULL)
return EINVAL; return -1;
/* /*
* Get original hash for the file from current * Get original hash for the file from current
* installed package. * installed package.
*/ */
prop_dictionary_get_cstring_nocopy(propsd, "pkgname", &pkgname);
xbps_dbg_printf("%s: processing conf_file %s\n", xbps_dbg_printf("%s: processing conf_file %s\n",
pkgname, archive_entry_pathname(entry)); pkgname, entry_pname);
forigd = xbps_get_pkg_dict_from_metadata_plist(pkgname, XBPS_PKGFILES); forigd = xbps_get_pkg_dict_from_metadata_plist(pkgname, XBPS_PKGFILES);
if (forigd == NULL) { if (forigd == NULL) {
xbps_dbg_printf("%s: conf_file %s not currently installed\n", xbps_dbg_printf("%s: conf_file %s not currently installed\n",
pkgname, archive_entry_pathname(entry)); pkgname, entry_pname);
install_new = true; rv = 1;
goto out; goto out;
} }
@ -120,10 +121,10 @@ xbps_config_file_from_archive_entry(prop_dictionary_t filesd,
buf = xbps_xasprintf(".%s", cffile); buf = xbps_xasprintf(".%s", cffile);
if (buf == NULL) { if (buf == NULL) {
prop_object_iterator_release(iter2); prop_object_iterator_release(iter2);
rv = ENOMEM; rv = -1;
goto out; goto out;
} }
if (strcmp(archive_entry_pathname(entry), buf) == 0) { if (strcmp(entry_pname, buf) == 0) {
prop_dictionary_get_cstring(obj2, "sha256", prop_dictionary_get_cstring(obj2, "sha256",
&sha256_orig); &sha256_orig);
free(buf); free(buf);
@ -139,9 +140,9 @@ xbps_config_file_from_archive_entry(prop_dictionary_t filesd,
* First case: original hash not found, install new file. * First case: original hash not found, install new file.
*/ */
if (sha256_orig == NULL) { if (sha256_orig == NULL) {
install_new = true;
xbps_dbg_printf("%s: conf_file %s unknown orig sha256\n", xbps_dbg_printf("%s: conf_file %s unknown orig sha256\n",
pkgname, archive_entry_pathname(entry)); pkgname, entry_pname);
rv = 1;
goto out; goto out;
} }
@ -153,9 +154,9 @@ xbps_config_file_from_archive_entry(prop_dictionary_t filesd,
buf = xbps_xasprintf(".%s", cffile); buf = xbps_xasprintf(".%s", cffile);
if (buf == NULL) { if (buf == NULL) {
prop_object_iterator_release(iter); prop_object_iterator_release(iter);
return ENOMEM; return -1;
} }
if (strcmp(archive_entry_pathname(entry), buf)) { if (strcmp(entry_pname, buf)) {
free(buf); free(buf);
buf = NULL; buf = NULL;
continue; continue;
@ -168,13 +169,12 @@ xbps_config_file_from_archive_entry(prop_dictionary_t filesd,
/* /*
* File not installed, install new one. * File not installed, install new one.
*/ */
install_new = true;
xbps_dbg_printf("%s: conf_file %s not " xbps_dbg_printf("%s: conf_file %s not "
"installed\n", pkgname, "installed\n", pkgname, entry_pname);
archive_entry_pathname(entry)); rv = 1;
break; break;
} else { } else {
rv = errno; rv = -1;
break; break;
} }
} }
@ -187,10 +187,9 @@ xbps_config_file_from_archive_entry(prop_dictionary_t filesd,
if ((strcmp(sha256_orig, sha256_cur) == 0) && if ((strcmp(sha256_orig, sha256_cur) == 0) &&
(strcmp(sha256_orig, sha256_new) == 0) && (strcmp(sha256_orig, sha256_new) == 0) &&
(strcmp(sha256_cur, sha256_new) == 0)) { (strcmp(sha256_cur, sha256_new) == 0)) {
install_new = true;
xbps_dbg_printf("%s: conf_file %s orig = X," xbps_dbg_printf("%s: conf_file %s orig = X,"
"cur = X, new = X\n", pkgname, "cur = X, new = X\n", pkgname, entry_pname);
archive_entry_pathname(entry)); rv = 1;
break; break;
/* /*
* Orig = X, Curr = X, New = Y * Orig = X, Curr = X, New = Y
@ -200,9 +199,9 @@ xbps_config_file_from_archive_entry(prop_dictionary_t filesd,
} else if ((strcmp(sha256_orig, sha256_cur) == 0) && } else if ((strcmp(sha256_orig, sha256_cur) == 0) &&
(strcmp(sha256_orig, sha256_new)) && (strcmp(sha256_orig, sha256_new)) &&
(strcmp(sha256_cur, sha256_new))) { (strcmp(sha256_cur, sha256_new))) {
printf("Updating %s file with new version.\n", printf("Updating configuration file `%s' "
cffile); "with new version.\n", cffile);
install_new = true; rv = 1;
break; break;
/* /*
* Orig = X, Curr = Y, New = X * Orig = X, Curr = Y, New = X
@ -212,8 +211,9 @@ xbps_config_file_from_archive_entry(prop_dictionary_t filesd,
} else if ((strcmp(sha256_orig, sha256_new) == 0) && } else if ((strcmp(sha256_orig, sha256_new) == 0) &&
(strcmp(sha256_cur, sha256_new)) && (strcmp(sha256_cur, sha256_new)) &&
(strcmp(sha256_orig, sha256_cur))) { (strcmp(sha256_orig, sha256_cur))) {
printf("Keeping modified file %s.\n", cffile); printf("Keeping modified configuration file "
*skip = true; "`%s'.\n", cffile);
rv = 0;
break; break;
/* /*
* Orig = X, Curr = Y, New = Y * Orig = X, Curr = Y, New = Y
@ -223,38 +223,36 @@ xbps_config_file_from_archive_entry(prop_dictionary_t filesd,
} else if ((strcmp(sha256_cur, sha256_new) == 0) && } else if ((strcmp(sha256_cur, sha256_new) == 0) &&
(strcmp(sha256_orig, sha256_new)) && (strcmp(sha256_orig, sha256_new)) &&
(strcmp(sha256_orig, sha256_cur))) { (strcmp(sha256_orig, sha256_cur))) {
install_new = true;
xbps_dbg_printf("%s: conf_file %s orig = X," xbps_dbg_printf("%s: conf_file %s orig = X,"
"cur = Y, new = Y\n", pkgname, "cur = Y, new = Y\n", pkgname, entry_pname);
archive_entry_pathname(entry)); rv = 1;
break; break;
/* /*
* Orig = X, Curr = Y, New = Z * Orig = X, Curr = Y, New = Z
* *
* Install new file as file.new. * Install new file as file.new-<pkg_version>
*/ */
} else if ((strcmp(sha256_orig, sha256_cur)) && } else if ((strcmp(sha256_orig, sha256_cur)) &&
(strcmp(sha256_cur, sha256_new)) && (strcmp(sha256_cur, sha256_new)) &&
(strcmp(sha256_orig, sha256_new))) { (strcmp(sha256_orig, sha256_new))) {
buf = xbps_xasprintf(".%s.new", cffile); buf = xbps_xasprintf(".%s.new-%s",
cffile, version);
if (buf == NULL) { if (buf == NULL) {
rv = ENOMEM; rv = -1;
break; break;
} }
printf("Keeping modified file %s.\n", cffile); printf("Keeping modified configuration file "
printf("Installing new version as %s.new.\n", cffile); "`%s'.\n", cffile);
install_new = true; printf("Installing new configuration file as "
"`%s.new-%s'\n", cffile, version);
archive_entry_set_pathname(entry, buf); archive_entry_set_pathname(entry, buf);
free(buf); free(buf);
rv = 1;
break; break;
} }
} }
out: out:
if (install_new) {
*flags &= ~ARCHIVE_EXTRACT_NO_OVERWRITE;
*flags &= ~ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
}
if (sha256_orig) if (sha256_orig)
free(sha256_orig); free(sha256_orig);
if (sha256_cur) if (sha256_cur)
@ -263,7 +261,7 @@ out:
prop_object_iterator_release(iter); prop_object_iterator_release(iter);
xbps_dbg_printf("%s: conf_file %s returned %d\n", xbps_dbg_printf("%s: conf_file %s returned %d\n",
pkgname, archive_entry_pathname(entry)); pkgname, entry_pname, rv);
return rv; return rv;
} }

View File

@ -91,33 +91,36 @@ set_extract_flags(int *flags, bool update)
* the consumer. * the consumer.
*/ */
static int static int
unpack_archive_fini(struct archive *ar, unpack_archive_fini(prop_dictionary_t pkg_repod,
prop_dictionary_t pkg, struct archive *ar,
const char *pkgname, const char *pkgname,
const char *version) const char *version)
{ {
prop_dictionary_t propsd, filesd, old_filesd; prop_dictionary_t propsd, filesd, old_filesd;
struct archive_entry *entry; struct archive_entry *entry;
size_t entry_idx = 0; size_t entry_idx = 0;
const char *rootdir, *entry_str, *transact; const char *rootdir, *entry_pname, *transact;
char *buf; char *buf;
int rv, flags, lflags; int rv, flags, lflags;
bool preserve, skip_entry, update, replace_files_in_pkg_update; bool preserve, update, replace_files_in_pkg_update;
bool props_plist_found, files_plist_found;
assert(ar != NULL); assert(ar != NULL);
assert(pkg != NULL); assert(pkg_repod != NULL);
assert(pkgname != NULL);
assert(version != NULL);
preserve = skip_entry = update = replace_files_in_pkg_update = false; preserve = update = replace_files_in_pkg_update = false;
props_plist_found = files_plist_found = false;
rootdir = xbps_get_rootdir(); rootdir = xbps_get_rootdir();
flags = xbps_get_flags(); flags = xbps_get_flags();
if (chdir(rootdir) == -1) if (chdir(rootdir) == -1)
return errno; return errno;
prop_dictionary_get_bool(pkg, "preserve", &preserve); prop_dictionary_get_bool(pkg_repod, "preserve", &preserve);
prop_dictionary_get_cstring_nocopy(pkg, "trans-action", &transact); prop_dictionary_get_cstring_nocopy(pkg_repod,
"trans-action", &transact);
assert(transasct != NULL);
if (strcmp(transact, "update") == 0) if (strcmp(transact, "update") == 0)
update = true; update = true;
@ -139,6 +142,7 @@ unpack_archive_fini(struct archive *ar,
} }
} }
free(buf); free(buf);
buf = xbps_xasprintf(".%s/metadata/%s/REMOVE", buf = xbps_xasprintf(".%s/metadata/%s/REMOVE",
XBPS_META_PATH, pkgname); XBPS_META_PATH, pkgname);
if (buf == NULL) if (buf == NULL)
@ -152,59 +156,54 @@ unpack_archive_fini(struct archive *ar,
} }
free(buf); free(buf);
} }
/* /*
* Process the archive files. * Process the archive files.
*/ */
while (archive_read_next_header(ar, &entry) == ARCHIVE_OK) { while (archive_read_next_header(ar, &entry) == ARCHIVE_OK) {
entry_str = archive_entry_pathname(entry); entry_pname = archive_entry_pathname(entry);
set_extract_flags(&lflags, update); set_extract_flags(&lflags, update);
/*
* Run the pre INSTALL action if the file is there. if (strcmp("./INSTALL", entry_pname) == 0) {
*/ /*
if (strcmp("./INSTALL", entry_str) == 0) { * Extract package INSTALL file into destination
* directory and execute the pre install action.
*/
buf = xbps_xasprintf(".%s/metadata/%s/INSTALL", buf = xbps_xasprintf(".%s/metadata/%s/INSTALL",
XBPS_META_PATH, pkgname); XBPS_META_PATH, pkgname);
if (buf == NULL) { if (buf == NULL) {
rv = ENOMEM; rv = ENOMEM;
goto out; goto out;
} }
archive_entry_set_pathname(entry, buf); archive_entry_set_pathname(entry, buf);
archive_entry_set_perm(entry, 0750); archive_entry_set_perm(entry, 0750);
if (archive_read_extract(ar, entry, lflags) != 0) { if (archive_read_extract(ar, entry, lflags) != 0) {
if ((rv = archive_errno(ar)) != EEXIST) { if ((rv = archive_errno(ar)) != EEXIST) {
free(buf); free(buf);
goto out; goto out;
} }
} }
rv = xbps_file_exec(buf, "pre", rv = xbps_file_exec(buf, "pre",
pkgname, version, update ? "yes" : "no", NULL); pkgname, version, update ? "yes" : "no", NULL);
free(buf);
if (rv != 0) { if (rv != 0) {
free(buf);
fprintf(stderr, fprintf(stderr,
"%s: preinst action target error %s\n", "%s: preinst action target error %s\n",
pkgname, strerror(errno)); pkgname, strerror(errno));
goto out; goto out;
} }
/* Pass to the next entry if successful */ /* Pass to the next entry if successful */
free(buf);
entry_idx++; entry_idx++;
continue; continue;
/* /*
* Unpack metadata files in final directory. * Unpack metadata files in final directory.
*/ */
} else if (strcmp("./REMOVE", entry_str) == 0) { } else if (strcmp("./REMOVE", entry_pname) == 0) {
buf = xbps_xasprintf(".%s/metadata/%s/REMOVE", buf = xbps_xasprintf(".%s/metadata/%s/REMOVE",
XBPS_META_PATH, pkgname); XBPS_META_PATH, pkgname);
if (buf == NULL) { if (buf == NULL) {
rv = ENOMEM; rv = ENOMEM;
goto out; goto out;
} }
archive_entry_set_pathname(entry, buf); archive_entry_set_pathname(entry, buf);
free(buf); free(buf);
archive_entry_set_perm(entry, 0750); archive_entry_set_perm(entry, 0750);
@ -212,12 +211,11 @@ unpack_archive_fini(struct archive *ar,
if ((rv = archive_errno(ar)) != EEXIST) if ((rv = archive_errno(ar)) != EEXIST)
goto out; goto out;
} }
/* Pass to next entry if successful */ /* Pass to next entry if successful */
entry_idx++; entry_idx++;
continue; continue;
} else if (strcmp("./files.plist", entry_str) == 0) { } else if (strcmp("./files.plist", entry_pname) == 0) {
/* /*
* Now we have a dictionary from the entry * Now we have a dictionary from the entry
* in memory. Will be written to disk later, when * in memory. Will be written to disk later, when
@ -228,23 +226,19 @@ unpack_archive_fini(struct archive *ar,
rv = errno; rv = errno;
goto out; goto out;
} }
/* Pass to next entry */ /* Pass to next entry */
files_plist_found = true;
entry_idx++; entry_idx++;
continue; continue;
} else if (strcmp("./props.plist", entry_str) == 0) { } else if (strcmp("./props.plist", entry_pname) == 0) {
buf = xbps_xasprintf(".%s/metadata/%s/%s", buf = xbps_xasprintf(".%s/metadata/%s/%s",
XBPS_META_PATH, pkgname, XBPS_PKGPROPS); XBPS_META_PATH, pkgname, XBPS_PKGPROPS);
if (buf == NULL) { if (buf == NULL) {
rv = ENOMEM; rv = ENOMEM;
goto out; goto out;
} }
archive_entry_set_pathname(entry, buf); archive_entry_set_pathname(entry, buf);
free(buf); free(buf);
if (archive_read_extract(ar, entry, lflags) != 0) { if (archive_read_extract(ar, entry, lflags) != 0) {
rv = archive_errno(ar); rv = archive_errno(ar);
goto out; goto out;
@ -258,16 +252,14 @@ unpack_archive_fini(struct archive *ar,
goto out; goto out;
} }
/* Pass to next entry if successful */ /* Pass to next entry if successful */
props_plist_found = true;
entry_idx++; entry_idx++;
continue; continue;
} }
/* /*
* If XBPS_PKGFILES or XBPS_PKGPROPS weren't found * If XBPS_PKGFILES or XBPS_PKGPROPS weren't found
* in the archive at this phase, skip all data. * in the archive at this phase, skip all data.
*/ */
if (!files_plist_found || !props_plist_found) { if (propsd == NULL || filesd == NULL) {
archive_read_data_skip(ar); archive_read_data_skip(ar);
/* /*
* If we have processed 4 entries and the two * If we have processed 4 entries and the two
@ -280,25 +272,37 @@ unpack_archive_fini(struct archive *ar,
entry_idx++; entry_idx++;
continue; continue;
} }
/* /*
* Handle configuration files. Check if current entry is * Handle configuration files. Check if current entry is
* a configuration file and take action if required. Skip * a configuration file and take action if required. Skip
* packages that don't have the "conf_files" array in * packages that don't have the "conf_files" array in
* the XBPS_PKGPROPS dictionary. * the XBPS_PKGPROPS dictionary.
*/ */
if (prop_dictionary_get(propsd, "conf_files")) { rv = xbps_entry_is_a_conf_file(propsd, entry_pname);
if ((rv = xbps_config_file_from_archive_entry(filesd, if (rv == -1) {
propsd, entry, &lflags, &skip_entry)) != 0) /* error */
goto out;
} else if (rv == 1) {
rv = xbps_entry_install_conf_file(filesd,
entry, entry_pname, pkgname, version);
if (rv == -1) {
/* error */
goto out; goto out;
} else if (rv == 1) {
if (skip_entry) { /*
* Configuration file should be installed.
*/
lflags &= ~ARCHIVE_EXTRACT_NO_OVERWRITE;
lflags &= ~ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
} else {
/*
* Keep current configuration file
* as is now and pass to next entry.
*/
archive_read_data_skip(ar); archive_read_data_skip(ar);
skip_entry = false;
continue; continue;
} }
} }
/* /*
* Account for the following scenario (real example): * Account for the following scenario (real example):
* *
@ -318,7 +322,8 @@ unpack_archive_fini(struct archive *ar,
* don't match the SHA256 hash and skips them. * don't match the SHA256 hash and skips them.
*/ */
replace_files_in_pkg_update = false; replace_files_in_pkg_update = false;
prop_dictionary_get_bool(pkg, "replace-files-in-pkg-update", prop_dictionary_get_bool(pkg_repod,
"replace-files-in-pkg-update",
&replace_files_in_pkg_update); &replace_files_in_pkg_update);
if (replace_files_in_pkg_update) { if (replace_files_in_pkg_update) {
lflags &= ~ARCHIVE_EXTRACT_NO_OVERWRITE; lflags &= ~ARCHIVE_EXTRACT_NO_OVERWRITE;
@ -331,21 +336,21 @@ unpack_archive_fini(struct archive *ar,
if (archive_read_extract(ar, entry, lflags) != 0) { if (archive_read_extract(ar, entry, lflags) != 0) {
rv = archive_errno(ar); rv = archive_errno(ar);
if (rv && rv != EEXIST) { if (rv && rv != EEXIST) {
fprintf(stderr, "ERROR: %s...exiting!\n", fprintf(stderr, "ERROR: extracting `%s' "
"(%s) ...exiting!\n", entry_pname,
archive_error_string(ar)); archive_error_string(ar));
goto out; goto out;
} else if (rv == EEXIST) { } else if (rv == EEXIST) {
if (flags & XBPS_FLAG_VERBOSE) { if (flags & XBPS_FLAG_VERBOSE) {
fprintf(stderr, fprintf(stderr,
"WARNING: ignoring existent " "WARNING: ignoring existent "
"path: %s\n", "entry: %s\n", entry_pname);
archive_entry_pathname(entry));
} }
continue; continue;
} }
} }
if (flags & XBPS_FLAG_VERBOSE) if (flags & XBPS_FLAG_VERBOSE)
printf(" %s\n", archive_entry_pathname(entry)); printf(" %s\n", entry_pname);
} }
if ((rv = archive_errno(ar)) == 0) { if ((rv = archive_errno(ar)) == 0) {
@ -402,19 +407,19 @@ out:
} }
int int
xbps_unpack_binary_pkg(prop_dictionary_t pkg) xbps_unpack_binary_pkg(prop_dictionary_t pkg_repod)
{ {
const char *pkgname, *version; const char *pkgname, *version;
struct archive *ar = NULL; struct archive *ar = NULL;
char *binfile = NULL; char *binfile = NULL;
int pkg_fd, rv = 0; int pkg_fd, rv = 0;
assert(pkg != NULL); assert(pkg_repod != NULL);
prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname); prop_dictionary_get_cstring_nocopy(pkg_repod, "pkgname", &pkgname);
prop_dictionary_get_cstring_nocopy(pkg, "version", &version); prop_dictionary_get_cstring_nocopy(pkg_repod, "version", &version);
binfile = xbps_get_binpkg_repo_uri(pkg); binfile = xbps_get_binpkg_repo_uri(pkg_repod);
if (binfile == NULL) if (binfile == NULL)
return EINVAL; return EINVAL;
@ -445,7 +450,7 @@ xbps_unpack_binary_pkg(prop_dictionary_t pkg)
goto out; goto out;
} }
if ((rv = unpack_archive_fini(ar, pkg, pkgname, version)) != 0) if ((rv = unpack_archive_fini(pkg_repod, ar, pkgname, version)) != 0)
goto out; goto out;
/* /*