mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-22 07:37:12 +02:00
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
This commit is contained in:
parent
f14c041e51
commit
83c716424f
@ -92,10 +92,29 @@
|
||||
#define DONE goto done
|
||||
|
||||
|
||||
static void compact_pkg(struct pkg *new, struct jrb *jrb)
|
||||
static void finish_pkg(struct pkg *new, struct jrb *jrb)
|
||||
{
|
||||
struct pkg *old;
|
||||
|
||||
if (!new->version) {
|
||||
fprintf(stderr, "package %.*s has no version\n",
|
||||
ID2PF(new->id));
|
||||
exit(1);
|
||||
}
|
||||
if (!new->arch) {
|
||||
fprintf(stderr,
|
||||
"package %.*s version %.*s has no architecture\n",
|
||||
ID2PF(new->id), ID2PF(new->version));
|
||||
exit(1);
|
||||
}
|
||||
if (!new->filename && !(new->flags & QPKG_INSTALLED)) {
|
||||
fprintf(stderr,
|
||||
"package %.*s version %.*s has no file name "
|
||||
"(nor is it installed)\n",
|
||||
ID2PF(new->id), ID2PF(new->version));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (old = new->more; old; old = old->more)
|
||||
if (old->version == new->version)
|
||||
goto compact;
|
||||
@ -280,7 +299,7 @@ depends:
|
||||
|
||||
package:
|
||||
if (pkg)
|
||||
compact_pkg(pkg, jrb);
|
||||
finish_pkg(pkg, jrb);
|
||||
|
||||
WHITESPACE;
|
||||
pkg = alloc_type(struct pkg);
|
||||
@ -407,7 +426,7 @@ list_with_version:
|
||||
|
||||
done:
|
||||
if (pkg)
|
||||
compact_pkg(pkg, jrb);
|
||||
finish_pkg(pkg, jrb);
|
||||
return;
|
||||
|
||||
fail:
|
||||
|
Loading…
Reference in New Issue
Block a user