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
9292#define DONE goto done
9393
9494
95static void compact_pkg(struct pkg *new, struct jrb *jrb)
95static void finish_pkg(struct pkg *new, struct jrb *jrb)
9696{
9797    struct pkg *old;
9898
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
99118    for (old = new->more; old; old = old->more)
100119        if (old->version == new->version)
101120            goto compact;
...... 
280299
281300package:
282301    if (pkg)
283        compact_pkg(pkg, jrb);
302        finish_pkg(pkg, jrb);
284303
285304    WHITESPACE;
286305    pkg = alloc_type(struct pkg);
...... 
407426
408427done:
409428    if (pkg)
410        compact_pkg(pkg, jrb);
429        finish_pkg(pkg, jrb);
411430    return;
412431
413432fail:

Archive Download the corresponding diff file

Branches:
master



interactive