]>
Commit | Line | Data |
---|---|---|
23c9e63c DD |
1 | /* |
2 | * Copyright (c) 2000, Red Hat, Inc. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * A copy of the GNU General Public License can be found at | |
10 | * http://www.gnu.org/ | |
11 | * | |
12 | * Written by DJ Delorie <dj@cygnus.com> | |
13 | * | |
14 | */ | |
15 | ||
16 | /* When setup.ini is parsed, the information is stored according to | |
17 | the declarations here. ini.cc (via inilex and iniparse) | |
18 | initializes these structures. choose.cc sets the action and trust | |
19 | fields. download.cc downloads any needed files for selected | |
20 | packages (the chosen "install" field). install.cc installs | |
21 | selected packages. */ | |
22 | ||
23 | #define YYSTYPE char * | |
24 | ||
25 | /* lowest number must be most trusted, highest least trusted */ | |
c46a33a9 CF |
26 | typedef enum |
27 | { | |
28 | TRUST_UNKNOWN, | |
29 | TRUST_PREV, | |
30 | TRUST_CURR, | |
31 | TRUST_TEST, | |
3ae6c15c | 32 | NTRUST |
c46a33a9 CF |
33 | } trusts; |
34 | ||
35 | typedef enum | |
36 | { | |
fafc7fdf | 37 | /* Note that the next four items must be in the same order as the |
c46a33a9 | 38 | TRUST items above. */ |
fafc7fdf | 39 | ACTION_UNKNOWN, |
c46a33a9 CF |
40 | ACTION_PREV, |
41 | ACTION_CURR, | |
42 | ACTION_TEST, | |
43 | ACTION_SKIP, | |
44 | ACTION_UNINSTALL, | |
45 | ACTION_REDO, | |
46 | ACTION_SRC_ONLY, | |
47 | ACTION_LAST, | |
48 | ACTION_ERROR, | |
49 | ACTION_SAME = 100, | |
fafc7fdf | 50 | /* Actions taken when installed version matches the selected version. */ |
c46a33a9 CF |
51 | ACTION_SAME_PREV = ACTION_PREV + ACTION_SAME, |
52 | ACTION_SAME_CURR = ACTION_CURR + ACTION_SAME, | |
53 | ACTION_SAME_TEST = ACTION_TEST + ACTION_SAME, | |
fafc7fdf | 54 | /* Last action. */ |
c46a33a9 CF |
55 | ACTION_SAME_LAST |
56 | } actions; | |
57 | ||
58 | typedef enum | |
59 | { | |
60 | EXCLUDE_NONE = 0, | |
61 | EXCLUDE_BY_SETUP, | |
62 | EXCLUDE_NOT_FOUND | |
63 | } excludes; | |
64 | ||
65 | #define is_download_action(pkg) \ | |
66 | ((pkg)->action == ACTION_PREV || \ | |
67 | (pkg)->action == ACTION_CURR || \ | |
68 | (pkg)->action == ACTION_TEST || \ | |
69 | (pkg)->action == ACTION_REDO || \ | |
70 | (pkg)->action == ACTION_SRC_ONLY) | |
71 | ||
72 | #define is_upgrade_action(pkg) \ | |
73 | (((pkg)->action >= ACTION_CURR && \ | |
74 | (pkg)->action <= ACTION_TEST) || \ | |
75 | (pkg)->action == ACTION_REDO) | |
76 | ||
77 | #define is_uninstall_action(pkg) \ | |
78 | (is_upgrade_action (pkg) || \ | |
79 | (pkg)->action == ACTION_PREV || \ | |
80 | (pkg)->action == ACTION_UNINSTALL) | |
23c9e63c | 81 | |
97312777 CF |
82 | #define is_full_action(pkg) \ |
83 | (((pkg)->action >= ACTION_SAME_PREV && (pkg)->action <= ACTION_SAME_TEST) \ | |
84 | || (pkg)->action == ACTION_SKIP) | |
85 | ||
3b9077d4 DD |
86 | #define SRCACTION_NO 0 |
87 | #define SRCACTION_YES 1 | |
3ae6c15c | 88 | typedef struct _Info |
85b43844 CF |
89 | { |
90 | char *version; /* version part of filename */ | |
91 | char *install; /* file name to install */ | |
92 | int install_size; /* in bytes */ | |
93 | int install_exists; /* install file exists on disk */ | |
94 | char *source; /* sources for installed binaries */ | |
95 | int source_size; /* in bytes */ | |
96 | int source_exists; /* source file exists on disk */ | |
3ae6c15c CF |
97 | #ifdef __cplusplus |
98 | _Info (const char *_install, const char *_version, | |
fafc7fdf CF |
99 | int _install_size, const char *_source = NULL, |
100 | int _source_size = 0); | |
3ae6c15c | 101 | #endif |
85b43844 | 102 | } Info; /* +1 for TRUST_UNKNOWN */ |
3b9077d4 | 103 | |
38c97581 CF |
104 | typedef struct _Dependency |
105 | { | |
106 | struct _Dependency *next; /* the next package in this dependency list */ | |
107 | char *package; /* the name of the package that is depended on */ | |
108 | } Dependency; /* Dependencies can be used for | |
109 | recommended/required/related... */ | |
85b43844 CF |
110 | typedef struct |
111 | { | |
c46a33a9 CF |
112 | char *name; /* package name, like "cygwin" */ |
113 | char *sdesc; /* short description (replaces "name" if provided) */ | |
114 | char *ldesc; /* long description (multi-line) */ | |
38c97581 CF |
115 | char *category; /* the category the package belongs to, like "required" or "XFree86" */ |
116 | Dependency *required; /* the packages required for this package to work */ | |
fafc7fdf CF |
117 | actions action; /* A range of states applicable to this package */ |
118 | trusts trust; /* Selects among info[] below, a subset of action */ | |
119 | int srcpicked; /* True if source is required */ | |
c46a33a9 | 120 | |
fafc7fdf CF |
121 | Info *installed; /* Info on installed package */ |
122 | trusts installed_ix; /* Index into info array for currently installed package */ | |
c46a33a9 CF |
123 | excludes exclude; /* true if this package should be excluded */ |
124 | ||
fafc7fdf CF |
125 | /* The reason for this weird layout is to allow for loops that scan either |
126 | the info array, based on trust value or the infoscan array based on a pointer, | |
127 | looking for a particular version. */ | |
654ea642 CF |
128 | Info info[1]; /* First element. Intentionally allocated prior |
129 | to infoscan */ | |
130 | Info infoscan[NTRUST - 1]; /* +1 for TRUST_UNKNOWN */ | |
131 | Info infoend[0]; /* end marker */ | |
23c9e63c DD |
132 | } Package; |
133 | ||
134 | extern Package *package; | |
135 | extern int npackages; | |
136 | ||
137 | #ifdef __cplusplus | |
138 | extern "C" { | |
139 | #endif | |
140 | ||
141 | Package *new_package (char *name); | |
142 | void ini_init (char *string); | |
c46a33a9 | 143 | Package *getpkgbyname (const char *pkgname); |
38c97581 | 144 | void new_requirement (Package *package, char *dependson); |
ef2007fd | 145 | |
23c9e63c DD |
146 | #ifdef __cplusplus |
147 | } | |
148 | #endif |