/* we're done, the lib is installed */
return 2;
}
}
for (i = 0; i < opt->repos.gl_pathc; i++) {
/* we're done, the lib is installed */
return 2;
}
}
for (i = 0; i < opt->repos.gl_pathc; i++) {
rv = zpm_vercmp(found, latest);
if (rv == 1) {
latest = found;
free(pkgfile);
pkgfile = strdup(opt->repos.gl_pathv[i]);
}
rv = zpm_vercmp(found, latest);
if (rv == 1) {
latest = found;
free(pkgfile);
pkgfile = strdup(opt->repos.gl_pathv[i]);
}
struct pkgloc *find_package(char *pkgstr, struct search_ctl *opt) {
char *latest = 0;
char *installed = 0, *found = 0;
struct pkgloc *find_package(char *pkgstr, struct search_ctl *opt) {
char *latest = 0;
char *installed = 0, *found = 0;
- found = zpm_findpkg(opt->zpmdb, pkgstr, NULL);
- if (found) {
- rv = zpm_vercmp(found, latest);
- if (rv == 1) {
- latest = found;
- pkgfile = opt->zpmdb->path;
+ if (!opt->onlylocalinstalled) {
+ found = zpm_findpkg(opt->zpmdb, pkgstr, NULL);
+ if (found) {
+ rv = zpm_vercmp(found, latest);
+ if (rv == 1) {
+ latest = found;
+ pkgfile = opt->zpmdb->path;
+ }
/* if it's in checked_libs, we've already looked at this one */
if (jsw_afind(checked_libs, soname)) {
/* if it's in checked_libs, we've already looked at this one */
if (jsw_afind(checked_libs, soname)) {
}
/* shouldn't be in there already */
jsw_hinsert(forlibs, pkginfo.id, pkginfo.file);
}
/* shouldn't be in there already */
jsw_hinsert(forlibs, pkginfo.id, pkginfo.file);
opt.localdb = getenv("ZPMDB");
if (!opt.localdb) opt.localdb = "/var/lib/zpm/local.db";
opt.pkgdir = getenv("ZPM_PACKAGE_DIR");
if (!opt.pkgdir) opt.pkgdir = "/var/lib/zpm/packages";
opt.repodir = getenv("ZPM_REPO_DIR");
opt.localdb = getenv("ZPMDB");
if (!opt.localdb) opt.localdb = "/var/lib/zpm/local.db";
opt.pkgdir = getenv("ZPM_PACKAGE_DIR");
if (!opt.pkgdir) opt.pkgdir = "/var/lib/zpm/packages";
opt.repodir = getenv("ZPM_REPO_DIR");
* ZPM_PACKAGE_DIRS - : separated paths to *.zpm files,
* '/var/lib/zpm/packages'
* ZPM_ROOT_DIR :- prepends to above paths
* ZPM_PACKAGE_DIRS - : separated paths to *.zpm files,
* '/var/lib/zpm/packages'
* ZPM_ROOT_DIR :- prepends to above paths
+ case 'q': output = 0; break;
+ /* show installed files */
+ case 'i': opt.matchinstalled = 1; break;
+ case 'I': opt.suppressinstalled = 1; break;
+ /* only find localdb pkgs if installed */
+ case 'O': opt.onlylocalinstalled = 1; break;
case 'd': opt.localdb = optarg; break;
case 'p': opt.pkgdir = optarg; break;
case 'r': opt.repodir = optarg; break;
case 'P': opt.pkgdir = 0; break;
case 'R': opt.repodir = 0; break;
case 'D': opt.localdb = 0; break;
case 'd': opt.localdb = optarg; break;
case 'p': opt.pkgdir = optarg; break;
case 'r': opt.repodir = optarg; break;
case 'P': opt.pkgdir = 0; break;
case 'R': opt.repodir = 0; break;
case 'D': opt.localdb = 0; break;
+ if (opt.verbose > 1) {
+ unsigned int i;
+ fprintf(stderr, "globs:");
+ for (i = 0; i < opt.repos.gl_pathc; i++) {
+ fprintf(stderr, " %s", opt.repos.gl_pathv[i]);
+ }
+ fprintf(stderr, "\n");
+ }
+
packages = jsw_hnew(ac,NULL,(cmp_f)strcmp,(keydup_f)strdup,
(itemdup_f)strdup,free,free);
check = jsw_hnew(ac,NULL,(cmp_f)strcmp,(keydup_f)strdup,
packages = jsw_hnew(ac,NULL,(cmp_f)strcmp,(keydup_f)strdup,
(itemdup_f)strdup,free,free);
check = jsw_hnew(ac,NULL,(cmp_f)strcmp,(keydup_f)strdup,
int arg;
for (arg = argn; arg < ac; arg++) {
found = find_package(av[arg], &opt);
int arg;
for (arg = argn; arg < ac; arg++) {
found = find_package(av[arg], &opt);
jsw_hinsert(packages, found->id, found->file);
jsw_hinsert(check, found->id, found->file);
free(found->id);
jsw_hinsert(packages, found->id, found->file);
jsw_hinsert(check, found->id, found->file);
free(found->id);
if (findlibs) {
checklibs(&opt, check, forlibs, nolib);
if (findlibs) {
checklibs(&opt, check, forlibs, nolib);
if (jsw_hsize(forlibs)) {
print_pkghash(forlibs, json);
}
if (jsw_hsize(forlibs)) {
print_pkghash(forlibs, json);
}