[copr] master: [frontend] enabled `gpgcheck=1` in .repo template (f114c72)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit f114c72f1c68c3a9936ea5bef8e734ee57148252
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Feb 5 14:47:31 2015 +0100
[frontend] enabled `gpgcheck=1` in .repo template
>---------------------------------------------------------------
.../coprs_frontend/coprs/templates/coprs/copr.repo | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/templates/coprs/copr.repo b/frontend/coprs_frontend/coprs/templates/coprs/copr.repo
index d316ae7..07b2762 100644
--- a/frontend/coprs_frontend/coprs/templates/coprs/copr.repo
+++ b/frontend/coprs_frontend/coprs/templates/coprs/copr.repo
@@ -2,7 +2,7 @@
name=Copr repo for {{ copr.name }} owned by {{ copr.owner.name }}
baseurl={{ url | fix_url_https_backend }}
skip_if_unavailable=True
-gpgcheck=0
+gpgcheck=1
gpgkey={{ pubkey_url | fix_url_https_backend }}
enabled=1
9 years, 3 months
[copr] master: [backend] one-time run sciprt to sign older builds: added createrepo call (6e369cd)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 6e369cdd8758554682ab9bbd958188e3b10b27b0
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Feb 5 14:31:02 2015 +0100
[backend] one-time run sciprt to sign older builds: added createrepo call
>---------------------------------------------------------------
backend/run/copr_sign_unsigned.py | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/backend/run/copr_sign_unsigned.py b/backend/run/copr_sign_unsigned.py
index de1527a..fc690eb 100755
--- a/backend/run/copr_sign_unsigned.py
+++ b/backend/run/copr_sign_unsigned.py
@@ -27,9 +27,10 @@ sys.path.append("/usr/share/copr/")
from backend.helpers import BackendConfigReader
from backend.sign import get_pubkey, sign_rpms_in_dir, create_user_keys
from backend.exceptions import CoprSignNoKeyError
+from backend.createrepo import createrepo
-def check_signed_rpms_in_pkg_dir(pkg_dir, user, project, opts):
+def check_signed_rpms_in_pkg_dir(pkg_dir, user, project, chroot, chroot_dir, opts):
success = True
class LogCb(object):
@@ -46,6 +47,18 @@ def check_signed_rpms_in_pkg_dir(pkg_dir, user, project, opts):
try:
sign_rpms_in_dir(user, project, pkg_dir, opts, callback=cb)
+
+ log.info("running createrepo for {}".format(pkg_dir))
+ base_url = "/".join([opts.results_baseurl, user,
+ project, chroot])
+ createrepo(
+ path=chroot_dir,
+ front_url=opts.frontend_base_url,
+ base_url=base_url,
+ username=user,
+ projectname=project,
+ )
+
except Exception as err:
success = False
log.error(">>> Failed to check/sign rpm in dir pkg_dir")
@@ -78,7 +91,7 @@ def check_signed_rpms(project_dir, user, project, opts):
log.debug(">> Stepping into package: {}".format(mb_pkg_path))
- if not check_signed_rpms_in_pkg_dir(mb_pkg_path, user, project, opts):
+ if not check_signed_rpms_in_pkg_dir(mb_pkg_path, user, project, chroot, chroot_path, opts):
success = False
return success
9 years, 3 months
[copr] master: [backend] one-time run sciprt to sign older builds (cc712a3)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit cc712a388c0cc3a1d72ec712b786b5c5f8d43faa
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Feb 5 13:40:01 2015 +0100
[backend] one-time run sciprt to sign older builds
>---------------------------------------------------------------
backend/run/copr_sign_unsigned.py | 152 +++++++++++++++++++++++++++++++++++++
1 files changed, 152 insertions(+), 0 deletions(-)
diff --git a/backend/run/copr_sign_unsigned.py b/backend/run/copr_sign_unsigned.py
new file mode 100755
index 0000000..de1527a
--- /dev/null
+++ b/backend/run/copr_sign_unsigned.py
@@ -0,0 +1,152 @@
+#!/usr/bin/python
+# coding: utf-8
+
+"""
+One-time run script to sign unsigned rpms and place pubkey gpg to the all projects.
+"""
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import division
+from __future__ import absolute_import
+import shutil
+
+import sys
+import os
+import logging
+import pwd
+
+
+logging.basicConfig(
+ filename="/var/log/copr/onetime_signer.log",
+ format='[%(asctime)s][%(levelname)6s]: %(message)s',
+ level=logging.DEBUG)
+log = logging.getLogger(__name__)
+
+
+sys.path.append("/usr/share/copr/")
+from backend.helpers import BackendConfigReader
+from backend.sign import get_pubkey, sign_rpms_in_dir, create_user_keys
+from backend.exceptions import CoprSignNoKeyError
+
+
+def check_signed_rpms_in_pkg_dir(pkg_dir, user, project, opts):
+ success = True
+
+ class LogCb(object):
+ def __init__(self, logger):
+ self.logger = logger
+
+ def log(self, msg):
+ self.logger.info(">>> {}".format(msg))
+
+ def error(self, msg):
+ self.logger.error(">>> {}".format(msg))
+
+ cb = LogCb(log)
+
+ try:
+ sign_rpms_in_dir(user, project, pkg_dir, opts, callback=cb)
+ except Exception as err:
+ success = False
+ log.error(">>> Failed to check/sign rpm in dir pkg_dir")
+ log.exception(err)
+
+ return success
+
+
+def check_signed_rpms(project_dir, user, project, opts):
+ """
+ Ensure that all rpm files are signed
+ """
+ success = True
+ for chroot in os.listdir(project_dir):
+ if not (chroot.startswith("fedora") or chroot.startswith("epel")):
+ continue
+
+ chroot_path = os.path.join(project_dir, chroot)
+ if not os.path.isdir(chroot_path):
+ continue
+
+ log.debug("> Checking chroot `{}` in dir `{}`".format(chroot, project_dir))
+
+ for mb_pkg in os.listdir(chroot_path):
+ if mb_pkg in ["repodata", "devel"]:
+ continue
+ mb_pkg_path = os.path.join(chroot_path, mb_pkg)
+ if not os.path.isdir(mb_pkg_path):
+ continue
+
+ log.debug(">> Stepping into package: {}".format(mb_pkg_path))
+
+ if not check_signed_rpms_in_pkg_dir(mb_pkg_path, user, project, opts):
+ success = False
+
+ return success
+
+
+def check_pubkey(pubkey_path, user, project, opts):
+ """
+ Ensure that pubkey.gpg presented in project/dir
+ """
+ if os.path.exists(pubkey_path):
+ log.info("Pubkey for {}/{} exists: {}".format(user, project, pubkey_path))
+ return True
+ else:
+ log.info("Missing pubkey for {}/{}".format(user, project))
+ try:
+ get_pubkey(user, project, pubkey_path)
+ return True
+ except Exception as err:
+ log.exception(err)
+ return False
+
+
+def main():
+ shutil.rmtree("/tmp/users_failed.txt", ignore_errors=True)
+ shutil.rmtree("/tmp/users_done.txt", ignore_errors=True)
+
+ opts = BackendConfigReader().read()
+ log.info("Starting pubkey fill, destdir: {}".format(opts.destdir))
+
+ log.debug("list dir: {}".format(os.listdir(opts.destdir)))
+ for user_name in os.listdir(opts.destdir):
+ failed = False
+ log.info("Started processing user dir: {}".format(user_name))
+ user_dir = os.path.join(opts.destdir, user_name)
+
+ for project_name in os.listdir(user_dir):
+ log.info("Checking project dir: {}".format(project_name))
+
+ try:
+ get_pubkey(user_name, project_name)
+ log.info("Key-pair exists for {}/{}".format(user_name, project_name))
+ except CoprSignNoKeyError:
+ create_user_keys(user_name, project_name, opts)
+ log.info("Created new key-pair for {}/{}".format(user_name, project_name))
+ except Exception as err:
+ log.error("Failed to get pubkey for {}/{}, mark as failed, skipping")
+ log.exception(err)
+ failed = True
+ continue
+
+ project_dir = os.path.join(user_dir, project_name)
+ pubkey_path = os.path.join(project_dir, "pubkey.gpg")
+ if not check_signed_rpms(project_dir, user_name, project_name, opts):
+ failed = False
+
+ if not check_pubkey(pubkey_path, user_name, project_name, opts):
+ failed = False
+
+ if failed:
+ with open("/tmp/users_failed.txt", "a") as handle:
+ handle.write("{}\n".format(user_name))
+ else:
+ with open("/tmp/users_done.txt", "a") as handle:
+ handle.write("{}\n".format(user_name))
+
+if __name__ == "__main__":
+ if pwd.getpwuid(os.getuid())[0] != "copr":
+ print("This script should be executed under the `copr` user")
+ sys.exit(1)
+ else:
+ main()
9 years, 3 months
[copr] master: [copr] monitor page redone: show version for each chroot (78e2557)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 78e2557a2b5c10cd915a7125fa09d58a358dd838
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Wed Feb 4 18:10:24 2015 +0100
[copr] monitor page redone: show version for each chroot
>---------------------------------------------------------------
frontend/copr-frontend.spec | 1 +
frontend/coprs_frontend/coprs/logic/api_logic.py | 37 ++++++++--
.../coprs_frontend/coprs/logic/builds_logic.py | 70 +++++++++++--------
frontend/coprs_frontend/coprs/static/copr.css | 14 ++--
frontend/coprs_frontend/coprs/templates/api.html | 8 +-
.../coprs/templates/coprs/detail/monitor.html | 30 +++++----
.../coprs/views/coprs_ns/coprs_builds.py | 3 +
.../tests/test_logic/test_builds_logic.py | 2 +-
.../test_views/test_coprs_ns/test_coprs_builds.py | 34 ++++++----
9 files changed, 123 insertions(+), 76 deletions(-)
diff --git a/frontend/copr-frontend.spec b/frontend/copr-frontend.spec
index ab2acba..cd50598 100644
--- a/frontend/copr-frontend.spec
+++ b/frontend/copr-frontend.spec
@@ -167,6 +167,7 @@ service httpd condrestart
%ghost %{_sharedstatedir}/copr/data/copr.db
%defattr(644, copr-fe, copr-fe, 755)
+%dir %{_var}/log/copr
%ghost %{_var}/log/copr/*.log
%defattr(600, copr-fe, copr-fe, 700)
diff --git a/frontend/coprs_frontend/coprs/logic/api_logic.py b/frontend/coprs_frontend/coprs/logic/api_logic.py
index 19c98c2..93c7568 100644
--- a/frontend/coprs_frontend/coprs/logic/api_logic.py
+++ b/frontend/coprs_frontend/coprs/logic/api_logic.py
@@ -49,12 +49,33 @@ class MonitorWrapper(object):
BuildWrapper(build).to_dict()
for build in self.monitor_data["builds"]
]
- out["packages"] = [
- {
- "pkg_name": pkg[0],
- "pkg_version": pkg[1],
- "results": dict(zip(chroots, pkg[2]))
- }
- for pkg in self.monitor_data["packages"]
- ]
+
+ packages_fixed = []
+ for (pkg_name, results_by_chroot) in self.monitor_data["packages"]:
+ results = {}
+ for chroot_name, (build_id, status, pkg_version, _) in zip(chroots, results_by_chroot):
+ if status is None or pkg_version is None:
+ results[chroot_name] = None
+ else:
+ results[chroot_name] = dict(build_id=build_id,
+ status=status,
+ pkg_version=pkg_version)
+
+ packages_fixed.append({
+ "pkg_name": pkg_name,
+ "pkg_version": None, # legacy
+ "results": results
+ })
+
+ out["packages"] = packages_fixed
+ #
+ # [
+ # {
+ # "pkg_name": pkg_name,
+ # "pkg_version": None, # legacy
+ # "results": dict(zip(chroots, results_by_chroot))
+ # }
+ # for (pkg_name, results_by_chroot)
+ # in self.monitor_data["packages"]
+ # ]
return out
diff --git a/frontend/coprs_frontend/coprs/logic/builds_logic.py b/frontend/coprs_frontend/coprs/logic/builds_logic.py
index a6a50f6..8283d5e 100644
--- a/frontend/coprs_frontend/coprs/logic/builds_logic.py
+++ b/frontend/coprs_frontend/coprs/logic/builds_logic.py
@@ -1,5 +1,7 @@
+from collections import defaultdict
import json
import os
+import pprint
import time
from sqlalchemy import or_
from sqlalchemy import and_
@@ -15,6 +17,8 @@ from coprs.constants import DEFAULT_BUILD_TIMEOUT, MAX_BUILD_TIMEOUT
from coprs.logic import coprs_logic
from coprs.logic import users_logic
+log = app.logger
+
class BuildsLogic(object):
@@ -264,7 +268,7 @@ class BuildsLogic(object):
@classmethod
def get_multiply_by_copr(cls, copr):
- """ Get collection of builds in copr
+ """ Get collection of builds in copr sorted by build_id descending
:arg copr: object of copr
"""
@@ -278,50 +282,55 @@ class BuildsMonitorLogic(object):
@classmethod
def get_monitor_data(cls, copr):
+ # builds are sorted by build id descending
builds = BuildsLogic.get_multiply_by_copr(copr).all()
- # please don"t waste time trying to decipher this
- # the only reason why this is necessary is non-existent
- # database design
- #
- # loop goes through builds trying to approximate
- # per-package results based on previous builds
- # - it can"t determine build results if build contains
- # more than one package as this data is not available
-
chroots = set(chroot.name for chroot in copr.active_chroots)
- latest_build = None
if builds:
latest_build = builds[0]
- chroots.union([chroot.name for chroot
- in latest_build.build_chroots])
+ chroots.union([chroot.name for chroot in latest_build.build_chroots])
+ else:
+ latest_build = None
chroots = sorted(chroots)
- out = []
- packages = []
- for build in builds:
- chroot_results = dict(
- [(chroot.name, chroot.state) for chroot in build.build_chroots])
- build_results = []
- for chroot_name in chroots:
- if chroot_name in chroot_results:
- results = chroot_results[chroot_name]
- else:
- results = None
+ # { pkg_name -> { chroot -> (build_id, pkg_version, status) }}
+ build_result_by_pkg_chroot = defaultdict(lambda: defaultdict(lambda: None))
- build_results.append((build.id, results, chroot_name))
+ # collect information about pkg version and build states
+ for build in builds:
+ chroot_results = {chroot.name: chroot.state for chroot in build.build_chroots}
for pkg_url in build.pkgs.split():
pkg = os.path.basename(pkg_url)
pkg_name = helpers.parse_package_name(pkg)
- if pkg_name in out:
- continue
+ for chroot_name, state in chroot_results.items():
+ # set only latest version/state
+ if build_result_by_pkg_chroot[pkg_name][chroot_name] is None:
+ build_result_by_pkg_chroot[pkg_name][chroot_name] = (build.id, build.pkg_version, state)
+
+ # "transpose" data to present build status per package
+ packages = []
+ for pkg_name, chroot_dict in build_result_by_pkg_chroot.items():
+ br = []
+ try:
+ latest_build_id = max([build_id for build_id, pkg_version, state
+ in chroot_dict.values()])
+ except ValueError:
+ latest_build_id = None
+
+ for chroot_name in chroots:
+ chroot_result = chroot_dict.get(chroot_name)
+ if chroot_result:
+ build_id, pkg_version, state = chroot_result
+ br.append((build_id, state, pkg_version, chroot_name))
+ else:
+ br.append((latest_build_id, None, None, chroot_name))
+
+ packages.append((pkg_name, br))
- packages.append((pkg_name, build.pkg_version, build_results))
- out.append(pkg_name)
- packages.sort()
+ packages.sort()
result = {
"builds": builds,
@@ -329,4 +338,5 @@ class BuildsMonitorLogic(object):
"packages": packages,
"latest_build": latest_build,
}
+ app.logger.debug("Monitor data: \n{}".format(pprint.pformat(result)))
return result
diff --git a/frontend/coprs_frontend/coprs/static/copr.css b/frontend/coprs_frontend/coprs/static/copr.css
index d78df1e..71fbdf5 100644
--- a/frontend/coprs_frontend/coprs/static/copr.css
+++ b/frontend/coprs_frontend/coprs/static/copr.css
@@ -394,31 +394,31 @@ tr.build-row-skipped {
color: black;
}
-.build-pending {
+.build-pending,.build-pending>a {
color: #55b;
}
-.build-starting {
+.build-starting,.build-starting>a {
color: #c84;
}
-.build-running {
+.build-running,.build-running>a {
color: #c84;
}
-.build-succeeded {
+.build-succeeded,.build-succeeded>a {
color: #272;
}
-.build-skipped {
+.build-skipped,.build-skipped>a {
color: #272;
}
-.build-failed {
+.build-failed,.build-failed>a {
color: #c44;
}
-.build-cancelled {
+.build-cancelled,.build-cancelled>a {
color: #666;
}
diff --git a/frontend/coprs_frontend/coprs/templates/api.html b/frontend/coprs_frontend/coprs/templates/api.html
index a38c389..4e5bd2e 100644
--- a/frontend/coprs_frontend/coprs/templates/api.html
+++ b/frontend/coprs_frontend/coprs/templates/api.html
@@ -240,11 +240,11 @@ copr_url = {{ ('https://' + config['PUBLIC_COPR_HOSTNAME'])| fix_url_https_front
"packages": [
{
"pkg_name": "python-copr-client",
- "pkg_version": "1.43",
+ "pkg_version": null, # not used anymore
"results": {
- "epel-5-x86_64": [9578, "failed"],
- "epel-7-x86_64": [9578, "failed"],
- "fedora-20-x86_64": [9578, "skipped"]
+ "epel-5-x86_64": {"build_id": 9578, "status": "failed", "pkg_version": "1.2-1.fc20"],
+ "epel-7-x86_64": {"build_id": 9578, "status": "failed", "pkg_version": "1.2-1.fc20"],
+ "fedora-20-x86_64": null # this chroot was never build,
}
}
]
diff --git a/frontend/coprs_frontend/coprs/templates/coprs/detail/monitor.html b/frontend/coprs_frontend/coprs/templates/coprs/detail/monitor.html
index 168a9b9..3ce2642 100644
--- a/frontend/coprs_frontend/coprs/templates/coprs/detail/monitor.html
+++ b/frontend/coprs_frontend/coprs/templates/coprs/detail/monitor.html
@@ -13,7 +13,7 @@
<tr></tr>
<tr>
<th rowspan="2">Package</th>
- <th rowspan="2">Version</th>
+ <!--<th rowspan="2">Version</th>-->
{% for i, chroot in oses %}
<th colspan="{{i}}">
{{ chroot|capitalize }}
@@ -27,26 +27,30 @@
</th>
{% endfor %}
</tr>
- {% for package, version, states in packages %}
+ {% for package, states_by_chroot in packages %}
<tr>
<td>{{ package }}</td>
- <td>
- {% if version: %}
- {{ version }}
- {% else %}
- -
- {% endif %}
- </td>
- {% for build_id, state, chroot in states %}
- <td class="centered build-{{ state }}">
+ {% for build_id, state, pkg_version, chroot in states_by_chroot %}
+ <td class="centered">
{% if state %}
- {{ state }}
+ <a class="build-{{ state }}"
+ href="{{ url_for('coprs_ns.copr_build',
+ username=copr.owner.name,
+ coprname=copr.name,
+ build_id=build_id) }}">
+ {{ state }}
+ </a> <br />
+ {% if pkg_version %}
+ <small> {{ pkg_version }} </small>
+ {% endif %}
{% else %}
+ {% if build_id %}
<a href="{{ url_for('coprs_ns.copr_repeat_build',
username=copr.owner.name,
coprname=copr.name,
build_id=build_id,
- chroot=chroot) }}">resubmit</a>
+ chroot=chroot) }}">new build</a>
+ {% endif %}
{% endif %}
</td>
{% endfor %}
diff --git a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
index 35ebc0b..fe076f4 100644
--- a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
+++ b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
@@ -189,6 +189,9 @@ def copr_repeat_build(username, coprname, build_id, page=1):
return page_not_found(
"Copr {0}/{1} does not exist.".format(username, coprname))
+ if not flask.g.user.can_build_in(build.copr):
+ flask.flash("You are not allowed to repeat this build.")
+
form = forms.BuildFormFactory.create_form_cls(copr.active_chroots)(
pkgs=build.pkgs, enable_net=build.enable_net,
)
diff --git a/frontend/coprs_frontend/tests/test_logic/test_builds_logic.py b/frontend/coprs_frontend/tests/test_logic/test_builds_logic.py
index ef43cd0..055978a 100644
--- a/frontend/coprs_frontend/tests/test_logic/test_builds_logic.py
+++ b/frontend/coprs_frontend/tests/test_logic/test_builds_logic.py
@@ -50,7 +50,7 @@ class TestBuildsLogic(CoprsTestCase):
def test_monitor_logic(self, f_users, f_coprs, f_mock_chroots_many, f_build_many_chroots, f_db):
copr = self.c1
md = BuildsMonitorLogic.get_monitor_data(copr)
- results = md["packages"][-1][2]
+ results = md["packages"][-1][-1]
mchroots = md["chroots"]
for chr, res in zip(mchroots, results):
diff --git a/frontend/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_builds.py b/frontend/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_builds.py
index 6a72158..393b00e 100644
--- a/frontend/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_builds.py
+++ b/frontend/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_builds.py
@@ -145,7 +145,7 @@ class TestCoprDeleteBuild(CoprsTestCase):
class TestCoprRepeatBuild(CoprsTestCase):
@TransactionDecorator("u1")
- def test_copr_build_chroots_subset_preserved_on_build_repeat(
+ def test_copr_build_basic_build_repeat(
self, f_users, f_coprs, f_mock_chroots_many, f_db):
self.b_few_chroots = models.Build(
id=2345,
@@ -181,15 +181,19 @@ class TestCoprRepeatBuild(CoprsTestCase):
data={},
follow_redirects=True)
- assert "Build was resubmitted" in r.data
+ assert r.status_code == 200
+ assert self.b_few_chroots.pkgs in r.data
+ assert "Adding Build for user1/foocopr" in r.data
- new_build = self.models.Build.query.filter(
- self.models.Build.id != 2345).first()
+ # TODO: maybe test, that only failed chroots are selected
- expected_build_chroots_name_set = set(self.status_by_chroot.keys())
- result_build_chroots_name_set = set([c.name for c in new_build.chroots])
-
- assert result_build_chroots_name_set == expected_build_chroots_name_set
+ # new_build = self.models.Build.query.filter(
+ # self.models.Build.id != 2345).first()
+ #
+ # expected_build_chroots_name_set = set(self.status_by_chroot.keys())
+ # result_build_chroots_name_set = set([c.name for c in new_build.chroots])
+ #
+ # assert result_build_chroots_name_set == expected_build_chroots_name_set
@TransactionDecorator("u1")
def test_copr_build_submitter_can_repeat_build(self, f_users,
@@ -207,10 +211,12 @@ class TestCoprRepeatBuild(CoprsTestCase):
data={},
follow_redirects=True)
- assert "Build was resubmitted" in r.data
- assert len(self.models.Build.query
- .filter(self.models.Build.pkgs == pkgs)
- .all()) == 2
+ assert "Adding Build for user1/foocopr" in r.data
+ assert r.status_code == 200
+ # assert "Build was resubmitted" in r.data
+ # assert len(self.models.Build.query
+ # .filter(self.models.Build.pkgs == pkgs)
+ # .all()) == 2
@TransactionDecorator("u2")
def test_copr_build_non_submitter_cannot_repeat_build(self, f_users,
@@ -225,4 +231,6 @@ class TestCoprRepeatBuild(CoprsTestCase):
data={},
follow_redirects=True)
- assert "t have permissions to build" in r.data
+ # import ipdb; ipdb.set_trace()
+ assert "You are not allowed to repeat this build." in r.data
+
9 years, 3 months
[copr] master: [frontend] [rhbz:#1160370, #1173165] sub-page on resubmit action, where user could change preselected build chroots. (9a39959)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 9a399599364b1201c8d099e37ac1df75b5aa6e17
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Wed Feb 4 13:03:20 2015 +0100
[frontend] [rhbz:#1160370, #1173165] sub-page on resubmit action, where user could change preselected build chroots.
>---------------------------------------------------------------
frontend/coprs_frontend/config/copr.conf | 3 +-
frontend/coprs_frontend/coprs/config.py | 2 +-
.../coprs_frontend/coprs/logic/builds_logic.py | 6 ++-
frontend/coprs_frontend/coprs/models.py | 17 +++++++
.../templates/coprs/detail/_builds_forms.html | 2 +-
.../coprs/templates/coprs/detail/monitor.html | 5 +-
.../coprs/views/coprs_ns/coprs_builds.py | 49 +++++++++++--------
frontend/coprs_frontend/tests/test_models.py | 28 +++++++++++
frontend/run_tests.sh | 4 +-
9 files changed, 86 insertions(+), 30 deletions(-)
diff --git a/frontend/coprs_frontend/config/copr.conf b/frontend/coprs_frontend/config/copr.conf
index a039bea..ab4fb96 100644
--- a/frontend/coprs_frontend/config/copr.conf
+++ b/frontend/coprs_frontend/config/copr.conf
@@ -28,7 +28,8 @@ SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://copr-fe:coprpass@/coprdb'
# where to send notice about raised legal flag
#SEND_LEGAL_TO = ['root@localhost', 'somebody(a)somewhere.com']
-DEBUG = False
+# DEBUG = False
+DEBUG = True
SQLALCHEMY_ECHO = False
#CSRF_ENABLED = True
diff --git a/frontend/coprs_frontend/coprs/config.py b/frontend/coprs_frontend/coprs/config.py
index 6c83748..557dcc6 100644
--- a/frontend/coprs_frontend/coprs/config.py
+++ b/frontend/coprs_frontend/coprs/config.py
@@ -28,7 +28,7 @@ class Config(object):
# logging options
SEND_LOGS_TO = ["root@localhost"]
- LOGGING_LEVEL = logging.INFO
+ LOGGING_LEVEL = logging.DEBUG
SEND_LEGAL_TO = ["root@localhost"]
diff --git a/frontend/coprs_frontend/coprs/logic/builds_logic.py b/frontend/coprs_frontend/coprs/logic/builds_logic.py
index d1cd9b8..a6a50f6 100644
--- a/frontend/coprs_frontend/coprs/logic/builds_logic.py
+++ b/frontend/coprs_frontend/coprs/logic/builds_logic.py
@@ -4,6 +4,7 @@ import time
from sqlalchemy import or_
from sqlalchemy import and_
+from coprs import app
from coprs import db
from coprs import exceptions
from coprs import models
@@ -309,7 +310,7 @@ class BuildsMonitorLogic(object):
else:
results = None
- build_results.append((build.id, results))
+ build_results.append((build.id, results, chroot_name))
for pkg_url in build.pkgs.split():
pkg = os.path.basename(pkg_url)
@@ -322,9 +323,10 @@ class BuildsMonitorLogic(object):
out.append(pkg_name)
packages.sort()
- return {
+ result = {
"builds": builds,
"chroots": chroots,
"packages": packages,
"latest_build": latest_build,
}
+ return result
diff --git a/frontend/coprs_frontend/coprs/models.py b/frontend/coprs_frontend/coprs/models.py
index 506d48a..e2d48c6 100644
--- a/frontend/coprs_frontend/coprs/models.py
+++ b/frontend/coprs_frontend/coprs/models.py
@@ -295,6 +295,23 @@ class Build(db.Model, helpers.Serializer):
def chroot_states(self):
return map(lambda chroot: chroot.status, self.build_chroots)
+ def get_chroots_by_status(self, statuses=None):
+ """
+ Get build chroots with states which present in `states` list
+ If states == None, function returns build_chroots
+ """
+ chroot_states_map = dict(zip(self.build_chroots, self.chroot_states))
+ if statuses is not None:
+ statuses = set(statuses)
+ else:
+ return self.build_chroots
+
+ return [
+ chroot for chroot, status in chroot_states_map.items()
+ if status in statuses
+ ]
+
+
@property
def has_pending_chroot(self):
# FIXME bad name
diff --git a/frontend/coprs_frontend/coprs/templates/coprs/detail/_builds_forms.html b/frontend/coprs_frontend/coprs/templates/coprs/detail/_builds_forms.html
index 2ec2429..8c61ffb 100644
--- a/frontend/coprs_frontend/coprs/templates/coprs/detail/_builds_forms.html
+++ b/frontend/coprs_frontend/coprs/templates/coprs/detail/_builds_forms.html
@@ -76,7 +76,7 @@
{% if build.repeatable %}
<form action="{{ url_for('coprs_ns.copr_repeat_build', username=build.copr.owner.name, coprname=build.copr.name, build_id=build.id)}}" method="post">
<input type="hidden" value="page" value="{{ page }}">
- <input type="submit" value="Repeat">
+ <input type="submit" value="Resubmit">
</form>
{% endif %}
{% endmacro %}
diff --git a/frontend/coprs_frontend/coprs/templates/coprs/detail/monitor.html b/frontend/coprs_frontend/coprs/templates/coprs/detail/monitor.html
index 197b0ac..168a9b9 100644
--- a/frontend/coprs_frontend/coprs/templates/coprs/detail/monitor.html
+++ b/frontend/coprs_frontend/coprs/templates/coprs/detail/monitor.html
@@ -37,7 +37,7 @@
-
{% endif %}
</td>
- {% for build_id, state in states %}
+ {% for build_id, state, chroot in states %}
<td class="centered build-{{ state }}">
{% if state %}
{{ state }}
@@ -45,7 +45,8 @@
<a href="{{ url_for('coprs_ns.copr_repeat_build',
username=copr.owner.name,
coprname=copr.name,
- build_id=build_id) }}">resubmit</a>
+ build_id=build_id,
+ chroot=chroot) }}">resubmit</a>
{% endif %}
</td>
{% endfor %}
diff --git a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
index 938142d..35ebc0b 100644
--- a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
+++ b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
@@ -1,6 +1,8 @@
import flask
+from flask import request
import re
+from coprs import app
from coprs import db
from coprs import forms
from coprs import helpers
@@ -12,7 +14,7 @@ from coprs.views.misc import login_required, page_not_found
from coprs.views.coprs_ns import coprs_ns
from coprs.exceptions import (ActionInProgressException,
- InsufficientRightsException)
+ InsufficientRightsException, MalformedArgumentException)
@coprs_ns.route("/build/<int:build_id>/")
@@ -187,28 +189,33 @@ def copr_repeat_build(username, coprname, build_id, page=1):
return page_not_found(
"Copr {0}/{1} does not exist.".format(username, coprname))
- try:
- builds_logic.BuildsLogic.add(
- user=flask.g.user,
- pkgs=build.pkgs,
- copr=copr,
- repos=copr.repos,
- memory_reqs=build.memory_reqs,
- timeout=build.timeout,
- chroots=build.chroots,
- )
-
- except (ActionInProgressException, InsufficientRightsException) as e:
- db.session.rollback()
- flask.flash(str(e))
+ form = forms.BuildFormFactory.create_form_cls(copr.active_chroots)(
+ pkgs=build.pkgs, enable_net=build.enable_net,
+ )
+
+ # remove all checkboxes by default
+ for ch in copr.active_chroots:
+ field = getattr(form, ch.name)
+ field.data = False
+
+ chroot_to_build = request.args.get("chroot")
+ app.logger.debug("got param chroot: {}".format(chroot_to_build))
+ if chroot_to_build:
+ # set single checkbox if chroot query arg was provided
+ if hasattr(form, chroot_to_build):
+ getattr(form, chroot_to_build).data = True
else:
- db.session.commit()
- flask.flash("Build was resubmitted")
+ # set checkbox on the failed chroots
+ chroots_to_select = set(ch.name for ch in build.get_chroots_by_status([
+ helpers.StatusEnum('failed'), helpers.StatusEnum('canceled'),
+ ]))
- return flask.redirect(flask.url_for("coprs_ns.copr_builds",
- username=username,
- coprname=coprname,
- page=page))
+ for ch in build.chroots:
+ if ch.name in chroots_to_select:
+ getattr(form, ch.name).data = True
+
+ return flask.render_template("coprs/detail/add_build.html",
+ copr=copr, form=form)
@coprs_ns.route("/<username>/<coprname>/delete_build/<int:build_id>/",
diff --git a/frontend/coprs_frontend/tests/test_models.py b/frontend/coprs_frontend/tests/test_models.py
new file mode 100644
index 0000000..f14448c
--- /dev/null
+++ b/frontend/coprs_frontend/tests/test_models.py
@@ -0,0 +1,28 @@
+from copy import deepcopy
+import six
+
+if six.PY3:
+ from unittest import mock
+else:
+ import mock
+
+from tests.coprs_test_case import CoprsTestCase
+
+
+class TestBuildModel(CoprsTestCase):
+
+ def test_get_chroots_by_status(self, f_users, f_coprs,
+ f_builds, f_mock_chroots,
+ f_mock_chroots_many, f_build_many_chroots, f_db):
+
+ self.db.session.commit()
+
+ expected_on_none = set([ch_name for ch_name, status in self.status_by_chroot.items()])
+ result_on_none = set([ch.name for ch in self.b_many_chroots.get_chroots_by_status()])
+ assert result_on_none == expected_on_none
+
+ expected_1 = set([ch_name for ch_name, status in self.status_by_chroot.items()
+ if status in [0, 1, 3]])
+
+ result_1 = set([ch.name for ch in self.b_many_chroots.get_chroots_by_status(statuses=[0, 1, 3])])
+ assert expected_1 == result_1
diff --git a/frontend/run_tests.sh b/frontend/run_tests.sh
index 2ecd9b9..22c7ad7 100755
--- a/frontend/run_tests.sh
+++ b/frontend/run_tests.sh
@@ -1,6 +1,6 @@
#!/bin/sh
cd coprs_frontend
-COPR_CONFIG="$(pwd)/config/copr_unit_test.conf" python -m pytest tests -s \
- --cov-report term-missing --cov coprs $@
+COPR_CONFIG="$(pwd)/config/copr_unit_test.conf" python -m pytest tests -s $@ # \
+ #--cov-report term-missing --cov coprs $@
9 years, 3 months
[copr] master: [frontend] added filelog for frontend (1d92c0d)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 1d92c0d6e8257353c3faa14a763ed67e29d17632
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Wed Feb 4 11:19:21 2015 +0100
[frontend] added filelog for frontend
>---------------------------------------------------------------
frontend/conf/logrotate | 11 ++++++
frontend/copr-frontend.spec | 10 ++++++
frontend/coprs_frontend/config/copr.conf | 3 ++
frontend/coprs_frontend/coprs/__init__.py | 3 ++
frontend/coprs_frontend/coprs/config.py | 5 ++-
frontend/coprs_frontend/coprs/log.py | 49 +++++++++++++++++++---------
6 files changed, 64 insertions(+), 17 deletions(-)
diff --git a/frontend/conf/logrotate b/frontend/conf/logrotate
new file mode 100644
index 0000000..9f0b99d
--- /dev/null
+++ b/frontend/conf/logrotate
@@ -0,0 +1,11 @@
+# logrotation file for Copr frontend
+
+/var/log/copr/*.log {
+ weekly
+ rotate 5
+ copytruncate
+ compress
+ notifempty
+ missingok
+ create 644 copr-fe copr-fe
+}
diff --git a/frontend/copr-frontend.spec b/frontend/copr-frontend.spec
index 89aed47..ab2acba 100644
--- a/frontend/copr-frontend.spec
+++ b/frontend/copr-frontend.spec
@@ -126,6 +126,11 @@ mv %{buildroot}%{_datadir}/copr/coprs_frontend/config/* %{buildroot}%{_sysconfdi
rm %{buildroot}%{_datadir}/copr/coprs_frontend/CONTRIBUTION_GUIDELINES
touch %{buildroot}%{_sharedstatedir}/copr/data/copr.db
+install -d %{buildroot}%{_var}/log/copr
+install -d %{buildroot}%{_sysconfdir}/logrotate.d
+cp -a conf/logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
+touch %{buildroot}%{_var}/log/copr/frontend.log
+
%check
%if %{with_test} && "%{_arch}" == "x86_64"
pushd coprs_frontend
@@ -151,6 +156,8 @@ service httpd condrestart
%dir %{_sharedstatedir}/copr
%{_datadir}/copr/coprs_frontend
+%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
+
%defattr(-, copr-fe, copr-fe, -)
%dir %{_sharedstatedir}/copr/data
%dir %{_sharedstatedir}/copr/data/openid_store
@@ -159,6 +166,9 @@ service httpd condrestart
%ghost %{_sharedstatedir}/copr/data/copr.db
+%defattr(644, copr-fe, copr-fe, 755)
+%ghost %{_var}/log/copr/*.log
+
%defattr(600, copr-fe, copr-fe, 700)
%config(noreplace) %{_sysconfdir}/copr/copr.conf
%config(noreplace) %{_sysconfdir}/copr/copr_devel.conf
diff --git a/frontend/coprs_frontend/config/copr.conf b/frontend/coprs_frontend/config/copr.conf
index 3572b44..a039bea 100644
--- a/frontend/coprs_frontend/config/copr.conf
+++ b/frontend/coprs_frontend/config/copr.conf
@@ -69,3 +69,6 @@ SEND_EMAILS = True
#}
PUBLIC_COPR_HOSTNAME = "copr.fedoraproject.org"
+
+# primary
+LOG_FILENAME = "/var/log/copr/frontend.log"
diff --git a/frontend/coprs_frontend/coprs/__init__.py b/frontend/coprs_frontend/coprs/__init__.py
index 8d1e785..de5fc5d 100644
--- a/frontend/coprs_frontend/coprs/__init__.py
+++ b/frontend/coprs_frontend/coprs/__init__.py
@@ -27,6 +27,7 @@ whooshee = Whooshee(app)
import coprs.filters
import coprs.log
+from coprs.log import setup_log
import coprs.models
import coprs.whoosheers
@@ -48,6 +49,8 @@ from coprs.views.recent_ns import recent_general
from .context_processors import include_banner
+setup_log()
+
app.register_blueprint(api_ns.api_ns)
app.register_blueprint(admin_ns.admin_ns)
app.register_blueprint(coprs_ns.coprs_ns)
diff --git a/frontend/coprs_frontend/coprs/config.py b/frontend/coprs_frontend/coprs/config.py
index 50c1f03..6c83748 100644
--- a/frontend/coprs_frontend/coprs/config.py
+++ b/frontend/coprs_frontend/coprs/config.py
@@ -28,7 +28,7 @@ class Config(object):
# logging options
SEND_LOGS_TO = ["root@localhost"]
- LOGGING_LEVEL = logging.ERROR
+ LOGGING_LEVEL = logging.INFO
SEND_LEGAL_TO = ["root@localhost"]
@@ -40,6 +40,9 @@ class Config(object):
PUBLIC_COPR_HOSTNAME = "copr-fe-dev.cloud.fedoraproject.org"
+ # primary log file
+ LOG_FILENAME = "/var/log/copr/frontend.log"
+
class ProductionConfig(Config):
DEBUG = False
diff --git a/frontend/coprs_frontend/coprs/log.py b/frontend/coprs_frontend/coprs/log.py
index 2f05da3..90d2022 100644
--- a/frontend/coprs_frontend/coprs/log.py
+++ b/frontend/coprs_frontend/coprs/log.py
@@ -1,12 +1,10 @@
import logging
-import logging.handlers
+from logging import Formatter
+from logging.handlers import SMTPHandler, WatchedFileHandler
from coprs import app
-send_logs_to = app.config.get("SEND_LOGS_TO")
-level = app.config.get("LOGGING_LEVEL")
-
-formatter = logging.Formatter("""
+mail_error_formatter = Formatter("""
Message type: %(levelname)s
Location: %(pathname)s:%(lineno)d
Module: %(module)s
@@ -18,14 +16,33 @@ Message:
%(message)s
""")
-if not app.debug:
- mail_handler = logging.handlers.SMTPHandler(
- "127.0.0.1",
- "copr-fe-error@{0}".format(
- app.config["SERVER_NAME"] or "fedorahosted.org"),
- send_logs_to,
- "Yay, error in copr frontend occured!")
-
- mail_handler.setFormatter(formatter)
- mail_handler.setLevel(level)
- app.logger.addHandler(mail_handler)
+
+default_formatter = Formatter(
+ "%(asctime)s [%(levelname)s]"
+ "[%(pathname)s:%(lineno)d|%(module)s:%(funcName)s] %(message)s"
+)
+
+
+def setup_log():
+ if not app.debug:
+ # Send critical message by email
+ mail_handler = SMTPHandler(
+ "127.0.0.1",
+ "copr-fe-error@{0}".format(
+ app.config["SERVER_NAME"] or "fedorahosted.org"),
+ app.config.get("SEND_LOGS_TO"),
+ "Yay, error in copr frontend occured!")
+
+ mail_handler.setFormatter(mail_error_formatter)
+ mail_handler.setLevel(logging.CRITICAL)
+ app.logger.addHandler(mail_handler)
+
+ # store all logs to the file log
+ log_filename = app.config.get("LOG_FILENAME")
+ handler = WatchedFileHandler(log_filename)
+ handler.setFormatter(default_formatter)
+ log_level = app.config.get("LOGGING_LEVEL", logging.INFO)
+ handler.setLevel(log_level)
+ app.logger.addHandler(handler)
+
+ app.logger.info("logging configuration finished")
9 years, 3 months
[copr] master: [frontend] Added "-%{release}" to the build version on the copr pages. (ea2b258)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit ea2b25808b383948032e74a0b429ea02fb56ec48
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Mon Feb 2 10:28:50 2015 +0100
[frontend] Added "-%{release}" to the build version on the copr pages.
>---------------------------------------------------------------
frontend/copr-frontend.spec | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/frontend/copr-frontend.spec b/frontend/copr-frontend.spec
index fb814a5..89aed47 100644
--- a/frontend/copr-frontend.spec
+++ b/frontend/copr-frontend.spec
@@ -119,7 +119,7 @@ install -d %{buildroot}%{_sharedstatedir}/copr/data/whooshee/copr_user_whoosheer
cp -a coprs_frontend/* %{buildroot}%{_datadir}/copr/coprs_frontend
-sed -i "s/__RPM_BUILD_VERSION/%{version}/" %{buildroot}%{_datadir}/copr/coprs_frontend/coprs/templates/layout.html
+sed -i "s/__RPM_BUILD_VERSION/%{version}-%{release}/" %{buildroot}%{_datadir}/copr/coprs_frontend/coprs/templates/layout.html
mv %{buildroot}%{_datadir}/copr/coprs_frontend/coprs.conf.example ./
mv %{buildroot}%{_datadir}/copr/coprs_frontend/config/* %{buildroot}%{_sysconfdir}/copr
9 years, 3 months
[copr] master: [backend] update tests, don't connect to redis during unittest run. (aaf36af)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit aaf36af11892f760709dbb1efbbf8c2a2255bb1b
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Mon Feb 2 10:04:22 2015 +0100
[backend] update tests, don't connect to redis during unittest run.
>---------------------------------------------------------------
backend/tests/deamons/test_dispatcher.py | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/backend/tests/deamons/test_dispatcher.py b/backend/tests/deamons/test_dispatcher.py
index c56bbd4..23e3a11 100644
--- a/backend/tests/deamons/test_dispatcher.py
+++ b/backend/tests/deamons/test_dispatcher.py
@@ -33,6 +33,14 @@ COPR_NAME = "copr_name"
COPR_VENDOR = "vendor"
+(a)pytest.yield_fixture
+def mc_register_build_result(*args, **kwargs):
+ patcher = mock.patch("backend.daemons.dispatcher.register_build_result")
+ obj = patcher.start()
+ yield obj
+ patcher.stop()
+
+
class TestDispatcher(object):
def setup_method(self, method):
@@ -172,7 +180,7 @@ class TestDispatcher(object):
with pytest.raises(CoprWorkerError):
self.worker.spawn_instance_with_check()
- def test_spawn_instance_with_check_ansible_error_reraised(self, init_worker):
+ def test_spawn_instance_with_check_ansible_error_reraised(self, init_worker, mc_register_build_result):
self.worker.spawn_instance = MagicMock()
self.worker.spawn_instance.side_effect = AnsibleError("foobar")
@@ -549,7 +557,7 @@ class TestDispatcher(object):
assert not mc_mr.called
@mock.patch("backend.daemons.dispatcher.MockRemote")
- def test_do_job(self, mc_mr_class, init_worker, reg_vm):
+ def test_do_job(self, mc_mr_class, init_worker, reg_vm, mc_register_build_result):
assert not os.path.exists(self.DESTDIR_CHROOT)
self.worker.frontend_callback = self.worker_fe_callback
@@ -558,7 +566,7 @@ class TestDispatcher(object):
assert os.path.exists(self.DESTDIR_CHROOT)
@mock.patch("backend.daemons.dispatcher.MockRemote")
- def test_do_job_updates_details(self, mc_mr_class, init_worker, reg_vm):
+ def test_do_job_updates_details(self, mc_mr_class, init_worker, reg_vm, mc_register_build_result):
assert not os.path.exists(self.DESTDIR_CHROOT)
mc_mr_class.return_value.build_pkg.return_value = {
"results": self.test_time,
@@ -571,7 +579,8 @@ class TestDispatcher(object):
assert os.path.exists(self.DESTDIR_CHROOT)
@mock.patch("backend.daemons.dispatcher.MockRemote")
- def test_do_job_mr_error(self, mc_mr_class, init_worker, reg_vm):
+ def test_do_job_mr_error(self, mc_mr_class, init_worker,
+ reg_vm, mc_register_build_result):
mc_mr_class.return_value.build_pkg.side_effect = MockRemoteError("foobar")
self.worker.frontend_callback = self.worker_fe_callback
9 years, 3 months
[copr] master: mark license as license in spec (de9bcfe)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit de9bcfee34bde0241ed127c3a1b0f71de9f6c08a
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Feb 2 09:01:57 2015 +0100
mark license as license in spec
>---------------------------------------------------------------
backend/copr-backend.spec | 4 ++--
cli/copr-cli.spec | 5 +++--
frontend/copr-frontend.spec | 3 ++-
java/copr-java.spec | 6 ++++--
keygen/copr-keygen.spec | 3 ++-
python/python-copr.spec | 8 +++++---
selinux/copr-selinux.spec | 2 +-
7 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/backend/copr-backend.spec b/backend/copr-backend.spec
index d7e869d..ec3dc85 100644
--- a/backend/copr-backend.spec
+++ b/backend/copr-backend.spec
@@ -171,7 +171,7 @@ useradd -r -g copr -G lighttpd -s /bin/bash -c "COPR user" copr
%systemd_postun_with_restart copr-backend.service
%files
-%doc LICENSE
+%license LICENSE
%{_datadir}/copr/*
%dir %{_sharedstatedir}/copr
@@ -201,7 +201,7 @@ useradd -r -g copr -G lighttpd -s /bin/bash -c "COPR user" copr
%config(noreplace) %attr(0600, root, root) %{_sysconfdir}/sudoers.d/copr
%files doc
-%doc LICENSE
+%license LICENSE
%doc %{_pkgdocdir}/python-doc
%exclude %{_pkgdocdir}/lighttpd
%exclude %{_pkgdocdir}/playbooks
diff --git a/cli/copr-cli.spec b/cli/copr-cli.spec
index dca3d3f..44ebc03 100644
--- a/cli/copr-cli.spec
+++ b/cli/copr-cli.spec
@@ -76,7 +76,8 @@ install -p -m 644 man/copr-cli.1 %{buildroot}/%{_mandir}/man1/
install -p man/copr.1 %{buildroot}/%{_mandir}/man1/
%files
-%doc LICENSE README.rst
+%license LICENSE
+%doc README.rst
%{_bindir}/copr-cli
%{python_sitelib}/*
%{_mandir}/man1/copr-cli.1*
@@ -85,8 +86,8 @@ install -p man/copr.1 %{buildroot}/%{_mandir}/man1/
%if 0%{?fedora}
+%license LICENSE
%files doc
-%doc LICENSE
%endif
%changelog
diff --git a/frontend/copr-frontend.spec b/frontend/copr-frontend.spec
index 43e88ac..fb814a5 100644
--- a/frontend/copr-frontend.spec
+++ b/frontend/copr-frontend.spec
@@ -144,7 +144,8 @@ useradd -r -g copr-fe -G copr-fe -d %{_datadir}/copr/coprs_frontend -s /bin/bash
service httpd condrestart
%files
-%doc LICENSE coprs.conf.example
+%license LICENSE
+%doc coprs.conf.example
%dir %{_datadir}/copr
%dir %{_sysconfdir}/copr
%dir %{_sharedstatedir}/copr
diff --git a/java/copr-java.spec b/java/copr-java.spec
index eb0b50e..529bcdf 100644
--- a/java/copr-java.spec
+++ b/java/copr-java.spec
@@ -35,10 +35,12 @@ This package provides %{summary}.
%mvn_install
%files -f .mfiles
-%doc LICENSE NOTICE
+%license LICENSE
+%doc NOTICE
%files javadoc -f .mfiles-javadoc
-%doc LICENSE NOTICE
+%license LICENSE
+%doc NOTICE
%changelog
* Tue Sep 16 2014 Mikolaj Izdebski <mizdebsk(a)redhat.com>
diff --git a/keygen/copr-keygen.spec b/keygen/copr-keygen.spec
index 1a5a1fd..471231a 100644
--- a/keygen/copr-keygen.spec
+++ b/keygen/copr-keygen.spec
@@ -156,7 +156,8 @@ service httpd condrestart
service httpd condrestart
%files
-%doc LICENSE docs/INSTALL.rst docs/README.rst
+%license LICENSE
+%doc docs/INSTALL.rst docs/README.rst
%doc configs/local_settings.py.example
%{_datadir}/copr-keygen/*
diff --git a/python/python-copr.spec b/python/python-copr.spec
index b1a701b..f4e9fc0 100644
--- a/python/python-copr.spec
+++ b/python/python-copr.spec
@@ -149,18 +149,20 @@ popd
%endif # with_python3
%files
-%doc LICENSE README.rst
+%license LICENSE
+%doc README.rst
%{python_sitelib}/*
%if 0%{?with_python3}
%files -n python3-copr
-%doc LICENSE README.rst
+%license LICENSE
+%doc README.rst
%{python3_sitelib}/*
%endif # with_python3
%if 0%{?fedora}
%files -n python-copr-doc
-%doc LICENSE
+%license LICENSE
%doc %{_pkgdocdir}
%endif
diff --git a/selinux/copr-selinux.spec b/selinux/copr-selinux.spec
index 25120c3..facc53f 100644
--- a/selinux/copr-selinux.spec
+++ b/selinux/copr-selinux.spec
@@ -100,7 +100,7 @@ fi
%{_sbindir}/restorecon -rvvi %{_sharedstatedir}/copr
%files
-%doc LICENSE
+%license LICENSE
%{_datadir}/selinux/*/%{modulename}.pp.bz2
# empty, do not distribute it for now
%exclude %{_datadir}/selinux/devel/include/%{moduletype}/%{modulename}.if
9 years, 3 months
[copr] master: 1188022 - accept dash in project name (e923789)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit e923789eceac8442ea5b46ac3aef70ea4d045863
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Feb 2 08:53:19 2015 +0100
1188022 - accept dash in project name
>---------------------------------------------------------------
cli/copr_cli/main.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cli/copr_cli/main.py b/cli/copr_cli/main.py
index f719119..4320b12 100644
--- a/cli/copr_cli/main.py
+++ b/cli/copr_cli/main.py
@@ -153,7 +153,7 @@ class Commands(object):
"""
copr = args.copr
- m = re.match(r"(\w+)/(\w+)", copr)
+ m = re.match(r"(\w+)/(.*)", copr)
if m:
username = m.group(1)
copr = m.group(2)
9 years, 3 months