#1457 hybrid: Explicitly pull in debugsource packages
Opened 2 months ago by lsedlar. Modified 2 months ago
lsedlar/pungi debugsource  into  master

@@ -351,8 +351,8 @@ 

  

              # There are two ways how the debuginfo package can be named. We

              # want to get them all.

-             for pattern in ["%s-debuginfo", "%s-debugsource"]:

-                 debuginfo_name = pattern % pkg.name

+             source_name = kobo.rpmlib.parse_nvra(pkg.rpm_sourcerpm)["name"]

+             for debuginfo_name in ["%s-debuginfo" % pkg.name, "%s-debugsource" % source_name]:

                  debuginfo = self._get_debuginfo(debuginfo_name, pkg_arch)

                  for dbg in debuginfo:

                      # For each debuginfo package that matches on name and

@@ -390,7 +390,7 @@ 

              ),

          }

          po.return_value = ([("p-1-1", "x86_64", frozenset())], ["m1"])

-         self.phase.packages = {"p-1-1.x86_64": mock.Mock()}

+         self.phase.packages = {"p-1-1.x86_64": mock.Mock(rpm_sourcerpm="p-1-1.src.rpm")}

  

          res = self.phase.run_solver(

              self.compose.variants["Server"],
@@ -430,7 +430,7 @@ 

          )

  

      def test_with_comps(self, run, gc, po, wc):

-         self.phase.packages = {"pkg-1.0-1.x86_64": mock.Mock()}

+         self.phase.packages = {"pkg-1.0-1.x86_64": mock.Mock(rpm_sourcerpm="pkg-1.0-1.src.rpm")}

          self.phase.debuginfo = {"x86_64": {}}

          po.return_value = ([("pkg-1.0-1", "x86_64", frozenset())], [])

          res = self.phase.run_solver(
@@ -471,11 +471,23 @@ 

          )

  

      def test_with_comps_with_debuginfo(self, run, gc, po, wc):

-         dbg1 = NamedMock(name="pkg-debuginfo", arch="x86_64", sourcerpm="pkg.src.rpm")

-         dbg2 = NamedMock(name="pkg-debuginfo", arch="x86_64", sourcerpm="x.src.rpm")

+         # dbg1 and dbg2 mocks both package from Kobo (with sourcerpm) and from

+         # createrepo_c (with rpm_sourcerpm)

+         dbg1 = NamedMock(

+             name="pkg-debuginfo",

+             arch="x86_64",

+             sourcerpm="pkg-1.0-1.src.rpm",

+             rpm_sourcerpm="pkg-1.0-1.src.rpm"

+         )

+         dbg2 = NamedMock(

+             name="pkg-debuginfo",

+             arch="x86_64",

+             sourcerpm="pkg-1.0-2.src.rpm",

+             rpm_sourcerpm="pkg-1.0-2.src.rpm"

+         )

          self.phase.packages = {

              "pkg-1.0-1.x86_64": NamedMock(

-                 name="pkg", arch="x86_64", rpm_sourcerpm="pkg.src.rpm"

+                 name="pkg", arch="x86_64", rpm_sourcerpm="pkg-1.0-1.src.rpm"

              ),

              "pkg-debuginfo-1.0-1.x86_64": dbg1,

              "pkg-debuginfo-1.0-2.x86_64": dbg2,
@@ -556,8 +568,8 @@ 

          ]

          po.side_effect = [([("pkg-1.0-1", "x86_64", frozenset())], []), (final, [])]

          self.phase.packages = {

-             "pkg-1.0-1.x86_64": mock.Mock(),

-             "pkg-en-1.0-1.noarch": mock.Mock(),

+             "pkg-1.0-1.x86_64": mock.Mock(rpm_sourcerpm="pkg-1.0-1.src.rpm"),

+             "pkg-en-1.0-1.noarch": mock.Mock(rpm_sourcerpm="pkg-1.0-1.src.rpm"),

          }

  

          res = self.phase.run_solver(
@@ -626,9 +638,9 @@ 

          cr.Metadata.return_value.keys.return_value = []

          self.phase.package_maps = {

              "x86_64": {

-                 "pkg-devel-1.0-1.x86_64": NamedMock(name="pkg-devel"),

-                 "pkg-devel-1.0-1.i686": NamedMock(name="pkg-devel"),

-                 "foo-1.0-1.x86_64": NamedMock(name="foo"),

+                 "pkg-devel-1.0-1.x86_64": NamedMock(name="pkg-devel", rpm_sourcerpm="pkg-1.0-1.src.rpm"),

+                 "pkg-devel-1.0-1.i686": NamedMock(name="pkg-devel", rpm_sourcerpm="pkg-1.0-1.src.rpm"),

+                 "foo-1.0-1.x86_64": NamedMock(name="foo", rpm_sourcerpm="foo-1.0-1.src.rpm"),

              }

          }

          self.phase.packages = self.phase.package_maps["x86_64"]
@@ -716,6 +728,7 @@ 

                  release="1",

                  arch="x86_64",

                  provides=[("/usr/lib/libfoo.1.so.1", None, None)],

+                 rpm_sourcerpm="foo-1.0-1.src.rpm",

              ),

              "def": NamedMock(

                  name="foo",
@@ -724,6 +737,7 @@ 

                  release="1",

                  arch="i686",

                  provides=[("/usr/lib/libfoo.1.so.1", None, None)],

+                 rpm_sourcerpm="foo-1.0-1.src.rpm",

              ),

              "ghi": NamedMock(

                  name="pkg-devel",
@@ -732,6 +746,7 @@ 

                  release="1",

                  arch="x86_64",

                  provides=[],

+                 rpm_sourcerpm="pkg-devel-1.0-1.src.rpm",

              ),

          }

          cr.Metadata.return_value.keys.return_value = packages.keys()

This should cover case where we there's a build like this:

foo-1-1.src.rpm
foo-sub-1-1.noarch.rpm
foo-debugsource-1-1.x86_64.rpm

The compose contains the noarch package, and should also have the debugsource package. The original code only checked for foo-sub-debugsource though.