[copr] master: temporary workaround for BZ 1065251 (74a64de)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 74a64de37b54ba1d77cae9cec4b0fbb259b4fcda
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 14 09:31:59 2014 +0100
temporary workaround for BZ 1065251
>---------------------------------------------------------------
backend/dispatcher.py | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/backend/dispatcher.py b/backend/dispatcher.py
index 4374552..77bf2ed 100644
--- a/backend/dispatcher.py
+++ b/backend/dispatcher.py
@@ -9,6 +9,7 @@ import subprocess
import multiprocessing
import ansible
+import ansible.utils
from ansible import callbacks
from bunch import Bunch
from setproctitle import setproctitle
10 years, 2 months
[copr] master: Chroot details API now uses GET instead of POST (0aaf69a)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 0aaf69a1ce3670d579a09c712542aa54ff4dfcb7
Author: Matej Stuchlik <mstuchli(a)redhat.com>
Date: Thu Feb 13 05:58:24 2014 -0500
Chroot details API now uses GET instead of POST
>---------------------------------------------------------------
coprs_frontend/coprs/views/api_ns/api_general.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/coprs_frontend/coprs/views/api_ns/api_general.py b/coprs_frontend/coprs/views/api_ns/api_general.py
index d43d0dd..0a673d2 100644
--- a/coprs_frontend/coprs/views/api_ns/api_general.py
+++ b/coprs_frontend/coprs/views/api_ns/api_general.py
@@ -321,7 +321,7 @@ def copr_modify_chroot(username, coprname, chrootname):
jsonout.status_code = httpcode
return jsonout
-(a)api_ns.route('/coprs/<username>/<coprname>/detail/<chrootname>/', methods=["POST"])
+(a)api_ns.route('/coprs/<username>/<coprname>/detail/<chrootname>/', methods=["GET"])
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()
10 years, 2 months
[copr] master's head updated: Merge branch 'dnf' (b2212f2)
by Igor Gnatenko
Repository : http://git.fedorahosted.org/cgit/copr.git
Branch 'master' now includes:
311f89a dnf-plugin: answer is no by default
2a0beb6 dnf-plugin: enable logging
36276df dnf-plugin: use _copr_user-copr for .repo
c563e17 dnf-plugin: implement disable function
c1e6536 dnf-plugin: make third argument optional
0450b79 dnf-plugin: implement list function
fed2a50 dnf-plugin: use cli.logger instead
b2212f2 Merge branch 'dnf'
10 years, 2 months
[copr] master: Merge branch 'dnf' (b2212f2)
by Igor Gnatenko
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit b2212f204026c9ce49ae0ee811a571bc0d32ac02
Merge: f0cc497 fed2a50
Author: Igor Gnatenko <i.gnatenko.brain(a)gmail.com>
Date: Wed Feb 12 21:10:51 2014 +0400
Merge branch 'dnf'
>---------------------------------------------------------------
dnf-plugin/copr_hook.py | 61 +++++++++++++++++++++++++++++++++++++++-------
1 files changed, 51 insertions(+), 10 deletions(-)
diff --git a/dnf-plugin/copr_hook.py b/dnf-plugin/copr_hook.py
index 61ab0dc..eeddc8c 100644
--- a/dnf-plugin/copr_hook.py
+++ b/dnf-plugin/copr_hook.py
@@ -1,12 +1,15 @@
import dnf
import os
import sys
+import platform
from dnf.yum.i18n import _
from urlgrabber import grabber
+import urllib
+import json
-yes = set([_('yes'), _('y'), ''])
-no = set([_('no'), _('n')])
+yes = set([_('yes'), _('y')])
+no = set([_('no'), _('n'), ''])
class Copr(dnf.Plugin):
"""DNF plugin supplying the 'copr' command."""
@@ -18,6 +21,7 @@ class Copr(dnf.Plugin):
super(Copr, self).__init__(base, cli)
if cli is not None:
cli.register_command(CoprCommand)
+ cli.logger.debug("initialized Copr plugin")
class CoprCommand(dnf.cli.Command):
""" Copr plugin for DNF """
@@ -29,29 +33,44 @@ class CoprCommand(dnf.cli.Command):
"""Return a one line summary of what the command does."""
return _("""Interact with Copr repositories. Example:
copr enable rhscl/perl516 epel-6-x86_64
+ copr enable ignatenkobrain/ocltoys
+ copr disable rhscl/perl516
+ copr list ignatenkobrain
""")
@staticmethod
def get_usage():
"""Return a usage string for the command, including arguments."""
- return _("enable name/project chroot")
+ return _("""
+enable name/project [chroot]
+disable name/project
+list name""")
def run(self, extcmds):
# 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
+ subcommand = extcmds[0]
+ project_name = extcmds[1]
except ValueError:
self.cli.logger.critical(
- _('Error: ') + _('exactly three additional parameters to copr command are required'))
+ _('Error: ') + _('exactly two additional parameters to copr command are required'))
dnf.cli.commands._err_mini_usage(self.cli, self.cli.base.basecmd)
- raise dnf.cli.CliError(_('exactly three additional parameters to copr command are required'))
- repo_filename = "/etc/yum.repos.d/{}.repo".format(project_name.replace("/", "_"))
-
+ raise dnf.cli.CliError(_('exactly two additional parameters to copr command are required'))
+ try:
+ chroot = extcmds[2]
+ except IndexError:
+ # FIXME Copr should generate non-specific arch repo
+ dist = platform.linux_distribution()
+ if "Fedora" in dist:
+ chroot = ("fedora-%s-x86_64" % dist[2].lower() if "Rawhide" in dist else dist[1])
+ else:
+ chroot = ("epel-%s-x86_64" % dist[1].split(".", 1)[0], arch)
+ repo_filename = "/etc/yum.repos.d/_copr_{}.repo".format(project_name.replace("/", "-"))
+ base_url = "http://copr.fedoraproject.org"
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()
@@ -62,6 +81,27 @@ class CoprCommand(dnf.cli.Command):
except grabber.URLGrabError, e:
raise dnf.exceptions.Error(str(e)), None, sys.exc_info()[2]
self.cli.logger.info(_("Repository successfully enabled."))
+ elif subcommand == "disable":
+ # FIXME is it Copr repo ?
+ try:
+ os.remove(repo_filename)
+ except OSError, e:
+ raise dnf.exceptions.Error(str(e)), None, sys.exc_info()[2]
+ self.cli.logger.info(_("Repository successfully disabled."))
+ elif subcommand == "list":
+ #http://copr.fedoraproject.org/api/coprs/ignatenkobrain/
+ api_path = "/api/coprs/{}/".format(project_name)
+
+ opener = urllib.FancyURLopener({})
+ res = opener.open(base_url+api_path)
+ try:
+ json_parse = json.loads(res.read())
+ except ValueError:
+ raise dnf.exceptions.Error(_("Can't parse repositories for username '{}'.").format(project_name)), None, sys.exc_info()[2]
+ i = 0
+ while i < len(json_parse["repos"]):
+ print "{0}/{1}".format(project_name, json_parse["repos"][i]["name"])
+ i += 1
else:
raise dnf.exceptions.Error(_('Unknown subcommand {}.').format(subcommand))
@@ -75,11 +115,12 @@ 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]: """)
+Do you want to continue? [y/N]: """)
answer = raw_input(question).lower()
answer = _(answer)
while not ((answer in yes) or (answer in no)):
answer = raw_input(question).lower()
+ answer = _(answer)
if answer in yes:
return
else:
10 years, 2 months
[copr] dnf: dnf-plugin: use cli.logger instead (fed2a50)
by Igor Gnatenko
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : dnf
>---------------------------------------------------------------
commit fed2a505d3a6148b7652cfffc9651f37e877980b
Author: Igor Gnatenko <i.gnatenko.brain(a)gmail.com>
Date: Wed Feb 12 20:59:03 2014 +0400
dnf-plugin: use cli.logger instead
Signed-off-by: Igor Gnatenko <i.gnatenko.brain(a)gmail.com>
>---------------------------------------------------------------
dnf-plugin/copr_hook.py | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/dnf-plugin/copr_hook.py b/dnf-plugin/copr_hook.py
index 42af038..eeddc8c 100644
--- a/dnf-plugin/copr_hook.py
+++ b/dnf-plugin/copr_hook.py
@@ -1,5 +1,4 @@
import dnf
-import logging
import os
import sys
import platform
@@ -12,8 +11,6 @@ import json
yes = set([_('yes'), _('y')])
no = set([_('no'), _('n'), ''])
-logger = logging.getLogger('dnf.plugin')
-
class Copr(dnf.Plugin):
"""DNF plugin supplying the 'copr' command."""
@@ -24,7 +21,7 @@ class Copr(dnf.Plugin):
super(Copr, self).__init__(base, cli)
if cli is not None:
cli.register_command(CoprCommand)
- logger.debug("initialized Copr plugin")
+ cli.logger.debug("initialized Copr plugin")
class CoprCommand(dnf.cli.Command):
""" Copr plugin for DNF """
10 years, 2 months
[copr] master: when deleting/canceling task, go to same page (f0cc497)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit f0cc497ea5acd993be953ade153eeed725361383
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Wed Feb 12 15:52:02 2014 +0100
when deleting/canceling task, go to same page
>---------------------------------------------------------------
.../templates/coprs/detail/_builds_forms.html | 9 +++++--
.../templates/coprs/detail/_builds_table.html | 8 +++---
.../coprs/templates/coprs/detail/builds.html | 2 +-
.../coprs/views/coprs_ns/coprs_builds.py | 24 +++++++++++++++-----
4 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/coprs_frontend/coprs/templates/coprs/detail/_builds_forms.html b/coprs_frontend/coprs/templates/coprs/detail/_builds_forms.html
index e918ade..f6b7bd2 100644
--- a/coprs_frontend/coprs/templates/coprs/detail/_builds_forms.html
+++ b/coprs_frontend/coprs/templates/coprs/detail/_builds_forms.html
@@ -23,25 +23,28 @@
</form>
{% endmacro %}
-{% macro copr_build_cancel_form(build) %}
+{% macro copr_build_cancel_form(build, page) %}
{% if build.cancelable %}
<form action="{{ url_for('coprs_ns.copr_cancel_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="Cancel">
</form>
{% endif %}
{% endmacro %}
-{% macro copr_build_repeat_form(build) %}
+{% macro copr_build_repeat_form(build, page) %}
{% if build.cancelable %}
<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">
</form>
{% endif %}
{% endmacro %}
-{% macro copr_build_delete_form(build) %}
+{% macro copr_build_delete_form(build, page) %}
{% 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="hidden" value="page" value="{{ page }}">
<input type="submit" value="Delete">
</form>
{% endif %}
diff --git a/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html b/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
index d2364d9..720ef76 100644
--- a/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
+++ b/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
@@ -1,6 +1,6 @@
{% from "coprs/detail/_builds_forms.html" import copr_build_cancel_form, copr_build_repeat_form, copr_build_delete_form %}
-{% macro builds_table(builds) %}
+{% macro builds_table(builds, page) %}
{% if builds %}
<table class="builds-table">
<tr>
@@ -34,13 +34,13 @@
<td colspan=6 class="end">
<div>
{% if g.user and g.user.can_build_in(copr) %}
- {{ copr_build_cancel_form(build) }}
+ {{ copr_build_cancel_form(build, page) }}
{% endif %}
{% if g.user and g.user.can_build_in(copr) %}
- {{ copr_build_repeat_form(build) }}
+ {{ copr_build_repeat_form(build, page) }}
{% endif %}
{% if g.user and g.user.can_edit(copr) %}
- {{ copr_build_delete_form(build) }}
+ {{ copr_build_delete_form(build, page) }}
{% endif %}
<div>
{% if build.results %}
diff --git a/coprs_frontend/coprs/templates/coprs/detail/builds.html b/coprs_frontend/coprs/templates/coprs/detail/builds.html
index 2746554..3aca8bf 100644
--- a/coprs_frontend/coprs/templates/coprs/detail/builds.html
+++ b/coprs_frontend/coprs/templates/coprs/detail/builds.html
@@ -6,7 +6,7 @@
{% block detail_body %}
{% if builds %}
- {{ builds_table(builds) }}
+ {{ builds_table(builds, paginator.page) }}
<div class="pagination">
{{ render_pagination(request, paginator) }}
</div>
diff --git a/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py b/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
index f1e73ed..dbcc3dd 100644
--- a/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
+++ b/coprs_frontend/coprs/views/coprs_ns/coprs_builds.py
@@ -86,9 +86,12 @@ def copr_new_build(username, coprname):
@coprs_ns.route("/<username>/<coprname>/cancel_build/<int:build_id>/",
+ defaults={"page": 1},
+ methods=["POST"])
+(a)coprs_ns.route("/<username>/<coprname>/cancel_build/<int:build_id>/<int:page>/",
methods=["POST"])
@login_required
-def copr_cancel_build(username, coprname, build_id):
+def copr_cancel_build(username, coprname, build_id, page=1):
# only the user who ran the build can cancel it
build = builds_logic.BuildsLogic.get(build_id).first()
if not build:
@@ -104,13 +107,17 @@ def copr_cancel_build(username, coprname, build_id):
return flask.redirect(flask.url_for("coprs_ns.copr_builds",
username=username,
- coprname=coprname))
+ coprname=coprname,
+ page=page))
@coprs_ns.route("/<username>/<coprname>/repeat_build/<int:build_id>/",
+ defaults={"page": 1},
+ methods=["GET", "POST"])
+(a)coprs_ns.route("/<username>/<coprname>/repeat_build/<int:build_id>/<int:page>/",
methods=["GET", "POST"])
@login_required
-def copr_repeat_build(username, coprname, build_id):
+def copr_repeat_build(username, coprname, build_id, page=1):
build = builds_logic.BuildsLogic.get(build_id).first()
copr = coprs_logic.CoprsLogic.get(
flask.g.user, username=username, coprname=coprname).first()
@@ -141,13 +148,17 @@ def copr_repeat_build(username, coprname, build_id):
return flask.redirect(flask.url_for("coprs_ns.copr_builds",
username=username,
- coprname=coprname))
+ coprname=coprname,
+ page=page))
@coprs_ns.route("/<username>/<coprname>/delete_build/<int:build_id>/",
+ defaults={"page": 1},
+ methods=["POST"])
+(a)coprs_ns.route("/<username>/<coprname>/delete_build/<int:build_id>/<int:page>/",
methods=["POST"])
@login_required
-def copr_delete_build(username, coprname, build_id):
+def copr_delete_build(username, coprname, build_id, page=1):
build = builds_logic.BuildsLogic.get(build_id).first()
if not build:
return page_not_found(
@@ -161,4 +172,5 @@ def copr_delete_build(username, coprname, build_id):
flask.flash("Build was deleted")
return flask.redirect(flask.url_for("coprs_ns.copr_builds",
- username=username, coprname=coprname))
+ username=username, coprname=coprname,
+ page=page))
10 years, 2 months
[copr] dnf: dnf-plugin: implement list function (0450b79)
by Igor Gnatenko
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : dnf
>---------------------------------------------------------------
commit 0450b7957d9e40a67a8fe84d96c05c64c7ea7bd0
Author: Igor Gnatenko <i.gnatenko.brain(a)gmail.com>
Date: Wed Feb 12 18:49:23 2014 +0400
dnf-plugin: implement list function
Signed-off-by: Igor Gnatenko <i.gnatenko.brain(a)gmail.com>
>---------------------------------------------------------------
dnf-plugin/copr_hook.py | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/dnf-plugin/copr_hook.py b/dnf-plugin/copr_hook.py
index dd4000c..42af038 100644
--- a/dnf-plugin/copr_hook.py
+++ b/dnf-plugin/copr_hook.py
@@ -6,6 +6,8 @@ import platform
from dnf.yum.i18n import _
from urlgrabber import grabber
+import urllib
+import json
yes = set([_('yes'), _('y')])
no = set([_('no'), _('n'), ''])
@@ -36,6 +38,7 @@ class CoprCommand(dnf.cli.Command):
copr enable rhscl/perl516 epel-6-x86_64
copr enable ignatenkobrain/ocltoys
copr disable rhscl/perl516
+ copr list ignatenkobrain
""")
@staticmethod
@@ -43,7 +46,8 @@ class CoprCommand(dnf.cli.Command):
"""Return a usage string for the command, including arguments."""
return _("""
enable name/project [chroot]
-disable name/project""")
+disable name/project
+list name""")
def run(self, extcmds):
# FIXME this should do dnf itself (BZ#1062889)
@@ -67,9 +71,9 @@ disable name/project""")
else:
chroot = ("epel-%s-x86_64" % dist[1].split(".", 1)[0], arch)
repo_filename = "/etc/yum.repos.d/_copr_{}.repo".format(project_name.replace("/", "-"))
+ base_url = "http://copr.fedoraproject.org"
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()
@@ -87,6 +91,20 @@ disable name/project""")
except OSError, e:
raise dnf.exceptions.Error(str(e)), None, sys.exc_info()[2]
self.cli.logger.info(_("Repository successfully disabled."))
+ elif subcommand == "list":
+ #http://copr.fedoraproject.org/api/coprs/ignatenkobrain/
+ api_path = "/api/coprs/{}/".format(project_name)
+
+ opener = urllib.FancyURLopener({})
+ res = opener.open(base_url+api_path)
+ try:
+ json_parse = json.loads(res.read())
+ except ValueError:
+ raise dnf.exceptions.Error(_("Can't parse repositories for username '{}'.").format(project_name)), None, sys.exc_info()[2]
+ i = 0
+ while i < len(json_parse["repos"]):
+ print "{0}/{1}".format(project_name, json_parse["repos"][i]["name"])
+ i += 1
else:
raise dnf.exceptions.Error(_('Unknown subcommand {}.').format(subcommand))
10 years, 2 months
[copr] dnf: dnf-plugin: make third argument optional (c1e6536)
by Igor Gnatenko
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : dnf
>---------------------------------------------------------------
commit c1e6536e67f78ec29de6a10b888311c8e72e6269
Author: Igor Gnatenko <i.gnatenko.brain(a)gmail.com>
Date: Wed Feb 12 18:34:51 2014 +0400
dnf-plugin: make third argument optional
Signed-off-by: Igor Gnatenko <i.gnatenko.brain(a)gmail.com>
>---------------------------------------------------------------
dnf-plugin/copr_hook.py | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/dnf-plugin/copr_hook.py b/dnf-plugin/copr_hook.py
index 7c1d2fe..dd4000c 100644
--- a/dnf-plugin/copr_hook.py
+++ b/dnf-plugin/copr_hook.py
@@ -2,6 +2,7 @@ import dnf
import logging
import os
import sys
+import platform
from dnf.yum.i18n import _
from urlgrabber import grabber
@@ -33,29 +34,39 @@ class CoprCommand(dnf.cli.Command):
"""Return a one line summary of what the command does."""
return _("""Interact with Copr repositories. Example:
copr enable rhscl/perl516 epel-6-x86_64
- copr disable rhscl/perl516 epel-6-x86_64
+ copr enable ignatenkobrain/ocltoys
+ copr disable rhscl/perl516
""")
@staticmethod
def get_usage():
"""Return a usage string for the command, including arguments."""
return _("""
-enable name/project chroot
-disable name/project chroot""")
+enable name/project [chroot]
+disable name/project""")
def run(self, extcmds):
# 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
+ subcommand = extcmds[0]
+ project_name = extcmds[1]
except ValueError:
self.cli.logger.critical(
- _('Error: ') + _('exactly three additional parameters to copr command are required'))
+ _('Error: ') + _('exactly two additional parameters to copr command are required'))
dnf.cli.commands._err_mini_usage(self.cli, self.cli.base.basecmd)
- raise dnf.cli.CliError(_('exactly three additional parameters to copr command are required'))
+ raise dnf.cli.CliError(_('exactly two additional parameters to copr command are required'))
+ try:
+ chroot = extcmds[2]
+ except IndexError:
+ # FIXME Copr should generate non-specific arch repo
+ dist = platform.linux_distribution()
+ if "Fedora" in dist:
+ chroot = ("fedora-%s-x86_64" % dist[2].lower() if "Rawhide" in dist else dist[1])
+ else:
+ chroot = ("epel-%s-x86_64" % dist[1].split(".", 1)[0], arch)
repo_filename = "/etc/yum.repos.d/_copr_{}.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"
10 years, 2 months
[copr] dnf: dnf-plugin: implement disable function (c563e17)
by Igor Gnatenko
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : dnf
>---------------------------------------------------------------
commit c563e17474c641556bccd3864e4a2bc5ed6e86ec
Author: Igor Gnatenko <i.gnatenko.brain(a)gmail.com>
Date: Wed Feb 12 18:25:32 2014 +0400
dnf-plugin: implement disable function
Signed-off-by: Igor Gnatenko <i.gnatenko.brain(a)gmail.com>
>---------------------------------------------------------------
dnf-plugin/copr_hook.py | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/dnf-plugin/copr_hook.py b/dnf-plugin/copr_hook.py
index 4a50a2f..7c1d2fe 100644
--- a/dnf-plugin/copr_hook.py
+++ b/dnf-plugin/copr_hook.py
@@ -33,12 +33,15 @@ class CoprCommand(dnf.cli.Command):
"""Return a one line summary of what the command does."""
return _("""Interact with Copr repositories. Example:
copr enable rhscl/perl516 epel-6-x86_64
+ copr disable rhscl/perl516 epel-6-x86_64
""")
@staticmethod
def get_usage():
"""Return a usage string for the command, including arguments."""
- return _("enable name/project chroot")
+ return _("""
+enable name/project chroot
+disable name/project chroot""")
def run(self, extcmds):
# FIXME this should do dnf itself (BZ#1062889)
@@ -66,6 +69,13 @@ class CoprCommand(dnf.cli.Command):
except grabber.URLGrabError, e:
raise dnf.exceptions.Error(str(e)), None, sys.exc_info()[2]
self.cli.logger.info(_("Repository successfully enabled."))
+ elif subcommand == "disable":
+ # FIXME is it Copr repo ?
+ try:
+ os.remove(repo_filename)
+ except OSError, e:
+ raise dnf.exceptions.Error(str(e)), None, sys.exc_info()[2]
+ self.cli.logger.info(_("Repository successfully disabled."))
else:
raise dnf.exceptions.Error(_('Unknown subcommand {}.').format(subcommand))
10 years, 2 months