1 /* opkg_hash_test.c - the itsy package management system
5 Copyright (C) 2001 University of Southern California
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2, or (at
10 your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
18 #include <libopkg/opkg.h>
20 #include <libopkg/hash_table.h>
21 #include <libopkg/opkg_utils.h>
22 #include <libopkg/pkg_hash.h>
24 int main(int argc, char *argv[])
27 hash_table_t *hash = &conf.pkg_hash;
32 "Usage: %s <pkgs_file1> <pkgs_file2> [pkg_name...]\n",
36 pkg_hash_init("test", hash, 1024);
38 pkg_hash_add_from_file(&conf, argv[1], NULL, NULL, 0);
39 pkg_hash_add_from_file(&conf, argv[2], NULL, NULL, 0);
42 pkg_print_info(pkg_hash_fetch_by_name_version
43 (hash, "libc6", "2.2.3-2"), stdout);
44 /* for(i = 0; i < pkg_vec->len; i++)
45 pkg_print(pkg_vec->pkgs[i], stdout);
52 for (i = 3; i < argc; i++) {
53 pkg_vec = pkg_vec_fetch_by_name(hash, argv[i]);
54 if (pkg_vec == NULL) {
56 "*** WARNING: Unknown package: %s\n\n",
61 for (j = 0; j < pkg_vec->len; j++) {
62 pkg_print_info(pkg_vec->pkgs[j], stdout);
63 dep_vec = pkg_vec_alloc();
64 pkg_hash_fetch_unsatisfied_dependencies(&conf,
71 "and the unsatisfied dependencies are:\n");
72 for (k = 0; k < dep_vec->len; k++) {
75 dep_vec->pkgs[k]->name,
87 pkg_hash_deinit(hash);