Date:2010-11-23 02:48:28 (8 years 7 months ago)
Author:Werner Almesberger
Commit:6a3e471304b939fa920adcf6f6a9ac31b22fd976
Message: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
Files: qpkg/TODO (1 diff)
qpkg/gobble.c (5 diffs)
qpkg/pkg.h (1 diff)

Change Details

qpkg/TODO
135135- consider also supporting the similar but not identical (parent ?) format
136136  of /var/lib/dpkg/status and /var/lib/apt/lists/*Packages
137137
138  Update: added as much as my Ubuntu system can reach before hitting |
139
138140
139141Done
140142====
qpkg/gobble.c
161161            FAIL;
162162        }
163163
164    case 'B': /* Bugs */
165        EXPECT("ugs:");
166        goto skip_data;
167
164168    case 'C': /* Conflicts // Conffiles */
165169        EXPECT("onf");
166170        switch (NEXT) {
...... 
202206            FAIL;
203207        }
204208
205    case 'I': /* Installed-Time */
206        EXPECT("nstalled-Time:");
207        goto skip_data;
209    case 'I': /* Installed-Size, Installed-Time */
210        EXPECT("nstalled-");
211        switch (NEXT) {
212        case 'S':
213            EXPECT("ize:");
214            goto skip_data;
215        case 'T':
216            EXPECT("ime:");
217            goto skip_data;
218        default:
219            FAIL;
220        }
208221
209222    case 'L': /* License */
210223        EXPECT("icense:");
211224        goto skip_data;
212225
213    case 'M': /* Maintainer, MD5Sum */
226    case 'M': /* Maintainer, MD5Sum, MD5sum */
214227        switch (NEXT) {
215228        case 'a':
216229            EXPECT("intainer:");
217230            goto skip_data;
218231        case 'D':
219            EXPECT("5Sum:");
232            EXPECT("5");
233            switch (NEXT) {
234            case 'S':
235            case 's':
236                break;
237            default:
238                FAIL;
239            }
240            EXPECT("um:");
220241            goto skip_data;
221242        default:
222243            FAIL;
223244        }
224245
225    case 'O': /* OE */
226        EXPECT("E:");
246    case 'O': /* OE, Origin, Original-Maintainer */
247        switch (NEXT) {
248        case 'E':
249            EXPECT(":");
250            goto skip_data;
251        case 'r':
252            EXPECT("igin");
253            switch (NEXT) {
254            case ':':
255                break;
256            case 'a':
257                EXPECT("l-Maintainer:");
258                break;
259            default:
260                FAIL;
261            }
262            goto skip_data;
263        default:
264            FAIL;
265        }
227266        goto skip_data;
228267
229268    case 'P': /* Package, Priority, Provides */
...... 
260299            FAIL;
261300        }
262301
263    case 'S': /* Section, Size, Source, Suggests // Status */
302    case 'S': /* Section, SHA1, SHA256, Size, Source, Suggests
303               // Status */
264304        switch (NEXT) {
265305        case 'e':
266306            EXPECT("ction:");
267307            goto skip_data;
308        case 'H':
309            EXPECT("A");
310            switch (NEXT) {
311            case '1':
312                EXPECT(":");
313                break;
314            case '2':
315                EXPECT("56:");
316                break;
317            default:
318                FAIL;
319            }
320            goto skip_data;
268321        case 'i':
269322            EXPECT("ze:");
270323            goto skip_data;
...... 
281334            FAIL;
282335        }
283336
337    case 'T': /* Task */
338        EXPECT("ask:");
339        goto skip_data;
340
284341    case 'V': /* Version */
285342        EXPECT("ersion:");
286343        goto version;
...... 
389446            ref->version = NULL;
390447        else {
391448            buf++;
392            if (buf == end)
393                FAIL;
394            switch (*buf++) {
449            switch (NEXT) {
395450            case '=':
396451                ref->relop = rel_eq;
397452                break;
398453            case '<':
399                ref->relop = rel_lt;
454                switch (NEXT) {
455                case ' ':
456                    ref->relop = rel_lt;
457                    break;
458                case '=':
459                    ref->relop = rel_le;
460                    break;
461                case '<':
462                    ref->relop = rel_ll;
463                    break;
464                default:
465                    buf--;
466                }
400467                break;
401468            case '>':
402                EXPECT("=");
403                ref->relop = rel_ge;
469                switch (NEXT) {
470                case '=':
471                    ref->relop = rel_ge;
472                    break;
473                case '>':
474                    ref->relop = rel_gg;
475                    break;
476                default:
477                    FAIL;
478                }
404479                break;
405480            default:
406481                FAIL;
qpkg/pkg.h
2828};
2929
3030enum relop {
31    rel_eq,
32    rel_ge,
33    rel_lt,
31    rel_eq, /* = */
32    rel_ge, /* >= */
33    rel_gg, /* >> */
34    rel_lt, /* < */
35    rel_le, /* <= */
36    rel_ll, /* << */
3437};
3538
3639struct pkg;

Archive Download the corresponding diff file

Branches:
master



interactive