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
This commit is contained in:
Georgy Kibardin 2016-12-29 14:34:41 +03:00 committed by Alexey Shtokolov
parent 13c73e5609
commit 57476f32d3
2 changed files with 16 additions and 20 deletions

View File

@ -34,6 +34,8 @@ logger = logging.getLogger(__name__)
class BaseBuildPlugin(BaseAction):
release_tmpl_src_path = 'templates/base/build/Release.mako'
@abc.abstractproperty
def requires(self):
"""Should return a list of commands which
@ -62,6 +64,13 @@ class BaseBuildPlugin(BaseAction):
self.checksums_path = join_path(self.build_src_dir, 'checksums.sha1')
self.name = self.meta['name']
self.plugin_version, self.full_version = utils.version_split_name_rpm(
self.meta['version'])
fpb_dir = join_path(os.path.dirname(__file__), '..')
self.release_tmpl_src = os.path.abspath(join_path(
fpb_dir, self.release_tmpl_src_path))
def run(self):
logger.debug('Start plugin building "%s"', self.plugin_path)
self.clean()
@ -99,11 +108,17 @@ class BaseBuildPlugin(BaseAction):
self.build_ubuntu_repos(releases_paths.get('ubuntu', []))
self.build_centos_repos(releases_paths.get('centos', []))
def build_ubuntu_repos(cls, releases_paths):
def build_ubuntu_repos(self, releases_paths):
for repo_path in releases_paths:
utils.exec_piped_cmds(
['dpkg-scanpackages -m .', 'gzip -c9 > Packages.gz'],
cwd=repo_path)
release_path = join_path(repo_path, 'Release')
utils.render_to_file(
self.release_tmpl_src,
release_path,
{'plugin_name': self.meta['name'],
'major_version': self.plugin_version})
@classmethod
def build_centos_repos(cls, releases_paths):
@ -156,14 +171,10 @@ class BuildPluginV2(BaseBuildPlugin):
requires = ['rpmbuild', 'rpm', 'createrepo', 'dpkg-scanpackages']
rpm_spec_src_path = 'templates/v2/build/plugin_rpm.spec.mako'
release_tmpl_src_path = 'templates/v2/build/Release.mako'
def __init__(self, *args, **kwargs):
super(BuildPluginV2, self).__init__(*args, **kwargs)
self.plugin_version, self.full_version = utils.version_split_name_rpm(
self.meta['version'])
self.rpm_path = os.path.abspath(
join_path(self.plugin_path, '.build', 'rpm'))
@ -179,9 +190,6 @@ class BuildPluginV2(BaseBuildPlugin):
self.spec_src = os.path.abspath(join_path(
fpb_dir, self.rpm_spec_src_path))
self.release_tmpl_src = os.path.abspath(join_path(
fpb_dir, self.release_tmpl_src_path))
self.spec_dst = join_path(self.rpm_path, 'plugin_rpm.spec')
self.rpm_packages_mask = join_path(
@ -223,18 +231,6 @@ class BuildPluginV2(BaseBuildPlugin):
'vendor': ', '.join(self.meta.get('authors', [])),
'year': utils.get_current_year()}
def build_ubuntu_repos(self, releases_paths):
for repo_path in releases_paths:
utils.exec_piped_cmds(
['dpkg-scanpackages -m .', 'gzip -c9 > Packages.gz'],
cwd=repo_path)
release_path = join_path(repo_path, 'Release')
utils.render_to_file(
self.release_tmpl_src,
release_path,
{'plugin_name': self.meta['name'],
'major_version': self.plugin_version})
class BuildPluginV3(BuildPluginV2):