| |
@@ -20,7 +20,7 @@
|
| |
import tempfile
|
| |
import shutil
|
| |
import os
|
| |
-
|
| |
+ import sys
|
| |
import yaml
|
| |
import click
|
| |
|
| |
@@ -220,6 +220,16 @@
|
| |
push_cmd = ['git', 'push']
|
| |
self._run_git_cmd(push_cmd)
|
| |
|
| |
+ def fetch(self):
|
| |
+ """
|
| |
+ Fetches from the Git server
|
| |
+ :return: None or GitException
|
| |
+ """
|
| |
+ self._assert_cloned()
|
| |
+ click.echo('- Fetching from {0}'.format(self.git_url))
|
| |
+ push_cmd = ['git', 'fetch']
|
| |
+ self._run_git_cmd(push_cmd)
|
| |
+
|
| |
def set_monitoring_on_repo(self, namespace, repo, monitoring_level):
|
| |
"""
|
| |
Set the monitoring level of a repo in config.yml
|
| |
@@ -256,3 +266,36 @@
|
| |
self.add(config_yml_path)
|
| |
self.commit('Adding monitoring for {0}/{1}'.format(namespace, repo))
|
| |
self.push()
|
| |
+
|
| |
+ def create_epel_package_cfg(self, namespace, repo, branch):
|
| |
+ """
|
| |
+ Create package.cfg file in epel branch
|
| |
+ :param namespace: the dist-git namespace of the package in question.
|
| |
+ :param repo: the name of the dist-git repo in question.
|
| |
+ :param branch: the name of the branch
|
| |
+ :return: None or GitException
|
| |
+ """
|
| |
+ self._assert_cloned()
|
| |
+
|
| |
+ if self.current_branch != branch:
|
| |
+ self.fetch()
|
| |
+ self.checkout_branch(branch)
|
| |
+ try:
|
| |
+ # Open the package.cfg file in the repo
|
| |
+ # Write the config needed with epel\d and epel\d-playground
|
| |
+ # build targets
|
| |
+ # Close the file
|
| |
+ # Add the file, commit the changes and push
|
| |
+ with open(os.path.join(self.clone_dir, 'package.cfg'), 'w') as pkg_cfg:
|
| |
+ pkg_cfg.write("[koji]\n")
|
| |
+ pkg_cfg.write("targets = {0} {0}-playground".format(branch))
|
| |
+ pkg_cfg.close()
|
| |
+ self.add(pkg_cfg.name)
|
| |
+ self.commit("Adding package.cfg file")
|
| |
+ self.push()
|
| |
+ except IOError:
|
| |
+ print("Couldn't create package.cfg file in {0} of {1}/{2} repo, "
|
| |
+ "please file a releng ticket".format(branch, namespace, repo))
|
| |
+ sys.exit(1)
|
| |
+ finally:
|
| |
+ pkg_cfg.close()
|
| |
Signed-off-by: Mohan Boddu mboddu@bhujji.com