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

View File

@ -1,4 +1,4 @@
.Dd December 20, 2012 .Dd January 31, 2013
.Os Void Linux .Os Void Linux
.Dt xbps-install 8 .Dt xbps-install 8
.Sh NAME .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. Default repository to be used if no repository is specified in configuration file.
.It Fl r, Fl -rootdir Ar dir .It Fl r, Fl -rootdir Ar dir
Specifies a full path for the target root directory. Specifies a full path for the target root directory.
.It Fl s, Fl -skip-sync .It Fl S, Fl -sync
Skip synchronizing remote repository index files. Synchronize remote repository index files.
.It Fl u, Fl -update .It Fl u, Fl -update
Update target package(s) rather than install. If Update target package(s) rather than install. If
.Op PKG .Op PKG