Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit 238dd923294a4b450e725c0a9c0c222b8e548f58
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Fri Apr 10 14:56:30 2015 +0200
[backend] new documentation
---------------------------------------------------------------
backend/copr-backend.spec | 28 +++++++----
backend/docs/requirements.txt | 5 +-
backend/docs/source/Autodoc.rst | 7 +++
backend/docs/source/INSTALL.rst | 24 +++++-----
backend/docs/source/README.rst | 1 -
backend/docs/source/conf.py | 23 ++++++++-
backend/docs/source/index.rst | 4 +-
backend/docs/source/package/vm_manage/__init__.rst | 6 ++
backend/docs/source/package/vm_manage/check.rst | 6 ++
.../docs/source/package/vm_manage/event_handle.rst | 6 ++
backend/docs/source/package/vm_manage/executor.rst | 6 ++
backend/docs/source/package/vm_manage/models.rst | 6 ++
backend/docs/source/package/vm_manage/spawn.rst | 6 ++
.../docs/source/package/vm_manage/terminate.rst | 6 ++
backend/docs/source/run_scripts.rst | 53 ++++++++++++++++++--
backend/docs/source/scripts/copr_be.rst | 9 ---
backend/docs/source/scripts/prune_repo.rst | 19 -------
backend/run/copr_prune_results.py | 4 +-
18 files changed, 156 insertions(+), 63 deletions(-)
diff --git a/backend/copr-backend.spec b/backend/copr-backend.spec
index f43343f..51fde49 100644
--- a/backend/copr-backend.spec
+++ b/backend/copr-backend.spec
@@ -28,9 +28,8 @@ BuildRequires: python-copr
BuildRequires: systemd
BuildRequires: redis
-#for doc package
-BuildRequires: epydoc
-BuildRequires: graphviz
+
+
BuildRequires: pytest
BuildRequires: python-pytest-cov
BuildRequires: python-mock
@@ -47,8 +46,10 @@ BuildRequires: ansible >= 1.2
BuildRequires: python-IPy
BuildRequires: python-paramiko
BuildRequires: python-psutil
-# BuildRequires: python-ipdb
-BuildRequires: wget
+# BuildRequires: wget -- ???
+
+#for doc package
+BuildRequires: sphinx
Requires: obs-signd
Requires: ansible >= 1.2
@@ -76,7 +77,7 @@ Requires: gawk
Requires: crontabs
Requires: python-paramiko
# Requires: python-ipdb
-# Requires: logstash
+Requires: logstash
Requires(post): systemd
Requires(preun): systemd
@@ -103,11 +104,14 @@ only.
%build
-# TODO: remove when sphinx docs added
+
+%if 0%{?fedora}
# build documentation
-# pushd documentation
-# make %{?_smp_mflags} python
-# popd
+pushd docs
+ make %{?_smp_mflags} html
+ rm build/html/.buildinfo
+popd
+%endif # ?fedora
%install
@@ -161,6 +165,10 @@ cp -a conf/playbooks %{buildroot}%{_pkgdocdir}/
install -d %{buildroot}%{_pkgdocdir}/examples/%{_sysconfdir}/logstash.d
cp -a conf/logstash/copr_backend.conf
%{buildroot}%{_pkgdocdir}/examples/%{_sysconfdir}/logstash.d/copr_backend.conf
+%if 0%{?fedora}
+ cp -a docs/build/html %{buildroot}%{_pkgdocdir}/
+%endif
+
%check
# redis-server --port 7777 &> /dev/null &
diff --git a/backend/docs/requirements.txt b/backend/docs/requirements.txt
index a8cf351..852b7a8 100644
--- a/backend/docs/requirements.txt
+++ b/backend/docs/requirements.txt
@@ -1,13 +1,12 @@
PyYAML
-ansible
+# ansible
setproctitle
redis
-retask
+# retask
python-daemon
bunch
IPy
-
# documentation
sphinx
sphinx-argparse
diff --git a/backend/docs/source/Autodoc.rst b/backend/docs/source/Autodoc.rst
index 339f215..75609c9 100644
--- a/backend/docs/source/Autodoc.rst
+++ b/backend/docs/source/Autodoc.rst
@@ -41,4 +41,11 @@ backend.vm_manage.
Package for VM management only.
.. toctree::
+ package/vm_manage/__init__
+ package/vm_manage/models
package/vm_manage/manager
+ package/vm_manage/event_handle
+ package/vm_manage/executor
+ package/vm_manage/spawn
+ package/vm_manage/terminate
+ package/vm_manage/check
diff --git a/backend/docs/source/INSTALL.rst b/backend/docs/source/INSTALL.rst
index e7c1959..742a0f9 100644
--- a/backend/docs/source/INSTALL.rst
+++ b/backend/docs/source/INSTALL.rst
@@ -5,23 +5,23 @@ INSTALL
Get rpm either from upstream copr:
https://copr.fedoraproject.org/coprs/msuchy/copr/ ::
- dnf copr enable msuchy/copr
- dnf install -y copr-backend copr-selinux
+ dnf copr enable msuchy/copr
+ dnf install -y copr-backend copr-selinux
or checkout git repo and build latest release with tito::
- git clone
https://git.fedorahosted.org/cgit/copr.git
- yum install -y tito yum-utils
- yum-builddep backend/copr-backend.spec
- yum-builddep selinux/copr-selinux.spec
- yum-builddep python/python-copr.spec
- cd backend && tito build --rpm && cd ..
- cd selinux && tito build --rpm && cd ..
- cd python && tito build --rpm && cd ..
- yum localinstall <path to the built rpms>
-::
+ git clone
https://git.fedorahosted.org/cgit/copr.git
+ yum install -y tito yum-utils
+ yum-builddep backend/copr-backend.spec
+ yum-builddep selinux/copr-selinux.spec
+ yum-builddep python/python-copr.spec
+ cd backend && tito build --rpm && cd ..
+ cd selinux && tito build --rpm && cd ..
+ cd python && tito build --rpm && cd ..
+ yum localinstall <path to the built rpms>
+
2. Prepare ansible playbooks to spawn and terminate VM builders using your VM provider.
You could find some inspiration in ``backend/conf/playbooks/``.
diff --git a/backend/docs/source/README.rst b/backend/docs/source/README.rst
index a566a44..bbd0669 100644
--- a/backend/docs/source/README.rst
+++ b/backend/docs/source/README.rst
@@ -5,5 +5,4 @@ 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 backend. Copr-backend is responsible for build process, package
signing, manages project repositories.
-
Currently copr-backend is intended to use at Fedora 20+.
diff --git a/backend/docs/source/conf.py b/backend/docs/source/conf.py
index aa9e7f6..839d2cd 100644
--- a/backend/docs/source/conf.py
+++ b/backend/docs/source/conf.py
@@ -11,12 +11,33 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
+import sys
+import os
+from subprocess import call
+
+TO_INSTALL = [
+ # "redis",
+ "retask"
+]
+
+
+for pkg in TO_INSTALL:
+ call(["pip", "install", pkg])
+
+# on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+# if on_rtd:
+# # html_theme = 'default'
+# call("python ../../../python/setup.py install".split())
+# else:
+# # html_theme = 'nature'
+# pass
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../..'))
+sys.path.insert(os.path.abspath('../../../python/'))
+print(call(["ls", "-lah"]))
# -- General configuration -----------------------------------------------------
diff --git a/backend/docs/source/index.rst b/backend/docs/source/index.rst
index 09a98f8..8a0490c 100644
--- a/backend/docs/source/index.rst
+++ b/backend/docs/source/index.rst
@@ -6,10 +6,12 @@
Welcome to copr-backend's documentation!
========================================
+
+.. include:: README.rst
+
.. toctree::
:maxdepth: 1
- README
INSTALL
Backend_design
VmManagement
diff --git a/backend/docs/source/package/vm_manage/__init__.rst
b/backend/docs/source/package/vm_manage/__init__.rst
new file mode 100644
index 0000000..00abe56
--- /dev/null
+++ b/backend/docs/source/package/vm_manage/__init__.rst
@@ -0,0 +1,6 @@
+backend.vm_manage.__init__
+==========================
+
+.. automodule:: backend.vm_manage.__init__
+ :members:
+ :undoc-members:
diff --git a/backend/docs/source/package/vm_manage/check.rst
b/backend/docs/source/package/vm_manage/check.rst
new file mode 100644
index 0000000..75ddfe8
--- /dev/null
+++ b/backend/docs/source/package/vm_manage/check.rst
@@ -0,0 +1,6 @@
+backend.vm_manage.check
+=======================
+
+.. automodule:: backend.vm_manage.check
+ :members:
+ :undoc-members:
diff --git a/backend/docs/source/package/vm_manage/event_handle.rst
b/backend/docs/source/package/vm_manage/event_handle.rst
new file mode 100644
index 0000000..c4024bd
--- /dev/null
+++ b/backend/docs/source/package/vm_manage/event_handle.rst
@@ -0,0 +1,6 @@
+backend.vm_manage.event_handle
+==============================
+
+.. automodule:: backend.vm_manage.event_handle
+ :members:
+ :undoc-members:
diff --git a/backend/docs/source/package/vm_manage/executor.rst
b/backend/docs/source/package/vm_manage/executor.rst
new file mode 100644
index 0000000..0f70810
--- /dev/null
+++ b/backend/docs/source/package/vm_manage/executor.rst
@@ -0,0 +1,6 @@
+backend.vm_manage.executor
+==========================
+
+.. automodule:: backend.vm_manage.executor
+ :members:
+ :undoc-members:
diff --git a/backend/docs/source/package/vm_manage/models.rst
b/backend/docs/source/package/vm_manage/models.rst
new file mode 100644
index 0000000..d7d2473
--- /dev/null
+++ b/backend/docs/source/package/vm_manage/models.rst
@@ -0,0 +1,6 @@
+backend.vm_manage.models
+========================
+
+.. automodule:: backend.vm_manage.models
+ :members:
+ :undoc-members:
diff --git a/backend/docs/source/package/vm_manage/spawn.rst
b/backend/docs/source/package/vm_manage/spawn.rst
new file mode 100644
index 0000000..63ae2ca
--- /dev/null
+++ b/backend/docs/source/package/vm_manage/spawn.rst
@@ -0,0 +1,6 @@
+backend.vm_manage.spawn
+=======================
+
+.. automodule:: backend.vm_manage.spawn
+ :members:
+ :undoc-members:
diff --git a/backend/docs/source/package/vm_manage/terminate.rst
b/backend/docs/source/package/vm_manage/terminate.rst
new file mode 100644
index 0000000..70c9ab2
--- /dev/null
+++ b/backend/docs/source/package/vm_manage/terminate.rst
@@ -0,0 +1,6 @@
+backend.vm_manage.terminate
+===========================
+
+.. automodule:: backend.vm_manage.terminate
+ :members:
+ :undoc-members:
diff --git a/backend/docs/source/run_scripts.rst b/backend/docs/source/run_scripts.rst
index a5afb17..6a9ad43 100644
--- a/backend/docs/source/run_scripts.rst
+++ b/backend/docs/source/run_scripts.rst
@@ -1,6 +1,49 @@
-
Run scripts
------------
-.. toctree::
- scripts/copr_be.rst
- scripts/prune_repo.rst
+===========
+
+Start copr backend
+------------------
+Script to run copr-backend ``/usr/bin/copr_be.py``
+Uses backend config with default location ``/etc/copr/copr-be.conf``.
+
+.. TODO: use `http://sphinx-argparse.readthedocs.org/en/latest/`
+
+Prune repository
+----------------
+
+To prune result builds use ``run/copr_prune_results.py``.
+Internally it would invoke sh script ``run/copr_find_obsolete_builds.sh``
+
+copr_prune_results.py
+_____________________
+
+Clean ups old builds. Don't affect projects with disabled ``auto_createrepo``
option.
+
+Doesn't have startup options. Uses backend config with default location
``/etc/copr/copr-be.conf``.
+Can be changed by setting environment variable **BACKEND_CONFIG**
+
+copr_find_obsolete_builds.sh
+____________________________
+
+Finds folders in **CHROOTPATH**, with built package which is older than **DAYS** and
+there is a higher version in a chroot repository.
+
+copr_find_obsolete_builds.sh CHROOTPATH DAYS
+
+VM info
+-------
+
+To get current copr-backend view on used VM use:
+``run/copr_get_vm_info.py``
+
+
+Consecutive builds fails
+------------------------
+To monitor service disruption use ``run/check_consecutive_builds_fails.py``. It checks if
copr-backend has too many
+interrupted builds. This script is aimed to be used by nagios nrpe check.
+
+Return code meanings:
+ - 0: OK
+ - 1: Warning
+ - 2: Failure
+
diff --git a/backend/docs/source/scripts/copr_be.rst
b/backend/docs/source/scripts/copr_be.rst
deleted file mode 100644
index a305fdc..0000000
--- a/backend/docs/source/scripts/copr_be.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-Start copr backend
-==================
-Main script to run copr-backend ``/usr/bin/copr-be.py``
-Uses backend config with default location ``/etc/copr/copr-be.conf``.
-
-
-TODO: rename to copr_be.py; use `http://sphinx-argparse.readthedocs.org/en/latest/`
-
-
diff --git a/backend/docs/source/scripts/prune_repo.rst
b/backend/docs/source/scripts/prune_repo.rst
deleted file mode 100644
index c55d1d7..0000000
--- a/backend/docs/source/scripts/prune_repo.rst
+++ /dev/null
@@ -1,19 +0,0 @@
-Prune repository
-================
-
-To prune result builds use ``run/copr_prune_results.py``.
-Internally it would invoke sh script ``run/copr_prune_old_builds.sh``
-
-copr_prune_results.py
----------------------
-Clean ups old builds. Don't affect projects with disabled ``auto_creatrepo`` option.
-
-
-Doesn't have startup options. Uses backend config with default location
``/etc/copr/copr-be.conf``.
-Can be changed by setting environment variable **BACKEND_CONFIG**
-
-copr_prune_old_builds.sh
-------------------------
-
-
-copr_prune_old_builds.sh REPOPATH DAYS
diff --git a/backend/run/copr_prune_results.py b/backend/run/copr_prune_results.py
index de96dc3..8401f2a 100755
--- a/backend/run/copr_prune_results.py
+++ b/backend/run/copr_prune_results.py
@@ -38,7 +38,7 @@ class Pruner(object):
def __init__(self, opts):
self.opts = opts
self.days = getattr(self.opts, "prune_days", DEF_DAYS)
- self.prune_sh_script = getattr(self.opts, "find_obsolete_script",
DEF_FIND_OBSOLETE_SCRIPT)
+ self.find_obsolete_script = getattr(self.opts, "find_obsolete_script",
DEF_FIND_OBSOLETE_SCRIPT)
def prune_failed_builds(self, chroot_path):
"""
@@ -66,7 +66,7 @@ class Pruner(object):
:param chroot_path: path to the chroot directory
"""
# import ipdb; ipdb.set_trace()
- cmd = map(str, [self.prune_sh_script, chroot_path, self.days])
+ cmd = map(str, [self.find_obsolete_script, chroot_path, self.days])
handle = Popen(cmd, stdout=PIPE, stderr=PIPE)
stdout, stderr = handle.communicate()
if handle.returncode != 0:
diff --git a/backend/run/test.sh b/backend/run/test.sh
deleted file mode 100644
index e69de29..0000000