[copr] master: [frontend][RHBZ:1128602] RFE: define banner for local instance (5ab2579)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 5ab2579adc40e39e056086babed5c1a608417666
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Fri Aug 22 14:45:42 2014 +0200
[frontend][RHBZ:1128602] RFE: define banner for local instance
>---------------------------------------------------------------
frontend/coprs_frontend/coprs/__init__.py | 2 ++
.../coprs_frontend/coprs/context_processors.py | 10 ++++++++++
.../coprs_frontend/coprs/templates/layout.html | 5 +++++
3 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/__init__.py b/frontend/coprs_frontend/coprs/__init__.py
index 7aad77b..8d1e785 100644
--- a/frontend/coprs_frontend/coprs/__init__.py
+++ b/frontend/coprs_frontend/coprs/__init__.py
@@ -46,6 +46,8 @@ from coprs.views.status_ns import status_general
from coprs.views import recent_ns
from coprs.views.recent_ns import recent_general
+from .context_processors import include_banner
+
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/context_processors.py b/frontend/coprs_frontend/coprs/context_processors.py
new file mode 100644
index 0000000..db4d4c8
--- /dev/null
+++ b/frontend/coprs_frontend/coprs/context_processors.py
@@ -0,0 +1,10 @@
+import os
+from . import app
+
+BANNER_LOCATION = "/var/lib/copr/banner-include.html"
+
+
+(a)app.context_processor
+def include_banner():
+ if os.path.exists(BANNER_LOCATION):
+ return {"copr_banner": open(BANNER_LOCATION).read()}
diff --git a/frontend/coprs_frontend/coprs/templates/layout.html b/frontend/coprs_frontend/coprs/templates/layout.html
index 66823e4..1d520fe 100644
--- a/frontend/coprs_frontend/coprs/templates/layout.html
+++ b/frontend/coprs_frontend/coprs/templates/layout.html
@@ -11,6 +11,11 @@
<script src="{{ url_for('static', filename='copr.js') }}"></script>
</head>
<body>
+
+{% if copr_banner %}
+ {{ copr_banner | safe }}
+{% endif %}
+
<div class="menu">
<div class="menu-inner">
<a href="{{ url_for('coprs_ns.coprs_show') }}"><img id="logo" src="{{ url_for('static', filename='copr_logo.png') }}" alt="Copr Build System"></a>
9 years, 9 months
[copr] master: [frontend][RHBZ:1131186] Use https URLs to install copr repo file (624e40a)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 624e40a36c8727fe8f4d65d2e3cc635f66d98f25
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Fri Aug 22 13:16:18 2014 +0200
[frontend][RHBZ:1131186] Use https URLs to install copr repo file
>---------------------------------------------------------------
.../coprs/templates/coprs/detail/overview.html | 21 +++++++++++++------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/templates/coprs/detail/overview.html b/frontend/coprs_frontend/coprs/templates/coprs/detail/overview.html
index fb71b63..8c1f789 100644
--- a/frontend/coprs_frontend/coprs/templates/coprs/detail/overview.html
+++ b/frontend/coprs_frontend/coprs/templates/coprs/detail/overview.html
@@ -54,13 +54,20 @@
mock_chroot.os_version != copr.active_chroots[loop.index0 - 1].os_version or
loop.index0 == 0 %}
{# previous os_release-os_version were different or this is the first one #}
- <td><a href="{{ url_for(
- 'coprs_ns.generate_repo_file',
- username=copr.owner.name,
- coprname=copr.name,
- chroot=mock_chroot.os_release+"-"+mock_chroot.os_version,
- repofile=copr.owner.name+'-'+copr.name+'-'+mock_chroot.os_release+"-"+mock_chroot.os_version+'.repo') }}">
- {{ copr.owner.name }}-{{ copr.name }}-{{mock_chroot.os_release+"-"+mock_chroot.os_version}}.repo</a></td>
+ <td>
+ <a href="{{
+ url_for(
+ 'coprs_ns.generate_repo_file',
+ username=copr.owner.name,
+ coprname=copr.name,
+ chroot=mock_chroot.os_release+"-"+mock_chroot.os_version,
+ repofile=copr.owner.name+'-'+copr.name+'-'+mock_chroot.os_release+"-"+mock_chroot.os_version+'.repo',
+ _scheme='https',
+ _external=True
+ )}}">
+ {{ copr.owner.name }}-{{ copr.name }}-{{mock_chroot.os_release+"-"+mock_chroot.os_version}}.repo
+ </a>
+ </td>
{% else %}
<td></td>
{% endif %}
9 years, 9 months
[copr] master: Automatic commit of package [python-copr] release [1.46-1]. (445aede)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 445aede45c128957c9ffb8d85153a8a8229d89f1
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Fri Aug 22 10:28:35 2014 +0200
Automatic commit of package [python-copr] release [1.46-1].
>---------------------------------------------------------------
python/python-copr.spec | 5 ++++-
rel-eng/packages/python-copr | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/python/python-copr.spec b/python/python-copr.spec
index 3f07c36..dcaf58b 100644
--- a/python/python-copr.spec
+++ b/python/python-copr.spec
@@ -5,7 +5,7 @@
%global with_python3 1
Name: python-copr
-Version: 1.45
+Version: 1.46
Release: 1%{?dist}
Summary: Python interface for Copr
@@ -160,6 +160,9 @@ popd
%endif
%changelog
+* Fri Aug 22 2014 Valentin Gologuzov <vgologuz(a)redhat.com> 1.46-1
+- [python-copr] packaging fixes to satisfy Fedora package guidelines.
+
* Thu Aug 21 2014 Valentin Gologuzov <vgologuz(a)redhat.com> 1.45-1
- change package name: python-copr-client -> python-copr
diff --git a/rel-eng/packages/python-copr b/rel-eng/packages/python-copr
index ad9ae3d..f8bf078 100644
--- a/rel-eng/packages/python-copr
+++ b/rel-eng/packages/python-copr
@@ -1 +1 @@
-1.45-1 python/
+1.46-1 python/
9 years, 9 months
[copr] master: [python-copr] packaging fixes to satisfy Fedora package guidelines. (2c22f2a)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 2c22f2a57fd16479f3086ffdc7c12be2814e9f20
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Fri Aug 22 10:27:18 2014 +0200
[python-copr] packaging fixes to satisfy Fedora package guidelines.
>---------------------------------------------------------------
python/python-copr.spec | 54 ++++++++++++++++++++++++----------------------
1 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/python/python-copr.spec b/python/python-copr.spec
index d261a82..3f07c36 100644
--- a/python/python-copr.spec
+++ b/python/python-copr.spec
@@ -27,60 +27,60 @@ BuildRequires: python-six
BuildRequires: python-mock
BuildRequires: pytest
BuildRequires: python2-devel
-%if 0%{?with_python3}
-BuildRequires: python3-devel
-BuildRequires: python3-setuptools
-BuildRequires: python3-pytest
-BuildRequires: python3-mock
-BuildRequires: python3-requests
-BuildRequires: python3-six
-%endif # if with_python3
#for doc package
BuildRequires: epydoc
BuildRequires: graphviz
-Requires: python-requests
Requires: python-setuptools
Requires: python-six
-%if 0%{?with_python3}
-Requires: python3-six
-Requires: python3-requests
-%endif # if with_python3
-
+Requires: python-requests
%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.
-This package contains python interface to access Copr service. Mostly useful for developers
-only.
+This package contains python interface to access Copr service. Mostly useful
+for developers.
+only
%if 0%{?with_python3}
-%package -n python3-copr-client
+%package -n python3-copr
Summary: Python interface for Copr
Group: Applications/Productivity
-%description -n python3-copr-client
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pytest
+BuildRequires: python3-mock
+BuildRequires: python3-requests
+BuildRequires: python3-six
+
+Requires: python3-setuptools
+Requires: python3-six
+Requires: python3-requests
+
+%description -n python3-copr
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.
-This package contains python interface to access Copr service. Mostly useful for developers
-only.
+This package contains python interface to access Copr service. Mostly useful
+for developers.
+only
%endif # with_python3
%if 0%{?fedora}
%package doc
-Summary: Code documentation for python-copr package.
+Summary: Code documentation for python-copr package
%description doc
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.
-This package includes documentation for python-copr. Mostly useful for developers
-only.
+This package includes documentation for python-copr. Mostly useful for
+developers only.
%endif
%prep
@@ -96,12 +96,12 @@ find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
%build
-CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
+CFLAGS="%{optflags}" %{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
-CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
+CFLAGS="%{optflags}" %{__python3} setup.py build
popd
%endif # with_python3
@@ -148,13 +148,15 @@ popd
%{python_sitelib}/*
%if 0%{?with_python3}
+%files -n python3-copr
+%doc LICENSE README.rst
%{python3_sitelib}/*
%endif # with_python3
%if 0%{?fedora}
%files doc
%doc LICENSE
-%doc %{_pkgdocdir}/python-doc
+%doc %{_pkgdocdir}
%endif
%changelog
9 years, 9 months
[copr] master: [backend] [RHBZ:1128606 ] For rhel-5 builds pass "--checksum md5" to `createrepo_c` command. (02b8fa8)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 02b8fa8307d8af4900183f8a3f0ec8dcb046e8de
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Aug 21 18:01:38 2014 +0200
[backend] [RHBZ:1128606 ] For rhel-5 builds pass "--checksum md5" to `createrepo_c` command.
>---------------------------------------------------------------
backend/backend/mockremote.py | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/backend/backend/mockremote.py b/backend/backend/mockremote.py
index ae21aeb..bec58c2 100755
--- a/backend/backend/mockremote.py
+++ b/backend/backend/mockremote.py
@@ -64,21 +64,14 @@ class SortedOptParser(optparse.OptionParser):
def createrepo(path, lock=None):
+ comm = ['/usr/bin/createrepo_c', '--database', '--ignore-lock']
+ if os.path.exists(path + '/repodata/repomd.xml'):
+ comm.append("--update")
if "epel-5" in path:
# this is because rhel-5 doesn't know sha256
- if os.path.exists(path + '/repodata/repomd.xml'):
- comm = ['/usr/bin/createrepo_c', '--database', '--ignore-lock',
- '--update', '-s', 'sha', path]
- else:
- comm = ['/usr/bin/createrepo_c', '--database', '--ignore-lock',
- '-s', 'sha', path]
- else:
- if os.path.exists(path + '/repodata/repomd.xml'):
- comm = ['/usr/bin/createrepo_c', '--database', '--ignore-lock',
- '--update', path]
- else:
- comm = ['/usr/bin/createrepo_c', '--database', '--ignore-lock',
- path]
+ comm.extend(['-s', 'sha', '--checksum', 'md5'])
+ comm.append(path)
+
if lock:
lock.acquire()
cmd = subprocess.Popen(comm,
9 years, 9 months
[copr] master: Automatic commit of package [python-copr] release [1.45-1]. (dceb473)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit dceb473250a27d8a615c53fc1d956a476dee8ad5
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Aug 21 17:04:07 2014 +0200
Automatic commit of package [python-copr] release [1.45-1].
>---------------------------------------------------------------
python/python-copr.spec | 5 ++++-
rel-eng/packages/python-copr | 1 +
rel-eng/packages/python-copr-client | 1 -
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/python/python-copr.spec b/python/python-copr.spec
index 52a4708..d261a82 100644
--- a/python/python-copr.spec
+++ b/python/python-copr.spec
@@ -5,7 +5,7 @@
%global with_python3 1
Name: python-copr
-Version: 1.44
+Version: 1.45
Release: 1%{?dist}
Summary: Python interface for Copr
@@ -158,6 +158,9 @@ popd
%endif
%changelog
+* Thu Aug 21 2014 Valentin Gologuzov <vgologuz(a)redhat.com> 1.45-1
+- change package name: python-copr-client -> python-copr
+
* Tue Aug 19 2014 Valentin Gologuzov <vgologuz(a)redhat.com> 1.44-1
- [python-client] fixed BuildRequires
diff --git a/rel-eng/packages/python-copr b/rel-eng/packages/python-copr
new file mode 100644
index 0000000..ad9ae3d
--- /dev/null
+++ b/rel-eng/packages/python-copr
@@ -0,0 +1 @@
+1.45-1 python/
diff --git a/rel-eng/packages/python-copr-client b/rel-eng/packages/python-copr-client
deleted file mode 100644
index 1b19557..0000000
--- a/rel-eng/packages/python-copr-client
+++ /dev/null
@@ -1 +0,0 @@
-1.44-1 python/
9 years, 9 months
[copr] master: [python-copr] Renamed package: python-copr-client -> python-copr (67b870e)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 67b870efbf19c3a204bddca9f91875f8c1ab19e2
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Aug 21 17:02:34 2014 +0200
[python-copr] Renamed package: python-copr-client -> python-copr
>---------------------------------------------------------------
cli/copr_cli/main.py | 4 +-
python/{copr_client => copr}/README.rst | 0
python/{copr_client => copr}/__init__.py | 0
python/{copr_client => copr}/client/__init__.py | 0
python/{copr_client => copr}/client/client.py | 0
python/{copr_client => copr}/client/exceptions.py | 0
python/{copr_client => copr}/client/responses.py | 2 +-
python/{copr_client => copr}/test/__init__.py | 0
.../test/resources/build_details.200.json | 0
.../test/resources/copr_cli.conf | 0
.../test/resources/projects_list.200.json | 0
python/{copr_client => copr}/test/test_client.py | 2 +-
python/documentation/Makefile | 2 +-
.../{python-copr-client.spec => python-copr.spec} | 34 ++++++++-----------
python/setup.py | 6 ++--
15 files changed, 22 insertions(+), 28 deletions(-)
diff --git a/cli/copr_cli/main.py b/cli/copr_cli/main.py
index b575b48..e4c617e 100644
--- a/cli/copr_cli/main.py
+++ b/cli/copr_cli/main.py
@@ -10,8 +10,8 @@ import datetime
import time
from collections import defaultdict
-from copr_client import CoprClient
-import copr_client.client.exceptions as copr_exceptions
+from copr import CoprClient
+import copr.client.exceptions as copr_exceptions
try:
diff --git a/python/copr_client/README.rst b/python/copr/README.rst
similarity index 100%
rename from python/copr_client/README.rst
rename to python/copr/README.rst
diff --git a/python/copr_client/__init__.py b/python/copr/__init__.py
similarity index 100%
rename from python/copr_client/__init__.py
rename to python/copr/__init__.py
diff --git a/python/copr_client/client/__init__.py b/python/copr/client/__init__.py
similarity index 100%
rename from python/copr_client/client/__init__.py
rename to python/copr/client/__init__.py
diff --git a/python/copr_client/client/client.py b/python/copr/client/client.py
similarity index 100%
rename from python/copr_client/client/client.py
rename to python/copr/client/client.py
diff --git a/python/copr_client/client/exceptions.py b/python/copr/client/exceptions.py
similarity index 100%
rename from python/copr_client/client/exceptions.py
rename to python/copr/client/exceptions.py
diff --git a/python/copr_client/client/responses.py b/python/copr/client/responses.py
similarity index 99%
rename from python/copr_client/client/responses.py
rename to python/copr/client/responses.py
index 2769969..3f00d13 100644
--- a/python/copr_client/client/responses.py
+++ b/python/copr/client/responses.py
@@ -15,7 +15,7 @@ class BaseResponse(object):
def __init__(self, client, response):
"""
- :param client: copr_client.main.Client
+ :param client: copr.main.Client
:param response:
"""
self.response = response
diff --git a/python/copr_client/test/__init__.py b/python/copr/test/__init__.py
similarity index 100%
rename from python/copr_client/test/__init__.py
rename to python/copr/test/__init__.py
diff --git a/python/copr_client/test/resources/build_details.200.json b/python/copr/test/resources/build_details.200.json
similarity index 100%
rename from python/copr_client/test/resources/build_details.200.json
rename to python/copr/test/resources/build_details.200.json
diff --git a/python/copr_client/test/resources/copr_cli.conf b/python/copr/test/resources/copr_cli.conf
similarity index 100%
rename from python/copr_client/test/resources/copr_cli.conf
rename to python/copr/test/resources/copr_cli.conf
diff --git a/python/copr_client/test/resources/projects_list.200.json b/python/copr/test/resources/projects_list.200.json
similarity index 100%
rename from python/copr_client/test/resources/projects_list.200.json
rename to python/copr/test/resources/projects_list.200.json
diff --git a/python/copr_client/test/test_client.py b/python/copr/test/test_client.py
similarity index 98%
rename from python/copr_client/test/test_client.py
rename to python/copr/test/test_client.py
index 3d0fe86..7835762 100644
--- a/python/copr_client/test/test_client.py
+++ b/python/copr/test/test_client.py
@@ -4,7 +4,7 @@ import pytest
import mock
from requests.models import Response
-from copr_client import CoprClient
+from copr import CoprClient
path = os.path.abspath(__file__)
dir_path = os.path.dirname(path)
diff --git a/python/documentation/Makefile b/python/documentation/Makefile
index 11be589..14be501 100644
--- a/python/documentation/Makefile
+++ b/python/documentation/Makefile
@@ -13,7 +13,7 @@ BUILD_DIR := build
EPYDOC_BIN := `which epydoc`
EPYDOC_SWITCHES := --inheritance listed --graph all --html -v
PYTHON_DOC_DIR := python-doc
-PYTHON_DIRS := ../copr_client
+PYTHON_DIRS := ../copr
# TARGETS
# schema is not incldued here, since you need a live db
diff --git a/python/python-copr-client.spec b/python/python-copr.spec
similarity index 97%
rename from python/python-copr-client.spec
rename to python/python-copr.spec
index 517a060..52a4708 100644
--- a/python/python-copr-client.spec
+++ b/python/python-copr.spec
@@ -4,7 +4,7 @@
%endif
%global with_python3 1
-Name: python-copr-client
+Name: python-copr
Version: 1.44
Release: 1%{?dist}
Summary: Python interface for Copr
@@ -50,9 +50,10 @@ Requires: python3-requests
%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 latests builds.
+and submit new builds and COPR will create yum repository from latest builds.
-This package contains command line interface.
+This package contains python interface to access Copr service. Mostly useful for developers
+only.
%if 0%{?with_python3}
@@ -62,9 +63,9 @@ Group: Applications/Productivity
%description -n python3-copr-client
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.
+and submit new builds and COPR will create yum repository from latest builds.
-This package include documentation for COPR code. Mostly useful for developers
+This package contains python interface to access Copr service. Mostly useful for developers
only.
%endif # with_python3
@@ -72,18 +73,16 @@ only.
%if 0%{?fedora}
%package doc
-Summary: Code documentation for COPR
+Summary: Code documentation for python-copr package.
%description doc
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.
+and submit new builds and COPR will create yum repository from latest builds.
-This package include documentation for COPR code. Mostly useful for developers
+This package includes documentation for python-copr. Mostly useful for developers
only.
%endif
-
-
%prep
%setup -q
@@ -107,7 +106,7 @@ CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
popd
%endif # with_python3
-mv copr_client/README.rst ./
+mv copr/README.rst ./
%if 0%{?fedora}
# build documentation
@@ -118,8 +117,6 @@ popd
%install
-install -d %{buildroot}%{_pkgdocdir}/
-
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
@@ -131,22 +128,21 @@ popd
find %{buildroot}%{python2_sitelib} -name '*.exe' | xargs rm -f
#doc
+install -d %{buildroot}%{_pkgdocdir}/
+
%if 0%{?fedora}
cp -a documentation/python-doc %{buildroot}%{_pkgdocdir}/
%endif
-#rm -rf %{buildroot}
%check
-
-%{__python2} -m pytest copr_client/test
+%{__python2} -m pytest copr/test
%if 0%{?with_python3}
pushd %{py3dir}
-%{__python3} -m pytest copr_client
+%{__python3} -m pytest copr/test
popd
%endif # with_python3
-
%files
%doc LICENSE README.rst
%{python_sitelib}/*
@@ -155,8 +151,6 @@ popd
%{python3_sitelib}/*
%endif # with_python3
-
-
%if 0%{?fedora}
%files doc
%doc LICENSE
diff --git a/python/setup.py b/python/setup.py
index 1527a97..c11f417 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -11,14 +11,14 @@ is used to allow packagers to create third party repositories.
This part is a python client to the copr service."""
-from copr_client.client import __description__, __version__
+from copr.client import __description__, __version__
requires = [
'requests',
]
-__name__ = 'copr-client'
+__name__ = 'copr'
__version__ = __version__
__description__ = __description__
__author__ = "Valentin Gologuzov"
@@ -43,7 +43,7 @@ setup(
"Development Status :: 1 - Alpha",
],
install_requires=requires,
- packages=['copr_client', 'copr_client.client', 'copr_client.test'],
+ packages=['copr', 'copr.client', 'copr.test'],
include_package_data=True,
zip_safe=False,
)
9 years, 9 months
[copr] master: [frontend] [RHBZ:1128231] Show list of recent builds owned by user ( for logged in users). (03df2df)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 03df2df1d956346e0f1693b285508766f7422664
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Aug 21 16:57:20 2014 +0200
[frontend] [RHBZ:1128231] Show list of recent builds owned by user ( for logged in users).
>---------------------------------------------------------------
.../coprs_frontend/coprs/logic/builds_logic.py | 13 ++++-
.../coprs_frontend/coprs/templates/recent.html | 49 +++++++++++++++++++-
.../coprs/views/recent_ns/recent_general.py | 13 +++++-
3 files changed, 70 insertions(+), 5 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/logic/builds_logic.py b/frontend/coprs_frontend/coprs/logic/builds_logic.py
index 26567b4..434a5eb 100644
--- a/frontend/coprs_frontend/coprs/logic/builds_logic.py
+++ b/frontend/coprs_frontend/coprs/logic/builds_logic.py
@@ -24,15 +24,22 @@ class BuildsLogic(object):
.order_by(models.BuildChroot.build_id.desc())
@classmethod
- def get_recent_tasks(cls, limit=None):
+ def get_recent_tasks(cls, user=None, limit=None):
if not limit:
limit = 100
- return models.Build.query \
- .filter(models.Build.ended_on != None) \
+ query = models.Build.query \
+ .filter(models.Build.ended_on != None)
+
+ if user is not None:
+ query = query.filter(models.Build.user_id == user.id)
+
+ query = query \
.order_by(models.Build.id.desc()) \
.limit(limit)
+ return query
+
@classmethod
def get_build_task_queue(cls):
diff --git a/frontend/coprs_frontend/coprs/templates/recent.html b/frontend/coprs_frontend/coprs/templates/recent.html
index 9c7213a..b3cfa2c 100644
--- a/frontend/coprs_frontend/coprs/templates/recent.html
+++ b/frontend/coprs_frontend/coprs/templates/recent.html
@@ -4,6 +4,8 @@
{% block body %}
<h1> Recent builds </h1>
+{% if g.user %}
+<h2> Your projects </h2>
<table class="status-table">
<tr>
<th>Build</th>
@@ -13,6 +15,51 @@
<th>Repo</th>
<th>Status</th>
</tr>
+
+ {% for build in user_builds %}
+ <tr>
+ <td><a href="{{ url_for('coprs_ns.copr_build', username = build.copr.owner.name, coprname = build.copr.name, build_id = build.id) }}">
+ {{build.id}}
+ </a></td>
+
+
+ <td>{{ build.ended_on | localized_time(g.user.timezone) }}</td>
+
+ <td><a href="{{ url_for('coprs_ns.copr_detail', username = build.copr.owner.name, coprname = build.copr.name) }}">
+ {{build.copr.owner.name}}/{{build.copr.name}}
+ </a></td>
+
+
+ <td>{{ build.pkgs | pkg_name }} </td>
+
+ <td><a href="{{ build.results }}">
+ {{build.copr.owner.name}}/{{build.copr.name}}
+ </a></td>
+
+ <td>
+ {{ build.state }}
+ </td>
+ </tr>
+ {% endfor %}
+</table>
+
+
+
+{% endif %}
+
+<h2> All projects </h2>
+<table class="status-table">
+ <tr>
+ <th>Build</th>
+ <th>Finished</th>
+ <th>Project</th>
+ <th>Packages</th>
+ <th>Repo</th>
+ <th>Status</th>
+ </tr>
+
+
+
{% for build in builds %}
<tr>
<td><a href="{{ url_for('coprs_ns.copr_build', username = build.copr.owner.name, coprname = build.copr.name, build_id = build.id) }}">
@@ -20,7 +67,7 @@
</a></td>
- <td>{{ build.ended_on | time_ago }}</td>
+ <td>{{ build.ended_on | localized_time(g.user.timezone) }}</td>
<td><a href="{{ url_for('coprs_ns.copr_detail', username = build.copr.owner.name, coprname = build.copr.name) }}">
{{build.copr.owner.name}}/{{build.copr.name}}
diff --git a/frontend/coprs_frontend/coprs/views/recent_ns/recent_general.py b/frontend/coprs_frontend/coprs/views/recent_ns/recent_general.py
index a05765d..13022c4 100644
--- a/frontend/coprs_frontend/coprs/views/recent_ns/recent_general.py
+++ b/frontend/coprs_frontend/coprs/views/recent_ns/recent_general.py
@@ -5,10 +5,21 @@ from . import recent_ns
from coprs.logic import builds_logic
from coprs import helpers
+import logging
+log = logging.getLogger(__name__)
+
@recent_ns.route("/")
def recent():
# tasks = bilds_logic.BuildsLogic.get_build_tasks(
builds = builds_logic.BuildsLogic.get_recent_tasks(limit=20)
+ #if flask.g:
+ # log.info("flask.g")\
+ if flask.g.user is not None:
+ user_builds = builds_logic.BuildsLogic.get_recent_tasks(user=flask.g.user, limit=20)
+ else:
+ user_builds = []
+
return flask.render_template("recent.html",
number=len(list(builds)),
- builds=builds)
+ builds=builds,
+ user_builds=user_builds)
9 years, 9 months