#1235 fix weak deps handling in rpminfo web page
Merged 5 years ago by mikem. Opened 5 years ago by tkopecek.
tkopecek/koji issue1234  into  master

file modified
+4 -4
@@ -1372,18 +1372,18 @@ 

          values['conflicts'].sort(_sortbyname)

          values['requires'] = server.getRPMDeps(rpm['id'], koji.DEP_REQUIRE)

          values['requires'].sort(_sortbyname)

-         if koji.RPM_SUPPORTS_OPTIONAL_DEPS:

-             values['optional_deps'] = True

+         if koji.SUPPORTED_OPT_DEP_HDRS['RECOMMENDNAME']:

              values['recommends'] = server.getRPMDeps(rpm['id'], koji.DEP_RECOMMEND)

              values['recommends'].sort(_sortbyname)

+         if koji.SUPPORTED_OPT_DEP_HDRS['SUGGESTNAME']:

              values['suggests'] = server.getRPMDeps(rpm['id'], koji.DEP_SUGGEST)

              values['suggests'].sort(_sortbyname)

+         if koji.SUPPORTED_OPT_DEP_HDRS['SUPPLEMENTNAME']:

              values['supplements'] = server.getRPMDeps(rpm['id'], koji.DEP_SUPPLEMENT)

              values['supplements'].sort(_sortbyname)

+         if koji.SUPPORTED_OPT_DEP_HDRS['ENHANCENAME']:

              values['enhances'] = server.getRPMDeps(rpm['id'], koji.DEP_ENHANCE)

              values['enhances'].sort(_sortbyname)

-         else:

-             values['optional_deps'] = False

          headers = server.getRPMHeaders(rpm['id'], headers=['summary', 'description', 'license'])

          values['summary'] = koji.fixEncoding(headers.get('summary'))

          values['description'] = koji.fixEncoding(headers.get('description'))

file modified
+7 -1
@@ -144,7 +144,7 @@ 

          #end if

        </td>

      </tr>

-     #if $optional_deps

+     #if $koji.SUPPORTED_OPT_DEP_HDRS['RECOMMENDNAME']

      <tr>

        <th>Recommends</th>

        <td class="container">
@@ -161,6 +161,8 @@ 

          #end if

        </td>

      </tr>

+     #end if

+     #if $koji.SUPPORTED_OPT_DEP_HDRS['SUGGESTNAME']

      <tr>

        <th>Suggests</th>

        <td class="container">
@@ -177,6 +179,8 @@ 

          #end if

        </td>

      </tr>

+     #end if

+     #if $koji.SUPPORTED_OPT_DEP_HDRS['SUPPLEMENTNAME']

      <tr>

        <th>Supplements</th>

        <td class="container">
@@ -193,6 +197,8 @@ 

          #end if

        </td>

      </tr>

+     #end if

+     #if $koji.SUPPORTED_OPT_DEP_HDRS['ENHANCENAME']

      <tr>

        <th>Enhances</th>

        <td class="container">

PR #965 (commit ef998c6) changed way, how weak reference support is
detected in rpm. As a result, web page rpminfo is failing due to missing
variable.

Fixes: https://pagure.io/koji/issue/1234

The web ui might not be running on the same platform as the hub, which is where the querying of the rpm actually happens. So this check is not telling us whether the hub can actually report these deps.

Since we have the dependency type constants in koji directly (e.g. koji.DEP_SUGGEST), I don't think we actually need rpm on the web system to understand these deps. We do need to know if the hub does not support them so we can avoid showing them as empty when we do not know that.

That said, this is probably good enough for now. I don't see any way to figure out whether the hub supports these with the current api.

Commit a34d50e fixes this pull-request

Pull-Request has been merged by mikem

5 years ago