xbps-repo: made 'genindex' code run ~60% faster than before!

Rather than externalizing the package index plist file to storage every
time a package is registered, only do it one time once all packages
have been processed. Creating an index with 700 pkgs now takes 14s
in a VM, where before it took 39s. As consequence of this, the 'add-pkgidx'
target is no longer relevant or useful, remove it.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091118053439-ct1chn4hdeir1pdo
This commit is contained in:
Juan RP
2009-11-18 06:34:39 +01:00
parent cc6417b9bf
commit f859663a4b
4 changed files with 67 additions and 56 deletions

View File

@ -49,10 +49,9 @@ usage(void)
{
printf("Usage: xbps-repo [options] [action] [arguments]\n\n"
" Available actions:\n"
" add, add-pkgidx, genindex, list, remove, search, show\n"
" add, genindex, list, remove, search, show\n"
" Actions with arguments:\n"
" add\t\t<URI>\n"
" add-pkgidx\t<repo> <binpkg>\n"
" genindex\t<path>\n"
" remove\t<URI>\n"
" search\t<string>\n"
@ -69,7 +68,6 @@ usage(void)
" $ xbps-repo remove /path/to/directory\n"
" $ xbps-repo search klibc\n"
" $ xbps-repo show klibc\n"
" $ xbps-repo add-pkgidx /pkgdir /pkgdir/noarch/foo.xbps\n"
" $ xbps-repo genindex /pkgdir\n");
exit(EXIT_FAILURE);
}
@ -147,6 +145,7 @@ add_repository(const char *uri, bool remote)
if (!sanitize_localpath(idxstr, uri))
return errno;
printf("Fetching remote package index at %s...\n", uri);
rv = xbps_sync_repository_pkg_index(idxstr);
if (rv != 0)
return rv;
@ -301,15 +300,6 @@ main(int argc, char **argv)
rv = xbps_repo_genindex(argv[1]);
exit(rv);
} else if (strcasecmp(argv[0], "add-pkgidx") == 0) {
/* Add a binary package into a package repository. */
if (argc != 3)
usage();
rv = xbps_repo_addpkg_index(argv[1], argv[2]);
if (rv != 0)
exit(rv);
} else if (strcasecmp(argv[0], "sync") == 0) {
/* Syncs the pkg index file from a remote repo */
if (argc != 2)