xbps-bin: added support for the show target.
--HG-- extra : convert_revision : 24b2d30a94c95b22b1c524203cf578da03314335
This commit is contained in:
parent
54cce657ec
commit
2b24128059
|
@ -1,7 +1,7 @@
|
||||||
TOPDIR = ../..
|
TOPDIR = ../..
|
||||||
include $(TOPDIR)/vars.mk
|
include $(TOPDIR)/vars.mk
|
||||||
|
|
||||||
OBJS = main.o
|
OBJS = main.o ../xbps-repo/util.o
|
||||||
BIN = xbps-bin
|
BIN = xbps-bin
|
||||||
|
|
||||||
all: $(BIN)
|
all: $(BIN)
|
||||||
|
@ -18,6 +18,7 @@ clean-bins:
|
||||||
|
|
||||||
clean-objs:
|
clean-objs:
|
||||||
-rm -f *.o
|
-rm -f *.o
|
||||||
|
-rm -f ../xbps-repo/util.o
|
||||||
|
|
||||||
install: $(BIN)
|
install: $(BIN)
|
||||||
install -d $(SBINDIR)
|
install -d $(SBINDIR)
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <xbps_api.h>
|
#include <xbps_api.h>
|
||||||
|
#include "../xbps-repo/util.h"
|
||||||
|
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
static void show_missing_deps(prop_dictionary_t, const char *);
|
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]);
|
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 {
|
} else {
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,41 @@ search_string_in_pkgs(prop_object_t obj, void *arg, bool *loop_done)
|
||||||
return 0;
|
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
|
int
|
||||||
show_pkg_info_from_repolist(prop_object_t obj, void *arg, bool *loop_done)
|
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.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _XBPS_REPO_UTIL_H_
|
||||||
|
#define _XBPS_REPO_UTIL_H_
|
||||||
|
|
||||||
int search_string_in_pkgs(prop_object_t, void *, bool *);
|
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 show_pkg_info_from_repolist(prop_object_t, void *, bool *);
|
||||||
int list_strings_in_array(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 detect orphaned packages.
|
||||||
* Add support to check sha256 hashes of all installed files, as well as
|
* Add support to check sha256 hashes of all installed files, as well as
|
||||||
hashes for binary packages before installation happens.
|
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.
|
* Add support to install binary packages without any repository.
|
||||||
|
|
||||||
xbps-repo:
|
xbps-repo:
|
||||||
|
|
|
@ -47,6 +47,9 @@
|
||||||
/* Filename of the packages register. */
|
/* Filename of the packages register. */
|
||||||
#define XBPS_REGPKGDB "regpkgdb.plist"
|
#define XBPS_REGPKGDB "regpkgdb.plist"
|
||||||
|
|
||||||
|
/* Filename of the package properties plist file. */
|
||||||
|
#define XBPS_PKGPROPS "props.plist"
|
||||||
|
|
||||||
#include "cmpver.h"
|
#include "cmpver.h"
|
||||||
#include "fexec.h"
|
#include "fexec.h"
|
||||||
#include "humanize_number.h"
|
#include "humanize_number.h"
|
||||||
|
|
Loading…
Reference in New Issue