diff --git a/qpkg/gobble.c b/qpkg/gobble.c index 3c9dfa4..a64f750 100644 --- a/qpkg/gobble.c +++ b/qpkg/gobble.c @@ -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: