#89 symlink: Add non-ga base product type
Merged 5 years ago by lsedlar. Opened 5 years ago by lsedlar.
lsedlar/compose-utils symlink-base-product  into  master

@@ -48,7 +48,11 @@ 

  

          fmt = "latest-{0.release.short}-{1}"

          if self.compose.info.release.is_layered:

+             # Add info about base product

              fmt += '-{0.base_product.short}-{0.base_product.version}'

+             if self.compose.info.base_product.type != "ga":

+                 # Add base product type only if it's not ga

+                 fmt += "-{0.base_product.type}"

          return fmt.format(self.compose.info, version)

  

      def print_latest_link(self, minor_version=None, version_type=VersionType.MAJOR):

file modified
+10 -2
@@ -25,11 +25,11 @@ 

      def tearDown(self):

          shutil.rmtree(self.compose_dir)

  

-     def _write_compose(self, is_layered=False):

+     def _write_compose(self, is_layered=False, base_product_type="ga"):

          if is_layered:

              self.compose.info.release.is_layered = True

              self.compose.info.base_product.name = 'Base Product'

-             self.compose.info.base_product.type = 'ga'

+             self.compose.info.base_product.type = base_product_type

              self.compose.info.base_product.short = 'BP'

              self.compose.info.base_product.version = '15'

  
@@ -51,6 +51,14 @@ 

          self.assertEqual(os.readlink(os.path.join(self.compose_dir, 'latest-DP-1-BP-15')),

                           'DP-1.0-20160315.t.1')

  

+     def test_layered_non_ga_base(self):

+         path = self._write_compose(is_layered=True, base_product_type="eus")

+         symlink.create_latest_link(path)

+         self.assertEqual(

+             os.readlink(os.path.join(self.compose_dir, "latest-DP-1-BP-15-eus")),

+             "DP-1.0-20160315.t.1"

+         )

+ 

      def test_with_minor_version(self):

          path = self._write_compose()

          with self.assertWarns(DeprecationWarning):

The same layered product can be built for multiple versions of base product. We don't want colliding symlinks. For backwards compatibility the type is only added when it's not GA. This way it's also similar to how release IDs are generated in productmd.

Pull-Request has been merged by lsedlar

5 years ago