xbps-rindex: added -f --force flag to forcefully register a pkg with -a --add.
This commit is contained in:
parent
30747b1c8b
commit
53217fd51b
2
NEWS
2
NEWS
@ -1,5 +1,7 @@
|
|||||||
xbps-0.24 (???):
|
xbps-0.24 (???):
|
||||||
|
|
||||||
|
* xbps-rindex(8): added -f, --force flag to forcefully register a package even
|
||||||
|
if an entry of the same package already exists on the index.
|
||||||
|
|
||||||
xbps-0.23 (2013-04-19):
|
xbps-0.23 (2013-04-19):
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2012 Juan Romero Pardines.
|
* Copyright (c) 2012-2013 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -29,7 +29,7 @@
|
|||||||
#include <xbps_api.h>
|
#include <xbps_api.h>
|
||||||
|
|
||||||
/* From index-add.c */
|
/* From index-add.c */
|
||||||
int index_add(struct xbps_handle *, int, char **);
|
int index_add(struct xbps_handle *, int, char **, bool);
|
||||||
|
|
||||||
/* From index-clean.c */
|
/* From index-clean.c */
|
||||||
int index_clean(struct xbps_handle *, const char *);
|
int index_clean(struct xbps_handle *, const char *);
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
* and entry when it's necessary.
|
* and entry when it's necessary.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
index_add(struct xbps_handle *xhp, int argc, char **argv)
|
index_add(struct xbps_handle *xhp, int argc, char **argv, bool force)
|
||||||
{
|
{
|
||||||
prop_array_t filespkgar, pkg_files, pkg_links, pkg_cffiles;
|
prop_array_t filespkgar, pkg_files, pkg_links, pkg_cffiles;
|
||||||
prop_dictionary_t idx, idxfiles, newpkgd, newpkgfilesd, curpkgd;
|
prop_dictionary_t idx, idxfiles, newpkgd, newpkgfilesd, curpkgd;
|
||||||
@ -134,7 +134,8 @@ index_add(struct xbps_handle *xhp, int argc, char **argv)
|
|||||||
free(pkgname);
|
free(pkgname);
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (!force) {
|
||||||
|
/* Only check version if !force */
|
||||||
prop_dictionary_get_cstring_nocopy(curpkgd,
|
prop_dictionary_get_cstring_nocopy(curpkgd,
|
||||||
"pkgver", &oldpkgver);
|
"pkgver", &oldpkgver);
|
||||||
prop_dictionary_get_cstring_nocopy(curpkgd,
|
prop_dictionary_get_cstring_nocopy(curpkgd,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2012 Juan Romero Pardines.
|
* Copyright (c) 2012-2013 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -37,6 +37,7 @@ usage(bool fail)
|
|||||||
fprintf(stdout,
|
fprintf(stdout,
|
||||||
"Usage: xbps-rindex [OPTIONS] MODE ARGUMENTS\n\n"
|
"Usage: xbps-rindex [OPTIONS] MODE ARGUMENTS\n\n"
|
||||||
"OPTIONS\n"
|
"OPTIONS\n"
|
||||||
|
" -f --force Force mode to overwrite entry in add mode\n"
|
||||||
" -h --help Show help usage\n"
|
" -h --help Show help usage\n"
|
||||||
" -V --version Show XBPS version\n\n"
|
" -V --version Show XBPS version\n\n"
|
||||||
"MODE\n"
|
"MODE\n"
|
||||||
@ -49,10 +50,11 @@ usage(bool fail)
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *shortopts = "achrV";
|
const char *shortopts = "acfhrV";
|
||||||
struct option longopts[] = {
|
struct option longopts[] = {
|
||||||
{ "add", no_argument, NULL, 'a' },
|
{ "add", no_argument, NULL, 'a' },
|
||||||
{ "clean", no_argument, NULL, 'c' },
|
{ "clean", no_argument, NULL, 'c' },
|
||||||
|
{ "force", no_argument, NULL, 'f' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ "remove-obsoletes", no_argument, NULL, 'r' },
|
{ "remove-obsoletes", no_argument, NULL, 'r' },
|
||||||
{ "version", no_argument, NULL, 'V' },
|
{ "version", no_argument, NULL, 'V' },
|
||||||
@ -60,7 +62,7 @@ main(int argc, char **argv)
|
|||||||
};
|
};
|
||||||
struct xbps_handle xh;
|
struct xbps_handle xh;
|
||||||
int rv, c;
|
int rv, c;
|
||||||
bool clean_mode = false, add_mode = false, rm_mode = false;
|
bool clean_mode = false, add_mode = false, rm_mode = false, force = false;
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@ -70,6 +72,9 @@ main(int argc, char **argv)
|
|||||||
case 'c':
|
case 'c':
|
||||||
clean_mode = true;
|
clean_mode = true;
|
||||||
break;
|
break;
|
||||||
|
case 'f':
|
||||||
|
force = true;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(false);
|
usage(false);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
@ -100,7 +105,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (add_mode)
|
if (add_mode)
|
||||||
rv = index_add(&xh, argc - optind, argv + optind);
|
rv = index_add(&xh, argc - optind, argv + optind, force);
|
||||||
else if (clean_mode)
|
else if (clean_mode)
|
||||||
rv = index_clean(&xh, argv[optind]);
|
rv = index_clean(&xh, argv[optind]);
|
||||||
else if (rm_mode)
|
else if (rm_mode)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.Dd February 20, 2013
|
.Dd May 2, 2013
|
||||||
.Os Void Linux
|
.Os Void Linux
|
||||||
.Dt xbps-rindex 8
|
.Dt xbps-rindex 8
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -16,6 +16,11 @@ utility creates, updates and removes obsolete binary packages stored
|
|||||||
in local repositories.
|
in local repositories.
|
||||||
.Sh OPTIONS
|
.Sh OPTIONS
|
||||||
.Bl -tag -width -x
|
.Bl -tag -width -x
|
||||||
|
.It Fl f -force
|
||||||
|
Forcefully register binary package into the local repository, overwriting existing entry.
|
||||||
|
This flag is only useful with the
|
||||||
|
.Em add
|
||||||
|
mode.
|
||||||
.It Fl h -help
|
.It Fl h -help
|
||||||
Show the help usage.
|
Show the help usage.
|
||||||
.It Fl V -version
|
.It Fl V -version
|
||||||
|
Loading…
Reference in New Issue
Block a user