|
10 | 10 | * References:
|
11 | 11 | * - https://rpm-software-management.github.io/rpm/manual/macros.html
|
12 | 12 | * - https://rpm-software-management.github.io/rpm/manual/spec.html
|
| 13 | +* - http://ftp.rpm.org/api/4.4.2.2/dependencies.html |
13 | 14 | */
|
14 | 15 |
|
15 | 16 | /*
|
16 | 17 | * TODO
|
17 | 18 | *
|
18 | 19 | * 1. Capturing required and provide packages as reference tags
|
19 | 20 | * 2. Capturing bz numbers and package versions in %changelog section
|
20 |
| - * 3. Capturing %configure --enable-FOO --with-BAR |
21 | 21 | */
|
22 | 22 | #include "general.h" /* must always come first */
|
23 | 23 |
|
@@ -311,17 +311,40 @@ static bool found_package_cb (const char *line,
|
311 | 311 | unsigned int count,
|
312 | 312 | void *userData)
|
313 | 313 | {
|
314 |
| - if (count > 0) |
315 |
| - { |
316 |
| - vString *name = vStringNew (); |
317 |
| - tagEntryInfo tag; |
| 314 | + if (count == 0) |
| 315 | + return true; |
| 316 | + |
| 317 | + /* --- |
| 318 | + * NAME: foo |
| 319 | + * %package bar |
| 320 | + * --- |
| 321 | + * In this case, emit foo-bar as a FQ tag. |
| 322 | + * |
| 323 | + * --- |
| 324 | + * NAME: foo |
| 325 | + * %package -n baz |
| 326 | + * --- |
| 327 | + * In this case, don't emit FQ tag. |
| 328 | + */ |
| 329 | + bool fq = true; |
| 330 | + |
| 331 | + /* strlen("-n") => 2 */ |
| 332 | + if (matches[1].length > 2) |
| 333 | + fq = false; |
| 334 | + |
| 335 | + vString *name = vStringNew (); |
| 336 | + tagEntryInfo tag; |
| 337 | + |
| 338 | + vStringNCopyS (name, line + matches[2].start, matches[2].length); |
| 339 | + initTagEntry (&tag, vStringValue (name), K_PACKAGE); |
| 340 | + tag.extensionFields.scopeIndex = ((struct rpmSpecCtx *)userData)->package_index; |
| 341 | + |
| 342 | + if (!fq) |
| 343 | + tag.skipAutoFQEmission = 1; |
| 344 | + |
| 345 | + makeTagEntry (&tag); |
| 346 | + vStringDelete (name); |
318 | 347 |
|
319 |
| - vStringNCopyS (name, line + matches[2].start, matches[2].length); |
320 |
| - initTagEntry (&tag, vStringValue (name), K_PACKAGE); |
321 |
| - tag.extensionFields.scopeIndex = ((struct rpmSpecCtx *)userData)->package_index; |
322 |
| - makeTagEntry (&tag); |
323 |
| - vStringDelete (name); |
324 |
| - } |
325 | 348 | return true;
|
326 | 349 | }
|
327 | 350 |
|
|
0 commit comments