2009-08-17 22:37:20 +05:30
|
|
|
/*-
|
2011-01-25 17:30:23 +05:30
|
|
|
* Copyright (c) 2008-2011 Juan Romero Pardines.
|
2009-08-17 22:37:20 +05:30
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2011-01-25 17:30:23 +05:30
|
|
|
#include <strings.h>
|
2009-08-17 22:37:20 +05:30
|
|
|
#include <errno.h>
|
2009-10-23 14:50:25 +05:30
|
|
|
#include <signal.h>
|
2010-11-13 07:48:58 +05:30
|
|
|
#include <assert.h>
|
2010-11-19 18:10:13 +05:30
|
|
|
#include <unistd.h>
|
2009-08-17 22:37:20 +05:30
|
|
|
|
|
|
|
#include <xbps_api.h>
|
2010-12-24 10:01:37 +05:30
|
|
|
#include "strlcpy.h"
|
2009-08-17 22:37:20 +05:30
|
|
|
#include "defs.h"
|
2009-11-24 16:35:39 +05:30
|
|
|
#include "../xbps-repo/defs.h"
|
2009-08-17 22:37:20 +05:30
|
|
|
|
2010-11-24 21:07:30 +05:30
|
|
|
struct list_pkgver_cb {
|
|
|
|
pkg_state_t state;
|
|
|
|
size_t pkgver_len;
|
|
|
|
};
|
|
|
|
|
2011-01-15 16:29:44 +05:30
|
|
|
static void __attribute__((noreturn))
|
2009-08-17 22:37:20 +05:30
|
|
|
usage(void)
|
|
|
|
{
|
2010-01-15 19:49:16 +05:30
|
|
|
fprintf(stderr,
|
2010-12-03 22:06:07 +05:30
|
|
|
"Usage: xbps-bin [options] [target] [arguments]\n"
|
|
|
|
"See xbps-bin(8) for more information.\n");
|
2009-08-17 22:37:20 +05:30
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
list_pkgs_in_dict(prop_object_t obj, void *arg, bool *loop_done)
|
|
|
|
{
|
2010-11-24 21:07:30 +05:30
|
|
|
struct list_pkgver_cb *lpc = arg;
|
2009-11-22 09:45:47 +05:30
|
|
|
const char *pkgver, *short_desc;
|
2010-11-24 21:07:30 +05:30
|
|
|
char *tmp = NULL;
|
2011-01-27 19:15:40 +05:30
|
|
|
pkg_state_t curstate;
|
2010-11-24 21:07:30 +05:30
|
|
|
size_t i = 0;
|
2009-08-17 22:37:20 +05:30
|
|
|
|
|
|
|
(void)loop_done;
|
|
|
|
|
2011-01-27 19:15:40 +05:30
|
|
|
if (xbps_get_pkg_state_dictionary(obj, &curstate))
|
|
|
|
return EINVAL;
|
2010-10-27 16:40:03 +05:30
|
|
|
|
2011-01-27 19:15:40 +05:30
|
|
|
if (lpc->state == 0) {
|
|
|
|
/* Only list packages that are fully installed */
|
|
|
|
if (curstate != XBPS_PKG_STATE_INSTALLED)
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
/* Only list packages with specified state */
|
|
|
|
if (curstate != lpc->state)
|
2010-10-27 16:40:03 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-11-22 09:45:47 +05:30
|
|
|
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
2009-08-17 22:37:20 +05:30
|
|
|
prop_dictionary_get_cstring_nocopy(obj, "short_desc", &short_desc);
|
2010-10-27 16:40:03 +05:30
|
|
|
if (!pkgver && !short_desc)
|
|
|
|
return EINVAL;
|
2009-08-17 22:37:20 +05:30
|
|
|
|
2010-12-04 15:00:01 +05:30
|
|
|
tmp = calloc(1, lpc->pkgver_len + 1);
|
2010-11-24 21:07:30 +05:30
|
|
|
if (tmp == NULL)
|
|
|
|
return errno;
|
|
|
|
|
2010-12-24 10:01:37 +05:30
|
|
|
strlcpy(tmp, pkgver, lpc->pkgver_len + 1);
|
2010-11-24 21:07:30 +05:30
|
|
|
for (i = strlen(tmp); i < lpc->pkgver_len; i++)
|
|
|
|
tmp[i] = ' ';
|
|
|
|
|
|
|
|
printf("%s %s\n", tmp, short_desc);
|
|
|
|
free(tmp);
|
|
|
|
|
2010-10-27 16:40:03 +05:30
|
|
|
return 0;
|
2009-08-17 22:37:20 +05:30
|
|
|
}
|
|
|
|
|
2009-10-28 08:09:13 +05:30
|
|
|
static int
|
|
|
|
list_manual_packages(prop_object_t obj, void *arg, bool *loop_done)
|
|
|
|
{
|
2009-11-22 09:45:47 +05:30
|
|
|
const char *pkgver;
|
2009-10-28 08:09:13 +05:30
|
|
|
bool automatic = false;
|
|
|
|
|
|
|
|
(void)arg;
|
|
|
|
(void)loop_done;
|
|
|
|
|
|
|
|
prop_dictionary_get_bool(obj, "automatic-install", &automatic);
|
|
|
|
if (automatic == false) {
|
2009-11-22 09:45:47 +05:30
|
|
|
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
|
|
|
printf("%s\n", pkgver);
|
2009-10-28 08:09:13 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-12-03 22:06:07 +05:30
|
|
|
static int
|
|
|
|
show_orphans(void)
|
|
|
|
{
|
|
|
|
prop_array_t orphans;
|
|
|
|
prop_object_iterator_t iter;
|
|
|
|
prop_object_t obj;
|
|
|
|
const char *pkgver;
|
|
|
|
|
2011-01-27 16:49:05 +05:30
|
|
|
orphans = xbps_find_pkg_orphans();
|
2010-12-03 22:06:07 +05:30
|
|
|
if (orphans == NULL)
|
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
if (prop_array_count(orphans) == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
iter = prop_array_iterator(orphans);
|
|
|
|
if (iter == NULL)
|
|
|
|
return ENOMEM;
|
|
|
|
|
|
|
|
while ((obj = prop_object_iterator_next(iter)) != NULL) {
|
|
|
|
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
|
|
|
printf("%s\n", pkgver);
|
|
|
|
}
|
|
|
|
prop_object_iterator_release(iter);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2010-01-21 07:40:19 +05:30
|
|
|
|
2011-01-15 16:29:44 +05:30
|
|
|
static void __attribute__((noreturn))
|
2010-01-21 07:40:19 +05:30
|
|
|
cleanup(int signum)
|
|
|
|
{
|
2010-11-19 18:10:13 +05:30
|
|
|
xbps_end();
|
2010-01-21 07:40:19 +05:30
|
|
|
exit(signum);
|
|
|
|
}
|
|
|
|
|
2009-08-17 22:37:20 +05:30
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
prop_dictionary_t dict;
|
2010-11-24 21:07:30 +05:30
|
|
|
struct list_pkgver_cb lpc;
|
2009-10-23 14:50:25 +05:30
|
|
|
struct sigaction sa;
|
2010-12-03 22:06:07 +05:30
|
|
|
int i , c, flags, rv;
|
|
|
|
bool yes, purge, with_debug, force_rm_with_deps;
|
2011-01-27 19:06:33 +05:30
|
|
|
bool show_download_pkglist_url = false;
|
2009-10-28 08:09:13 +05:30
|
|
|
|
2010-12-03 22:06:07 +05:30
|
|
|
i = c = flags = rv = 0;
|
|
|
|
yes = purge = force_rm_with_deps = with_debug = false;
|
2009-08-17 22:37:20 +05:30
|
|
|
|
2011-01-27 19:06:33 +05:30
|
|
|
while ((c = getopt(argc, argv, "VcdDFfpr:vy")) != -1) {
|
2009-08-17 22:37:20 +05:30
|
|
|
switch (c) {
|
2009-11-28 07:08:41 +05:30
|
|
|
case 'c':
|
|
|
|
xbps_set_cachedir(optarg);
|
|
|
|
break;
|
2010-11-19 18:10:13 +05:30
|
|
|
case 'd':
|
|
|
|
with_debug = true;
|
|
|
|
break;
|
2011-01-27 19:06:33 +05:30
|
|
|
case 'D':
|
|
|
|
show_download_pkglist_url = true;
|
|
|
|
break;
|
2010-12-03 22:06:07 +05:30
|
|
|
case 'F':
|
|
|
|
force_rm_with_deps = true;
|
|
|
|
break;
|
2009-08-17 22:37:20 +05:30
|
|
|
case 'f':
|
|
|
|
flags |= XBPS_FLAG_FORCE;
|
|
|
|
break;
|
2010-04-28 06:56:13 +05:30
|
|
|
case 'p':
|
|
|
|
purge = true;
|
|
|
|
break;
|
2009-08-17 22:37:20 +05:30
|
|
|
case 'r':
|
|
|
|
/* To specify the root directory */
|
|
|
|
xbps_set_rootdir(optarg);
|
|
|
|
break;
|
|
|
|
case 'v':
|
|
|
|
flags |= XBPS_FLAG_VERBOSE;
|
|
|
|
break;
|
2009-10-18 14:12:04 +05:30
|
|
|
case 'V':
|
|
|
|
printf("%s\n", XBPS_RELVER);
|
|
|
|
exit(EXIT_SUCCESS);
|
2009-12-22 19:13:38 +05:30
|
|
|
case 'y':
|
|
|
|
yes = true;
|
|
|
|
break;
|
2009-08-17 22:37:20 +05:30
|
|
|
case '?':
|
|
|
|
default:
|
|
|
|
usage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
argc -= optind;
|
|
|
|
argv += optind;
|
|
|
|
|
|
|
|
if (argc < 1)
|
|
|
|
usage();
|
|
|
|
|
|
|
|
if (flags != 0)
|
|
|
|
xbps_set_flags(flags);
|
|
|
|
|
2009-10-23 14:50:25 +05:30
|
|
|
/*
|
|
|
|
* Register a signal handler to clean up resources used by libxbps.
|
|
|
|
*/
|
|
|
|
memset(&sa, 0, sizeof(sa));
|
|
|
|
sa.sa_handler = cleanup;
|
|
|
|
sigaction(SIGINT, &sa, NULL);
|
|
|
|
sigaction(SIGTERM, &sa, NULL);
|
|
|
|
sigaction(SIGQUIT, &sa, NULL);
|
|
|
|
|
2010-11-19 18:10:13 +05:30
|
|
|
/*
|
|
|
|
* Initialize stuff for libxbps.
|
|
|
|
*/
|
|
|
|
xbps_init(with_debug);
|
|
|
|
|
|
|
|
if ((dict = xbps_regpkgdb_dictionary_get()) == NULL) {
|
|
|
|
if (errno && errno != ENOENT) {
|
2010-01-15 19:49:16 +05:30
|
|
|
fprintf(stderr,
|
|
|
|
"E: couldn't initialize regpkgdb dict: %s\n",
|
2009-08-17 22:37:20 +05:30
|
|
|
strerror(errno));
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-26 02:03:14 +05:30
|
|
|
if ((rv = xbps_repository_pool_init()) != 0) {
|
|
|
|
if (rv != ENOENT) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"E: couldn't initialize repository pool: %s\n",
|
|
|
|
strerror(rv));
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-17 22:37:20 +05:30
|
|
|
if (strcasecmp(argv[0], "list") == 0) {
|
|
|
|
/* Lists packages currently registered in database. */
|
2010-10-27 16:40:03 +05:30
|
|
|
if (argc < 1 || argc > 2)
|
2009-08-17 22:37:20 +05:30
|
|
|
usage();
|
|
|
|
|
|
|
|
if (dict == NULL) {
|
|
|
|
printf("No packages currently installed.\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2010-11-24 21:09:14 +05:30
|
|
|
lpc.state = 0;
|
2010-10-27 16:40:03 +05:30
|
|
|
if (argv[1]) {
|
|
|
|
if (strcmp(argv[1], "installed") == 0)
|
2010-11-24 21:07:30 +05:30
|
|
|
lpc.state = XBPS_PKG_STATE_INSTALLED;
|
2010-10-27 16:40:03 +05:30
|
|
|
else if (strcmp(argv[1], "unpacked") == 0)
|
2010-11-24 21:07:30 +05:30
|
|
|
lpc.state = XBPS_PKG_STATE_UNPACKED;
|
2010-10-27 16:40:03 +05:30
|
|
|
else if (strcmp(argv[1], "config-files") == 0)
|
2010-11-24 21:07:30 +05:30
|
|
|
lpc.state = XBPS_PKG_STATE_CONFIG_FILES;
|
2010-10-27 16:40:03 +05:30
|
|
|
else {
|
|
|
|
fprintf(stderr,
|
|
|
|
"E: invalid state `%s'. Accepted values: "
|
|
|
|
"config-files, unpacked, "
|
|
|
|
"installed [default]\n", argv[1]);
|
|
|
|
rv = -1;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2010-11-24 21:07:30 +05:30
|
|
|
/*
|
|
|
|
* Find the longest pkgver string to pretty print the output.
|
|
|
|
*/
|
|
|
|
lpc.pkgver_len = find_longest_pkgver(dict);
|
2010-11-19 18:10:13 +05:30
|
|
|
rv = xbps_callback_array_iter_in_dict(dict, "packages",
|
2010-11-24 21:07:30 +05:30
|
|
|
list_pkgs_in_dict, &lpc);
|
2009-08-17 22:37:20 +05:30
|
|
|
|
|
|
|
} else if (strcasecmp(argv[0], "install") == 0) {
|
|
|
|
/* Installs a binary package and required deps. */
|
2009-12-22 17:07:36 +05:30
|
|
|
if (argc < 2)
|
2009-08-17 22:37:20 +05:30
|
|
|
usage();
|
|
|
|
|
2009-12-22 17:07:36 +05:30
|
|
|
for (i = 1; i < argc; i++)
|
|
|
|
if ((rv = xbps_install_new_pkg(argv[i])) != 0)
|
|
|
|
goto out;
|
|
|
|
|
2011-01-27 19:06:33 +05:30
|
|
|
rv = xbps_exec_transaction(yes, show_download_pkglist_url);
|
2009-08-17 22:37:20 +05:30
|
|
|
|
|
|
|
} else if (strcasecmp(argv[0], "update") == 0) {
|
|
|
|
/* Update an installed package. */
|
2009-12-22 17:07:36 +05:30
|
|
|
if (argc < 2)
|
2009-08-17 22:37:20 +05:30
|
|
|
usage();
|
|
|
|
|
2009-12-22 17:07:36 +05:30
|
|
|
for (i = 1; i < argc; i++)
|
|
|
|
if ((rv = xbps_update_pkg(argv[i])) != 0)
|
|
|
|
goto out;
|
|
|
|
|
2011-01-27 19:06:33 +05:30
|
|
|
rv = xbps_exec_transaction(yes, show_download_pkglist_url);
|
2009-08-17 22:37:20 +05:30
|
|
|
|
|
|
|
} else if (strcasecmp(argv[0], "remove") == 0) {
|
|
|
|
/* Removes a binary package. */
|
2009-12-22 17:07:36 +05:30
|
|
|
if (argc < 2)
|
2009-08-17 22:37:20 +05:30
|
|
|
usage();
|
|
|
|
|
2010-12-03 22:06:07 +05:30
|
|
|
rv = xbps_remove_installed_pkgs(argc, argv, yes, purge,
|
|
|
|
force_rm_with_deps);
|
2009-08-17 22:37:20 +05:30
|
|
|
|
|
|
|
} else if (strcasecmp(argv[0], "show") == 0) {
|
|
|
|
/* Shows info about an installed binary package. */
|
|
|
|
if (argc != 2)
|
|
|
|
usage();
|
|
|
|
|
|
|
|
rv = show_pkg_info_from_metadir(argv[1]);
|
|
|
|
if (rv != 0) {
|
|
|
|
printf("Package %s not installed.\n", argv[1]);
|
2009-10-23 17:31:54 +05:30
|
|
|
goto out;
|
2009-08-17 22:37:20 +05:30
|
|
|
}
|
|
|
|
|
2009-10-06 03:36:59 +05:30
|
|
|
} else if (strcasecmp(argv[0], "show-files") == 0) {
|
2009-08-17 22:37:20 +05:30
|
|
|
/* Shows files installed by a binary package. */
|
|
|
|
if (argc != 2)
|
|
|
|
usage();
|
|
|
|
|
|
|
|
rv = show_pkg_files_from_metadir(argv[1]);
|
|
|
|
if (rv != 0) {
|
|
|
|
printf("Package %s not installed.\n", argv[1]);
|
2009-10-23 17:31:54 +05:30
|
|
|
goto out;
|
2009-08-17 22:37:20 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
} else if (strcasecmp(argv[0], "check") == 0) {
|
|
|
|
/* Checks the integrity of an installed package. */
|
|
|
|
if (argc != 2)
|
|
|
|
usage();
|
|
|
|
|
2009-10-06 04:12:37 +05:30
|
|
|
if (strcasecmp(argv[1], "all") == 0)
|
|
|
|
rv = xbps_check_pkg_integrity_all();
|
|
|
|
else
|
|
|
|
rv = xbps_check_pkg_integrity(argv[1]);
|
2009-08-17 22:37:20 +05:30
|
|
|
|
|
|
|
} else if (strcasecmp(argv[0], "autoupdate") == 0) {
|
|
|
|
/*
|
|
|
|
* To update all packages currently installed.
|
|
|
|
*/
|
|
|
|
if (argc != 1)
|
|
|
|
usage();
|
|
|
|
|
2011-01-27 19:06:33 +05:30
|
|
|
rv = xbps_autoupdate_pkgs(yes, show_download_pkglist_url);
|
2009-08-17 22:37:20 +05:30
|
|
|
|
2010-05-04 20:34:36 +05:30
|
|
|
} else if (strcasecmp(argv[0], "show-orphans") == 0) {
|
|
|
|
/*
|
|
|
|
* Only show the package name of all currently package
|
|
|
|
* orphans.
|
|
|
|
*/
|
|
|
|
if (argc != 1)
|
|
|
|
usage();
|
|
|
|
|
2010-12-03 22:06:07 +05:30
|
|
|
rv = show_orphans();
|
2010-05-04 20:34:36 +05:30
|
|
|
|
2009-08-17 22:37:20 +05:30
|
|
|
} else if (strcasecmp(argv[0], "autoremove") == 0) {
|
|
|
|
/*
|
|
|
|
* Removes orphan pkgs. These packages were installed
|
|
|
|
* as dependency and any installed package does not depend
|
|
|
|
* on it currently.
|
|
|
|
*/
|
|
|
|
if (argc != 1)
|
|
|
|
usage();
|
|
|
|
|
2010-12-03 22:06:07 +05:30
|
|
|
rv = xbps_autoremove_pkgs(yes, purge);
|
2009-08-17 22:37:20 +05:30
|
|
|
|
|
|
|
} else if (strcasecmp(argv[0], "purge") == 0) {
|
|
|
|
/*
|
|
|
|
* Purge a package completely.
|
|
|
|
*/
|
|
|
|
if (argc != 2)
|
|
|
|
usage();
|
|
|
|
|
2009-08-21 15:01:26 +05:30
|
|
|
if (strcasecmp(argv[1], "all") == 0)
|
|
|
|
rv = xbps_purge_all_pkgs();
|
|
|
|
else
|
|
|
|
rv = xbps_purge_pkg(argv[1], true);
|
2009-08-17 22:37:20 +05:30
|
|
|
|
|
|
|
} else if (strcasecmp(argv[0], "reconfigure") == 0) {
|
|
|
|
/*
|
|
|
|
* Reconfigure a package.
|
|
|
|
*/
|
|
|
|
if (argc != 2)
|
|
|
|
usage();
|
|
|
|
|
2009-08-21 15:01:26 +05:30
|
|
|
if (strcasecmp(argv[1], "all") == 0)
|
|
|
|
rv = xbps_configure_all_pkgs();
|
|
|
|
else
|
2009-12-09 20:44:35 +05:30
|
|
|
rv = xbps_configure_pkg(argv[1], NULL, true, false);
|
2009-08-17 22:37:20 +05:30
|
|
|
|
2009-08-22 04:42:19 +05:30
|
|
|
} else if (strcasecmp(argv[0], "show-deps") == 0) {
|
|
|
|
/*
|
|
|
|
* Show dependencies for a package.
|
|
|
|
*/
|
|
|
|
if (argc != 2)
|
|
|
|
usage();
|
|
|
|
|
|
|
|
rv = xbps_show_pkg_deps(argv[1]);
|
|
|
|
|
2009-11-09 07:29:19 +05:30
|
|
|
} else if (strcasecmp(argv[0], "list-manual") == 0) {
|
2009-10-28 08:09:13 +05:30
|
|
|
/*
|
2009-11-09 07:29:19 +05:30
|
|
|
* List packages that were installed manually, not as
|
2009-10-28 08:09:13 +05:30
|
|
|
* dependencies.
|
|
|
|
*/
|
|
|
|
if (argc != 1)
|
|
|
|
usage();
|
|
|
|
|
|
|
|
rv = xbps_callback_array_iter_in_dict(dict, "packages",
|
|
|
|
list_manual_packages, NULL);
|
2010-11-19 18:10:13 +05:30
|
|
|
|
2009-08-22 04:42:19 +05:30
|
|
|
} else if (strcasecmp(argv[0], "show-revdeps") == 0) {
|
|
|
|
/*
|
|
|
|
* Show reverse dependencies for a package.
|
|
|
|
*/
|
|
|
|
if (argc != 2)
|
|
|
|
usage();
|
|
|
|
|
|
|
|
rv = xbps_show_pkg_reverse_deps(argv[1]);
|
|
|
|
|
2010-10-27 03:55:02 +05:30
|
|
|
} else if (strcasecmp(argv[0], "find-files") == 0) {
|
|
|
|
/*
|
|
|
|
* Find files matched by a pattern from installed
|
|
|
|
* packages.
|
|
|
|
*/
|
|
|
|
if (argc != 2)
|
|
|
|
usage();
|
|
|
|
|
|
|
|
rv = find_files_in_packages(argv[1]);
|
|
|
|
|
2009-08-17 22:37:20 +05:30
|
|
|
} else {
|
|
|
|
usage();
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
2009-10-23 14:50:25 +05:30
|
|
|
cleanup(rv);
|
|
|
|
}
|