From 4c4f5eebefe33334ace0a710c86d5abfe3602983 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 31 Oct 2009 11:57:40 +0100 Subject: [PATCH] xbps-repo: add a sync target, to sync the pkg index file from a remote repository. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091031105740-xdqqsjqymc9rty5j --- bin/xbps-repo/main.c | 12 ++++++++++++ bin/xbps-repo/xbps-repo.8.txt | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/bin/xbps-repo/main.c b/bin/xbps-repo/main.c index 01b26e22..1ab55374 100644 --- a/bin/xbps-repo/main.c +++ b/bin/xbps-repo/main.c @@ -57,6 +57,7 @@ usage(void) " remove\t\n" " search\t\n" " show\t\n" + " sync\t\t\n" " Options shared by all actions:\n" " -r\t\t\n" " -V\t\tPrints xbps release version\n" @@ -309,6 +310,17 @@ main(int argc, char **argv) if (rv != 0) exit(rv); + } else if (strcasecmp(argv[0], "sync") == 0) { + /* Syncs the pkg index file from a remote repo */ + if (argc != 2) + usage(); + + if (!sanitize_localpath(dpkgidx, argv[1])) + exit(EXIT_FAILURE); + + printf("Updating package index from: %s\n", dpkgidx); + rv = xbps_sync_repository_pkg_index(dpkgidx); + } else { usage(); } diff --git a/bin/xbps-repo/xbps-repo.8.txt b/bin/xbps-repo/xbps-repo.8.txt index ca9fa2c4..fbb524e1 100644 --- a/bin/xbps-repo/xbps-repo.8.txt +++ b/bin/xbps-repo/xbps-repo.8.txt @@ -71,6 +71,11 @@ Please note that all targets are *case insensitive*. the size it takes in filesystem, description, maintainer, architecture and other information. +*sync 'URI'*:: + Syncs the package index file that is available from the repository + specified at 'URI'. The new file will be fetched if it has been + modified since last synchronization. + BUGS ----