#484 Rename include_rpms to include_rpm_manifest
Merged 4 years ago by gnaponie. Opened 4 years ago by cqi.
cqi/freshmaker rename-arg-include_rpms  into  master

@@ -45,7 +45,7 @@ 

                  }

              ]

          },

-         "projection": lb._get_default_projection(include_rpms=False)

+         "projection": lb._get_default_projection(include_rpm_manifest=False)

      }

      images = lb.find_container_images(query)

      pprint(images)

file modified
+2 -2
@@ -145,7 +145,7 @@ 

          repo = self._get_repository_from_image(image_nvr)

          self._verify_repository_data(repo)

  

-         images = self.lb.get_images_by_nvrs([image_nvr], include_rpms=False)

+         images = self.lb.get_images_by_nvrs([image_nvr], include_rpm_manifest=False)

          if not images:

              raise ValueError(

                  "No published images tagged by %r found in repository" % (
@@ -172,7 +172,7 @@ 

  

          rebuildable_images = {}

          images = self.lb.find_images_with_included_srpms(

-             [], [], {repo["repository"]: repo}, include_rpms=False)

+             [], [], {repo["repository"]: repo}, include_rpm_manifest=False)

          for image in images:

              nvr = image["brew"]["build"]

              self._verify_image_data(image)

file modified
+16 -14
@@ -440,7 +440,7 @@ 

          # Get the published version of this image to find out if the image

          # was actually published.

          images = lb_instance.get_images_by_nvrs(

-             [self["brew"]["build"]], published=True, include_rpms=False)

+             [self["brew"]["build"]], published=True, include_rpm_manifest=False)

          if images:

              self["published"] = True

          else:
@@ -694,13 +694,14 @@ 

          repositories = self.find_container_repositories(repo_request)

          return {r["repository"]: r for r in repositories}

  

-     def _get_default_projection(self, srpm_names=None, include_rpms=True):

+     def _get_default_projection(self, srpm_names=None, include_rpm_manifest=True):

          """

          Returns the default projection list for containerImage objects.

  

          :param list srpm_names: When not None, defines the SRPM names which

              are returned in "rpm_manifest" field of containerImage.;

-         :param include_rpms: When False, "rpm_manifest" is not returned at all.

+         :param bool include_rpm_manifest: indicate whether to include

+             "rpm_manifest" in the query result. Default is True.

          """

          projection = [

              {"field": "brew", "include": True, "recursive": True},
@@ -712,7 +713,7 @@ 

              {"field": "content_sets", "include": True, "recursive": True},

              {"field": "parent_brew_build", "include": True, "recursive": False},

          ]

-         if include_rpms:

+         if include_rpm_manifest:

              if srpm_names:

                  projection += [

                      {"field": "rpm_manifest.*.rpms", "include": True, "recursive": True,
@@ -851,7 +852,7 @@ 

  

      def find_images_with_included_srpms(

              self, content_sets, srpm_nvrs, repositories, published=True,

-             include_rpms=True):

+             include_rpm_manifest=True):

          """

          Query lightblue and find the containerImages in the given containerRepositories.

  
@@ -867,7 +868,7 @@ 

          :param dict repositories: List of repository names to look for.

          :param bool published: whether to limit queries to published

              repositories

-         :param bool include_rpms: whether to include the RPMs in the result.

+         :param bool include_rpm_manifest: whether to include the RPMs in the result.

          """

          auto_rebuild_tags = set()

          for repo in repositories.values():
@@ -901,7 +902,7 @@ 

              },

              "projection": self._get_default_projection(

                  srpm_names=srpm_name_to_nvrs.keys(),

-                 include_rpms=include_rpms)

+                 include_rpm_manifest=include_rpm_manifest)

          }

  

          if content_sets:
@@ -976,7 +977,8 @@ 

          return images

  

      def get_images_by_nvrs(self, nvrs, published=True, content_sets=None,

-                            srpm_nvrs=None, include_rpms=True, srpm_names=None):

+                            srpm_nvrs=None, include_rpm_manifest=True,

+                            srpm_names=None):

          """Query lightblue and returns containerImages defined by list of

          `nvrs`.

  
@@ -985,8 +987,8 @@ 

          :param list content_sets: List of content_sets the image includes RPMs

              from.

          :param list srpm_nvrs: list of SRPM NVRs to look for

-         :param bool include_rpms: When True, the rpm_manifest is included in

-             the returned ContainerImages.

+         :param bool include_rpm_manifest: When True, the rpm_manifest is

+             included in the returned ContainerImages.

          :param list srpm_names: list of SRPM names to look for.

          :return: List of containerImages.

          :rtype: list of ContainerImages.
@@ -1010,7 +1012,7 @@ 

                  ]

              },

              "projection": self._get_default_projection(

-                 include_rpms=include_rpms)

+                 include_rpm_manifest=include_rpm_manifest)

          }

  

          if content_sets is not None:
@@ -1100,7 +1102,7 @@ 

                      }

                  ]

              },

-             "projection": self._get_default_projection(include_rpms=False)

+             "projection": self._get_default_projection(include_rpm_manifest=False)

          }

          images = self.find_container_images(image_request)

          if not images:
@@ -1143,7 +1145,7 @@ 

              },

              "projection": self._get_default_projection(

                  srpm_names=[srpm_name] if srpm_name else None,

-                 include_rpms=srpm_name is not None)

+                 include_rpm_manifest=srpm_name is not None)

          }

  

          images = self.find_container_images(query)
@@ -1229,7 +1231,7 @@ 

                  continue

  

              possible_latest_parents = self.find_images_with_included_srpms(

-                 [], [], {repo["repository"]: repo_data}, include_rpms=False)

+                 [], [], {repo["repository"]: repo_data}, include_rpm_manifest=False)

              for possible_latest_parent in possible_latest_parents:

                  # Treat the `possible_latest_parent` as `latest_parent` in case its

                  # Name and Version are the same and Release is higher.

file modified
+2 -2
@@ -544,7 +544,7 @@ 

          self.assertEqual(image["published"], True)

          lb.get_images_by_nvrs.assert_called_once_with(

              ["package-name-1-4-12.10"], published=True,

-             include_rpms=False)

+             include_rpm_manifest=False)

  

      def test_resolve_published_unpublished(self):

          image = ContainerImage.create({
@@ -559,7 +559,7 @@ 

          image.resolve_published(lb)

          self.assertEqual(image["published"], False)

          lb.get_images_by_nvrs.asssert_has_calls([

-             call(["package-name-1-4-12.10"], published=True, include_rpms=False),

+             call(["package-name-1-4-12.10"], published=True, include_rpm_manifest=False),

              call(["package-name-1-4-12.10"])])

  

          self.assertEqual(image["rpm_manifest"], "x")

Use the new name to reflect directly that the rpm_manifest will be
included in query result.

Signed-off-by: Chenxiong Qi cqi@redhat.com

This PR proposes a new name to make it easier to understand.

rebased onto 55b8106

4 years ago

Rebased on master without any change.

Commit 35be1e5 fixes this pull-request

Pull-Request has been merged by gnaponie

4 years ago

Pull-Request has been merged by gnaponie

4 years ago