libopkg: propagate SF_NEED_DETAIL from abstract to discrete package
authorJo-Philipp Wich <jo@mein.io>
Wed, 15 Feb 2017 23:21:05 +0000 (00:21 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 16 Feb 2017 16:02:30 +0000 (17:02 +0100)
During parsing, propagate the state of the SF_NEED_DETAIL flag from the
related abstract package to the discrete pkg_t instance getting assembled.

This is required to ensure that subsequent parsing of pkg_t's dependency
lists considers the state of SF_NEED_DETAIL.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libopkg/pkg_parse.c

index d8b7b522b6077bbcd09b79ab8f6510ccbbc03aa4..c4637b266efff0fcc49290eb28e4e63bc5d9d8c2 100644 (file)
@@ -194,8 +194,17 @@ int pkg_parse_line(void *ptr, const char *line, uint mask)
                break;
 
        case 'P':
-               if ((mask & PFM_PACKAGE) && is_field("Package", line))
+               if ((mask & PFM_PACKAGE) && is_field("Package", line)) {
                        pkg->name = parse_simple("Package", line);
+                       ab_pkg = abstract_pkg_fetch_by_name(pkg->name);
+
+                       if (ab_pkg && (ab_pkg->state_flag & SF_NEED_DETAIL)) {
+                               if (!(pkg->state_flag & SF_NEED_DETAIL)) {
+                                       opkg_msg(DEPEND, "propagating abpkg flag to pkg %s\n", pkg->name);
+                                       pkg->state_flag |= SF_NEED_DETAIL;
+                               }
+                       }
+               }
                else if ((mask & PFM_PRIORITY) && is_field("Priority", line))
                        pkg_set_string(pkg, PKG_PRIORITY, line + strlen("Priority") + 1);
                else if ((mask & PFM_PROVIDES) && is_field("Provides", line))