Lines Matching +full:pkg +full:- +full:config
7 #include "config.h"
16 /*-
17 * Copyright (c) 1999-2019 The NetBSD Foundation, Inc.
138 …(void) fprintf(stderr, "usage: %s [-bqSVv] [-C config] [-d lsdir] [-K pkg_dbdir] [-s sfx] command … in usage()
140 " rebuild - rebuild pkgdb from +CONTENTS files\n" in usage()
141 " rebuild-tree - rebuild +REQUIRED_BY files from forward deps\n" in usage()
142 " check [pkg ...] - check md5 checksum of installed files\n" in usage()
143 " add pkg ... - add pkg files to database\n" in usage()
144 " set variable=value pkg ... - set installation variable for package\n" in usage()
145 " unset variable pkg ... - unset installation variable for package\n" in usage()
146 " lsall /path/to/pkgpattern - list all pkgs matching the pattern\n" in usage()
147 " lsbest /path/to/pkgpattern - list pkgs matching the pattern best\n" in usage()
148 " dump - dump database\n" in usage()
149 " pmatch pattern pkg - returns true if pkg matches pattern, otherwise false\n" in usage()
150 " fetch-pkg-vulnerabilities [-s] - fetch new vulnerability file\n" in usage()
151 … " check-pkg-vulnerabilities [-s] <file> - check syntax and checksums of the vulnerability file\n" in usage()
152 " audit [-eis] [-t type] ... - check installed packages for vulnerabilities\n" in usage()
153 " audit-pkg [-eis] [-t type] ... - check listed packages for vulnerabilities\n" in usage()
154 " audit-batch [-eis] [-t type] ... - check packages in listed files for vulnerabilities\n" in usage()
155 " audit-history [-t type] ... - print all advisories for package names\n" in usage()
156 " check-license <condition> - check if condition is acceptable\n" in usage()
157 " check-single-license <license> - check if license is acceptable\n" in usage()
158 " config-var name - print current value of the configuration variable\n" in usage()
159 " check-signature ... - verify the signature of packages\n" in usage()
160 " x509-sign-package pkg spkg key cert - create X509 signature\n" in usage()
161 " gpg-sign-package pkg spkg - create GPG signature\n", in usage()
167 * add1pkg(<pkg>)
168 * adds the files listed in the +CONTENTS of <pkg> into the
187 ++count->packages; in add_pkg()
199 PkgName = p->name; in add_pkg()
201 for (p = Plist.head; p; p = p->next) { in add_pkg()
202 switch(p->type) { in add_pkg()
205 errx(EXIT_FAILURE, "@cwd not yet found, please send-pr!"); in add_pkg()
207 (void) snprintf(file, sizeof(file), "%s/%s", dirp, p->name); in add_pkg()
218 ++count->files; in add_pkg()
222 add_pkgdir(PkgName, dirp, p->name); in add_pkg()
223 ++count->directories; in add_pkg()
226 if (strcmp(p->name, ".") != 0) in add_pkg()
227 dirp = p->name; in add_pkg()
232 p = p->next; in add_pkg()
287 lspattern(const char *pkg, void *vp) in lspattern() argument
290 printf("%s/%s\n", dir, pkg); in lspattern()
295 lsbasepattern(const char *pkg, void *vp) in lsbasepattern() argument
297 puts(pkg); in lsbasepattern()
308 if (unlink(path) == -1 && errno != ENOENT) in remove_required_by()
320 struct pkg_reqd_by *pkg; in add_required_by() local
341 SLIST_FOREACH(pkg, phead, entries) { in add_required_by()
342 if (strcmp(pkg->pkgname, best_installed) == 0) { in add_required_by()
349 ehead = &pkg->required_by[PKG_HASH_ENTRY(pkgname)]; in add_required_by()
351 if (strcmp(entry->pkgname, pkgname) == 0) in add_required_by()
357 entry->pkgname = xstrdup(pkgname); in add_required_by()
368 if (pkg == NULL) { in add_required_by()
369 pkg = xmalloc(sizeof(*pkg)); in add_required_by()
370 pkg->pkgname = xstrdup(best_installed); in add_required_by()
372 SLIST_INIT(&pkg->required_by[i]); in add_required_by()
374 ehead = &pkg->required_by[PKG_HASH_ENTRY(pkgname)]; in add_required_by()
376 entry->pkgname = xstrdup(pkgname); in add_required_by()
379 SLIST_INSERT_HEAD(phead, pkg, entries); in add_required_by()
402 for (p = plist.head; p; p = p->next) { in add_depends_of()
403 if (p->type == PLIST_PKGDEP) in add_depends_of()
404 add_required_by(p->name, pkgname, h); in add_depends_of()
420 struct pkgbase_entry *pkg, *pkgiter; in check_duplicate_pkgbase() local
423 if ((p = strrchr(pkgname, '-')) == NULL) { in check_duplicate_pkgbase()
428 pkg = xmalloc(sizeof(*pkg)); in check_duplicate_pkgbase()
429 pkg->pkgname = xstrdup(pkgname); in check_duplicate_pkgbase()
431 pkg->pkgbase = xstrdup(pkgname); in check_duplicate_pkgbase()
434 if (strcmp(pkg->pkgbase, pkgiter->pkgbase) == 0) { in check_duplicate_pkgbase()
436 "\t%s\n\t%s", pkg->pkgname, pkgiter->pkgname); in check_duplicate_pkgbase()
440 SLIST_INSERT_HEAD(head, pkg, entries); in check_duplicate_pkgbase()
451 if (iterate_pkg_db(check_duplicate_pkgbase, &pbhead) == -1) in check_pkgdb()
472 if (iterate_pkg_db(add_depends_of, &pkgs) == -1) in rebuild_tree()
478 if (iterate_pkg_db(remove_required_by, NULL) == -1) in rebuild_tree()
486 path = pkgdb_pkg_file(p->pkgname, REQUIRED_BY_FNAME); in rebuild_tree()
489 0644)) == -1) in rebuild_tree()
496 SLIST_FOREACH(e, &p->required_by[j], entries) in rebuild_tree()
497 fprintf(fp, "%s\n", e->pkgname); in rebuild_tree()
522 while ((ch = getopt(argc, argv, Options)) != -1) in main()
568 argc -= optind; in main()
576 * config-var is reading the config file implicitly, in main()
579 if (strcasecmp(argv[0], "config-var") != 0) in main()
587 char *pattern, *pkg; in main() local
596 pkg = argv[1]; in main()
598 if (pkg_match(pattern, pkg)){ in main()
612 } else if (strcasecmp(argv[0], "rebuild-tree") == 0) { in main()
645 if (rc == -1) in main()
698 } else if (strcasecmp(argv[0], "config-var") == 0) { in main()
701 errx(EXIT_FAILURE, "config-var takes exactly one argument"); in main()
703 } else if (strcasecmp(argv[0], "check-license") == 0) { in main()
705 errx(EXIT_FAILURE, "check-license takes exactly one argument"); in main()
716 case -1: in main()
719 } else if (strcasecmp(argv[0], "check-single-license") == 0) { in main()
721 errx(EXIT_FAILURE, "check-license takes exactly one argument"); in main()
731 case -1: in main()
757 } else if (strcasecmp(argv[0], "fetch-pkg-vulnerabilities") == 0) { in main()
758 fetch_pkg_vulnerabilities(--argc, ++argv); in main()
759 } else if (strcasecmp(argv[0], "check-pkg-vulnerabilities") == 0) { in main()
760 check_pkg_vulnerabilities(--argc, ++argv); in main()
762 audit_pkgdb(--argc, ++argv); in main()
763 } else if (strcasecmp(argv[0], "audit-pkg") == 0) { in main()
764 audit_pkg(--argc, ++argv); in main()
765 } else if (strcasecmp(argv[0], "audit-batch") == 0) { in main()
766 audit_batch(--argc, ++argv); in main()
767 } else if (strcasecmp(argv[0], "audit-history") == 0) { in main()
768 audit_history(--argc, ++argv); in main()
769 } else if (strcasecmp(argv[0], "check-signature") == 0) { in main()
770 struct archive *pkg; in main() local
774 for (--argc, ++argv; argc > 0; --argc, ++argv) { in main()
777 pkg = open_archive(*argv, &archive_name); in main()
778 if (pkg == NULL) { in main()
782 if (pkg_full_signature_check(archive_name, &pkg)) in main()
785 if (pkg != NULL) in main()
786 archive_read_free(pkg); in main()
789 } else if (strcasecmp(argv[0], "x509-sign-package") == 0) { in main()
791 --argc; in main()
794 errx(EXIT_FAILURE, "x509-sign-package takes exactly four arguments"); in main()
799 } else if (strcasecmp(argv[0], "gpg-sign-package") == 0) { in main()
800 --argc; in main()
803 errx(EXIT_FAILURE, "gpg-sign-package takes exactly two arguments"); in main()
829 retval = var_set(filename, arg->variable, arg->value); in set_installed_info_var()
832 arg->got_match = 1; in set_installed_info_var()
858 variable = xmalloc(eq-argv[0]+1); in set_unset_variable()
859 strlcpy(variable, argv[0], eq-argv[0]+1); in set_unset_variable()
881 if (match_installed_pkgs(*argv, set_installed_info_var, &arg) == -1) in set_unset_variable()
887 warnx("no matching pkg for `%s'", *argv); in set_unset_variable()
890 pattern = xasprintf("%s-[0-9]*", *argv); in set_unset_variable()
892 if (match_installed_pkgs(pattern, set_installed_info_var, &arg) == -1) in set_unset_variable()