[copr] master: add build deletion (ee25496)
by Richard Marko
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit ee25496f02524816e1a5d077daffc5413c865626
Author: Richard Marko <rmarko(a)fedoraproject.org>
Date: Sun Jan 12 22:31:48 2014 +0100
add build deletion
Signed-off-by: Richard Marko <rmarko(a)fedoraproject.org>
>---------------------------------------------------------------
backend/actions.py | 62 +++++++++++++++++---
coprs_frontend/coprs/logic/builds_logic.py | 19 ++++++
.../templates/coprs/detail/_builds_forms.html | 8 +++
.../templates/coprs/detail/_builds_table.html | 5 +-
.../coprs/views/coprs_ns/coprs_builds.py | 18 ++++++
.../test_views/test_coprs_ns/test_coprs_builds.py | 39 ++++++++++++
6 files changed, 142 insertions(+), 9 deletions(-)
diff --git a/backend/actions.py b/backend/actions.py
index b2bb6ab..11451cc 100644
--- a/backend/actions.py
+++ b/backend/actions.py
@@ -4,6 +4,9 @@ import os.path
import shutil
import time
+from mockremote import createrepo
+
+
class Action(object):
""" Object to send data back to fronted """
@@ -21,15 +24,57 @@ class Action(object):
""" Handle action (other then builds) - like rename or delete of project """
result = Bunch()
result.id = self.data['id']
- if self.data['action_type'] == 0: # delete
- self.event("Action delete")
- project = self.data['old_value']
- path = os.path.normpath(self.destdir + '/' + project)
- if os.path.exists(path):
- self.event('Removing %s' % path)
- shutil.rmtree(path)
+ if self.data['action_type'] == 0: # delete
+ if self.data['object_type'] == 'copr':
+ self.event("Action delete copr")
+ project = self.data['old_value']
+ path = os.path.normpath(self.destdir + '/' + project)
+ if os.path.exists(path):
+ self.event('Removing copr %s' % path)
+ shutil.rmtree(path)
+
+ elif self.data['object_type'] == 'build':
+ self.event("Action delete build")
+ project = self.data['old_value']
+ packages = map(lambda x:
+ os.path.basename(x).replace('.src.rpm', ''),
+ self.data['new_value'].split())
+
+ path = os.path.join(self.destdir, project)
+
+ self.event("Packages to delete {0}".format(' '.join(packages)))
+ self.event("Copr path {0}".format(path))
+
+ for chroot in os.listdir(path):
+ self.event("In chroot {0}".format(chroot))
+ altered = False
+
+ for pkg in packages:
+ pkg_path = os.path.join(path, chroot, pkg)
+ if os.path.isdir(pkg_path):
+ self.event('Removing build {0}'.format(pkg_path))
+ shutil.rmtree(pkg_path)
+ altered = True
+ else:
+ self.event('Package {0} dir not found in chroot {1}'
+ .format(pkg, chroot))
+
+ if altered:
+ self.event("Running createrepo")
+ rc, out, err = createrepo(os.path.join(path, chroot))
+ if err.strip():
+ self.event("Error making local repo: {0}".format(err))
+
+ log_path = os.path.join(
+ path, chroot,
+ 'build-{0}.log'.format(self.data['object_id']))
+
+ if os.path.isfile(log_path):
+ self.event("Removing log {0}".format(log_path))
+ os.unlink(log_path)
+
result.job_ended_on = time.time()
- result.result = 1 # success
+ result.result = 1 # success
elif self.data['action_type'] == 1: # rename
self.event("Action rename")
old_path = os.path.normpath(self.destdir + '/', self.data['old_value'])
@@ -46,5 +91,6 @@ class Action(object):
result.job_ended_on = time.time()
elif self.data['action_type'] == 2: # legal-flag
self.event("Action legal-flag: ignoring")
+
if 'result' in result:
self.frontend_callback.post_to_frontend( {'actions': [result]} )
diff --git a/coprs_frontend/coprs/logic/builds_logic.py b/coprs_frontend/coprs/logic/builds_logic.py
index acdcf9c..4881ab6 100644
--- a/coprs_frontend/coprs/logic/builds_logic.py
+++ b/coprs_frontend/coprs/logic/builds_logic.py
@@ -3,6 +3,7 @@ import time
from coprs import db
from coprs import exceptions
from coprs import models
+from coprs import helpers
from coprs import signals
from coprs.logic import coprs_logic
@@ -126,3 +127,21 @@ class BuildsLogic(object):
if build.user_id != user.id:
raise exceptions.InsufficientRightsException('You can only cancel your own builds.')
build.canceled = True
+
+ @classmethod
+ def delete_build(cls, user, build):
+ if build.user_id != user.id:
+ raise exceptions.InsufficientRightsException('You can only delete your own builds.')
+
+ action = models.Action(action_type=helpers.ActionTypeEnum('delete'),
+ object_type='build',
+ object_id=build.id,
+ old_value='{0}/{1}'.format(build.copr.owner.name,
+ build.copr.name),
+ new_value=build.pkgs,
+ created_on=int(time.time()))
+
+ db.session.add(action)
+ for build_chroot in build.build_chroots:
+ db.session.delete(build_chroot)
+ db.session.delete(build)
diff --git a/coprs_frontend/coprs/templates/coprs/detail/_builds_forms.html b/coprs_frontend/coprs/templates/coprs/detail/_builds_forms.html
index 4e81f3a..b7c7b0d 100644
--- a/coprs_frontend/coprs/templates/coprs/detail/_builds_forms.html
+++ b/coprs_frontend/coprs/templates/coprs/detail/_builds_forms.html
@@ -35,3 +35,11 @@
</form>
{% endif %}
{% endmacro %}
+
+{% macro copr_build_delete_form(build) %}
+ {% if build.ended_on %}
+ <form action="{{ url_for('coprs_ns.copr_delete_build', username=build.copr.owner.name, coprname=build.copr.name, build_id=build.id)}}" method="post">
+ <input type="submit" value="Delete">
+ </form>
+ {% endif %}
+{% endmacro %}
diff --git a/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html b/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
index f65d7ed..a70b53c 100644
--- a/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
+++ b/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
@@ -1,4 +1,4 @@
-{% from "coprs/detail/_builds_forms.html" import copr_build_cancel_form, copr_build_repeat_form %}
+{% from "coprs/detail/_builds_forms.html" import copr_build_cancel_form, copr_build_repeat_form, copr_build_delete_form %}
{% macro builds_table(builds) %}
{% if builds %}
@@ -29,6 +29,9 @@
{% if g.user and g.user.can_build_in(copr) %}
{{ copr_build_repeat_form(build) }}
{% endif %}
+ {% if g.user and g.user == build.user %}
+ {{ copr_build_delete_form(build) }}
+ {% endif %}
<div>
{% if build.results %}
<h2>Results: </h2><a href="{{ build.results }}">{{ build.results }}</a>
diff --git a/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py b/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
index 109a9f5..561fa61 100644
--- a/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
+++ b/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
@@ -109,3 +109,21 @@ def copr_repeat_build(username, coprname, build_id):
flask.flash('Build was resubmitted')
return flask.redirect(flask.url_for('coprs_ns.copr_builds', username = username, coprname = coprname))
+
+
+(a)coprs_ns.route('/<username>/<coprname>/delete_build/<int:build_id>/', methods=['POST'])
+@login_required
+def copr_delete_build(username, coprname, build_id):
+ build = builds_logic.BuildsLogic.get(build_id).first()
+ if not build:
+ return page_not_found('Build with id {0} does not exist.'.format(build_id))
+ try:
+ builds_logic.BuildsLogic.delete_build(flask.g.user, build)
+ except exceptions.InsufficientRightsException as e:
+ flask.flash(str(e))
+ else:
+ db.session.commit()
+ flask.flash('Build was deleted')
+
+ return flask.redirect(flask.url_for('coprs_ns.copr_builds',
+ username=username, coprname=coprname))
diff --git a/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_builds.py b/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_builds.py
index dc66562..c690833 100644
--- a/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_builds.py
+++ b/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_builds.py
@@ -57,3 +57,42 @@ class TestCoprCancelBuild(CoprsTestCase):
data = {},
follow_redirects = True)
assert self.models.Build.query.first().canceled is False
+
+
+class TestCoprDeleteBuild(CoprsTestCase):
+ @TransactionDecorator('u1')
+ def test_copr_build_submitter_can_delete_build(self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):
+ self.db.session.add_all([self.u1, self.c1, self.b1])
+ pkgs = 'one two three'
+ self.b1.pkgs = pkgs
+ r = self.test_client.post(
+ '/coprs/{0}/{1}/delete_build/{2}/'.format(self.u1.name,
+ self.c1.name, self.b1.id),
+ data={},
+ follow_redirects=True)
+
+ assert 'Build was deleted' in r.data
+ b = (self.models.Build.query.filter(
+ self.models.Build.id == self.b1.id)
+ .first())
+ assert b is None
+ act = self.models.Action.query.first()
+ assert act.object_type == 'build'
+ assert act.old_value == 'user1/foocopr'
+ assert act.new_value == pkgs
+
+ @TransactionDecorator('u2')
+ def test_copr_build_non_submitter_cannot_delete_build(self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):
+ self.db.session.add_all([self.u1, self.c1, self.b1])
+ r = self.test_client.post(
+ '/coprs/{0}/{1}/delete_build/{2}/'.format(self.u1.name,
+ self.c1.name, self.b1.id),
+ data={},
+ follow_redirects=True)
+
+ assert 'delete your own builds' in r.data
+ b = (self.models.Build.query.filter(
+ self.models.Build.id == self.b1.id)
+ .first())
+
+ assert b is not None
10 years, 5 months
[copr] master: 1044158 - do not require fas username prior to login (1958ff0)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 1958ff070f1e871059f44b267975e9dc3138374b
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jan 16 12:05:14 2014 +0100
1044158 - do not require fas username prior to login
>---------------------------------------------------------------
coprs_frontend/coprs/views/misc.py | 65 ++++++++++++++++--------------------
1 files changed, 29 insertions(+), 36 deletions(-)
diff --git a/coprs_frontend/coprs/views/misc.py b/coprs_frontend/coprs/views/misc.py
index 9863564..3f2b953 100644
--- a/coprs_frontend/coprs/views/misc.py
+++ b/coprs_frontend/coprs/views/misc.py
@@ -27,50 +27,43 @@ def page_not_found(message):
misc = flask.Blueprint('misc', __name__)
-(a)misc.route('/login/', methods=['GET', 'POST'])
+(a)misc.route('/login/', methods=['GET'])
@oid.loginhandler
def login():
if flask.g.user is not None:
return flask.redirect(oid.get_next_url())
- if flask.request.method == 'POST':
- fasusername = flask.request.form.get('fasuname')
- if fasusername and ((app.config['USE_ALLOWED_USERS'] \
- and fasusername in app.config['ALLOWED_USERS']) \
- or not app.config['USE_ALLOWED_USERS']):
- ask_for = []
- if not models.User.query.filter(models.User.openid_name==models.User.openidize_name(fasusername)).first():
- ask_for.append('email')
- return oid.try_login('http://{0}.id.fedoraproject.org/'.format(fasusername), ask_for=ask_for)
- else:
- return flask.render_template('login.html',
- error='User "{0}" is not allowed'.format(
- fasusername))
- return flask.render_template('login.html',
- next=oid.get_next_url(),
- error=oid.fetch_error())
+ else:
+ return oid.try_login('https://id.fedoraproject.org/', ask_for=['email'])
@oid.after_login
def create_or_login(resp):
flask.session['openid'] = resp.identity_url
- user = models.User.query.filter(
- models.User.openid_name == resp.identity_url).first()
- if not user: # create if not created already
- expiration_date_token = datetime.date.today() \
- + datetime.timedelta(days=flask.current_app.config['API_TOKEN_EXPIRATION'])
- copr64 = base64.b64encode('copr') + '##'
- user = models.User(openid_name = resp.identity_url, mail = resp.email,
- api_login = copr64 + helpers.generate_api_token(
- app.config['API_TOKEN_LENGTH'] - len(copr64)),
- api_token = helpers.generate_api_token(app.config['API_TOKEN_LENGTH']),
- api_token_expiration = expiration_date_token)
- db.session.add(user)
- db.session.commit()
- flask.flash(u'Welcome, {0}'.format(user.name))
- flask.g.user = user
- redirect_to = oid.get_next_url()
- if flask.request.url_root == oid.get_next_url():
- return flask.redirect(flask.url_for('coprs_ns.coprs_by_owner', username=user.name))
- return flask.redirect(oid.get_next_url())
+ fasusername = resp.identity_url.replace('.id.fedoraproject.org/', '').replace('http://', '')
+ if fasusername and ((app.config['USE_ALLOWED_USERS'] \
+ and fasusername in app.config['ALLOWED_USERS']) \
+ or not app.config['USE_ALLOWED_USERS']):
+ user = models.User.query.filter(
+ models.User.openid_name == resp.identity_url).first()
+ if not user: # create if not created already
+ expiration_date_token = datetime.date.today() \
+ + datetime.timedelta(days=flask.current_app.config['API_TOKEN_EXPIRATION'])
+ copr64 = base64.b64encode('copr') + '##'
+ user = models.User(openid_name = resp.identity_url, mail = resp.email,
+ api_login = copr64 + helpers.generate_api_token(
+ app.config['API_TOKEN_LENGTH'] - len(copr64)),
+ api_token = helpers.generate_api_token(app.config['API_TOKEN_LENGTH']),
+ api_token_expiration = expiration_date_token)
+ db.session.add(user)
+ db.session.commit()
+ flask.flash(u'Welcome, {0}'.format(user.name))
+ flask.g.user = user
+ redirect_to = oid.get_next_url()
+ if flask.request.url_root == oid.get_next_url():
+ return flask.redirect(flask.url_for('coprs_ns.coprs_by_owner', username=user.name))
+ return flask.redirect(oid.get_next_url())
+ else:
+ flask.flash('User "{0}" is not allowed'.format(user.name))
+ return flask.redirect(oid.get_next_url())
@misc.route('/logout/')
10 years, 5 months
[copr] master: replace http with https in copr-cli and in generated repo file (e5b9775)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit e5b97755c9e3674336b1edeb3f98205a238d7183
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Wed Jan 15 15:05:08 2014 +0100
replace http with https in copr-cli and in generated repo file
>---------------------------------------------------------------
copr_cli/subcommands.py | 2 +-
coprs_frontend/coprs/helpers.py | 1 +
coprs_frontend/coprs/templates/api.html | 8 ++++----
.../test_views/test_coprs_ns/test_coprs_general.py | 2 +-
man/copr-cli.1.asciidoc | 4 ++--
5 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/copr_cli/subcommands.py b/copr_cli/subcommands.py
index 7f7daa4..da52f48 100644
--- a/copr_cli/subcommands.py
+++ b/copr_cli/subcommands.py
@@ -69,7 +69,7 @@ def get_api_url():
)
# Default copr_url:
- copr_url = 'http://copr.fedoraproject.org/'
+ copr_url = 'https://copr.fedoraproject.org/'
if config.has_section('copr-cli') and config.has_option('copr-cli', 'copr_url'):
copr_url = config.get('copr-cli', 'copr_url')
return '%s/api' % copr_url
diff --git a/coprs_frontend/coprs/helpers.py b/coprs_frontend/coprs/helpers.py
index 36deaf5..2624ae7 100644
--- a/coprs_frontend/coprs/helpers.py
+++ b/coprs_frontend/coprs/helpers.py
@@ -134,4 +134,5 @@ def render_repo(copr, mock_chroot, url):
mock_chroot.os_version = '$releasever'
url = urlparse.urljoin(url, "%s-%s-%s/" % (mock_chroot.os_release, mock_chroot.os_version, '$basearch'))
copr.description = copr.description.replace("\n", " ")
+ url = url.replace("http://", "https://")
return flask.render_template('coprs/copr.repo', copr=copr, url=url)
diff --git a/coprs_frontend/coprs/templates/api.html b/coprs_frontend/coprs/templates/api.html
index 1ee4c2a..132aca8 100644
--- a/coprs_frontend/coprs/templates/api.html
+++ b/coprs_frontend/coprs/templates/api.html
@@ -23,7 +23,7 @@
login = {{ g.user.api_login }}
username = {{ g.user.name }}
token = {{ g.user.api_token }}
-copr_url = http://copr.fedoraproject.org
+copr_url = https://copr.fedoraproject.org
# expiration date: {{ g.user.api_token_expiration }}
</pre>
@@ -74,7 +74,7 @@ copr_url = http://copr.fedoraproject.org
</ul>
<h4>Example call URL</h4>
- <pre style="font-size:120%">http://copr-fe.cloud.fedoraproject.org/api/coprs/jdaniels/</pre>
+ <pre style="font-size:120%">https://copr.fedoraproject.org/api/coprs/jdaniels/</pre>
<h4>Example results</h4>
<pre>
@@ -83,8 +83,8 @@ copr_url = http://copr.fedoraproject.org
"repos": [
{
"yum_repos": {
- "fedora-19-i686": "http://copr-be.cloud.fedoraproject.org/results/jdaniels/log4j/fedora-19-i..."
- "fedora-19-x86_64": "http://copr-be.cloud.fedoraproject.org/results/jdaniels/log4j/fedora-19-x..."
+ "fedora-19-i686": "https://copr-be.cloud.fedoraproject.org/results/jdaniels/log4j/fedora-19-..."
+ "fedora-19-x86_64": "https://copr-be.cloud.fedoraproject.org/results/jdaniels/log4j/fedora-19-..."
},
"additional_repos": "",
"instructions": "",
diff --git a/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py b/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py
index a05c54d..1e3c0a8 100644
--- a/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py
+++ b/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py
@@ -440,4 +440,4 @@ class TestCoprRepoGeneration(CoprsTestCase):
def test_works_on_older_builds(self, f_users, f_coprs, f_custom_builds, f_db):
r = self.tc.get('/coprs/{0}/{1}/repo/fedora-18-x86_64/'.format(self.u1.name, self.c1.name))
assert r.status_code == 200
- assert 'baseurl=http://bar.baz' in r.data
+ assert 'baseurl=https://bar.baz' in r.data
diff --git a/man/copr-cli.1.asciidoc b/man/copr-cli.1.asciidoc
index d554eaa..b29e081 100644
--- a/man/copr-cli.1.asciidoc
+++ b/man/copr-cli.1.asciidoc
@@ -109,10 +109,10 @@ Be aware that API token have some expiration. See Expiration date on /api page.
COPR URL
--------
-You can alternatively specify different URL of Copr service. Open file \~/.config/copr and put there:
+You can alternatively specify different URL of Copr service. Open file `~/.config/copr` and put there:
[copr-cli]
- copr_url = http://copr-fe.cloud.fedoraproject.org
+ copr_url = https://copr.fedoraproject.org
The value above is default. Define copr_url only if you use different instance.
10 years, 5 months
[copr] master: [cli] UX changes - explicitely state that pkgs is URL (fb4b0e9)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit fb4b0e9167322f165b73174d812534c925e888b7
Author: Miroslav Suchý <miroslav(a)suchy.cz>
Date: Tue Jan 14 21:34:05 2014 +0100
[cli] UX changes - explicitely state that pkgs is URL
>---------------------------------------------------------------
copr_cli/main.py | 5 +++--
man/copr-cli.1.asciidoc | 11 ++++++-----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/copr_cli/main.py b/copr_cli/main.py
index e7632b3..e668410 100644
--- a/copr_cli/main.py
+++ b/copr_cli/main.py
@@ -81,7 +81,7 @@ def setup_parser():
help="Repository to add to this copr")
parser_create.add_argument('--initial-pkgs', dest='initial_pkgs',
action='append',
- help="List of packages to build in this "
+ help="List of packages URL to build in this "
"new copr")
parser_create.add_argument('--description',
help="Description of the copr")
@@ -96,7 +96,8 @@ def setup_parser():
parser_build.add_argument('copr',
help='The copr repo to build the package in'
)
- parser_build.add_argument('pkgs', nargs='+')
+ parser_build.add_argument('pkgs', nargs='+',
+ help='URL of packages to build')
parser_build.add_argument('--memory', dest='memory',
help="")
parser_build.add_argument('--timeout', dest='timeout',
diff --git a/man/copr-cli.1.asciidoc b/man/copr-cli.1.asciidoc
index 03e3d15..d554eaa 100644
--- a/man/copr-cli.1.asciidoc
+++ b/man/copr-cli.1.asciidoc
@@ -48,7 +48,7 @@ Get status of the build.
~~~~~~~~~~~~~~~~~~~~~~~~~~~
usage: copr-cli create [-h] --chroot CHROOTS [--repo REPOS]
- [--initial-pkgs INITIAL_PKGS]
+ [--initial-pkgs URL_OF_INITIAL_PKGS]
[--description DESCRIPTION]
[--instructions INSTRUCTIONS]
name
@@ -73,7 +73,7 @@ Instructions for the copr.
~~~~~~~~~~~~~~~~~~~~~~~~~~
usage: copr-cli build [-h] [--memory MEMORY] [--timeout TIMEOUT] [--nowait]
- copr pkgs [pkgs ...]
+ copr pkg_url [pkg_url ...]
--memory::
Override memory for this build
@@ -87,8 +87,9 @@ Don't wait for build completion
copr::
The copr repo to build the package in
-pkgs::
-Package to build.
+pkg_url::
+URL of package to build. Package must be placed on some public web of ftp, from where it can
+be downloaded.
API KEY
@@ -96,7 +97,7 @@ API KEY
Visit page http://your.copr/api and note down API token.
-Open file \~/.config/copr and put there content:
+Open file `~/.config/copr` and put there content:
[copr-cli]
username = msuchy
10 years, 5 months
[copr] master: build for el5, el6 and remove f18 (a3a6a6e)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit a3a6a6e71ab387c30235161dd284d4b62d29a8cc
Author: Miroslav Suchý <miroslav(a)suchy.cz>
Date: Tue Jan 14 20:20:11 2014 +0100
build for el5, el6 and remove f18
>---------------------------------------------------------------
rel-eng/releasers.conf | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/rel-eng/releasers.conf b/rel-eng/releasers.conf
index 36f06d7..92af343 100644
--- a/rel-eng/releasers.conf
+++ b/rel-eng/releasers.conf
@@ -8,7 +8,7 @@ branches = master
[fedora-git-all]
releaser = tito.release.FedoraGitReleaser
-branches = master f20 f19 f18
+branches = master f20 f19 el5 el6
[copr-msuchy]
releaser = tito.release.CoprReleaser
10 years, 5 months
[copr] master: 1053142 - only build copr-cli on el6 (ddf4441)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit ddf44419995ce6463b090204be2d95a10c60cf41
Author: Miroslav Suchý <miroslav(a)suchy.cz>
Date: Tue Jan 14 20:16:25 2014 +0100
1053142 - only build copr-cli on el6
>---------------------------------------------------------------
copr.spec | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/copr.spec b/copr.spec
index 59e9b9d..2738f04 100644
--- a/copr.spec
+++ b/copr.spec
@@ -1,6 +1,9 @@
%global with_test 1
+%global with_server 1
%if 0%{?rhel} < 7 && 0%{?rhel} > 0
%global _pkgdocdir %{_docdir}/%{name}-%{version}
+%global __python2 %{__python}
+%global with_server 0
%endif
%global moduletype apps
%global modulename copr
@@ -28,7 +31,9 @@ BuildRequires: util-linux
BuildRequires: python-setuptools
BuildRequires: python-requests
BuildRequires: python2-devel
+%if %{with_server}
BuildRequires: systemd
+%endif
%if 0%{?rhel} < 7 && 0%{?rhel} > 0
BuildRequires: python-argparse
%endif
@@ -36,14 +41,17 @@ BuildRequires: python-argparse
BuildRequires: epydoc
BuildRequires: graphviz
BuildRequires: make
+%if %{with_server}
#for selinux
BuildRequires: checkpolicy, selinux-policy-devel
BuildRequires: policycoreutils >= %{POLICYCOREUTILSVER}
+%endif
%description
COPR is lightweight build system. It allows you to create new project in WebUI,
and submit new builds and COPR will create yum repository from latest builds.
+%if %{with_server}
%package backend
Summary: Backend for COPR
Requires: ansible >= 1.2
@@ -116,6 +124,7 @@ COPR is lightweight build system. It allows you to create new project in WebUI,
and submit new builds and COPR will create yum repository from latests builds.
This package contains frontend.
+%endif # with_server
%package cli
Summary: Command line interface for COPR
@@ -131,6 +140,7 @@ and submit new builds and COPR will create yum repository from latests builds.
This package contains command line interface.
+%if %{with_server}
%package doc
Summary: Code documentation for COPR
@@ -153,7 +163,7 @@ COPR is lightweight build system. It allows you to create new project in WebUI,
and submit new builds and COPR will create yum repository from latests builds.
This package include SELinux targeted module for COPR
-
+%endif
%prep
%setup -q
@@ -172,6 +182,7 @@ pushd documentation
make %{?_smp_mflags} python
popd
+%if %{with_server}
#selinux
pushd selinux
perl -i -pe 'BEGIN { $VER = join ".", grep /^\d+$/, split /\./, "%{version}.%{release}"; } s!\@\@VERSION\@\@!$VER!g;' %{modulename}.te
@@ -182,9 +193,11 @@ for selinuxvariant in targeted; do
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
done
popd
+%endif
%install
+%if %{with_server}
#backend
install -d %{buildroot}%{_sharedstatedir}/copr
install -d %{buildroot}%{_sharedstatedir}/copr/jobs
@@ -236,12 +249,14 @@ mv %{buildroot}%{_datadir}/copr/coprs_frontend/coprs.conf.example ./
mv %{buildroot}%{_datadir}/copr/coprs_frontend/config/* %{buildroot}%{_sysconfdir}/copr
rm %{buildroot}%{_datadir}/copr/coprs_frontend/CONTRIBUTION_GUIDELINES
touch %{buildroot}%{_sharedstatedir}/copr/data/copr.db
+%endif # with_server
#copr-cli
%{__python2} coprcli-setup.py install --root %{buildroot}
install -d %{buildroot}%{_mandir}/man1
install -p -m 644 man/copr-cli.1 %{buildroot}/%{_mandir}/man1/
+%if %{with_server}
#doc
cp -a documentation/python-doc %{buildroot}%{_pkgdocdir}/
cp -a playbooks %{buildroot}%{_pkgdocdir}/
@@ -264,14 +279,16 @@ install -p -m 755 selinux/%{name}-selinux-relabel %{buildroot}%{_sbindir}/%{name
install -d %{buildroot}%{_mandir}/man8
install -p -m 644 man/%{name}-selinux-enable.8 %{buildroot}/%{_mandir}/man8/
install -p -m 644 man/%{name}-selinux-relabel.8 %{buildroot}/%{_mandir}/man8/
+%endif
%check
-%if ! 0%{?with_test:1}
+%if ! 0%{?with_test:1} && %{with_server}
pushd coprs_frontend
COPR_CONFIG="$(pwd)/config/copr_unit_test.conf" ./manage.py test
popd
%endif
+%if %{with_server}
%pre backend
getent group copr >/dev/null || groupadd -r copr
getent passwd copr >/dev/null || \
@@ -364,7 +381,7 @@ fi
%config(noreplace) %{_sysconfdir}/copr/copr.conf
%config(noreplace) %{_sysconfdir}/copr/copr_devel.conf
%config(noreplace) %{_sysconfdir}/copr/copr_unit_test.conf
-
+%endif # with_server
%files cli
%doc LICENSE README.rst
@@ -372,6 +389,7 @@ fi
%{python_sitelib}/*
%{_mandir}/man1/copr-cli.1*
+%if %{with_server}
%files doc
%doc %{_pkgdocdir}/python-doc
@@ -383,6 +401,7 @@ fi
%{_sbindir}/%{name}-selinux-relabel
%{_mandir}/man8/%{name}-selinux-enable.8*
%{_mandir}/man8/%{name}-selinux-relabel.8*
+%endif # with_server
%changelog
* Mon Jan 13 2014 Miroslav Suchý <msuchy(a)redhat.com> 1.23-1
10 years, 5 months
[copr] master: [frontend] correctly handle mangled chroot (d942812)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit d94281256a89f005c09eb3ca17d41ab2326a2a7c
Author: Miroslav Suchý <miroslav(a)suchy.cz>
Date: Tue Jan 14 16:58:04 2014 +0100
[frontend] correctly handle mangled chroot
as in previous 2 commits
>---------------------------------------------------------------
.../coprs/views/coprs_ns/coprs_chroots.py | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/coprs_frontend/coprs/views/coprs_ns/coprs_chroots.py b/coprs_frontend/coprs/views/coprs_ns/coprs_chroots.py
index 45baf4a..6dac9e4 100644
--- a/coprs_frontend/coprs/views/coprs_ns/coprs_chroots.py
+++ b/coprs_frontend/coprs/views/coprs_ns/coprs_chroots.py
@@ -17,9 +17,12 @@ from coprs.views.coprs_ns import coprs_ns
@login_required
def chroot_edit(username, coprname, chrootname):
copr = coprs_logic.CoprsLogic.get(flask.g.user, username, coprname).first()
- chroot = coprs_logic.MockChrootsLogic.get_from_name(chrootname, active_only=True).first()
if not copr:
return page_not_found('Project with name {0} does not exist.'.format(coprname))
+ try:
+ chroot = coprs_logic.MockChrootsLogic.get_from_name(chrootname, active_only=True).first()
+ except ValueError, e:
+ return page_not_found("%s" % e)
if not chroot:
return page_not_found('Chroot name {0} does not exist.'.format(chrootname))
form = forms.ChrootForm(buildroot_pkgs=copr.buildroot_pkgs(chroot))
@@ -34,9 +37,12 @@ def chroot_edit(username, coprname, chrootname):
def chroot_update(username, coprname, chrootname):
form = forms.ChrootForm()
copr = coprs_logic.CoprsLogic.get(flask.g.user, username, coprname).first()
- chroot = coprs_logic.MockChrootsLogic.get_from_name(chrootname, active_only=True).first()
- if not copr: # hey, this Copr doesn't exist
+ if not copr:
return page_not_found('Projec with name {0} does not exist.'.format(coprname))
+ try:
+ chroot = coprs_logic.MockChrootsLogic.get_from_name(chrootname, active_only=True).first()
+ except ValueError, e:
+ return page_not_found("%s" % e)
if form.validate_on_submit() and flask.g.user.can_build_in(copr):
coprs_logic.CoprChrootsLogic.update_buildroot_pkgs(copr, chroot, form.buildroot_pkgs.data)
flask.flash("Buildroot {0} for project {1} was updated".format(chrootname, coprname))
10 years, 5 months
[copr] master: correct previous commit (6626cec)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 6626cecff85980ca6670e2db52708102c9676bcb
Author: Miroslav Suchý <miroslav(a)suchy.cz>
Date: Tue Jan 14 16:53:40 2014 +0100
correct previous commit
move exception to correct place and also catch general exception
>---------------------------------------------------------------
.../coprs/views/coprs_ns/coprs_general.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/coprs_frontend/coprs/views/coprs_ns/coprs_general.py b/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
index 54208ab..1973ae5 100644
--- a/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
+++ b/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
@@ -330,13 +330,13 @@ def generate_repo_file(username, coprname, chroot):
with_builds=True).one()
except sqlalchemy.orm.exc.NoResultFound:
return page_not_found('Project {0}/{1} does not exist'.format(username, coprname))
- except exceptions.MalformedArgumentException, e:
- return page_not_found("%s" % e)
try:
mock_chroot = coprs_logic.MockChrootsLogic.get_from_name(chroot).one()
except sqlalchemy.orm.exc.NoResultFound:
return page_not_found('Chroot %s does not exist' % chroot)
+ except ValueError, e:
+ return page_not_found("%s" % e)
url = ''
for build in copr.builds:
10 years, 5 months
[copr] master: [frontend] do not traceback when user malform url (1fa19ba)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 1fa19ba328445e9c5df9c0e52d5ed8a090821bd2
Author: Miroslav Suchý <miroslav(a)suchy.cz>
Date: Tue Jan 14 16:44:26 2014 +0100
[frontend] do not traceback when user malform url
addressing:
Exception on /coprs/kevin/calibre/repo/f/ [GET]
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1687, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1358, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1344, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/share/copr/coprs_frontend/coprs/views/coprs_ns/coprs_general.py", line 332, in generate_repo_file
mock_chroot = coprs_logic.MockChrootsLogic.get_from_name(chroot).one()
File "/usr/share/copr/coprs_frontend/coprs/logic/coprs_logic.py", line 297, in get_from_name
name_tuple = cls.tuple_from_name(None, chroot_name)
File "/usr/share/copr/coprs_frontend/coprs/logic/coprs_logic.py", line 357, in tuple_from_name
'Chroot Name doesn\'t contain dash, can\'t determine chroot architecure.')
MalformedArgumentException: Chroot Name doesn't contain dash, can't determine chroot architecure.
>---------------------------------------------------------------
.../coprs/views/coprs_ns/coprs_general.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/coprs_frontend/coprs/views/coprs_ns/coprs_general.py b/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
index 3c6390e..54208ab 100644
--- a/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
+++ b/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
@@ -330,6 +330,8 @@ def generate_repo_file(username, coprname, chroot):
with_builds=True).one()
except sqlalchemy.orm.exc.NoResultFound:
return page_not_found('Project {0}/{1} does not exist'.format(username, coprname))
+ except exceptions.MalformedArgumentException, e:
+ return page_not_found("%s" % e)
try:
mock_chroot = coprs_logic.MockChrootsLogic.get_from_name(chroot).one()
10 years, 5 months
[copr] master: [frontend] change default description and instructions to sound more dangerously (30f9630)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 30f96303f715b97c3594c7a354542a2403a81a59
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Jan 14 13:40:06 2014 +0100
[frontend] change default description and instructions to sound more dangerously
>---------------------------------------------------------------
coprs_frontend/coprs/models.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/coprs_frontend/coprs/models.py b/coprs_frontend/coprs/models.py
index 8093a05..4352661 100644
--- a/coprs_frontend/coprs/models.py
+++ b/coprs_frontend/coprs/models.py
@@ -170,13 +170,13 @@ class Copr(db.Model, Serializer):
def description_or_not_filled(self):
md = markdown.Markdown(safe_mode='replace',
html_replacement_text='--RAW HTML NOT ALLOWED--')
- return md.convert(self.description) or 'Description not filled in by author.'
+ return md.convert(self.description) or 'Description not filled in by author. Very likely personal repository for testing purpose, which you should not use.'
@property
def instructions_or_not_filled(self):
md = markdown.Markdown(safe_mode='replace',
html_replacement_text='--RAW HTML NOT ALLOWED--')
- return md.convert(self.instructions) or 'Instructions not filled in by author.'
+ return md.convert(self.instructions) or 'Instructions not filled in by author. Author knows what to do. Everybody else should avoid this repo.'
@property
def active_mock_chroots(self):
10 years, 5 months