3 @@ -120,6 +120,9 @@ opkg_new()
7 + if (opkg_conf_load())
10 if (pkg_hash_load_feeds())
13 --- a/libopkg/opkg_conf.c
14 +++ b/libopkg/opkg_conf.c
15 @@ -91,15 +91,15 @@ opkg_option_t options[] = {
19 -resolve_pkg_dest_list(nv_pair_list_t *nv_pair_list)
20 +resolve_pkg_dest_list(void)
22 nv_pair_list_elt_t *iter;
27 - for (iter = nv_pair_list_first(nv_pair_list); iter;
28 - iter = nv_pair_list_next(nv_pair_list, iter)) {
29 + for (iter = nv_pair_list_first(&conf->tmp_dest_list); iter;
30 + iter = nv_pair_list_next(&conf->tmp_dest_list, iter)) {
31 nv_pair = (nv_pair_t *)iter->data;
33 if (conf->offline_root) {
34 @@ -185,8 +185,7 @@ opkg_conf_set_option(const char *name, c
37 opkg_conf_parse_file(const char *filename,
38 - pkg_src_list_t *pkg_src_list,
39 - nv_pair_list_t *tmp_dest_nv_pair_list)
40 + pkg_src_list_t *pkg_src_list)
44 @@ -269,7 +268,7 @@ opkg_conf_parse_file(const char *filenam
45 regmatch[11].rm_eo - regmatch[11].rm_so);
48 - /* We use the tmp_dest_nv_pair_list below instead of
49 + /* We use the tmp_dest_list below instead of
50 conf->pkg_dest_list because we might encounter an
51 offline_root option later and that would invalidate the
52 directories we would have computed in
53 @@ -292,7 +291,7 @@ opkg_conf_parse_file(const char *filenam
54 "Skipping.\n", name, value);
56 } else if (strcmp(type, "dest") == 0) {
57 - nv_pair_list_append(tmp_dest_nv_pair_list, name, value);
58 + nv_pair_list_append(&conf->tmp_dest_list, name, value);
59 } else if (strcmp(type, "lists_dir") == 0) {
60 conf->lists_dir = xstrdup(value);
61 } else if (strcmp(type, "arch") == 0) {
62 @@ -411,9 +410,19 @@ glob_errfunc(const char *epath, int eerr
66 + pkg_src_list_init(&conf->pkg_src_list);
67 + pkg_dest_list_init(&conf->pkg_dest_list);
68 + pkg_dest_list_init(&conf->tmp_dest_list);
69 + nv_pair_list_init(&conf->arch_list);
78 char *tmp, *tmp_dir_base, **tmp_val;
79 - nv_pair_list_t tmp_dest_nv_pair_list;
81 char *etc_opkg_conf_pattern;
83 @@ -423,11 +432,6 @@ opkg_conf_init(void)
84 conf->check_x509_path = 1;
87 - pkg_src_list_init(&conf->pkg_src_list);
88 - pkg_dest_list_init(&conf->pkg_dest_list);
89 - nv_pair_list_init(&conf->arch_list);
90 - nv_pair_list_init(&tmp_dest_nv_pair_list);
92 if (!conf->offline_root)
93 conf->offline_root = xstrdup(getenv("OFFLINE_ROOT"));
95 @@ -438,7 +442,7 @@ opkg_conf_init(void)
98 if (opkg_conf_parse_file(conf->conf_file,
99 - &conf->pkg_src_list, &tmp_dest_nv_pair_list))
100 + &conf->pkg_src_list))
104 @@ -467,7 +471,7 @@ opkg_conf_init(void)
105 !strcmp(conf->conf_file, globbuf.gl_pathv[i]))
107 if ( opkg_conf_parse_file(globbuf.gl_pathv[i],
108 - &conf->pkg_src_list, &tmp_dest_nv_pair_list)<0) {
109 + &conf->pkg_src_list)<0) {
113 @@ -528,16 +532,16 @@ opkg_conf_init(void)
116 /* Even if there is no conf file, we'll need at least one dest. */
117 - if (nv_pair_list_empty(&tmp_dest_nv_pair_list)) {
118 - nv_pair_list_append(&tmp_dest_nv_pair_list,
119 + if (nv_pair_list_empty(&conf->tmp_dest_list)) {
120 + nv_pair_list_append(&conf->tmp_dest_list,
121 OPKG_CONF_DEFAULT_DEST_NAME,
122 OPKG_CONF_DEFAULT_DEST_ROOT_DIR);
125 - if (resolve_pkg_dest_list(&tmp_dest_nv_pair_list))
126 + if (resolve_pkg_dest_list())
129 - nv_pair_list_deinit(&tmp_dest_nv_pair_list);
130 + nv_pair_list_deinit(&conf->tmp_dest_list);
134 @@ -577,7 +581,7 @@ err1:
138 - nv_pair_list_deinit(&tmp_dest_nv_pair_list);
139 + nv_pair_list_deinit(&conf->tmp_dest_list);
141 free(conf->dest_str);
143 --- a/libopkg/opkg_conf.h
144 +++ b/libopkg/opkg_conf.h
145 @@ -46,6 +46,7 @@ struct opkg_conf
147 pkg_src_list_t pkg_src_list;
148 pkg_dest_list_t pkg_dest_list;
149 + pkg_dest_list_t tmp_dest_list;
150 nv_pair_list_t arch_list;
152 int restrict_to_default_dest;
153 @@ -133,6 +134,7 @@ struct opkg_option {
156 int opkg_conf_init(void);
157 +int opkg_conf_load(void);
158 void opkg_conf_deinit(void);
160 int opkg_conf_write_status_files(void);
163 @@ -40,6 +40,8 @@ enum {
164 ARGS_OPT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES,
165 ARGS_OPT_FORCE_SPACE,
166 ARGS_OPT_FORCE_POSTINSTALL,
170 ARGS_OPT_DOWNLOAD_ONLY,
172 @@ -82,6 +84,8 @@ static struct option long_options[] = {
173 {"nodeps", 0, 0, ARGS_OPT_NODEPS},
174 {"offline", 1, 0, 'o'},
175 {"offline-root", 1, 0, 'o'},
176 + {"add-arch", 1, 0, ARGS_OPT_ADD_ARCH},
177 + {"add-dest", 1, 0, ARGS_OPT_ADD_DEST},
178 {"test", 0, 0, ARGS_OPT_NOACTION},
179 {"tmp-dir", 1, 0, 't'},
180 {"tmp_dir", 1, 0, 't'},
181 @@ -96,6 +100,7 @@ args_parse(int argc, char *argv[])
183 int option_index = 0;
185 + char *tuple, *prio;
188 c = getopt_long_only(argc, argv, "Ad:f:no:p:t:vV:",
189 @@ -162,6 +167,21 @@ args_parse(int argc, char *argv[])
190 case ARGS_OPT_NODEPS:
193 + case ARGS_OPT_ADD_ARCH:
194 + case ARGS_OPT_ADD_DEST:
195 + tuple = xstrdup(optarg);
196 + if ((prio = strchr(tuple, ':')) != NULL) {
198 + if ((strlen(tuple) > 0) && (strlen(prio) > 0)) {
199 + nv_pair_list_append(
200 + (c == ARGS_OPT_ADD_ARCH)
201 + ? &conf->arch_list : &conf->tmp_dest_list,
208 case ARGS_OPT_NOACTION:
211 @@ -240,6 +260,8 @@ usage()
212 printf(" directory name in a pinch).\n");
213 printf("\t-o <dir> Use <dir> as the root directory for\n");
214 printf("\t--offline-root <dir> offline installation of packages.\n");
215 + printf("\t--add-arch <arch>:<prio> Register architecture with given priority\n");
216 + printf("\t--add-dest <name>:<path> Register destination with given path\n");
218 printf("\nForce Options:\n");
219 printf("\t--force-depends Install/remove despite failed dependencies\n");
220 @@ -280,6 +302,9 @@ main(int argc, char *argv[])
221 int nocheckfordirorfile = 0;
222 int noreadfeedsfile = 0;
224 + if (opkg_conf_init())
227 conf->verbosity = NOTICE;
229 opts = args_parse(argc, argv);
230 @@ -317,7 +342,7 @@ main(int argc, char *argv[])
232 conf->pfm = cmd->pfm;
234 - if (opkg_conf_init())
235 + if (opkg_conf_load())
238 if (!nocheckfordirorfile) {