de1d82c10c3c45a4f2f6be8448e2d3cfa8abe81c
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
;
31 fprintf(stderr
, "Usage: %s <pkgs_file1> <pkgs_file2> [pkg_name...]\n", argv
[0]);
34 pkg_hash_init("test", hash
, 1024);
36 pkg_hash_add_from_file(&conf
, argv
[1], NULL
, NULL
, 0);
37 pkg_hash_add_from_file(&conf
, argv
[2], NULL
, NULL
, 0);
40 pkg_print_info( pkg_hash_fetch_by_name_version(hash
, "libc6", "2.2.3-2"), stdout
);
41 /* for(i = 0; i < pkg_vec->len; i++)
42 pkg_print(pkg_vec->pkgs[i], stdout);
49 for (i
= 3; i
< argc
; i
++) {
50 pkg_vec
= pkg_vec_fetch_by_name(hash
, argv
[i
]);
51 if (pkg_vec
== NULL
) {
52 fprintf(stderr
, "*** WARNING: Unknown package: %s\n\n", argv
[i
]);
56 for(j
= 0; j
< pkg_vec
->len
; j
++){
57 pkg_print_info(pkg_vec
->pkgs
[j
], stdout
);
58 dep_vec
= pkg_vec_alloc();
59 pkg_hash_fetch_unsatisfied_dependencies(&conf
,
64 fprintf(stderr
, "and the unsatisfied dependencies are:\n");
65 for(k
= 0; k
< dep_vec
->len
; k
++){
66 fprintf(stderr
, "%s version %s\n", dep_vec
->pkgs
[k
]->name
, dep_vec
->pkgs
[k
]->version
);
76 pkg_hash_deinit(hash
);