Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit e805439858a41f80adc5dab0e156b69c216e1416
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Mon Jul 27 13:54:33 2015 +0200
[dist-git] cleanup; error handling; selinux context for /var/lib/copr-dist-git to
allow read access to httpd
---------------------------------------------------------------
dist-git/copr-dist-git.spec | 4 ++++
dist-git/dist-git/dist_git_importer.py | 16 ++++++++--------
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/dist-git/copr-dist-git.spec b/dist-git/copr-dist-git.spec
index 3fe8fe8..bf5e7b5 100644
--- a/dist-git/copr-dist-git.spec
+++ b/dist-git/copr-dist-git.spec
@@ -56,6 +56,10 @@ touch %{buildroot}%{_var}/log/copr-dist-git/main.log
%check
+% post
+# change context to be readable by cgit
+semanage fcontext -a -t httpd_sys_content_t '/var/lib/copr-dist-git(/.*)?'
+restorecon -rv /var/lib/copr-dist-git
%files
%license LICENSE
diff --git a/dist-git/dist-git/dist_git_importer.py
b/dist-git/dist-git/dist_git_importer.py
index 47c5401..473ab0d 100755
--- a/dist-git/dist-git/dist_git_importer.py
+++ b/dist-git/dist-git/dist_git_importer.py
@@ -98,16 +98,13 @@ def import_srpm(user, project, pkg, branch, filepath):
commands.lookasidecache.upload = types.MethodType(_my_upload, repo_dir)
log.debug("clone the pkg repository into tmp directory")
- # module = "{}/{}/{}.git".format(user, project, pkg)
- # giturl = gitbaseurl % {'module': module}
- # cmd = ['git', 'clone', "-b", "f20",
giturl]
- # call(cmd, cwd=tmp)
commands.clone(module, tmp, branch)
log.debug("import the source rpm into git and save filenames of
sources")
try:
uploadfiles = commands.import_srpm(filepath)
- except:
+ except Exception:
+ log.exception("Failed to import the source rpm:
{}".format(filepath))
raise PackageImportException
log.info("save the source files into lookaside cache")
@@ -115,8 +112,6 @@ def import_srpm(user, project, pkg, branch, filepath):
log.debug("git push")
message = "Import of {}".format(os.path.basename(filepath))
- # call(["git", "commit", "-m", message],
cwd=repo_dir)
- # call(["git", "push"], cwd=repo_dir)
try:
commands.commit(message)
commands.push()
@@ -173,7 +168,8 @@ class DistGitImporter():
package_url = "{}/tmp/{}/{}".format(
self.opts.frontend_base_url, json_tmp, json_pkg)
else:
- raise Exception
+ log.error("Got unknown source type:
{}".format(source_type))
+ raise Exception("Got unknown source type:
{}".format(source_type))
except KeyboardInterrupt:
sys.exit(0)
@@ -192,6 +188,10 @@ class DistGitImporter():
except IOError:
raise PackageDownloadException
+ # todo: check that obtained file is a REAL srpm
+ # todo query package name & version and ise real name instead of
task["package"]
+ # if fetched file is not a proper srpm set error state
+
reponame = "{}/{}/{}".format(user, project, package)
log.debug("make sure repos exist: {}".format(reponame))
call(["/usr/share/dist-git/git_package.sh", reponame])