Werner's Miscellanea
Sign in or create your account | Project List | Help
Werner's Miscellanea Commit Details
Date: | 2010-11-21 08:00:32 (13 years 4 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 83c716424f97cfc1dfa2a1e88a64cd695f2717fa |
Message: | qpkg: perform sanity checks after parsing a package entry - gobble.c (compact_pkg, gobble_buf): renamed compact_pkg to finish_pkg - gobble.c (finish_pkg): check that the package has a version - gobble.c (finish_pkg): check that the package has an architecture - gobble.c (finish_pkg): check that the package either has a file name or is installed |
Files: |
qpkg/gobble.c (3 diffs) |
Change Details
qpkg/gobble.c | ||
---|---|---|
92 | 92 | #define DONE goto done |
93 | 93 | |
94 | 94 | |
95 | static void compact_pkg(struct pkg *new, struct jrb *jrb) | |
95 | static void finish_pkg(struct pkg *new, struct jrb *jrb) | |
96 | 96 | { |
97 | 97 | struct pkg *old; |
98 | 98 | |
99 | if (!new->version) { | |
100 | fprintf(stderr, "package %.*s has no version\n", | |
101 | ID2PF(new->id)); | |
102 | exit(1); | |
103 | } | |
104 | if (!new->arch) { | |
105 | fprintf(stderr, | |
106 | "package %.*s version %.*s has no architecture\n", | |
107 | ID2PF(new->id), ID2PF(new->version)); | |
108 | exit(1); | |
109 | } | |
110 | if (!new->filename && !(new->flags & QPKG_INSTALLED)) { | |
111 | fprintf(stderr, | |
112 | "package %.*s version %.*s has no file name " | |
113 | "(nor is it installed)\n", | |
114 | ID2PF(new->id), ID2PF(new->version)); | |
115 | exit(1); | |
116 | } | |
117 | ||
99 | 118 | for (old = new->more; old; old = old->more) |
100 | 119 | if (old->version == new->version) |
101 | 120 | goto compact; |
... | ... | |
280 | 299 | |
281 | 300 | package: |
282 | 301 | if (pkg) |
283 | compact_pkg(pkg, jrb); | |
302 | finish_pkg(pkg, jrb); | |
284 | 303 | |
285 | 304 | WHITESPACE; |
286 | 305 | pkg = alloc_type(struct pkg); |
... | ... | |
407 | 426 | |
408 | 427 | done: |
409 | 428 | if (pkg) |
410 | compact_pkg(pkg, jrb); | |
429 | finish_pkg(pkg, jrb); | |
411 | 430 | return; |
412 | 431 | |
413 | 432 | fail: |
Branches:
master