xbps-install: new flag -S,--sync and remove -s,--skip-sync.

-S: to explicitly synchronize remote repository index files.
-s: removed because it is now redundant and useless.
This commit is contained in:
Juan RP 2013-01-31 10:44:33 +01:00
parent cc068b2b39
commit 303df5fc46
3 changed files with 23 additions and 12 deletions

8
NEWS
View File

@ -1,3 +1,11 @@
xbps-0.21 (???):
* xbps-install(8): removed the -s,--skip-sync option; the new -S,--sync
option makes this redundant and useless.
* xbps-install(8): added -S,--sync option to synchronize remote repository index
files; can be combined with -u or used exclusively.
xbps-0.20 (2013-01-24):
* xbps-rindex(8): fix crash in -r (remove-obsoletes mode) if pkg cannot

View File

@ -52,7 +52,7 @@ usage(bool fail)
" -n --dry-run Dry-run mode\n"
" -R --repository <uri> Default repository to be used if config not set\n"
" -r --rootdir <dir> Full path to rootdir\n"
" -s --skip-sync Skip remote repository index sync\n"
" -S --sync Sync remote repository index\n"
" -u --update Update target package(s)\n"
" -v --verbose Verbose messages\n"
" -y --yes Assume yes to all questions\n"
@ -63,7 +63,7 @@ usage(bool fail)
int
main(int argc, char **argv)
{
const char *shortopts = "AC:c:dfhnR:r:suVvy";
const char *shortopts = "AC:c:dfhnR:r:SuVvy";
const struct option longopts[] = {
{ "automatic", no_argument, NULL, 'A' },
{ "config", required_argument, NULL, 'C' },
@ -74,7 +74,7 @@ main(int argc, char **argv)
{ "dry-run", no_argument, NULL, 'n' },
{ "repository", required_argument, NULL, 'R' },
{ "rootdir", required_argument, NULL, 'r' },
{ "skip-sync", no_argument, NULL, 's' },
{ "sync", no_argument, NULL, 'S' },
{ "update", no_argument, NULL, 'u' },
{ "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'V' },
@ -85,12 +85,12 @@ main(int argc, char **argv)
struct xferstat xfer;
const char *rootdir, *cachedir, *conffile, *defrepo;
int i, c, flags, rv;
bool skip_sync, yes, reinstall, drun, update;
bool sync, yes, reinstall, drun, update;
size_t maxcols;
rootdir = cachedir = conffile = defrepo = NULL;
flags = rv = 0;
skip_sync = yes = reinstall = drun = update = false;
sync = yes = reinstall = drun = update = false;
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
switch (c) {
@ -122,8 +122,8 @@ main(int argc, char **argv)
case 'r':
rootdir = optarg;
break;
case 's':
skip_sync = true;
case 'S':
sync = true;
break;
case 'u':
update = true;
@ -143,7 +143,7 @@ main(int argc, char **argv)
/* NOTREACHED */
}
}
if (!update && (argc == optind))
if ((!update && !sync) && (argc == optind))
usage(true);
/*
@ -184,10 +184,13 @@ main(int argc, char **argv)
}
/* Sync remote repository index files by default */
if (!skip_sync || !drun) {
if (sync && !drun) {
rv = xbps_rpool_sync(&xh, XBPS_PKGINDEX, NULL);
if (rv != 0)
exit(rv);
rv = xbps_rpool_sync(&xh, XBPS_PKGINDEX_FILES, NULL);
if (rv != 0)
exit(rv);
}
if (update && (argc == optind)) {

View File

@ -1,4 +1,4 @@
.Dd December 20, 2012
.Dd January 31, 2013
.Os Void Linux
.Dt xbps-install 8
.Sh NAME
@ -68,8 +68,8 @@ Dry-run mode. Show what actions would be done but don't do anything.
Default repository to be used if no repository is specified in configuration file.
.It Fl r, Fl -rootdir Ar dir
Specifies a full path for the target root directory.
.It Fl s, Fl -skip-sync
Skip synchronizing remote repository index files.
.It Fl S, Fl -sync
Synchronize remote repository index files.
.It Fl u, Fl -update
Update target package(s) rather than install. If
.Op PKG