1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 08:19:41 +02:00

qpkg: record Architecture: tag

- qpkg.h (struct pkg): added "arch" field for the architecture
- gobble.c (gobble_buf): record the architecture
- gobble.c (gobble_buf): fail if trying to set the file name twice
- qpkg.c (main): initialize trees before doing anything else, so that the
  argument processing stays together
This commit is contained in:
Werner Almesberger 2010-11-21 03:53:19 -03:00
parent dd0ee66304
commit f14c041e51
3 changed files with 16 additions and 4 deletions

View File

@ -134,8 +134,7 @@ initial:
switch (NEXT) { switch (NEXT) {
case 'r': case 'r':
EXPECT("chitecture:"); EXPECT("chitecture:");
/* @@@ use later */ goto architecture;
goto skip_data;
case 'u': case 'u':
EXPECT("to-Installed:"); EXPECT("to-Installed:");
goto skip_data; goto skip_data;
@ -290,6 +289,7 @@ package:
pkg->more = jrb->val; pkg->more = jrb->val;
jrb->val = pkg; jrb->val = pkg;
pkg->version = NULL; pkg->version = NULL;
pkg->arch = NULL;
pkg->conflicts = pkg->depends = NULL; pkg->conflicts = pkg->depends = NULL;
pkg->filename = NULL; pkg->filename = NULL;
pkg->flags = 0; pkg->flags = 0;
@ -303,6 +303,13 @@ version:
pkg->version = ID(versions)->key; pkg->version = ID(versions)->key;
goto eol; goto eol;
architecture:
WHITESPACE;
if (pkg->arch)
FAIL;
pkg->arch = buf;
goto skip_data;
provides: provides:
/* @@@ later */ /* @@@ later */
goto skip_data; goto skip_data;
@ -314,6 +321,8 @@ status:
filename: filename:
WHITESPACE; WHITESPACE;
if (pkg->filename)
FAIL;
pkg->filename = buf; pkg->filename = buf;
goto skip_data; goto skip_data;

View File

@ -126,10 +126,12 @@ int main(int argc, char **argv)
{ {
int arg; int arg;
if (argc == 1)
usage(*argv);
packages = make_tree(comp_id); packages = make_tree(comp_id);
versions = make_tree(comp_id); versions = make_tree(comp_id);
if (argc == 1)
usage(*argv);
for (arg = 1; arg != argc; arg++) { for (arg = 1; arg != argc; arg++) {
if (*argv[arg] == '-') if (*argv[arg] == '-')
usage(*argv); usage(*argv);

View File

@ -35,6 +35,7 @@ struct ref {
struct pkg { struct pkg {
struct id *id; struct id *id;
struct id *version; struct id *version;
const char *arch;
struct ref *conflicts; struct ref *conflicts;
struct ref *depends; struct ref *depends;
const char *filename; const char *filename;