Error and warning messages should go to stderr, make it so.
--HG-- extra : convert_revision : xtraeme%40gmail.com-20100115141916-tpg2rga1i4pm42kj
This commit is contained in:
parent
d2a093a401
commit
a165d20193
@ -129,17 +129,20 @@ xbps_check_pkg_integrity(const char *pkgname)
|
|||||||
propsd = prop_dictionary_internalize_from_file(path);
|
propsd = prop_dictionary_internalize_from_file(path);
|
||||||
free(path);
|
free(path);
|
||||||
if (propsd == NULL) {
|
if (propsd == NULL) {
|
||||||
printf("%s: unexistent %s metadata file.\n", pkgname,
|
fprintf(stderr,
|
||||||
|
"E: %s: unexistent %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGPROPS);
|
XBPS_PKGPROPS);
|
||||||
rv = errno;
|
rv = errno;
|
||||||
goto out;
|
goto out;
|
||||||
} else if (prop_object_type(propsd) != PROP_TYPE_DICTIONARY) {
|
} else if (prop_object_type(propsd) != PROP_TYPE_DICTIONARY) {
|
||||||
printf("%s: invalid %s metadata file.\n", pkgname,
|
fprintf(stderr,
|
||||||
|
"E: %s: invalid %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGPROPS);
|
XBPS_PKGPROPS);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out1;
|
goto out1;
|
||||||
} else if (prop_dictionary_count(propsd) == 0) {
|
} else if (prop_dictionary_count(propsd) == 0) {
|
||||||
printf("%s: incomplete %s metadata file.\n", pkgname,
|
fprintf(stderr,
|
||||||
|
"E: %s: incomplete %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGPROPS);
|
XBPS_PKGPROPS);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out1;
|
goto out1;
|
||||||
@ -158,24 +161,28 @@ xbps_check_pkg_integrity(const char *pkgname)
|
|||||||
filesd = prop_dictionary_internalize_from_file(path);
|
filesd = prop_dictionary_internalize_from_file(path);
|
||||||
free(path);
|
free(path);
|
||||||
if (filesd == NULL) {
|
if (filesd == NULL) {
|
||||||
printf("%s: unexistent %s metadata file.\n", pkgname,
|
fprintf(stderr,
|
||||||
|
"E: %s: unexistent %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGPROPS);
|
XBPS_PKGPROPS);
|
||||||
rv = ENOENT;
|
rv = ENOENT;
|
||||||
goto out1;
|
goto out1;
|
||||||
} else if (prop_object_type(filesd) != PROP_TYPE_DICTIONARY) {
|
} else if (prop_object_type(filesd) != PROP_TYPE_DICTIONARY) {
|
||||||
printf("%s: invalid %s metadata file.\n", pkgname,
|
fprintf(stderr,
|
||||||
|
"E: %s: invalid %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGFILES);
|
XBPS_PKGFILES);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out2;
|
goto out2;
|
||||||
} else if (prop_dictionary_count(filesd) == 0) {
|
} else if (prop_dictionary_count(filesd) == 0) {
|
||||||
printf("%s: incomplete %s metadata file.\n", pkgname,
|
fprintf(stderr,
|
||||||
|
"E: %s: incomplete %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGFILES);
|
XBPS_PKGFILES);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out2;
|
goto out2;
|
||||||
} else if (((array = prop_dictionary_get(filesd, "files")) == NULL) ||
|
} else if (((array = prop_dictionary_get(filesd, "files")) == NULL) ||
|
||||||
((array = prop_dictionary_get(filesd, "links")) == NULL) ||
|
((array = prop_dictionary_get(filesd, "links")) == NULL) ||
|
||||||
((array = prop_dictionary_get(filesd, "dirs")) == NULL)) {
|
((array = prop_dictionary_get(filesd, "dirs")) == NULL)) {
|
||||||
printf("%s: incomplete %s metadata file.\n", pkgname,
|
fprintf(stderr,
|
||||||
|
"E: %s: incomplete %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGFILES);
|
XBPS_PKGFILES);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out2;
|
goto out2;
|
||||||
@ -218,17 +225,18 @@ xbps_check_pkg_integrity(const char *pkgname)
|
|||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
printf("%s: unexistent file %s.\n",
|
fprintf(stderr, "%s: unexistent file %s.\n",
|
||||||
pkgname, file);
|
pkgname, file);
|
||||||
files_broken = true;
|
files_broken = true;
|
||||||
break;
|
break;
|
||||||
case ERANGE:
|
case ERANGE:
|
||||||
printf("%s: hash mismatch for %s.\n",
|
fprintf(stderr, "%s: hash mismatch for %s.\n",
|
||||||
pkgname, file);
|
pkgname, file);
|
||||||
files_broken = true;
|
files_broken = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("%s: unexpected error for %s (%s)\n",
|
fprintf(stderr,
|
||||||
|
"%s: unexpected error for %s (%s)\n",
|
||||||
pkgname, file, strerror(rv));
|
pkgname, file, strerror(rv));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -268,11 +276,13 @@ xbps_check_pkg_integrity(const char *pkgname)
|
|||||||
}
|
}
|
||||||
if ((rv = access(path, R_OK)) == -1) {
|
if ((rv = access(path, R_OK)) == -1) {
|
||||||
if (errno == ENOENT) {
|
if (errno == ENOENT) {
|
||||||
printf("%s: unexistent file %s\n",
|
fprintf(stderr,
|
||||||
|
"%s: unexistent file %s\n",
|
||||||
pkgname, file);
|
pkgname, file);
|
||||||
broken = true;
|
broken = true;
|
||||||
} else
|
} else
|
||||||
printf("%s: unexpected error for "
|
fprintf(stderr,
|
||||||
|
"%s: unexpected error for "
|
||||||
"%s (%s)\n", pkgname, file,
|
"%s (%s)\n", pkgname, file,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,8 @@ static void show_package_list(prop_object_iterator_t, const char *);
|
|||||||
static void
|
static void
|
||||||
show_missing_deps(prop_dictionary_t d)
|
show_missing_deps(prop_dictionary_t d)
|
||||||
{
|
{
|
||||||
printf("Unable to locate some required packages:\n");
|
fprintf(stderr,
|
||||||
|
"xbps-bin: unable to locate some required packages:\n");
|
||||||
(void)xbps_callback_array_iter_in_dict(d, "missing_deps",
|
(void)xbps_callback_array_iter_in_dict(d, "missing_deps",
|
||||||
show_missing_dep_cb, NULL);
|
show_missing_dep_cb, NULL);
|
||||||
}
|
}
|
||||||
@ -64,7 +65,7 @@ show_missing_dep_cb(prop_object_t obj, void *arg, bool *loop_done)
|
|||||||
if (reqpkg == NULL)
|
if (reqpkg == NULL)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
printf(" * Missing binary package for: %s\n", reqpkg);
|
fprintf(stderr, " * Missing binary package for: %s\n", reqpkg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,10 +79,11 @@ check_binpkg_hash(const char *path, const char *filename,
|
|||||||
rv = xbps_check_file_hash(path, sha256);
|
rv = xbps_check_file_hash(path, sha256);
|
||||||
errno = rv;
|
errno = rv;
|
||||||
if (rv != 0 && rv != ERANGE) {
|
if (rv != 0 && rv != ERANGE) {
|
||||||
printf("unexpected error: %s\n", strerror(rv));
|
fprintf(stderr, "xbps-bin: unexpected error: %s\n",
|
||||||
|
strerror(rv));
|
||||||
return false;
|
return false;
|
||||||
} else if (rv == ERANGE) {
|
} else if (rv == ERANGE) {
|
||||||
printf("hash mismatch!.\n");
|
fprintf(stderr, "xbps-bin: hash mismatch!.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
printf("OK.\n");
|
printf("OK.\n");
|
||||||
@ -165,13 +167,15 @@ download_package_list(prop_object_iterator_t iter)
|
|||||||
rv = xbps_fetch_file(binfile, cachedir, false, NULL);
|
rv = xbps_fetch_file(binfile, cachedir, false, NULL);
|
||||||
free(binfile);
|
free(binfile);
|
||||||
if (rv == -1) {
|
if (rv == -1) {
|
||||||
printf("Couldn't download %s from %s (%s)\n",
|
fprintf(stderr, "xbps-bin: couldn't download %s "
|
||||||
filename, repoloc, xbps_fetch_error_string());
|
"from %s (%s)\n", filename, repoloc,
|
||||||
|
xbps_fetch_error_string());
|
||||||
free(lbinfile);
|
free(lbinfile);
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
if (!check_binpkg_hash(lbinfile, filename, sha256)) {
|
if (!check_binpkg_hash(lbinfile, filename, sha256)) {
|
||||||
printf("W: removing wrong %s file ...\n", filename);
|
fprintf(stderr, "W: removing wrong %s file ...\n",
|
||||||
|
filename);
|
||||||
(void)remove(lbinfile);
|
(void)remove(lbinfile);
|
||||||
free(lbinfile);
|
free(lbinfile);
|
||||||
return errno;
|
return errno;
|
||||||
@ -279,15 +283,15 @@ show_transaction_sizes(prop_object_iterator_t iter)
|
|||||||
*/
|
*/
|
||||||
if (xbps_humanize_number(size, 5, (int64_t)dlsize,
|
if (xbps_humanize_number(size, 5, (int64_t)dlsize,
|
||||||
"", HN_AUTOSCALE, HN_B|HN_DECIMAL|HN_NOSPACE) == -1) {
|
"", HN_AUTOSCALE, HN_B|HN_DECIMAL|HN_NOSPACE) == -1) {
|
||||||
printf("error: humanize_number returns %s\n",
|
fprintf(stderr, "xbps-bin: error: humanize_number returns "
|
||||||
strerror(errno));
|
"%s\n", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
printf("Total download size: %s\n", size);
|
printf("Total download size: %s\n", size);
|
||||||
if (xbps_humanize_number(size, 5, (int64_t)instsize,
|
if (xbps_humanize_number(size, 5, (int64_t)instsize,
|
||||||
"", HN_AUTOSCALE, HN_B|HN_DECIMAL|HN_NOSPACE) == -1) {
|
"", HN_AUTOSCALE, HN_B|HN_DECIMAL|HN_NOSPACE) == -1) {
|
||||||
printf("error: humanize_number2 returns %s\n",
|
fprintf(stderr, "xbps-bin: error: humanize_number2 returns "
|
||||||
strerror(errno));
|
"%s\n", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
printf("Total installed size: %s\n\n", size);
|
printf("Total installed size: %s\n\n", size);
|
||||||
@ -399,11 +403,13 @@ xbps_install_new_pkg(const char *pkg)
|
|||||||
}
|
}
|
||||||
rv = xbps_repository_install_pkg(pkg, pkgmatch);
|
rv = xbps_repository_install_pkg(pkg, pkgmatch);
|
||||||
if (rv == EAGAIN) {
|
if (rv == EAGAIN) {
|
||||||
printf("Unable to locate '%s' in "
|
fprintf(stderr, "xbps-bin: unable to locate '%s' in "
|
||||||
"repository pool.\n", pkg);
|
"repository pool.\n", pkg);
|
||||||
rv = 0;
|
rv = 1;
|
||||||
} else if (rv != 0 && rv != ENOENT) {
|
} else if (rv != 0 && rv != ENOENT) {
|
||||||
printf("Unexpected error: %s", strerror(errno));
|
fprintf(stderr, "xbps-bin: unexpected error: %s",
|
||||||
|
strerror(errno));
|
||||||
|
rv = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pkgmatch)
|
if (pkgmatch)
|
||||||
@ -426,7 +432,7 @@ xbps_update_pkg(const char *pkgname)
|
|||||||
printf("Package '%s' is up to date.\n", pkgname);
|
printf("Package '%s' is up to date.\n", pkgname);
|
||||||
rv = 0;
|
rv = 0;
|
||||||
} else if (rv == ENOENT) {
|
} else if (rv == ENOENT) {
|
||||||
printf("Package '%s' not found in "
|
fprintf(stderr, "Package '%s' not found in "
|
||||||
"repository pool.\n", pkgname);
|
"repository pool.\n", pkgname);
|
||||||
rv = 0;
|
rv = 0;
|
||||||
}
|
}
|
||||||
@ -451,10 +457,8 @@ xbps_exec_transaction(bool yes)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
trans->dict = xbps_repository_get_transaction_dict();
|
trans->dict = xbps_repository_get_transaction_dict();
|
||||||
if (trans->dict == NULL) {
|
if (trans->dict == NULL)
|
||||||
printf("Empty transaction, exiting.\n");
|
goto out;
|
||||||
goto out1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bail out if there are unresolved deps.
|
* Bail out if there are unresolved deps.
|
||||||
@ -462,7 +466,7 @@ xbps_exec_transaction(bool yes)
|
|||||||
array = prop_dictionary_get(trans->dict, "missing_deps");
|
array = prop_dictionary_get(trans->dict, "missing_deps");
|
||||||
if (prop_array_count(array) > 0) {
|
if (prop_array_count(array) > 0) {
|
||||||
show_missing_deps(trans->dict);
|
show_missing_deps(trans->dict);
|
||||||
goto out2;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINTF(("%s", prop_dictionary_externalize(trans->dict)));
|
DPRINTF(("%s", prop_dictionary_externalize(trans->dict)));
|
||||||
@ -471,8 +475,9 @@ xbps_exec_transaction(bool yes)
|
|||||||
* Sort the package transaction dictionary.
|
* Sort the package transaction dictionary.
|
||||||
*/
|
*/
|
||||||
if ((rv = xbps_sort_pkg_deps(trans->dict)) != 0) {
|
if ((rv = xbps_sort_pkg_deps(trans->dict)) != 0) {
|
||||||
printf("Error while sorting packages: %s\n", strerror(rv));
|
fprintf(stderr, "xbps-bin: error while sorting "
|
||||||
goto out2;
|
"packages: %s\n", strerror(rv));
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -480,20 +485,21 @@ xbps_exec_transaction(bool yes)
|
|||||||
*/
|
*/
|
||||||
trans->iter = xbps_get_array_iter_from_dict(trans->dict, "packages");
|
trans->iter = xbps_get_array_iter_from_dict(trans->dict, "packages");
|
||||||
if (trans->iter == NULL) {
|
if (trans->iter == NULL) {
|
||||||
printf("error: allocating array mem! (%s)\n",
|
fprintf(stderr, "xbps-bin: error allocating array mem! (%s)\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto out2;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
trans->yes = yes;
|
trans->yes = yes;
|
||||||
rv = exec_transaction(trans);
|
rv = exec_transaction(trans);
|
||||||
|
|
||||||
prop_object_iterator_release(trans->iter);
|
|
||||||
out2:
|
|
||||||
prop_object_release(trans->dict);
|
|
||||||
out1:
|
|
||||||
free(trans);
|
|
||||||
out:
|
out:
|
||||||
|
if (trans->iter)
|
||||||
|
prop_object_iterator_release(trans->iter);
|
||||||
|
if (trans->dict)
|
||||||
|
prop_object_release(trans->dict);
|
||||||
|
if (trans)
|
||||||
|
free(trans);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,12 +528,12 @@ replace_packages(prop_object_iterator_t iter, const char *pkgver)
|
|||||||
reppkgn, pkgver);
|
reppkgn, pkgver);
|
||||||
version = xbps_get_pkg_version(pkgver);
|
version = xbps_get_pkg_version(pkgver);
|
||||||
if ((rv = xbps_remove_pkg(reppkgn, version, false)) != 0) {
|
if ((rv = xbps_remove_pkg(reppkgn, version, false)) != 0) {
|
||||||
printf("Couldn't remove %s (%s)\n",
|
fprintf(stderr, "xbps-bin: couldn't remove %s (%s)\n",
|
||||||
reppkgn, strerror(rv));
|
reppkgn, strerror(rv));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
if ((rv = xbps_purge_pkg(reppkgn, false)) != 0) {
|
if ((rv = xbps_purge_pkg(reppkgn, false)) != 0) {
|
||||||
printf("Couldn't purge %s (%s)\n",
|
fprintf(stderr, "xbps-bin: couldn't purge %s (%s)\n",
|
||||||
reppkgn, strerror(rv));
|
reppkgn, strerror(rv));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -616,8 +622,9 @@ exec_transaction(struct transaction *trans)
|
|||||||
if (replaces_iter != NULL) {
|
if (replaces_iter != NULL) {
|
||||||
rv = replace_packages(replaces_iter, pkgver);
|
rv = replace_packages(replaces_iter, pkgver);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
printf("Couldn't replace some packages! "
|
fprintf(stderr,
|
||||||
"(%s)\n", strerror(rv));
|
"xbps-bin: couldn't replace some "
|
||||||
|
"packages! (%s)\n", strerror(rv));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
replaces_iter = NULL;
|
replaces_iter = NULL;
|
||||||
@ -626,8 +633,8 @@ exec_transaction(struct transaction *trans)
|
|||||||
if (strcmp(tract, "update") == 0) {
|
if (strcmp(tract, "update") == 0) {
|
||||||
instpkgd = xbps_find_pkg_installed_from_plist(pkgname);
|
instpkgd = xbps_find_pkg_installed_from_plist(pkgname);
|
||||||
if (instpkgd == NULL) {
|
if (instpkgd == NULL) {
|
||||||
printf("error: unable to find %s installed "
|
fprintf(stderr, "xbps-bin: error: unable to "
|
||||||
"dict!\n", pkgname);
|
"find %s installed dict!\n", pkgname);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -646,7 +653,8 @@ exec_transaction(struct transaction *trans)
|
|||||||
if (essential) {
|
if (essential) {
|
||||||
rv = xbps_requiredby_pkg_remove(pkgname);
|
rv = xbps_requiredby_pkg_remove(pkgname);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
printf("error: couldn't remove reqby"
|
fprintf(stderr, "xbps-bin: error: "
|
||||||
|
"couldn't remove reqby"
|
||||||
" entries for %s-%s (%s)\n",
|
" entries for %s-%s (%s)\n",
|
||||||
pkgname, instver, strerror(rv));
|
pkgname, instver, strerror(rv));
|
||||||
return rv;
|
return rv;
|
||||||
@ -656,7 +664,8 @@ exec_transaction(struct transaction *trans)
|
|||||||
pkgname, instver);
|
pkgname, instver);
|
||||||
rv = xbps_remove_pkg(pkgname, version, true);
|
rv = xbps_remove_pkg(pkgname, version, true);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
printf("error: removing %s-%s (%s)\n",
|
fprintf(stderr, "xbps-bin: error "
|
||||||
|
"removing %s-%s (%s)\n",
|
||||||
pkgname, instver, strerror(rv));
|
pkgname, instver, strerror(rv));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -667,16 +676,16 @@ exec_transaction(struct transaction *trans)
|
|||||||
*/
|
*/
|
||||||
printf("Unpacking %s (from .../%s) ...\n", pkgver, filename);
|
printf("Unpacking %s (from .../%s) ...\n", pkgver, filename);
|
||||||
if ((rv = xbps_unpack_binary_pkg(obj)) != 0) {
|
if ((rv = xbps_unpack_binary_pkg(obj)) != 0) {
|
||||||
printf("error: unpacking %s (%s)\n", pkgver,
|
fprintf(stderr, "xbps-bin: error unpacking %s "
|
||||||
strerror(rv));
|
"(%s)\n", pkgver, strerror(rv));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Register binary package.
|
* Register binary package.
|
||||||
*/
|
*/
|
||||||
if ((rv = xbps_register_pkg(obj, autoinst)) != 0) {
|
if ((rv = xbps_register_pkg(obj, autoinst)) != 0) {
|
||||||
printf("error: registering %s! (%s)\n",
|
fprintf(stderr, "xbps-bin: error registering %s "
|
||||||
pkgver, strerror(rv));
|
"(%s)\n", pkgver, strerror(rv));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
autoinst = false;
|
autoinst = false;
|
||||||
@ -700,8 +709,8 @@ exec_transaction(struct transaction *trans)
|
|||||||
update = true;
|
update = true;
|
||||||
rv = xbps_configure_pkg(pkgname, version, false, update);
|
rv = xbps_configure_pkg(pkgname, version, false, update);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
printf("Error configuring package %s (%s)\n",
|
fprintf(stderr, "xbps-bin: error configuring "
|
||||||
pkgname, strerror(rv));
|
"package %s (%s)\n", pkgname, strerror(rv));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@ static int list_pkgs_in_dict(prop_object_t, void *, bool *);
|
|||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
printf("Usage: xbps-bin [options] [target] [arguments]\n\n"
|
fprintf(stderr,
|
||||||
|
"Usage: xbps-bin [options] [target] [arguments]\n\n"
|
||||||
" Available targets:\n"
|
" Available targets:\n"
|
||||||
" autoremove\n"
|
" autoremove\n"
|
||||||
" autoupdate\n"
|
" autoupdate\n"
|
||||||
@ -167,7 +168,8 @@ main(int argc, char **argv)
|
|||||||
if ((dict = xbps_regpkgs_dictionary_init()) == NULL) {
|
if ((dict = xbps_regpkgs_dictionary_init()) == NULL) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
printf("Couldn't initialized regpkgdb dict: %s\n",
|
fprintf(stderr,
|
||||||
|
"E: couldn't initialize regpkgdb dict: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ xbps_remove_installed_pkgs(int argc, char **argv, bool force)
|
|||||||
prop_dictionary_get_cstring_nocopy(dict, "version", &version);
|
prop_dictionary_get_cstring_nocopy(dict, "version", &version);
|
||||||
printf("Removing package %s-%s ...\n", argv[i], version);
|
printf("Removing package %s-%s ...\n", argv[i], version);
|
||||||
if ((rv = xbps_remove_pkg(argv[i], version, false)) != 0) {
|
if ((rv = xbps_remove_pkg(argv[i], version, false)) != 0) {
|
||||||
printf("Unable to remove %s-%s (%s).\n",
|
fprintf(stderr, "E: unable to remove %s-%s (%s).\n",
|
||||||
argv[i], version, strerror(errno));
|
argv[i], version, strerror(errno));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,8 @@ xbps_show_pkg_deps(const char *pkgname)
|
|||||||
propsd = prop_dictionary_internalize_from_file(path);
|
propsd = prop_dictionary_internalize_from_file(path);
|
||||||
free(path);
|
free(path);
|
||||||
if (propsd == NULL) {
|
if (propsd == NULL) {
|
||||||
printf("%s: unexistent %s metadata file.\n", pkgname,
|
fprintf(stderr,
|
||||||
|
"%s: unexistent %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGPROPS);
|
XBPS_PKGPROPS);
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
|
@ -109,8 +109,8 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *filedir,
|
|||||||
newpkgd = xbps_repository_get_pkg_plist_dict_from_url(file,
|
newpkgd = xbps_repository_get_pkg_plist_dict_from_url(file,
|
||||||
XBPS_PKGPROPS);
|
XBPS_PKGPROPS);
|
||||||
if (newpkgd == NULL) {
|
if (newpkgd == NULL) {
|
||||||
printf("%s: can't read %s metadata file, skipping!\n",
|
fprintf(stderr, "xbps-repo: can't read %s %s metadata "
|
||||||
file, XBPS_PKGPROPS);
|
"file, skipping!\n", file, XBPS_PKGPROPS);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!prop_dictionary_get_cstring_nocopy(newpkgd, "pkgname", &pkgname)) {
|
if (!prop_dictionary_get_cstring_nocopy(newpkgd, "pkgname", &pkgname)) {
|
||||||
@ -144,7 +144,7 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *filedir,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (xbps_cmpver(version, regver) <= 0) {
|
if (xbps_cmpver(version, regver) <= 0) {
|
||||||
printf("W: skipping %s. %s-%s already "
|
fprintf(stderr, "W: skipping %s. %s-%s already "
|
||||||
"registered.\n", filen, pkgname, regver);
|
"registered.\n", filen, pkgname, regver);
|
||||||
prop_object_release(newpkgd);
|
prop_object_release(newpkgd);
|
||||||
rv = EEXIST;
|
rv = EEXIST;
|
||||||
@ -168,7 +168,7 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *filedir,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (remove(oldfilepath) == -1) {
|
if (remove(oldfilepath) == -1) {
|
||||||
printf("E: Couldn't remove old package file "
|
fprintf(stderr, "E: Couldn't remove old package file "
|
||||||
"'%s'!\n", oldfilen);
|
"'%s'!\n", oldfilen);
|
||||||
free(oldfilepath);
|
free(oldfilepath);
|
||||||
prop_object_release(newpkgd);
|
prop_object_release(newpkgd);
|
||||||
@ -188,7 +188,8 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *filedir,
|
|||||||
free(tmpstr);
|
free(tmpstr);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
printf("W: removed outdated binpkg file for '%s'.\n", tmpstr);
|
fprintf(stderr, "W: removed outdated binpkg file for "
|
||||||
|
"'%s'.\n", tmpstr);
|
||||||
free(tmpstr);
|
free(tmpstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,7 +309,8 @@ xbps_repo_genindex(const char *pkgdir)
|
|||||||
|
|
||||||
dirp = opendir(path);
|
dirp = opendir(path);
|
||||||
if (dirp == NULL) {
|
if (dirp == NULL) {
|
||||||
printf("E: unexistent '%s' directory!\n", path);
|
fprintf(stderr, "E: unexistent '%s' directory!\n",
|
||||||
|
path);
|
||||||
free(path);
|
free(path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,8 @@ static void usage(void);
|
|||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
printf("Usage: xbps-repo [options] [action] [arguments]\n\n"
|
fprintf(stderr,
|
||||||
|
"Usage: xbps-repo [options] [action] [arguments]\n\n"
|
||||||
" Available actions:\n"
|
" Available actions:\n"
|
||||||
" add, genindex, list, remove, search, show, show-deps,\n"
|
" add, genindex, list, remove, search, show, show-deps,\n"
|
||||||
" show-files, sync\n"
|
" show-files, sync\n"
|
||||||
@ -102,7 +103,8 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
if ((rv = xbps_repository_pool_init()) != 0) {
|
if ((rv = xbps_repository_pool_init()) != 0) {
|
||||||
if (rv != ENOENT) {
|
if (rv != ENOENT) {
|
||||||
printf("E: cannot get repository list pool! %s\n",
|
fprintf(stderr,
|
||||||
|
"E: cannot get repository list pool! %s\n",
|
||||||
strerror(rv));
|
strerror(rv));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@ -152,7 +154,8 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
rv = show_pkg_info_from_repolist(argv[1]);
|
rv = show_pkg_info_from_repolist(argv[1]);
|
||||||
if (rv == 0 && errno == ENOENT) {
|
if (rv == 0 && errno == ENOENT) {
|
||||||
printf("Unable to locate package '%s' from "
|
fprintf(stderr,
|
||||||
|
"Unable to locate package '%s' from "
|
||||||
"repository pool.\n", argv[1]);
|
"repository pool.\n", argv[1]);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
@ -165,7 +168,8 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
rv = show_pkg_deps_from_repolist(argv[1]);
|
rv = show_pkg_deps_from_repolist(argv[1]);
|
||||||
if (rv == 0 && errno == ENOENT) {
|
if (rv == 0 && errno == ENOENT) {
|
||||||
printf("Unable to locate package '%s' from "
|
fprintf(stderr,
|
||||||
|
"Unable to locate package '%s' from "
|
||||||
"repository pool.\n", argv[1]);
|
"repository pool.\n", argv[1]);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
@ -179,7 +183,8 @@ main(int argc, char **argv)
|
|||||||
pkgd = xbps_repository_get_pkg_plist_dict(argv[1],
|
pkgd = xbps_repository_get_pkg_plist_dict(argv[1],
|
||||||
XBPS_PKGFILES);
|
XBPS_PKGFILES);
|
||||||
if (pkgd == NULL) {
|
if (pkgd == NULL) {
|
||||||
printf("E: couldn't read %s: %s.\n", XBPS_PKGFILES,
|
fprintf(stderr,
|
||||||
|
"E: couldn't read %s: %s.\n", XBPS_PKGFILES,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
rv = errno;
|
rv = errno;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -46,27 +46,29 @@ pkgindex_verify(const char *plist, const char *uri, bool only_sync)
|
|||||||
|
|
||||||
d = prop_dictionary_internalize_from_file(plist);
|
d = prop_dictionary_internalize_from_file(plist);
|
||||||
if (d == NULL) {
|
if (d == NULL) {
|
||||||
printf("E: repository %s does not contain any "
|
fprintf(stderr,
|
||||||
|
"E: repository %s does not contain any "
|
||||||
"xbps pkgindex file.\n", uri);
|
"xbps pkgindex file.\n", uri);
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prop_dictionary_get_cstring_nocopy(d,
|
if (!prop_dictionary_get_cstring_nocopy(d,
|
||||||
"pkgindex-version", &pkgidx_version)) {
|
"pkgindex-version", &pkgidx_version)) {
|
||||||
printf("E: missing 'pkgindex-version' object!\n");
|
fprintf(stderr,
|
||||||
|
"E: missing 'pkgindex-version' object!\n");
|
||||||
rv = errno;
|
rv = errno;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prop_dictionary_get_uint64(d, "total-pkgs", &total_pkgs)) {
|
if (!prop_dictionary_get_uint64(d, "total-pkgs", &total_pkgs)) {
|
||||||
printf("E: missing 'total-pkgs' object!\n");
|
fprintf(stderr, "E: missing 'total-pkgs' object!\n");
|
||||||
rv = errno;
|
rv = errno;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reject empty repositories, how could this happen? :-) */
|
/* Reject empty repositories, how could this happen? :-) */
|
||||||
if (total_pkgs == 0) {
|
if (total_pkgs == 0) {
|
||||||
printf("E: empty package list!\n");
|
fprintf(stderr, "E: empty package list!\n");
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -77,7 +79,8 @@ pkgindex_verify(const char *plist, const char *uri, bool only_sync)
|
|||||||
out:
|
out:
|
||||||
prop_object_release(d);
|
prop_object_release(d);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
printf("W: removing incorrect pkg index file: '%s' ...\n",
|
fprintf(stderr,
|
||||||
|
"W: removing incorrect pkg index file: '%s' ...\n",
|
||||||
plist);
|
plist);
|
||||||
rv = remove(plist);
|
rv = remove(plist);
|
||||||
}
|
}
|
||||||
@ -136,10 +139,10 @@ unregister_repository(const char *uri)
|
|||||||
|
|
||||||
if ((rv = xbps_repository_unregister(idxstr)) != 0) {
|
if ((rv = xbps_repository_unregister(idxstr)) != 0) {
|
||||||
if (rv == ENOENT)
|
if (rv == ENOENT)
|
||||||
printf("Repository '%s' not actually "
|
fprintf(stderr, "Repository '%s' not actually "
|
||||||
"registered.\n", idxstr);
|
"registered.\n", idxstr);
|
||||||
else
|
else
|
||||||
printf("E: couldn't unregister "
|
fprintf(stderr, "E: couldn't unregister "
|
||||||
"repository (%s)\n", strerror(rv));
|
"repository (%s)\n", strerror(rv));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +162,8 @@ register_repository(const char *uri)
|
|||||||
printf("Fetching remote package index at %s...\n", uri);
|
printf("Fetching remote package index at %s...\n", uri);
|
||||||
rv = xbps_repository_sync_pkg_index(idxstr);
|
rv = xbps_repository_sync_pkg_index(idxstr);
|
||||||
if (rv == -1) {
|
if (rv == -1) {
|
||||||
printf("Error: could not fetch pkg index file: %s.\n",
|
fprintf(stderr,
|
||||||
|
"E: could not fetch pkg index file: %s.\n",
|
||||||
xbps_fetch_error_string());
|
xbps_fetch_error_string());
|
||||||
return rv;
|
return rv;
|
||||||
} else if (rv == 0) {
|
} else if (rv == 0) {
|
||||||
@ -182,7 +186,8 @@ register_repository(const char *uri)
|
|||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
if (xbps_mkpath(metadir, 0755) == -1) {
|
if (xbps_mkpath(metadir, 0755) == -1) {
|
||||||
printf("E: couldn't create metadata dir! (%s)\n",
|
fprintf(stderr,
|
||||||
|
"E: couldn't create metadata dir! (%s)\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
free(metadir);
|
free(metadir);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
@ -198,7 +203,7 @@ register_repository(const char *uri)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if ((rv = xbps_repository_register(idxstr)) != 0) {
|
if ((rv = xbps_repository_register(idxstr)) != 0) {
|
||||||
printf("ERROR: couldn't register repository (%s)\n",
|
fprintf(stderr, "E: couldn't register repository (%s)\n",
|
||||||
strerror(rv));
|
strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -296,7 +301,7 @@ repository_sync(void)
|
|||||||
printf("Syncing package index from: %s\n", rp->rp_uri);
|
printf("Syncing package index from: %s\n", rp->rp_uri);
|
||||||
rv = xbps_repository_sync_pkg_index(rp->rp_uri);
|
rv = xbps_repository_sync_pkg_index(rp->rp_uri);
|
||||||
if (rv == -1) {
|
if (rv == -1) {
|
||||||
printf("Failed! returned: %s\n",
|
fprintf(stderr, "E: returned: %s\n",
|
||||||
xbps_fetch_error_string());
|
xbps_fetch_error_string());
|
||||||
break;
|
break;
|
||||||
} else if (rv == 0) {
|
} else if (rv == 0) {
|
||||||
|
@ -56,7 +56,8 @@ write_plist_file(prop_dictionary_t dict, const char *file)
|
|||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
printf("usage: xbps-uhelper [options] [action] [args]\n"
|
fprintf(stderr,
|
||||||
|
"usage: xbps-uhelper [options] [action] [args]\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Available actions:\n"
|
" Available actions:\n"
|
||||||
" cmpver, digest, fetch, getpkgdepname, getpkgname, getpkgrevision,\n"
|
" cmpver, digest, fetch, getpkgdepname, getpkgname, getpkgrevision,\n"
|
||||||
@ -131,7 +132,8 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
plist = xbps_xasprintf("%s/%s/%s", root, XBPS_META_PATH, XBPS_REGPKGDB);
|
plist = xbps_xasprintf("%s/%s/%s", root, XBPS_META_PATH, XBPS_REGPKGDB);
|
||||||
if (plist == NULL) {
|
if (plist == NULL) {
|
||||||
printf("%s=> ERROR: couldn't find regpkdb file (%s)%s\n",
|
fprintf(stderr,
|
||||||
|
"%s=> ERROR: couldn't find regpkdb file (%s)%s\n",
|
||||||
MSG_ERROR, strerror(errno), MSG_RESET);
|
MSG_ERROR, strerror(errno), MSG_RESET);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@ -168,7 +170,7 @@ main(int argc, char **argv)
|
|||||||
in_chroot ? "[chroot] " : "", argv[1], argv[2],
|
in_chroot ? "[chroot] " : "", argv[1], argv[2],
|
||||||
MSG_RESET);
|
MSG_RESET);
|
||||||
} else if (rv != 0) {
|
} else if (rv != 0) {
|
||||||
printf("%s%s=> couldn't register %s-%s "
|
fprintf(stderr, "%s%s=> couldn't register %s-%s "
|
||||||
"(%s).%s\n", MSG_ERROR,
|
"(%s).%s\n", MSG_ERROR,
|
||||||
in_chroot ? "[chroot] " : "" , argv[1], argv[2],
|
in_chroot ? "[chroot] " : "" , argv[1], argv[2],
|
||||||
strerror(rv), MSG_RESET);
|
strerror(rv), MSG_RESET);
|
||||||
@ -185,10 +187,10 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
rv = xbps_remove_pkg_dict_from_file(argv[1], plist);
|
rv = xbps_remove_pkg_dict_from_file(argv[1], plist);
|
||||||
if (rv == ENOENT) {
|
if (rv == ENOENT) {
|
||||||
printf("%s=> ERROR: %s not registered "
|
fprintf(stderr, "%s=> ERROR: %s not registered "
|
||||||
"in database.%s\n", MSG_WARN, argv[1], MSG_RESET);
|
"in database.%s\n", MSG_WARN, argv[1], MSG_RESET);
|
||||||
} else if (rv != 0) {
|
} else if (rv != 0) {
|
||||||
printf("%s=> ERROR: couldn't unregister %s "
|
fprintf(stderr, "%s=> ERROR: couldn't unregister %s "
|
||||||
"from database (%s)%s\n", MSG_ERROR,
|
"from database (%s)%s\n", MSG_ERROR,
|
||||||
argv[1], strerror(rv), MSG_RESET);
|
argv[1], strerror(rv), MSG_RESET);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -221,7 +223,8 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
dict = prop_dictionary_internalize_from_file(argv[1]);
|
dict = prop_dictionary_internalize_from_file(argv[1]);
|
||||||
if (dict == NULL) {
|
if (dict == NULL) {
|
||||||
printf("=> ERROR: couldn't sanitize %s plist file "
|
fprintf(stderr,
|
||||||
|
"=> ERROR: couldn't sanitize %s plist file "
|
||||||
"(%s)\n", argv[1], strerror(errno));
|
"(%s)\n", argv[1], strerror(errno));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@ -234,7 +237,8 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
version = xbps_get_pkg_version(argv[1]);
|
version = xbps_get_pkg_version(argv[1]);
|
||||||
if (version == NULL) {
|
if (version == NULL) {
|
||||||
printf("Invalid string, expected <string>-<version>\n");
|
fprintf(stderr,
|
||||||
|
"Invalid string, expected <string>-<version>\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
printf("%s\n", version);
|
printf("%s\n", version);
|
||||||
@ -246,7 +250,8 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
pkgname = xbps_get_pkg_name(argv[1]);
|
pkgname = xbps_get_pkg_name(argv[1]);
|
||||||
if (pkgname == NULL) {
|
if (pkgname == NULL) {
|
||||||
printf("Invalid string, expected <string>-<version>\n");
|
fprintf(stderr,
|
||||||
|
"Invalid string, expected <string>-<version>\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
printf("%s\n", pkgname);
|
printf("%s\n", pkgname);
|
||||||
@ -300,7 +305,8 @@ main(int argc, char **argv)
|
|||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
hash = xbps_get_file_hash(argv[i]);
|
hash = xbps_get_file_hash(argv[i]);
|
||||||
if (hash == NULL) {
|
if (hash == NULL) {
|
||||||
printf("Couldn't get hash for %s (%s)\n",
|
fprintf(stderr,
|
||||||
|
"E: couldn't get hash for %s (%s)\n",
|
||||||
argv[i], strerror(errno));
|
argv[i], strerror(errno));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -145,8 +145,8 @@ xbps_configure_pkg(const char *pkgname, const char *version, bool check_state,
|
|||||||
if ((rv = xbps_file_chdir_exec(rootdir, buf, "post",
|
if ((rv = xbps_file_chdir_exec(rootdir, buf, "post",
|
||||||
pkgname, lver, update ? "yes" : "no", NULL)) != 0) {
|
pkgname, lver, update ? "yes" : "no", NULL)) != 0) {
|
||||||
free(buf);
|
free(buf);
|
||||||
printf("%s: post INSTALL action returned: %s\n",
|
fprintf(stderr, "%s: post INSTALL action "
|
||||||
pkgname, strerror(errno));
|
"returned: %s\n", pkgname, strerror(errno));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
18
lib/remove.c
18
lib/remove.c
@ -79,13 +79,15 @@ xbps_remove_pkg_files(prop_dictionary_t dict, const char *key)
|
|||||||
}
|
}
|
||||||
rv = xbps_check_file_hash(path, sha256);
|
rv = xbps_check_file_hash(path, sha256);
|
||||||
if (rv == ENOENT) {
|
if (rv == ENOENT) {
|
||||||
printf("WARNING: '%s' doesn't exist!\n", file);
|
fprintf(stderr,
|
||||||
|
"WARNING: '%s' doesn't exist!\n", file);
|
||||||
free(path);
|
free(path);
|
||||||
rv = 0;
|
rv = 0;
|
||||||
continue;
|
continue;
|
||||||
} else if (rv == ERANGE) {
|
} else if (rv == ERANGE) {
|
||||||
if (flags & XBPS_FLAG_VERBOSE)
|
if (flags & XBPS_FLAG_VERBOSE)
|
||||||
printf("WARNING: '%s' SHA256 mismatch, "
|
fprintf(stderr,
|
||||||
|
"WARNING: '%s' SHA256 mismatch, "
|
||||||
"preserving...\n", file);
|
"preserving...\n", file);
|
||||||
rv = 0;
|
rv = 0;
|
||||||
free(path);
|
free(path);
|
||||||
@ -102,7 +104,8 @@ xbps_remove_pkg_files(prop_dictionary_t dict, const char *key)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (flags & XBPS_FLAG_VERBOSE) {
|
if (flags & XBPS_FLAG_VERBOSE) {
|
||||||
printf("WARNING: can't remove "
|
fprintf(stderr,
|
||||||
|
"WARNING: can't remove "
|
||||||
"directory %s (%s)\n", file,
|
"directory %s (%s)\n", file,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
free(path);
|
free(path);
|
||||||
@ -113,7 +116,8 @@ xbps_remove_pkg_files(prop_dictionary_t dict, const char *key)
|
|||||||
if (strcmp(key, "dirs")) {
|
if (strcmp(key, "dirs")) {
|
||||||
if ((rv = remove(path)) == -1) {
|
if ((rv = remove(path)) == -1) {
|
||||||
if (flags & XBPS_FLAG_VERBOSE)
|
if (flags & XBPS_FLAG_VERBOSE)
|
||||||
printf("WARNING: can't remove %s "
|
fprintf(stderr,
|
||||||
|
"WARNING: can't remove %s "
|
||||||
"(%s)\n", file, strerror(errno));
|
"(%s)\n", file, strerror(errno));
|
||||||
|
|
||||||
rv = 0;
|
rv = 0;
|
||||||
@ -171,7 +175,8 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
|
|||||||
rv = xbps_file_chdir_exec(rootdir, buf, "pre", pkgname,
|
rv = xbps_file_chdir_exec(rootdir, buf, "pre", pkgname,
|
||||||
version, update ? "yes" : "no", NULL);
|
version, update ? "yes" : "no", NULL);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
printf("%s: prerm action target error (%s)\n", pkgname,
|
fprintf(stderr,
|
||||||
|
"%s: prerm action target error (%s)\n", pkgname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
free(buf);
|
free(buf);
|
||||||
return rv;
|
return rv;
|
||||||
@ -223,7 +228,8 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
|
|||||||
if (update == false && prepostf) {
|
if (update == false && prepostf) {
|
||||||
if ((rv = xbps_file_chdir_exec(rootdir, buf, "post",
|
if ((rv = xbps_file_chdir_exec(rootdir, buf, "post",
|
||||||
pkgname, version, NULL)) != 0) {
|
pkgname, version, NULL)) != 0) {
|
||||||
printf("%s: postrm action target error (%s)\n",
|
fprintf(stderr,
|
||||||
|
"%s: postrm action target error (%s)\n",
|
||||||
pkgname, strerror(errno));
|
pkgname, strerror(errno));
|
||||||
free(buf);
|
free(buf);
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -90,7 +90,8 @@ again:
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (remove(buf) == -1) {
|
if (remove(buf) == -1) {
|
||||||
printf("WARNING: couldn't remove obsolete %s: %s\n",
|
fprintf(stderr,
|
||||||
|
"WARNING: couldn't remove obsolete %s: %s\n",
|
||||||
dolinks ? "link" : "file",
|
dolinks ? "link" : "file",
|
||||||
prop_string_cstring_nocopy(oldstr));
|
prop_string_cstring_nocopy(oldstr));
|
||||||
free(buf);
|
free(buf);
|
||||||
|
@ -203,7 +203,8 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
|
|||||||
pkgname, version, update ? "yes" : "no",
|
pkgname, version, update ? "yes" : "no",
|
||||||
NULL)) != 0) {
|
NULL)) != 0) {
|
||||||
free(buf);
|
free(buf);
|
||||||
printf("%s: preinst action target error %s\n",
|
fprintf(stderr,
|
||||||
|
"%s: preinst action target error %s\n",
|
||||||
pkgname, strerror(errno));
|
pkgname, strerror(errno));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -271,12 +272,13 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
|
|||||||
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 != EEXIST) {
|
if (rv != EEXIST) {
|
||||||
printf("ERROR: %s...exiting!\n",
|
fprintf(stderr, "ERROR: %s...exiting!\n",
|
||||||
archive_error_string(ar));
|
archive_error_string(ar));
|
||||||
return rv;;
|
return rv;;
|
||||||
} else if (rv == EEXIST) {
|
} else if (rv == EEXIST) {
|
||||||
if (flags & XBPS_FLAG_VERBOSE) {
|
if (flags & XBPS_FLAG_VERBOSE) {
|
||||||
printf("WARNING: ignoring existent "
|
fprintf(stderr,
|
||||||
|
"WARNING: ignoring existent "
|
||||||
"path: %s\n",
|
"path: %s\n",
|
||||||
archive_entry_pathname(entry));
|
archive_entry_pathname(entry));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user