diff --git a/NEWS b/NEWS index 2054a147..9f52dbc9 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ xbps-0.16 (???): + * xbps-bin(8): new flag: -S which syncs rpool indexes before executing + the "dist-upgrade", "install" or "update" targets. + * libxbps: renamed xbps_repository_pool_xxx to xbps_rpool_xxx (API/ABI incompat changes). diff --git a/bin/xbps-bin/main.c b/bin/xbps-bin/main.c index 9bfebdc5..1d991a0f 100644 --- a/bin/xbps-bin/main.c +++ b/bin/xbps-bin/main.c @@ -58,6 +58,7 @@ usage(bool fail) " -o key[,key] Print package metadata keys in show target\n" " -R Remove recursively packages\n" " -r rootdir Full path to rootdir\n" + " -S Sync repository index\n" " -v Verbose messages\n" " -y Assume yes to all questions\n" " -V Show XBPS version\n\n" @@ -112,15 +113,15 @@ main(int argc, char **argv) struct sigaction sa; const char *rootdir, *cachedir, *conffile, *option; int i, c, flags, rv; - bool yes, reqby_force, force_rm_with_deps, recursive_rm; + bool sync, yes, reqby_force, force_rm_with_deps, recursive_rm; bool reinstall, show_download_pkglist_url, dry_run; rootdir = cachedir = conffile = option = NULL; flags = rv = 0; - reqby_force = yes = dry_run = force_rm_with_deps = false; + reqby_force = sync = yes = dry_run = force_rm_with_deps = false; recursive_rm = reinstall = show_download_pkglist_url = false; - while ((c = getopt(argc, argv, "AC:c:dDFfhMno:Rr:Vvy")) != -1) { + while ((c = getopt(argc, argv, "AC:c:dDFfhMno:Rr:SVvy")) != -1) { switch (c) { case 'A': flags |= XBPS_FLAG_INSTALL_AUTO; @@ -164,6 +165,9 @@ main(int argc, char **argv) /* To specify the root directory */ rootdir = optarg; break; + case 'S': + sync = true; + break; case 'v': flags |= XBPS_FLAG_VERBOSE; break; @@ -264,6 +268,9 @@ main(int argc, char **argv) if (argc < 2) usage(true); + if (sync && ((rv = xbps_rpool_sync()) != 0)) + goto out; + for (i = 1; i < argc; i++) if ((rv = install_new_pkg(argv[i], reinstall)) != 0) goto out; @@ -275,6 +282,9 @@ main(int argc, char **argv) if (argc < 2) usage(true); + if (sync && ((rv = xbps_rpool_sync()) != 0)) + goto out; + for (i = 1; i < argc; i++) if ((rv = update_pkg(argv[i])) != 0) goto out; @@ -341,6 +351,9 @@ main(int argc, char **argv) if (argc != 1) usage(true); + if (sync && ((rv = xbps_rpool_sync()) != 0)) + goto out; + rv = dist_upgrade(yes, dry_run, show_download_pkglist_url); } else if (strcasecmp(argv[0], "show-orphans") == 0) { diff --git a/bin/xbps-bin/xbps-bin.8 b/bin/xbps-bin/xbps-bin.8 index 70d15d2d..683f2a8b 100644 --- a/bin/xbps-bin/xbps-bin.8 +++ b/bin/xbps-bin/xbps-bin.8 @@ -1,4 +1,4 @@ -.Dd May 8, 2012 +.Dd May 31, 2012 .Os Void GNU/Linux .Dt xbps-bin 8 .Sh NAME @@ -120,6 +120,14 @@ independently of rootdir setting. So if you use a rootdir of .Pa /blah , metadata stuff will go into .Pa /blah/var/db/xbps . +.It Fl S +Sync remote repository index files before executing the target. +Used currently in the +.Em dist-upgrade , +.Em install +and +.Em update +targets. .It Fl v Shows verbose messages. Useful while installing and removing packages. .It Fl y