Browse Source

Make ubuntu repo similar for all plugin versions

Release file began to present in a plugin ubuntu repository only since
version 2. This now conflicts with our new repo pinning code which
expects Release file to be in place.

Related-Bug: #1650551

Change-Id: I09b956555c3a6ab0944216d866739fb7f6dc66a0
Georgy Kibardin 2 years ago
parent
commit
57476f32d3

+ 16
- 20
fuel_plugin_builder/actions/build.py View File

@@ -34,6 +34,8 @@ logger = logging.getLogger(__name__)
34 34
 
35 35
 class BaseBuildPlugin(BaseAction):
36 36
 
37
+    release_tmpl_src_path = 'templates/base/build/Release.mako'
38
+
37 39
     @abc.abstractproperty
38 40
     def requires(self):
39 41
         """Should return a list of commands which
@@ -62,6 +64,13 @@ class BaseBuildPlugin(BaseAction):
62 64
         self.checksums_path = join_path(self.build_src_dir, 'checksums.sha1')
63 65
         self.name = self.meta['name']
64 66
 
67
+        self.plugin_version, self.full_version = utils.version_split_name_rpm(
68
+            self.meta['version'])
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
+
65 74
     def run(self):
66 75
         logger.debug('Start plugin building "%s"', self.plugin_path)
67 76
         self.clean()
@@ -99,11 +108,17 @@ class BaseBuildPlugin(BaseAction):
99 108
         self.build_ubuntu_repos(releases_paths.get('ubuntu', []))
100 109
         self.build_centos_repos(releases_paths.get('centos', []))
101 110
 
102
-    def build_ubuntu_repos(cls, releases_paths):
111
+    def build_ubuntu_repos(self, releases_paths):
103 112
         for repo_path in releases_paths:
104 113
             utils.exec_piped_cmds(
105 114
                 ['dpkg-scanpackages -m .', 'gzip -c9 > Packages.gz'],
106 115
                 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})
107 122
 
108 123
     @classmethod
109 124
     def build_centos_repos(cls, releases_paths):
@@ -156,14 +171,10 @@ class BuildPluginV2(BaseBuildPlugin):
156 171
     requires = ['rpmbuild', 'rpm', 'createrepo', 'dpkg-scanpackages']
157 172
 
158 173
     rpm_spec_src_path = 'templates/v2/build/plugin_rpm.spec.mako'
159
-    release_tmpl_src_path = 'templates/v2/build/Release.mako'
160 174
 
161 175
     def __init__(self, *args, **kwargs):
162 176
         super(BuildPluginV2, self).__init__(*args, **kwargs)
163 177
 
164
-        self.plugin_version, self.full_version = utils.version_split_name_rpm(
165
-            self.meta['version'])
166
-
167 178
         self.rpm_path = os.path.abspath(
168 179
             join_path(self.plugin_path, '.build', 'rpm'))
169 180
 
@@ -179,9 +190,6 @@ class BuildPluginV2(BaseBuildPlugin):
179 190
         self.spec_src = os.path.abspath(join_path(
180 191
             fpb_dir, self.rpm_spec_src_path))
181 192
 
182
-        self.release_tmpl_src = os.path.abspath(join_path(
183
-            fpb_dir, self.release_tmpl_src_path))
184
-
185 193
         self.spec_dst = join_path(self.rpm_path, 'plugin_rpm.spec')
186 194
 
187 195
         self.rpm_packages_mask = join_path(
@@ -223,18 +231,6 @@ class BuildPluginV2(BaseBuildPlugin):
223 231
             'vendor': ', '.join(self.meta.get('authors', [])),
224 232
             'year': utils.get_current_year()}
225 233
 
226
-    def build_ubuntu_repos(self, releases_paths):
227
-        for repo_path in releases_paths:
228
-            utils.exec_piped_cmds(
229
-                ['dpkg-scanpackages -m .', 'gzip -c9 > Packages.gz'],
230
-                cwd=repo_path)
231
-            release_path = join_path(repo_path, 'Release')
232
-            utils.render_to_file(
233
-                self.release_tmpl_src,
234
-                release_path,
235
-                {'plugin_name': self.meta['name'],
236
-                 'major_version': self.plugin_version})
237
-
238 234
 
239 235
 class BuildPluginV3(BuildPluginV2):
240 236
 

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


Loading…
Cancel
Save