Added basic support to update a single package via "xbps-bin update foo".

--HG--
extra : convert_revision : 7214ab270ccb57a327afeed94f6a2efc4738442d
This commit is contained in:
Juan RP
2009-04-02 02:46:36 +02:00
parent 7db36bf9e0
commit 54b6d87809
7 changed files with 174 additions and 65 deletions

View File

@@ -214,7 +214,7 @@ main(int argc, char **argv)
if (argc != 2)
usage();
rv = xbps_install_binary_pkg(argv[1]);
rv = xbps_install_binary_pkg(argv[1], false);
if (rv != 0) {
if (rv == EAGAIN) {
printf("Unable to locate %s in "
@@ -233,6 +233,17 @@ main(int argc, char **argv)
}
printf("Package %s installed successfully.\n", argv[1]);
} else if (strcasecmp(argv[0], "update") == 0) {
/* Update an installed package. */
if (argc != 2)
usage();
rv = xbps_install_binary_pkg(argv[1], true);
if (rv != 0)
exit(EXIT_FAILURE);
printf("Package %s updated successfully.\n", argv[1]);
} else if (strcasecmp(argv[0], "remove") == 0) {
/* Removes a binary package. */
if (argc != 2)

View File

@@ -130,8 +130,14 @@ main(int argc, char **argv)
if (argc != 4)
usage();
rv = xbps_register_pkg(NULL, argv[1], argv[2],
argv[3], automatic);
dict = prop_dictionary_create();
if (dict == NULL)
exit(EXIT_FAILURE);
prop_dictionary_set_cstring_nocopy(dict, "pkgname", argv[1]);
prop_dictionary_set_cstring_nocopy(dict, "version", argv[2]);
prop_dictionary_set_cstring_nocopy(dict, "short_desc", argv[3]);
rv = xbps_register_pkg(dict, false, automatic);
if (rv == EEXIST) {
printf("%s=> %s-%s already registered.\n",
in_chroot ? "[chroot] " : "", argv[1], argv[2]);