Browse Source

Move Release.mako into v1 template dir

It turned out that templates/base is used to create new plugin
directory structure by fpb --create and, therefore, is a bad place to
put Release.mako since it is attempted to render it at plugin creation
time, not at a build time as inteded.

Change-Id: I7dbbf192827f8b2a0c0675050f7b48820952f6af
Closes-Bug: #1655289
Georgy Kibardin 2 years ago
parent
commit
6a1ae7f520

+ 13
- 13
fuel_plugin_builder/actions/build.py View File

@@ -34,7 +34,7 @@ logger = logging.getLogger(__name__)
34 34
 
35 35
 class BaseBuildPlugin(BaseAction):
36 36
 
37
-    release_tmpl_src_path = 'templates/base/build/Release.mako'
37
+    release_tmpl_src_path = None
38 38
 
39 39
     @abc.abstractproperty
40 40
     def requires(self):
@@ -67,10 +67,6 @@ class BaseBuildPlugin(BaseAction):
67 67
         self.plugin_version, self.full_version = utils.version_split_name_rpm(
68 68
             self.meta['version'])
69 69
 
70
-        fpb_dir = join_path(os.path.dirname(__file__), '..')
71
-        self.release_tmpl_src = os.path.abspath(join_path(
72
-            fpb_dir, self.release_tmpl_src_path))
73
-
74 70
     def run(self):
75 71
         logger.debug('Start plugin building "%s"', self.plugin_path)
76 72
         self.clean()
@@ -113,12 +109,13 @@ class BaseBuildPlugin(BaseAction):
113 109
             utils.exec_piped_cmds(
114 110
                 ['dpkg-scanpackages -m .', 'gzip -c9 > Packages.gz'],
115 111
                 cwd=repo_path)
116
-            release_path = join_path(repo_path, 'Release')
117
-            utils.render_to_file(
118
-                self.release_tmpl_src,
119
-                release_path,
120
-                {'plugin_name': self.meta['name'],
121
-                 'major_version': self.plugin_version})
112
+            if self.release_tmpl_src_path:
113
+                release_path = join_path(repo_path, 'Release')
114
+                utils.render_to_file(
115
+                    self.release_tmpl_src_path,
116
+                    release_path,
117
+                    {'plugin_name': self.meta['name'],
118
+                     'major_version': self.plugin_version})
122 119
 
123 120
     @classmethod
124 121
     def build_centos_repos(cls, releases_paths):
@@ -150,6 +147,10 @@ class BaseBuildPlugin(BaseAction):
150 147
 class BuildPluginV1(BaseBuildPlugin):
151 148
 
152 149
     requires = ['rpm', 'createrepo', 'dpkg-scanpackages']
150
+    release_tmpl_src_path = os.path.abspath(join_path(
151
+        os.path.dirname(__file__),
152
+        '..',
153
+        'templates/v1/build/Release.mako'))
153 154
 
154 155
     @property
155 156
     def result_package_mask(self):
@@ -166,7 +167,7 @@ class BuildPluginV1(BaseBuildPlugin):
166 167
         utils.make_tar_gz(self.build_src_dir, tar_path, full_name)
167 168
 
168 169
 
169
-class BuildPluginV2(BaseBuildPlugin):
170
+class BuildPluginV2(BuildPluginV1):
170 171
 
171 172
     requires = ['rpmbuild', 'rpm', 'createrepo', 'dpkg-scanpackages']
172 173
 
@@ -235,7 +236,6 @@ class BuildPluginV2(BaseBuildPlugin):
235 236
 class BuildPluginV3(BuildPluginV2):
236 237
 
237 238
     rpm_spec_src_path = 'templates/v3/build/plugin_rpm.spec.mako'
238
-    release_tmpl_src_path = 'templates/v3/build/Release.mako'
239 239
 
240 240
     def _make_data_for_template(self):
241 241
         data = super(BuildPluginV3, self)._make_data_for_template()

fuel_plugin_builder/templates/base/build/Release.mako → fuel_plugin_builder/templates/v1/build/Release.mako View File


+ 0
- 2
fuel_plugin_builder/templates/v3/build/Release.mako View File

@@ -1,2 +0,0 @@
1
-Label: ${plugin_name}
2
-Version: ${major_version}

Loading…
Cancel
Save