xbps-bin: added support for the show target.
--HG-- extra : convert_revision : 24b2d30a94c95b22b1c524203cf578da03314335
This commit is contained in:
parent
54cce657ec
commit
2b24128059
6 changed files with 60 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
|||
TOPDIR = ../..
|
||||
include $(TOPDIR)/vars.mk
|
||||
|
||||
OBJS = main.o
|
||||
OBJS = main.o ../xbps-repo/util.o
|
||||
BIN = xbps-bin
|
||||
|
||||
all: $(BIN)
|
||||
|
@ -18,6 +18,7 @@ clean-bins:
|
|||
|
||||
clean-objs:
|
||||
-rm -f *.o
|
||||
-rm -f ../xbps-repo/util.o
|
||||
|
||||
install: $(BIN)
|
||||
install -d $(SBINDIR)
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "../xbps-repo/util.h"
|
||||
|
||||
static void usage(void);
|
||||
static void show_missing_deps(prop_dictionary_t, const char *);
|
||||
|
@ -188,6 +189,16 @@ main(int argc, char **argv)
|
|||
printf("Package %s removed successfully.\n", argv[1]);
|
||||
}
|
||||
|
||||
} 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]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
usage();
|
||||
}
|
||||
|
|
|
@ -152,6 +152,41 @@ search_string_in_pkgs(prop_object_t obj, void *arg, bool *loop_done)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
show_pkg_info_from_metadir(const char *pkgname)
|
||||
{
|
||||
prop_dictionary_t pkgd;
|
||||
size_t len = 0;
|
||||
char *plist, *path;
|
||||
|
||||
/* XBPS_META_PATH/metadata/<pkgname> + NULL */
|
||||
len = strlen(XBPS_META_PATH) + strlen(pkgname) + 12;
|
||||
path = malloc(len);
|
||||
if (path == NULL)
|
||||
return EINVAL;
|
||||
|
||||
(void)snprintf(path, len, "%s/metadata/%s", XBPS_META_PATH, pkgname);
|
||||
|
||||
plist = xbps_append_full_path(true, path, XBPS_PKGPROPS);
|
||||
if (plist == NULL) {
|
||||
free(path);
|
||||
return EINVAL;
|
||||
}
|
||||
free(path);
|
||||
|
||||
pkgd = prop_dictionary_internalize_from_file(plist);
|
||||
if (pkgd == NULL) {
|
||||
free(plist);
|
||||
return errno;
|
||||
}
|
||||
|
||||
show_pkg_info(pkgd);
|
||||
prop_object_release(pkgd);
|
||||
free(plist);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
show_pkg_info_from_repolist(prop_object_t obj, void *arg, bool *loop_done)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
int search_string_in_pkgs(prop_object_t, void *, bool *);
|
||||
int show_pkg_info_from_repolist(prop_object_t, void *, bool *);
|
||||
int list_strings_in_array(prop_object_t, void *, bool *);
|
||||
#ifndef _XBPS_REPO_UTIL_H_
|
||||
#define _XBPS_REPO_UTIL_H_
|
||||
|
||||
int search_string_in_pkgs(prop_object_t, void *, bool *);
|
||||
int show_pkg_info_from_metadir(const char *);
|
||||
int show_pkg_info_from_repolist(prop_object_t, void *, bool *);
|
||||
int list_strings_in_array(prop_object_t, void *, bool *);
|
||||
|
||||
#endif /* !_XBPS_REPO_UTIL_H_ */
|
||||
|
|
1
doc/TODO
1
doc/TODO
|
@ -25,7 +25,6 @@ xbps-bin:
|
|||
* Add support to detect orphaned packages.
|
||||
* Add support to check sha256 hashes of all installed files, as well as
|
||||
hashes for binary packages before installation happens.
|
||||
* Add support to use the show target with no repositories.
|
||||
* Add support to install binary packages without any repository.
|
||||
|
||||
xbps-repo:
|
||||
|
|
|
@ -47,6 +47,9 @@
|
|||
/* Filename of the packages register. */
|
||||
#define XBPS_REGPKGDB "regpkgdb.plist"
|
||||
|
||||
/* Filename of the package properties plist file. */
|
||||
#define XBPS_PKGPROPS "props.plist"
|
||||
|
||||
#include "cmpver.h"
|
||||
#include "fexec.h"
|
||||
#include "humanize_number.h"
|
||||
|
|
Loading…
Reference in a new issue