[copr] master: add initial version of dnf plugin (7cbc5a7)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 7cbc5a7da61650a9884e22a6df0b8dc5e071f955
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Feb 11 15:24:14 2014 +0100
add initial version of dnf plugin
>---------------------------------------------------------------
dnf-plugin/copr_hook.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 64 insertions(+), 0 deletions(-)
diff --git a/dnf-plugin/copr_hook.py b/dnf-plugin/copr_hook.py
new file mode 100644
index 0000000..7c86d79
--- /dev/null
+++ b/dnf-plugin/copr_hook.py
@@ -0,0 +1,64 @@
+import dnf
+import sys
+
+from urlgrabber import grabber
+
+yes = set(['yes','y', ''])
+no = set(['no','n'])
+
+class Copr(dnf.Plugin):
+ """DNF plugin supplying the 'copr' command."""
+
+ #name = 'copr'
+
+ def __init__(self, base, cli):
+ """Initialize the plugin instance."""
+ super(Copr, self).__init__(base, cli)
+ if cli is not None:
+ cli.register_command(CoprCommand)
+
+class CoprCommand(dnf.cli.Command):
+ """ Copr plugin for DNF """
+ aliases = "copr"
+
+ def run(self.args):
+ # FIXME this should do dnf itself (BZ#1062889)
+ if os.geteuid() != 0:
+ raise dnf.exceptions.Error('This command has to be run under the root user.')
+ try:
+ subcommand, project_name, chroot = extcmds
+ except ValueError:
+ raise ValueError('exactly three additional parameters to copr command are required')
+ repo_filename = "/etc/yum.repos.d/{}.repo".format(project_name.replace("/", "_"))
+
+ if subcommand == "enable":
+ #http://copr.fedoraproject.org/coprs/larsks/rcm/repo/epel-7-x86_64/
+ base_url = "http://copr.fedoraproject.org"
+ api_path = "/coprs/{0}/repo/{1}/".format(project_name, chroot)
+
+ self._ask_user()
+ ug = grabber.URLGrabber()
+ # FIXME when we are full on python2 urllib.parse
+ try:
+ fn = ug.urlgrab(base_url+api_path, filename=repo_filename)
+ except grabber.URLGrabError, e:
+ raise dnf.exceptions.Error(str(e)), None, sys.exc_info()[2]
+ self.base.read_all_repos()
+ else:
+ raise dnf.exceptions.Error(_('Unknown subcommand {}.').format(subcommand))
+
+ def _ask_user(self):
+ question = """
+You are going to enable Copr repository. Please not that this repository is not
+part of Fedora and may have various quality and Fedora distribution have no
+power over this repository and can not enforce some quality or security level.
+ Please do not file bug reports about this packages in Fedora bugzilla.
+In case of problems you should contact owner of this repository.
+Do you want to continue? [Y/n]: """
+ answer = raw_input(question).lower()
+ while not ((answer in yes) or (answer in no)):
+ answer = raw_input(question).lower()
+ if answer in yes:
+ return
+ else:
+ raise dnf.exceptions.Error('Safe and good answer. Exiting.')
10 years, 2 months
[copr] master: add copr modification to web api (916fd5b)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 916fd5b100c5e0e36639672d45157ef2c1634905
Author: Matej Stuchlik <mstuchli(a)redhat.com>
Date: Tue Feb 11 09:04:13 2014 -0500
add copr modification to web api
I've reviewed the issues raised in the code review:
1)
copr = coprs_logic.CoprsLogic.get(flask.g.user, username, coprname).first()
Really shouldn't need try/except wrapping, looking at the source it just returns
None when the username doesn't exist, which is handled correctly, and empirical
testing confirms that.
2)
if form.description.raw_data and len(form.description.raw_data):
copr.description = form.description.data
etc.
Really does handle the optional field as it should, meaning you can delete e.g.
description by passing an empty string in POST, and on the other hand when you don't
pass the field at all, it will not be changed.
3)
I've changed the chroot modification URL to /coprs/<username>/<coprname>/detail/<chrootname>/
as requested.
4)
Added the API documentation.
>---------------------------------------------------------------
coprs_frontend/coprs/forms.py | 15 ++++
coprs_frontend/coprs/templates/api.html | 98 ++++++++++++++++++++++
coprs_frontend/coprs/views/api_ns/api_general.py | 90 ++++++++++++++++++++
3 files changed, 203 insertions(+), 0 deletions(-)
diff --git a/coprs_frontend/coprs/forms.py b/coprs_frontend/coprs/forms.py
index 133275a..6d77974 100644
--- a/coprs_frontend/coprs/forms.py
+++ b/coprs_frontend/coprs/forms.py
@@ -264,3 +264,18 @@ class PermissionsFormFactory(object):
coerce=int))
return F
+
+class CoprModifyForm(wtf.Form):
+ description = wtforms.TextAreaField('Description',
+ validators=[wtforms.validators.Optional()])
+
+ instructions = wtforms.TextAreaField('Instructions',
+ validators=[wtforms.validators.Optional()])
+
+ repos = wtforms.TextAreaField('Repos',
+ validators=[UrlListValidator(),
+ wtforms.validators.Optional()],
+ filters=[StringListFilter()])
+
+class ModifyChrootForm(wtf.Form):
+ buildroot_pkgs = wtforms.TextField('Additional packages to be always present in minimal buildroot')
diff --git a/coprs_frontend/coprs/templates/api.html b/coprs_frontend/coprs/templates/api.html
index 48f95ca..e835d0f 100644
--- a/coprs_frontend/coprs/templates/api.html
+++ b/coprs_frontend/coprs/templates/api.html
@@ -235,5 +235,103 @@ copr_url = http://copr.fedoraproject.org
}
</pre>
+ <h3>Copr Modification</h3>
+
+ <p><span style="font-style:italic">Login required</span></p>
+
+ <h4>URL:</h4>
+ <pre style="font-size:120%">/api/coprs/<username>/<coprname>/modify/</pre>
+
+ <h4>URL parameters:</h4>
+ <ul>
+ <li><b>username</b> – Name of the user whose copr you'd like to modify</li>
+ <li><b>coprname</b> – Name of the copr you'd you'd like to modify</li>
+ </ul>
+
+ <h4>Parameters sent by POST:</h4>
+ <ul>
+ <li><b>description</b> – Brief description of the project (Optional)</li>
+ <li><b>instructions</b> – Description of how your project can be
+ installed, etc. (Optional)</li>
+ <li><b>repos</b> – URL to additional yum repos, which can be used
+ during build. Space separated. (Optional)</li>
+ </ul>
+
+ <h4>Result</h4>
+ <ul>
+ <li><b>description</b> – Same as above</li>
+ <li><b>instructions</b> – Same as above</li>
+ <li><b>repos</b> – Same as above</li>
+ </ul>
+
+ <h4>Example result</h4>
+ <pre>
+ {
+ "output": "ok",
+ "repos": "foo",
+ "description": "bar",
+ "instructions": "baz"
+ }
+ </pre>
+
+ <h3>Chroot Modification</h3>
+
+ <p><span style="font-style:italic">Login required</span></p>
+
+ <h4>URL:</h4>
+ <pre style="font-size:120%">/api/coprs/<username>/<coprname>/modify/<chrootname>/</pre>
+
+ <h4>URL parameters:</h4>
+ <ul>
+ <li><b>username</b> – Name of the user whose chroot you'd like to modify</li>
+ <li><b>coprname</b> – Name of the copr whose chroot you'd like to modify</li>
+ <li><b>chrootname</b> – Name of the chroot you'd like to modify</li>
+ </ul>
+
+ <h4>Parameters sent by POST:</h4>
+ <ul>
+ <li><b>buildroot_pkgs</b> – Additional packages to be always present in minimal
+ buildroot</li>
+ </ul>
+
+ <h4>Result</h4>
+ <ul>
+ <li><b>buildroot_pkgs</b> – Same as above</li>
+ </ul>
+
+ <h4>Example result</h4>
+ <pre>
+ {
+ "output": "ok"
+ "buildroot_pkgs": "scl-utils-build",
+ }
+ </pre>
+
+ <h3>Chroot details</h3>
+
+ <h4>URL:</h4>
+ <pre style="font-size:120%">/api/coprs/<username>/<coprname>/detail/<chrootname>/</pre>
+
+ <h4>URL parameters:</h4>
+ <ul>
+ <li><b>username</b> – Name of the user whose chroot you'd like to know details of</li>
+ <li><b>coprname</b> – Name of the copr whose chroot you'd like to know details of</li>
+ <li><b>chrootname</b> – Name of the chroot you'd like to know details of</li>
+ </ul>
+
+ <h4>Result</h4>
+ <ul>
+ <li><b>buildroot_pkgs</b> – Additional packages to be always present in minimal
+ buildroot</li>
+ </ul>
+
+ <h4>Example result</h4>
+ <pre>
+ {
+ "output": "ok"
+ "buildroot_pkgs": "scl-utils-build",
+ }
+ </pre>
+
</div>
{% endblock %}
diff --git a/coprs_frontend/coprs/views/api_ns/api_general.py b/coprs_frontend/coprs/views/api_ns/api_general.py
index 063593d..d43d0dd 100644
--- a/coprs_frontend/coprs/views/api_ns/api_general.py
+++ b/coprs_frontend/coprs/views/api_ns/api_general.py
@@ -250,3 +250,93 @@ def build_status(build_id):
jsonout = flask.jsonify(output)
jsonout.status_code = httpcode
return jsonout
+
+(a)api_ns.route('/coprs/<username>/<coprname>/modify/', methods=["POST"])
+@api_login_required
+def copr_modify(username, coprname):
+ form = forms.CoprModifyForm(csrf_enabled=False)
+ copr = coprs_logic.CoprsLogic.get(flask.g.user, username, coprname).first()
+
+ if copr is None:
+ output = {'output': 'notok', 'error': 'Invalid copr name or username'}
+ httpcode = 500
+ elif not form.validate_on_submit():
+ output = {'output': 'notok', 'error': 'Invalid request'}
+ httpcode = 500
+ else:
+ # .raw_data needs to be inspected to figure out whether the field
+ # was not sent or was sent empty
+ if form.description.raw_data and len(form.description.raw_data):
+ copr.description = form.description.data
+ if form.instructions.raw_data and len(form.instructions.raw_data):
+ copr.instructions = form.instructions.data
+ if form.repos.raw_data and len(form.repos.raw_data):
+ copr.repos = form.repos.data
+
+ try:
+ coprs_logic.CoprsLogic.update(flask.g.user, copr)
+ except (exceptions.ActionInProgressException, exceptions.InsufficientRightsException) as e:
+ db.session.rollback()
+
+ output = {'output': 'notok', 'error': str(e)}
+ httpcode = 500
+ else:
+ db.session.commit()
+
+ output = {'output': 'ok',
+ 'description': copr.description,
+ 'instructions': copr.instructions,
+ 'repos': copr.repos}
+ httpcode = 200
+
+ jsonout = flask.jsonify(output)
+ jsonout.status_code = httpcode
+ return jsonout
+
+(a)api_ns.route('/coprs/<username>/<coprname>/modify/<chrootname>/', methods=["POST"])
+@api_login_required
+def copr_modify_chroot(username, coprname, chrootname):
+ form = forms.ModifyChrootForm(csrf_enabled=False)
+ copr = coprs_logic.CoprsLogic.get(flask.g.user, username, coprname).first()
+ chroot = coprs_logic.MockChrootsLogic.get_from_name(chrootname, active_only=True).first()
+
+ if copr is None:
+ output = {'output': 'notok', 'error': 'Invalid copr name or username'}
+ httpcode = 500
+ elif chroot is None:
+ output = {'output': 'notok', 'error': 'Invalid chroot name'}
+ httpcode = 500
+ elif not form.validate_on_submit():
+ output = {'output': 'notok', 'error': 'Invalid request'}
+ httpcode = 500
+ else:
+ coprs_logic.CoprChrootsLogic.update_buildroot_pkgs(copr, chroot, form.buildroot_pkgs.data)
+ db.session.commit()
+
+ ch = copr.check_copr_chroot(chroot)
+ output = {'output': 'ok', 'buildroot_pkgs': ch.buildroot_pkgs}
+ httpcode = 200
+
+ jsonout = flask.jsonify(output)
+ jsonout.status_code = httpcode
+ return jsonout
+
+(a)api_ns.route('/coprs/<username>/<coprname>/detail/<chrootname>/', methods=["POST"])
+def copr_chroot_details(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 copr is None:
+ output = {'output': 'notok', 'error': 'Invalid copr name or username'}
+ httpcode = 500
+ elif chroot is None:
+ output = {'output': 'notok', 'error': 'Invalid chroot name'}
+ httpcode = 500
+ else:
+ ch = copr.check_copr_chroot(chroot)
+ output = {'output': 'ok', 'buildroot_pkgs': ch.buildroot_pkgs}
+ httpcode = 200
+
+ jsonout = flask.jsonify(output)
+ jsonout.status_code = httpcode
+ return jsonout
10 years, 2 months
[copr] master: 1063311 - admin should be able to delete task (bfa62e3)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit bfa62e333d944e588fc03852edf9d9fe2af69a29
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Feb 11 15:14:51 2014 +0100
1063311 - admin should be able to delete task
>---------------------------------------------------------------
.../templates/coprs/detail/_builds_table.html | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html b/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
index 8901140..d2364d9 100644
--- a/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
+++ b/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
@@ -33,13 +33,13 @@
<tr class="details">
<td colspan=6 class="end">
<div>
- {% if g.user and g.user == build.user %}
+ {% if g.user and g.user.can_build_in(copr) %}
{{ copr_build_cancel_form(build) }}
{% endif %}
{% if g.user and g.user.can_build_in(copr) %}
{{ copr_build_repeat_form(build) }}
{% endif %}
- {% if g.user and g.user == build.user %}
+ {% if g.user and g.user.can_edit(copr) %}
{{ copr_build_delete_form(build) }}
{% endif %}
<div>
10 years, 2 months
[copr] master: [frontend] Stray end tag h4. (73e4501)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 73e45012ed59fe6cabf7b177c2439315f6d65f44
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Feb 4 13:57:49 2014 +0100
[frontend] Stray end tag h4.
>---------------------------------------------------------------
coprs_frontend/coprs/templates/api.html | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/coprs_frontend/coprs/templates/api.html b/coprs_frontend/coprs/templates/api.html
index bf6a897..48f95ca 100644
--- a/coprs_frontend/coprs/templates/api.html
+++ b/coprs_frontend/coprs/templates/api.html
@@ -234,7 +234,6 @@ copr_url = http://copr.fedoraproject.org
"output": "ok"
}
</pre>
- </h4>
</div>
{% endblock %}
10 years, 3 months
[copr] master: [frontend] another s/coprs/projects/ rename (5ad96ed)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 5ad96ed506f286900a7c679e0a1617bab8109cc7
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Feb 4 13:33:23 2014 +0100
[frontend] another s/coprs/projects/ rename
>---------------------------------------------------------------
coprs_frontend/coprs/templates/api.html | 54 +++++++++++++++---------------
1 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/coprs_frontend/coprs/templates/api.html b/coprs_frontend/coprs/templates/api.html
index 4a5a9f3..bf6a897 100644
--- a/coprs_frontend/coprs/templates/api.html
+++ b/coprs_frontend/coprs/templates/api.html
@@ -1,13 +1,13 @@
{% extends "layout.html" %}
-{% block title %}API for Coprs{% endblock %}
-{% block header %}API for the Coprs Build System{% endblock %}
+{% block title %}API for Copr{% endblock %}
+{% block header %}API for the Copr Build System{% endblock %}
{% block body %}
{% if error %}<p class="error"><strong>Error:</strong> {{ error }}</p>{% endif %}
<div>
- <h1>Coprs API</h1>
+ <h1>Copr API</h1>
- <h2> API Token </h2>
+ <h2>API Token</h2>
<p>In order to access the API, you will need to provide an API token.
This token is unique, specific to you and <span style="font-weight:bold;">
should not be shared!</span>.
@@ -43,7 +43,7 @@ copr_url = http://copr.fedoraproject.org
represents result of the call and is described below for individual
calls.</p>
- <h3>List someone's coprs</h3>
+ <h3>List someone's projects</h3>
<h4>URL:</h4>
<pre style="font-size:120%">/api/coprs/<username>/</pre>
@@ -52,23 +52,23 @@ copr_url = http://copr.fedoraproject.org
<h4>URL parameters:</h4>
<ul>
- <li><b>username</b> – The name of the user whose coprs you'd like
+ <li><b>username</b> – The name of the user whose projects you'd like
to list</li>
</ul>
<h4>Result:</h4>
<ul>
- <li><b>"repos"</b> – List of coprs in given format:
+ <li><b>"repos"</b> – List of projects in given format:
<ul>
<li><b>"yum_repos"</b> – Map of chroots to yum repository
URLs. Chroots are in format
"<release>-<version>-<architecture>"</li>
<li><b>"additional_repos"</b> – List of additional
- repositories that are required for this copr</li>
+ repositories that are required for this project</li>
<li><b>"instructions"</b> – Installation instructions
- provided by copr's owner </li>
- <li><b>"name"</b> – Name of the copr</li>
- <li><b>"description"</b> – Description provided by copr's
+ provided by project's owner </li>
+ <li><b>"name"</b> – Name of the project</li>
+ <li><b>"description"</b> – Description provided by project's
owner </li>
</ul>
</ul>
@@ -102,9 +102,9 @@ copr_url = http://copr.fedoraproject.org
<h4>URL parameters:</h4>
<ul>
- <li><b>username</b> – The name of the user whose coprs you'd like
- to list</li>
- <li><b>priojectname</b> – The name of the project</li>
+ <li><b>username</b> – The name of the user whose projects you'd like
+ to show</li>
+ <li><b>projectname</b> – The name of the project</li>
</ul>
@@ -116,11 +116,11 @@ copr_url = http://copr.fedoraproject.org
URLs. Chroots are in format
"<release>-<version>-<architecture>"</li>
<li><b>"additional_repos"</b> – List of additional
- repositories that are required for this copr</li>
+ repositories that are required for this project</li>
<li><b>"instructions"</b> – Installation instructions
- provided by copr's owner </li>
- <li><b>"name"</b> – Name of the copr</li>
- <li><b>"description"</b> – Description provided by copr's
+ provided by project's owner </li>
+ <li><b>"name"</b> – Name of the project</li>
+ <li><b>"description"</b> – Description provided by project's
owner </li>
<li><b>"last_modified"</b> – Datetime (in epoch format) of
last successfull build.</li>
@@ -150,7 +150,7 @@ copr_url = http://copr.fedoraproject.org
}
</pre>
- <h3>Create new copr</h3>
+ <h3>Create new project</h3>
<p><span style="font-style:italic">Login required</span></p>
@@ -159,19 +159,19 @@ copr_url = http://copr.fedoraproject.org
<h4>URL parameters:</h4>
<ul>
- <li><b>username</b> – The name of the user whose copr should be
+ <li><b>username</b> – The name of the user whose project should be
created</li>
</ul>
<h4>Parameters sent by POST:</h4>
<ul>
- <li><b>name</b> – The name of the copr to be created</li>
+ <li><b>name</b> – The name of the project to be created</li>
<li><b>chroots</b> – A comma separated list of chroots to
- use in the copr</li>
+ use in the project</li>
<li><b>repos</b> – A comma separated list of repositories
- that this new copr should have access to</li>
+ that this new project should have access to</li>
<li><b>initial_pkgs</b> – A comma separated list of initial
- packages to build in this new copr</li>
+ packages to build in this new project</li>
</ul>
<h3>Add new build</h3>
@@ -179,12 +179,12 @@ copr_url = http://copr.fedoraproject.org
<p><span style="font-style:italic">Login required</span></p>
<h4>URL:</h4>
- <pre style="font-size:120%">/api/copr/<username>/<coprname>/new_build/</pre>
+ <pre style="font-size:120%">/api/copr/<username>/<projectname>/new_build/</pre>
<h4>URL parameters:</h4>
<ul>
- <li><b>username</b> – The name of given copr's owner</li>
- <li><b>coprname</b> – The name of the copr in which the package
+ <li><b>username</b> – The name of given projects's owner</li>
+ <li><b>projectname</b> – The name of the project in which the package
should be built</li>
</ul>
10 years, 3 months
[copr] master: [frontend] provide info about last successfull build (7a05a74)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 7a05a7483264c3bfb6f724b883d77527764a4c73
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Feb 4 10:31:15 2014 +0100
[frontend] provide info about last successfull build
>---------------------------------------------------------------
coprs_frontend/coprs/logic/builds_logic.py | 19 ++++++++
coprs_frontend/coprs/logic/coprs_logic.py | 1 -
coprs_frontend/coprs/templates/api.html | 54 ++++++++++++++++++++++
coprs_frontend/coprs/views/api_ns/api_general.py | 36 ++++++++++++++
4 files changed, 109 insertions(+), 1 deletions(-)
diff --git a/coprs_frontend/coprs/logic/builds_logic.py b/coprs_frontend/coprs/logic/builds_logic.py
index 4b91f29..b449ff3 100644
--- a/coprs_frontend/coprs/logic/builds_logic.py
+++ b/coprs_frontend/coprs/logic/builds_logic.py
@@ -162,3 +162,22 @@ class BuildsLogic(object):
for build_chroot in build.build_chroots:
db.session.delete(build_chroot)
db.session.delete(build)
+
+ @classmethod
+ def last_modified(cls, copr):
+ """ Get build datetime (as epoch) of last successfull build
+
+ :arg copr: object of copr
+ """
+ builds = cls.get_multiple(None, copr=copr)
+
+ last_build = (builds
+ .join(models.BuildChroot)
+ .filter(models.BuildChroot.status == helpers.StatusEnum("succeeded"))
+ .filter(models.Build.ended_on != None)
+ .order_by(models.Build.ended_on.desc())
+ ).first()
+ if last_build:
+ return last_build.ended_on
+ else:
+ return None
diff --git a/coprs_frontend/coprs/logic/coprs_logic.py b/coprs_frontend/coprs/logic/coprs_logic.py
index 173f1d1..7cab264 100644
--- a/coprs_frontend/coprs/logic/coprs_logic.py
+++ b/coprs_frontend/coprs/logic/coprs_logic.py
@@ -7,7 +7,6 @@ from coprs import models
from coprs import signals
from coprs.logic import users_logic
-
class CoprsLogic(object):
"""
diff --git a/coprs_frontend/coprs/templates/api.html b/coprs_frontend/coprs/templates/api.html
index 2a0a2a9..4a5a9f3 100644
--- a/coprs_frontend/coprs/templates/api.html
+++ b/coprs_frontend/coprs/templates/api.html
@@ -95,6 +95,60 @@ copr_url = http://copr.fedoraproject.org
}
</pre>
+ <h3>Detail of project</h3>
+
+ <h4>URL:</h4>
+ <pre style="font-size:120%">/api/coprs/<username>/<projectname>/detail/</pre>
+
+ <h4>URL parameters:</h4>
+ <ul>
+ <li><b>username</b> – The name of the user whose coprs you'd like
+ to list</li>
+ <li><b>priojectname</b> – The name of the project</li>
+
+ </ul>
+
+ <h4>Result:</h4>
+ <ul>
+ <li><b>"detial"</b> – dictionary with following keys:
+ <ul>
+ <li><b>"yum_repos"</b> – Map of chroots to yum repository
+ URLs. Chroots are in format
+ "<release>-<version>-<architecture>"</li>
+ <li><b>"additional_repos"</b> – List of additional
+ repositories that are required for this copr</li>
+ <li><b>"instructions"</b> – Installation instructions
+ provided by copr's owner </li>
+ <li><b>"name"</b> – Name of the copr</li>
+ <li><b>"description"</b> – Description provided by copr's
+ owner </li>
+ <li><b>"last_modified"</b> – Datetime (in epoch format) of
+ last successfull build.</li>
+ </ul>
+ </ul>
+
+ <h4>Example call URL</h4>
+ <pre style="font-size:120%">https://copr.fedoraproject.org/api/coprs/jdaniels/log4j/detail/</pre>
+
+ <h4>Example results</h4>
+ <pre>
+ {
+ "output": "ok",
+ "repos": [
+ {
+ "yum_repos": {
+ "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": "",
+ "name": "log4j",
+ "description": "Java logging package",
+ "last_modified": 1386695673
+ }
+ ]
+ }
+ </pre>
<h3>Create new copr</h3>
diff --git a/coprs_frontend/coprs/views/api_ns/api_general.py b/coprs_frontend/coprs/views/api_ns/api_general.py
index 166ad13..063593d 100644
--- a/coprs_frontend/coprs/views/api_ns/api_general.py
+++ b/coprs_frontend/coprs/views/api_ns/api_general.py
@@ -156,6 +156,42 @@ def api_coprs_by_owner(username=None):
jsonout.status_code = httpcode
return jsonout
+(a)api_ns.route("/coprs/<username>/<coprname>/detail/")
+def api_coprs_by_owner_detail(username, coprname):
+ """ Return detail of one project.
+
+ :arg username: the username of the person one would like to the
+ coprs of.
+ :arg coprname: the name of project.
+
+ """
+ copr = coprs_logic.CoprsLogic.get(flask.g.user, username,
+ coprname).first()
+ release_tmpl = "{chroot.os_release}-{chroot.os_version}-{chroot.arch}"
+ httpcode = 200
+ if username and copr:
+ output = {"output": "ok", "detail": {}}
+ yum_repos = {}
+ for build in copr.builds:
+ if build.results:
+ for chroot in copr.active_chroots:
+ release = release_tmpl.format(chroot=chroot)
+ yum_repos[release] = urlparse.urljoin(
+ build.results, release + '/')
+ break
+ output["detail"] = {"name": copr.name,
+ "additional_repos": copr.repos,
+ "yum_repos": yum_repos,
+ "description": copr.description,
+ "instructions": copr.instructions,
+ "last_modified": builds_logic.BuildsLogic.last_modified(copr)}
+ else:
+ output = {"output": "notok", "error": "Copr with name {0} does not exist.".format(coprname)}
+ httpcode = 500
+
+ jsonout = flask.jsonify(output)
+ jsonout.status_code = httpcode
+ return jsonout
@api_ns.route("/coprs/<username>/<coprname>/new_build/", methods=["POST"])
@api_login_required
10 years, 3 months
[copr] master: [spec] rhel5 needs group definition even in subpackage (c60e0c7)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit c60e0c7768ad8fc7e6d52b5a50898ffadab51704
Author: Miroslav Suchý <miroslav(a)suchy.cz>
Date: Tue Jan 28 01:48:21 2014 +0100
[spec] rhel5 needs group definition even in subpackage
>---------------------------------------------------------------
copr.spec | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/copr.spec b/copr.spec
index 42703cc..720c54e 100644
--- a/copr.spec
+++ b/copr.spec
@@ -133,6 +133,9 @@ This package contains frontend.
Summary: Command line interface for COPR
Requires: python-requests
Requires: python-setuptools
+%if 0%{?rhel} < 6 && 0%{?rhel} > 0
+Group: Applications/Productivity
+%endif
%if 0%{?rhel} < 7 && 0%{?rhel} > 0
Requires: python-argparse
%endif
10 years, 3 months