1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 06:17:31 +02:00

qpkg: added some field names and relational operators from Ubuntu

- gobble.c (gobble_buf): recognize (and ignore) the following fields:
  Bugs, Installed-Size, MD5sum, Origin, Original-Maintainer, SHA1, SHA256,
  Task.
- pkg.h (enum relop): added comments showing the respective symbol
- pkg.h (enum relop): added rel_gg (>>), rel_le (<=), and rel_ll (<<)
- gobble.c (gobble_buf): recognize >>, <=, and <<
- TODO: record progress in support beyond Jlime/OE
This commit is contained in:
Werner Almesberger 2010-11-22 22:48:28 -03:00
parent ab5df0a8d8
commit 6a3e471304
3 changed files with 105 additions and 25 deletions

View File

@ -135,6 +135,8 @@ Still left to do
- consider also supporting the similar but not identical (parent ?) format - consider also supporting the similar but not identical (parent ?) format
of /var/lib/dpkg/status and /var/lib/apt/lists/*Packages of /var/lib/dpkg/status and /var/lib/apt/lists/*Packages
Update: added as much as my Ubuntu system can reach before hitting |
Done Done
==== ====

View File

@ -161,6 +161,10 @@ initial:
FAIL; FAIL;
} }
case 'B': /* Bugs */
EXPECT("ugs:");
goto skip_data;
case 'C': /* Conflicts // Conffiles */ case 'C': /* Conflicts // Conffiles */
EXPECT("onf"); EXPECT("onf");
switch (NEXT) { switch (NEXT) {
@ -202,28 +206,63 @@ initial:
FAIL; FAIL;
} }
case 'I': /* Installed-Time */ case 'I': /* Installed-Size, Installed-Time */
EXPECT("nstalled-Time:"); EXPECT("nstalled-");
goto skip_data;
case 'L': /* License */
EXPECT("icense:");
goto skip_data;
case 'M': /* Maintainer, MD5Sum */
switch (NEXT) { switch (NEXT) {
case 'a': case 'S':
EXPECT("intainer:"); EXPECT("ize:");
goto skip_data; goto skip_data;
case 'D': case 'T':
EXPECT("5Sum:"); EXPECT("ime:");
goto skip_data; goto skip_data;
default: default:
FAIL; FAIL;
} }
case 'O': /* OE */ case 'L': /* License */
EXPECT("E:"); EXPECT("icense:");
goto skip_data;
case 'M': /* Maintainer, MD5Sum, MD5sum */
switch (NEXT) {
case 'a':
EXPECT("intainer:");
goto skip_data;
case 'D':
EXPECT("5");
switch (NEXT) {
case 'S':
case 's':
break;
default:
FAIL;
}
EXPECT("um:");
goto skip_data;
default:
FAIL;
}
case 'O': /* OE, Origin, Original-Maintainer */
switch (NEXT) {
case 'E':
EXPECT(":");
goto skip_data;
case 'r':
EXPECT("igin");
switch (NEXT) {
case ':':
break;
case 'a':
EXPECT("l-Maintainer:");
break;
default:
FAIL;
}
goto skip_data;
default:
FAIL;
}
goto skip_data; goto skip_data;
case 'P': /* Package, Priority, Provides */ case 'P': /* Package, Priority, Provides */
@ -260,11 +299,25 @@ initial:
FAIL; FAIL;
} }
case 'S': /* Section, Size, Source, Suggests // Status */ case 'S': /* Section, SHA1, SHA256, Size, Source, Suggests
// Status */
switch (NEXT) { switch (NEXT) {
case 'e': case 'e':
EXPECT("ction:"); EXPECT("ction:");
goto skip_data; goto skip_data;
case 'H':
EXPECT("A");
switch (NEXT) {
case '1':
EXPECT(":");
break;
case '2':
EXPECT("56:");
break;
default:
FAIL;
}
goto skip_data;
case 'i': case 'i':
EXPECT("ze:"); EXPECT("ze:");
goto skip_data; goto skip_data;
@ -281,6 +334,10 @@ initial:
FAIL; FAIL;
} }
case 'T': /* Task */
EXPECT("ask:");
goto skip_data;
case 'V': /* Version */ case 'V': /* Version */
EXPECT("ersion:"); EXPECT("ersion:");
goto version; goto version;
@ -389,18 +446,36 @@ list_with_version:
ref->version = NULL; ref->version = NULL;
else { else {
buf++; buf++;
if (buf == end) switch (NEXT) {
FAIL;
switch (*buf++) {
case '=': case '=':
ref->relop = rel_eq; ref->relop = rel_eq;
break; break;
case '<': case '<':
ref->relop = rel_lt; switch (NEXT) {
case ' ':
ref->relop = rel_lt;
break;
case '=':
ref->relop = rel_le;
break;
case '<':
ref->relop = rel_ll;
break;
default:
buf--;
}
break; break;
case '>': case '>':
EXPECT("="); switch (NEXT) {
ref->relop = rel_ge; case '=':
ref->relop = rel_ge;
break;
case '>':
ref->relop = rel_gg;
break;
default:
FAIL;
}
break; break;
default: default:
FAIL; FAIL;

View File

@ -28,9 +28,12 @@ enum flags {
}; };
enum relop { enum relop {
rel_eq, rel_eq, /* = */
rel_ge, rel_ge, /* >= */
rel_lt, rel_gg, /* >> */
rel_lt, /* < */
rel_le, /* <= */
rel_ll, /* << */
}; };
struct pkg; struct pkg;