[copr] master: document how to set api key for copr-cli (4c53368)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 4c533681a9cfe123ee1d08b787507e8210c35d3e
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Oct 7 10:47:37 2013 +0200
document how to set api key for copr-cli
>---------------------------------------------------------------
man/copr-cli.1.asciidoc | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/man/copr-cli.1.asciidoc b/man/copr-cli.1.asciidoc
index b04ccf6..c8b7579 100644
--- a/man/copr-cli.1.asciidoc
+++ b/man/copr-cli.1.asciidoc
@@ -16,6 +16,7 @@ DESCRIPTION
-----------
This command allow you to interact with build system COPR from command line.
+You need to generate and provide API key (see API KEY section below)
OPTIONS
-------
@@ -84,6 +85,19 @@ pkgs::
Package to build.
+API KEY
+-------
+
+Visit page http://your.copr/api and note down API token.
+
+Open file \~/.config/copr and put there content:
+
+ [copr-cli]
+ username = msuchy
+ token = vbfseelqdebzedukgombekmuvbkqwo
+
+Be aware that API token have some expiration. See Expiration date on /api page.
+
AUTHORS
-------
Miroslav Suchý <msuchy(a)redhat.com>
10 years, 7 months
[copr] master: do not create list of list (219e1df)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 219e1dfcc39daa5368f7ac52bf694188785d9fe4
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Oct 7 10:32:17 2013 +0200
do not create list of list
nargs plus append will create list of list, we want just list.
addressing:
Traceback (most recent call last):
File "/usr/bin/copr-cli", line 9, in <module>
load_entry_point('copr-cli==0.1.0', 'console_scripts', 'copr-cli')()
File "/usr/lib/python2.7/site-packages/copr_cli/main.py", line 111, in main
arg.func(arg)
File "/usr/lib/python2.7/site-packages/copr_cli/main.py", line 21, in action_build
args.memory, args.timeout)
File "/usr/lib/python2.7/site-packages/copr_cli/subcommands.py", line 172, in build
data = {'pkgs': ' '.join(pkgs),
TypeError: sequence item 0: expected string, list found
>---------------------------------------------------------------
copr_cli/main.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/copr_cli/main.py b/copr_cli/main.py
index 449a3fa..ca29017 100644
--- a/copr_cli/main.py
+++ b/copr_cli/main.py
@@ -91,7 +91,7 @@ def setup_parser():
parser_build.add_argument('copr',
help='The copr repo to build the package in'
)
- parser_build.add_argument('pkgs', nargs='+', action='append')
+ parser_build.add_argument('pkgs', nargs='+')
parser_build.add_argument('--memory', dest='memory',
help="")
parser_build.add_argument('--timeout', dest='timeout',
10 years, 7 months
[copr] master: document SECRET_KEY variable (10ccf59)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 10ccf590b8c0389eb8bfa5073b207e9eeec3b7f9
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Oct 7 10:06:15 2013 +0200
document SECRET_KEY variable
>---------------------------------------------------------------
coprs_frontend/config/copr.conf | 2 ++
coprs_frontend/config/copr_devel.conf | 2 ++
coprs_frontend/config/copr_unit_test.conf | 2 ++
3 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/coprs_frontend/config/copr.conf b/coprs_frontend/config/copr.conf
index 6b3363a..67d07a2 100644
--- a/coprs_frontend/config/copr.conf
+++ b/coprs_frontend/config/copr.conf
@@ -4,7 +4,9 @@
#OPENID_STORE = '/var/lib/copr/data/openid_store'
#WHOOSHEE_DIR = '/var/lib/copr/data/whooshee'
+# salt for CSRF codes
#SECRET_KEY = 'put_some_secret_here'
+
#BACKEND_PASSWORD = 'password_here'
# restrict access to a set of users
diff --git a/coprs_frontend/config/copr_devel.conf b/coprs_frontend/config/copr_devel.conf
index d357b82..ecd3553 100644
--- a/coprs_frontend/config/copr_devel.conf
+++ b/coprs_frontend/config/copr_devel.conf
@@ -4,7 +4,9 @@
#OPENID_STORE = '/var/lib/copr/data/openid_store'
#WHOOSHEE_DIR = '/var/lib/copr/data/whooshee'
+# salt for CSRF codes
#SECRET_KEY = 'put_some_secret_here'
+
#BACKEND_PASSWORD = 'password_here'
# restrict access to a set of users
diff --git a/coprs_frontend/config/copr_unit_test.conf b/coprs_frontend/config/copr_unit_test.conf
index 7eacf66..6b79539 100644
--- a/coprs_frontend/config/copr_unit_test.conf
+++ b/coprs_frontend/config/copr_unit_test.conf
@@ -4,7 +4,9 @@ DATABASE = '/tmp/copr.db'
OPENID_STORE = '/tmp/openid_store'
WHOOSHEE_DIR = '/tmp/whooshee'
+# salt for CSRF codes
#SECRET_KEY = 'put_some_secret_here'
+
#BACKEND_PASSWORD = 'password_here'
# restrict access to a set of users
10 years, 7 months
[copr] master: make note how to become admin (721cc49)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 721cc49edf6c02b0e7280cab8e3844bc78e770a1
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Oct 4 10:52:27 2013 +0200
make note how to become admin
>---------------------------------------------------------------
copr-setup.txt | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/copr-setup.txt b/copr-setup.txt
index 2fca3d3..1286d2c 100644
--- a/copr-setup.txt
+++ b/copr-setup.txt
@@ -124,3 +124,13 @@ and test the connection:
PGPASSWORD=coprpass psql -a -U copr-fe coprdb
PGPASSWORD=coprpass psql -a -h localhost -U copr-fe coprdb
+
+Make yourself admin
+===================
+
+Run:
+ cd /usr/share/copr/coprs_frontend/
+ ./manage.py alter_user --admin msuchy
+
+Then navigate to:
+ http://your.copr.fqdn/admin
10 years, 7 months
[copr] master: instruct people to install selinux with frontend (3994463)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 399446349e2cf3977811e002389694820aaa2ab4
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Oct 3 14:52:45 2013 +0200
instruct people to install selinux with frontend
>---------------------------------------------------------------
copr-setup.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/copr-setup.txt b/copr-setup.txt
index 8ac173b..2fca3d3 100644
--- a/copr-setup.txt
+++ b/copr-setup.txt
@@ -50,7 +50,7 @@ FEDORA PLAYBOOK:
Frontend:
- if you run on EPEL - add epel repo
- add yum repository http://copr-be.cloud.fedoraproject.org/results/msuchy/copr/
-- yum install copr-frontend
+- yum install copr-frontend copr-selinux
- apache setup
cp /usr/share/doc/copr-frontend-*/coprs.conf.example /etc/httpd/conf.d/coprs.conf
10 years, 7 months
[copr] master: Automatic commit of package [copr] release [1.9-1]. (e60d71c)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit e60d71cccd986fb30fb8aa551a50d06d8fc9b8a9
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Oct 3 14:07:44 2013 +0200
Automatic commit of package [copr] release [1.9-1].
>---------------------------------------------------------------
copr.spec | 24 +++++++++++++++++++++++-
rel-eng/packages/copr | 2 +-
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/copr.spec b/copr.spec
index 668acd9..5fb96e0 100644
--- a/copr.spec
+++ b/copr.spec
@@ -5,7 +5,7 @@
%global modulename copr
Name: copr
-Version: 1.8
+Version: 1.9
Release: 1%{?dist}
Summary: Cool Other Package Repo
@@ -380,6 +380,28 @@ fi
%{_mandir}/man8/%{name}-selinux-relabel.8*
%changelog
+* Thu Oct 03 2013 Miroslav Suchý <msuchy(a)redhat.com> 1.9-1
+- prune old builds
+- require python-decorator
+- remove requirements.txt
+- move TODO-backend to our wiki
+- create pid file in /var/run/copr-backend
+- add backend service file for systemd
+- remove daemonize option in config
+- use python logging
+- create pid file in /var/run by default
+- do not create destdir
+- use daemon module instead of home brew function
+- fix default location of copr-be.conf
+- 2 tests fixed, one still failing
+- fix failing test test_fail_on_missing_dash
+- fixing test_fail_on_nonexistent_copr test
+- run frontend unit tests when building package
+- Adjust URLs in the unit-tests to their new structure
+- Adjust the CLI to call the adjuste endpoint of the API
+- Adjust API endpoint to reflects the UI endpoints in their url structure
+- First pass at adding fedmsg hooks.
+
* Tue Sep 24 2013 Miroslav Suchý <msuchy(a)redhat.com> 1.8-1
- 1008532 - require python2-devel
- add note about ssh keys to copr-setup.txt
diff --git a/rel-eng/packages/copr b/rel-eng/packages/copr
index 401fc3e..0685ba1 100644
--- a/rel-eng/packages/copr
+++ b/rel-eng/packages/copr
@@ -1 +1 @@
-1.8-1 ./
+1.9-1 ./
10 years, 7 months
[copr] master: prune old builds (269d98c)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 269d98ca4e0728a3c8c9bee5a11b9026e2bc7d52
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Oct 3 12:26:37 2013 +0200
prune old builds
this add new command
/usr/sbin/copr-prune-repo
which
* remove all failed builds older than 14 days
* remove all successfull builds older than 14 days if there is newer successfull build
and update repository metadata
It *does not* remove those build from DB (not sure if we want to remove it).
This command is executed via daily crontab.
>---------------------------------------------------------------
copr-prune-repo | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
copr.spec | 8 +++++++
crontab/copr-backend | 3 ++
3 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/copr-prune-repo b/copr-prune-repo
new file mode 100755
index 0000000..8a20ea2
--- /dev/null
+++ b/copr-prune-repo
@@ -0,0 +1,52 @@
+#!/usr/bin/bash
+
+DAYS=14
+RESULTDIR=$(awk -F "=" '/^destdir/ {print $2}' /etc/copr/copr-be.conf
+
+if [ ! -d $RESULTDIR ]; then
+ echo "ERROR: destdir ($RESULTDIR) in /etc/copr/copr-be.conf does not exist."
+ exit 1
+fi
+
+pushd $RESULTDIR >/dev/null
+for REPO in $( ls -d */*/* | grep -v '/repodata$' ); do
+ pushd $REPO >/dev/null
+
+ # Removing failed builds
+ for FAILED in $(find -name 'fail' -mtime +$DAYS); do
+ rm -rf $(dirname $FAILED)
+ echo -n .
+
+ # Query latest (sucessfull) packages
+ LATEST_PKGS=$(mktemp)
+ ERR_LOG=$(mktemp)
+ # "yum clean metadata" does not work on this custom repos
+ rm -rf $(find /var/tmp -name query)
+ rm -rf /var/tmp/createrepo*
+ rm -rf /var/cache/yum/*
+ repoquery --repofrompath=query,$RESULTDIR/$REPO --repoid=query -a --location 2>$ERR_LOG \
+ | cut -c8- > $LATEST_PKGS
+ # remove directory if it does not have repodata at all
+ grep 'Cannot retrieve repository metadata' $ERR_LOG && rm -rf $RESULTDIR/$REPO
+
+ # Remove builds older then $DAYS days and which have newer builds available
+ for SUCCESS in $(find -name success -mtime +$DAYS); do
+ DIR=$(basename $(dirname $SUCCESS))
+ for PACKAGE in $(ls $DIR); do
+ grep $PACKAGE $LATEST_PKGS >/dev/null && continue 2
+ done
+ # package was not found in $LATEST_PKGS
+ rm -rf $DIR
+ echo -n .
+ done
+
+ rm -f $LATEST_PKGS $ERR_LOG
+ # unless we previosly deleted the repo, regen metadata
+ if [ -d $(pwd) ]; then
+ createrepo --update -q .
+ fi
+ popd >/dev/null
+done
+popd >/dev/null
+echo
+echo Done
diff --git a/copr.spec b/copr.spec
index cb05276..668acd9 100644
--- a/copr.spec
+++ b/copr.spec
@@ -59,6 +59,8 @@ Requires: python-lockfile
Requires: python-requests
Requires: logrotate
Requires: fedmsg
+Requires: gawk
+Requires: crontabs
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
@@ -191,10 +193,14 @@ install -d %{buildroot}%{_unitdir}
install -d %{buildroot}/%{_var}/log/copr-backend
install -d %{buildroot}/%{_var}/run/copr-backend/
install -d %{buildroot}/%{_tmpfilesdir}
+install -d %{buildroot}/%{_sbindir}
+install -d %{buildroot}%{_sysconfdir}/cron.daily
cp -a backend/* %{buildroot}%{_datadir}/copr/backend
cp -a copr-be.py %{buildroot}%{_datadir}/copr/
cp -a copr-be.conf.example %{buildroot}%{_sysconfdir}/copr/copr-be.conf
+install -p -m 755 copr-prune-repo %{buildroot}%{_sbindir}/copr-prune-repo
+install -p -m 750 crontab/copr-backend %{buildroot}%{_sysconfdir}/cron.daily/copr-backend
cp -a backend-dist/lighttpd/* %{buildroot}%{_pkgdocdir}/lighttpd/
cp -a logrotate/* %{buildroot}%{_sysconfdir}/logrotate.d/
@@ -328,6 +334,8 @@ fi
%config(noreplace) %{_sysconfdir}/copr/copr-be.conf
%{_unitdir}/copr-backend.service
%{_tmpfilesdir}/copr-backend.conf
+%{_sbindir}/copr-prune-repo
+%config(noreplace) %{_sysconfdir}/cron.daily/copr-backend
%{_datadir}/copr/backend
%{_datadir}/copr/copr-be.py*
diff --git a/crontab/copr-backend b/crontab/copr-backend
new file mode 100644
index 0000000..586d45b
--- /dev/null
+++ b/crontab/copr-backend
@@ -0,0 +1,3 @@
+#!/usr/bin/sh
+
+/usr/sbin/copr-prune-repo >/var/log/copr.log 2>&1
10 years, 7 months
[copr] master: require python-decorator (1cec21a)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 1cec21aa09ff65274795b9a67141f4f33907c739
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Wed Oct 2 15:55:33 2013 +0200
require python-decorator
addressing:
____________ ERROR collecting tests/test_logic/test_builds_logic.py ____________
tests/test_logic/test_builds_logic.py:6: in <module>
> from tests.coprs_test_case import CoprsTestCase
tests/coprs_test_case.py:7: in <module>
> import decorator
E ImportError: No module named decorator
>---------------------------------------------------------------
copr.spec | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/copr.spec b/copr.spec
index 27f2c2e..cb05276 100644
--- a/copr.spec
+++ b/copr.spec
@@ -88,6 +88,7 @@ Requires: python-whoosh >= 2.5.3
# for tests:
Requires: pytest
Requires: python-flexmock
+Requires: python-decorator
%if 0%{?rhel} < 7 && 0%{?rhel} > 0
BuildRequires: python-argparse
%endif
@@ -101,6 +102,7 @@ BuildRequires: python-pylibravatar
BuildRequires: python-flask-wtf
BuildRequires: pytest
BuildRequires: python-flexmock
+BuildRequires: python-decorator
%description frontend
COPR is lightweight build system. It allows you to create new project in WebUI,
10 years, 7 months
[copr] master: remove requirements.txt (86afb6a)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 86afb6ae5f9ae552a24021c3fa0caa2bfb2e1ccd
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Wed Oct 2 15:47:37 2013 +0200
remove requirements.txt
requirements are now specified in spec file
>---------------------------------------------------------------
requirements.txt | 12 ------------
1 files changed, 0 insertions(+), 12 deletions(-)
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 9094607..0000000
--- a/requirements.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# Used for when working from a virtualenv.
-# Use this file by running "$ pip install -r requirements.txt"
-alembic
-argparse
-blinker
-flask-sqlalchemy
-flask-openid
-flask-script
-flask-whooshee
-flask-wtf
-flexmock
-pytest
10 years, 7 months