1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-12-24 05:33:20 +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
of /var/lib/dpkg/status and /var/lib/apt/lists/*Packages
Update: added as much as my Ubuntu system can reach before hitting |
Done
====

View File

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

View File

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