[copr] master: initial selinux subpackage (5f15f35)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 5f15f35ebb420188c7b9454f864681a54dc46675
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Sep 17 20:36:57 2013 +0200
initial selinux subpackage
for now, with empty content
>---------------------------------------------------------------
copr.spec | 78 +++++++++++++++++++++++++++++++++++
man/copr-selinux-enable.8.asciidoc | 28 ++++++++++++
man/copr-selinux-relabel.8.asciidoc | 27 ++++++++++++
selinux/copr-selinux-enable | 13 ++++++
selinux/copr-selinux-relabel | 9 ++++
selinux/copr.fc | 3 +
selinux/copr.if | 3 +
selinux/copr.te | 10 ++++
8 files changed, 171 insertions(+), 0 deletions(-)
diff --git a/copr.spec b/copr.spec
index 6a6d7bd..cd12346 100644
--- a/copr.spec
+++ b/copr.spec
@@ -1,6 +1,8 @@
%if 0%{?rhel} < 7 && 0%{?rhel} > 0
%global _pkgdocdir %{_docdir}/%{name}-%{version}
%endif
+%global moduletype apps
+%global modulename copr
Name: copr
Version: 1.5
@@ -31,6 +33,9 @@ BuildRequires: python-argparse
BuildRequires: epydoc
BuildRequires: graphviz
BuildRequires: make
+#for selinux
+BuildRequires: checkpolicy, selinux-policy-devel
+BuildRequires: policycoreutils >= %{POLICYCOREUTILSVER}
%description
COPR is lightweight build system. It allows you to create new project in WebUI,
@@ -107,6 +112,20 @@ and submit new builds and COPR will create yum repository from latests builds.
This package include documentation for COPR code. Mostly useful for developers
only.
+%package selinux
+Summary: SELinux module for COPR
+Requires(post): policycoreutils, libselinux-utils
+Requires(post): policycoreutils-python
+Requires(post): selinux-policy-targeted
+Requires(postun): policycoreutils
+
+%description selinux
+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.
+
+This package include SELinux targeted module for COPR
+
+
%prep
%setup -q
@@ -116,12 +135,25 @@ mv copr_cli/README.rst ./
# convert manages
a2x -d manpage -f manpage man/copr-cli.1.asciidoc
+a2x -d manpage -f manpage man/copr-selinux-enable.8.asciidoc
+a2x -d manpage -f manpage man/copr-selinux-relabel.8.asciidoc
# build documentation
pushd documentation
make python
popd
+#selinux
+pushd selinux
+perl -i -pe 'BEGIN { $VER = join ".", grep /^\d+$/, split /\./, "%{version}.%{release}"; } s!\@\@VERSION\@\@!$VER!g;' %{modulename}.te
+for selinuxvariant in targeted; do
+ make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile
+ bzip2 -9 %{modulename}.pp
+ mv %{modulename}.pp.bz2 %{modulename}.pp.bz2.${selinuxvariant}
+ make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
+done
+popd
+
%install
#backend
@@ -172,6 +204,24 @@ install -p -m 644 man/copr-cli.1 %{buildroot}/%{_mandir}/man1/
cp -a documentation/python-doc %{buildroot}%{_pkgdocdir}/
cp -a playbooks %{buildroot}%{_pkgdocdir}/
+#selinux
+for selinuxvariant in targeted; do
+ install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
+ install -p -m 644 selinux/%{modulename}.pp.bz2.${selinuxvariant} \
+ %{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp.bz2
+done
+# Install SELinux interfaces
+install -d %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}
+install -p -m 644 selinux/%{modulename}.if \
+ %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}/%{modulename}.if
+# Install copr-selinux-enable which will be called in %posttrans
+install -d %{buildroot}%{_sbindir}
+install -p -m 755 selinux/%{name}-selinux-enable %{buildroot}%{_sbindir}/%{name}-selinux-enable
+install -p -m 755 selinux/%{name}-selinux-relabel %{buildroot}%{_sbindir}/%{name}-selinux-relabel
+
+install -d %{buildroot}%{_mandir}/man8
+install -p -m 644 man/%{name}-selinux-enable.8 %{buildroot}/%{_mandir}/man8/
+install -p -m 644 man/%{name}-selinux-relabel.8 %{buildroot}/%{_mandir}/man8/
%pre backend
getent group copr >/dev/null || groupadd -r copr
getent passwd copr >/dev/null || \
@@ -187,6 +237,26 @@ useradd -r -g copr-fe -G copr-fe -d %{_datadir}/copr/coprs_frontend -s /bin/bash
%post frontend
service httpd condrestart
+%post selinux
+if /usr/sbin/selinuxenabled ; then
+ %{_sbindir}/%{name}-selinux-enable
+fi
+
+%posttrans selinux
+if /usr/sbin/selinuxenabled ; then
+ %{_sbindir}/%{name}-selinux-relabel
+fi
+
+%postun
+# Clean up after package removal
+if [ $1 -eq 0 ]; then
+ for selinuxvariant in targeted; do
+ /usr/sbin/semodule -s ${selinuxvariant} -l > /dev/null 2>&1 \
+ && /usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} || :
+ done
+fi
+%{sbinpath}/restorecon -rvvi %{_sharedstatedir}/copr
+
%files backend
%doc LICENSE README
%dir %{_datadir}/copr
@@ -235,6 +305,14 @@ service httpd condrestart
%files doc
%doc %{_pkgdocdir}/python-doc
+%files selinux
+%{_datadir}/selinux/*/%{modulename}.pp.bz2
+%{_datadir}/selinux/devel/include/%{moduletype}/%{modulename}.if
+%{_sbindir}/%{name}-selinux-enable
+%{_sbindir}/%{name}-selinux-relabel
+%{_mandir}/man8/%{name}-selinux-enable.8*
+%{_mandir}/man8/%{name}-selinux-relabel.8*
+
%changelog
* Mon Sep 16 2013 Miroslav Suchý <msuchy(a)redhat.com> 1.5-1
- 1008532 - use __python2 instead of __python
diff --git a/man/copr-selinux-enable.8.asciidoc b/man/copr-selinux-enable.8.asciidoc
new file mode 100644
index 0000000..4c55023
--- /dev/null
+++ b/man/copr-selinux-enable.8.asciidoc
@@ -0,0 +1,28 @@
+copr-selinux-enable(8)
+=====================
+:man source: copr
+:man manual: COPR
+
+NAME
+----
+
+copr-selinux-enable - enable Copr SELinux policy
+
+SYNOPSIS
+--------
+
+copr-selinux-enable
+
+DESCRIPTION
+-----------
+
+The *copr-selinux-enable* program will install and enable Copr
+SELinux module and sets required SELinux bool flags.
+
+The program is called by rpm post script and it
+is not usually required to run it manually.
+
+SEE ALSO
+--------
+
+copr-selinux-relabel(8)
diff --git a/man/copr-selinux-relabel.8.asciidoc b/man/copr-selinux-relabel.8.asciidoc
new file mode 100644
index 0000000..c2b6339
--- /dev/null
+++ b/man/copr-selinux-relabel.8.asciidoc
@@ -0,0 +1,27 @@
+copr-selinux-relabel(8)
+=====================
+:man source: copr
+:man manual: COPR
+
+NAME
+----
+
+copr-selinux-relabel - call restorecon on Copr files
+
+SYNOPSIS
+--------
+
+copr-selinux-relabel
+
+DESCRIPTION
+-----------
+
+The *copr-selinux-relabel* program will call restorecon(8) on all
+Copr files. Efectively restore SELinux context.
+
+The program is called by rpm post script and it
+is not usually required to run it manually.
+
+=head1 SEE ALSO
+
+copr-selinux-enable(8), restorecon(8)
diff --git a/selinux/copr-selinux-enable b/selinux/copr-selinux-enable
new file mode 100755
index 0000000..1974de2
--- /dev/null
+++ b/selinux/copr-selinux-enable
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# Install SELinux policy modules
+for selinuxvariant in targeted; do
+ /usr/sbin/semodule -s ${selinuxvariant} -l > /dev/null 2>&1 \
+ && /usr/sbin/semodule -s ${selinuxvariant} -i /usr/share/selinux/${selinuxvariant}/copr.pp.bz2
+done
+
+/usr/sbin/setsebool -P httpd_enable_cgi 1
+/usr/sbin/setsebool -P httpd_can_network_connect 1
+/usr/sbin/setsebool -P httpd_can_sendmail 1
+
+
diff --git a/selinux/copr-selinux-relabel b/selinux/copr-selinux-relabel
new file mode 100755
index 0000000..d482d60
--- /dev/null
+++ b/selinux/copr-selinux-relabel
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+for package in copr-backend copr-frontend copr-cli copr-selinux; do
+ rpm -q $package &>/dev/null && /usr/sbin/fixfiles -R $package restore
+done
+
+if [ -d /var/lib/copr ]; then
+ restorecon -rvvi /var/lib/copr
+fi
diff --git a/selinux/copr.fc b/selinux/copr.fc
new file mode 100644
index 0000000..fdff57a
--- /dev/null
+++ b/selinux/copr.fc
@@ -0,0 +1,3 @@
+#
+# This file is currently intentionally left blank.
+#
diff --git a/selinux/copr.if b/selinux/copr.if
new file mode 100644
index 0000000..fdff57a
--- /dev/null
+++ b/selinux/copr.if
@@ -0,0 +1,3 @@
+#
+# This file is currently intentionally left blank.
+#
diff --git a/selinux/copr.te b/selinux/copr.te
new file mode 100644
index 0000000..4ffecc3
--- /dev/null
+++ b/selinux/copr.te
@@ -0,0 +1,10 @@
+policy_module(copr,@@VERSION@@)
+
+## <desc>
+## <p>
+## Allow Copr BE to work with data (/var/lib/copr/public_html) stored
+## on NFS-mounted directories.
+## </p>
+## </desc>
+gen_tunable(copr_nfs_mountpoint,false)
+
10 years, 7 months
[copr] master: Automatic commit of package [copr] release [1.5-1]. (08cb84c)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 08cb84c83ee494a5547985ca3874dfbeb6e2838f
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Sep 16 17:07:33 2013 +0200
Automatic commit of package [copr] release [1.5-1].
>---------------------------------------------------------------
copr.spec | 7 ++++++-
rel-eng/packages/copr | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/copr.spec b/copr.spec
index 5843252..6a6d7bd 100644
--- a/copr.spec
+++ b/copr.spec
@@ -3,7 +3,7 @@
%endif
Name: copr
-Version: 1.4
+Version: 1.5
Release: 1%{?dist}
Summary: Cool Other Package Repo
@@ -236,6 +236,11 @@ service httpd condrestart
%doc %{_pkgdocdir}/python-doc
%changelog
+* Mon Sep 16 2013 Miroslav Suchý <msuchy(a)redhat.com> 1.5-1
+- 1008532 - use __python2 instead of __python
+- 1008532 - do not mark man page as doc
+- 1008532 - preserve timestamp
+
* Mon Sep 16 2013 Miroslav Suchý <msuchy(a)redhat.com> 1.4-1
- add logrotate file
diff --git a/rel-eng/packages/copr b/rel-eng/packages/copr
index ec3d4be..d52faa8 100644
--- a/rel-eng/packages/copr
+++ b/rel-eng/packages/copr
@@ -1 +1 @@
-1.4-1 ./
+1.5-1 ./
10 years, 7 months
[copr] master: 1008532 - use __python2 instead of __python (080c96c)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 080c96c9760926e11d3df59bf2e503c56b5a893e
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Sep 16 17:07:03 2013 +0200
1008532 - use __python2 instead of __python
>---------------------------------------------------------------
copr.spec | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/copr.spec b/copr.spec
index 1ef6ae2..5843252 100644
--- a/copr.spec
+++ b/copr.spec
@@ -164,7 +164,7 @@ rm %{buildroot}%{_datadir}/copr/coprs_frontend/CONTRIBUTION_GUIDELINES
touch %{buildroot}%{_sharedstatedir}/copr/data/copr.db
#copr-cli
-%{__python} coprcli-setup.py install --root %{buildroot}
+%{__python2} coprcli-setup.py install --root %{buildroot}
install -d %{buildroot}%{_mandir}/man1
install -p -m 644 man/copr-cli.1 %{buildroot}/%{_mandir}/man1/
10 years, 7 months
[copr] master: 1008532 - do not mark man page as doc (95149e7)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 95149e7ece6110927c99b98ecf4a8dbf3c11fde4
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Sep 16 16:48:48 2013 +0200
1008532 - do not mark man page as doc
>---------------------------------------------------------------
copr.spec | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/copr.spec b/copr.spec
index ffed822..1ef6ae2 100644
--- a/copr.spec
+++ b/copr.spec
@@ -230,7 +230,7 @@ service httpd condrestart
%doc LICENSE README.rst
%{_bindir}/copr-cli
%{python_sitelib}/*
-%doc %{_mandir}/man1/copr-cli.1*
+%{_mandir}/man1/copr-cli.1*
%files doc
%doc %{_pkgdocdir}/python-doc
10 years, 7 months
[copr] master: 1008532 - preserve timestamp (0e185c2)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 0e185c25dc26a9e6d3291602e8414e3ab13e43fe
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Sep 16 16:46:10 2013 +0200
1008532 - preserve timestamp
>---------------------------------------------------------------
copr.spec | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/copr.spec b/copr.spec
index 9150c0c..ffed822 100644
--- a/copr.spec
+++ b/copr.spec
@@ -166,7 +166,7 @@ touch %{buildroot}%{_sharedstatedir}/copr/data/copr.db
#copr-cli
%{__python} coprcli-setup.py install --root %{buildroot}
install -d %{buildroot}%{_mandir}/man1
-install -m 644 man/copr-cli.1 %{buildroot}/%{_mandir}/man1/
+install -p -m 644 man/copr-cli.1 %{buildroot}/%{_mandir}/man1/
#doc
cp -a documentation/python-doc %{buildroot}%{_pkgdocdir}/
10 years, 7 months
[copr] master: Automatic commit of package [copr] release [1.4-1]. (5f7d2ce)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 5f7d2cec6869297a31ebed0867fddd0157aa473e
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Sep 16 16:21:48 2013 +0200
Automatic commit of package [copr] release [1.4-1].
>---------------------------------------------------------------
copr.spec | 5 ++++-
rel-eng/packages/copr | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/copr.spec b/copr.spec
index 234add0..9150c0c 100644
--- a/copr.spec
+++ b/copr.spec
@@ -3,7 +3,7 @@
%endif
Name: copr
-Version: 1.3
+Version: 1.4
Release: 1%{?dist}
Summary: Cool Other Package Repo
@@ -236,6 +236,9 @@ service httpd condrestart
%doc %{_pkgdocdir}/python-doc
%changelog
+* Mon Sep 16 2013 Miroslav Suchý <msuchy(a)redhat.com> 1.4-1
+- add logrotate file
+
* Mon Sep 16 2013 Miroslav Suchý <msuchy(a)redhat.com> 1.3-1
- be clear how we create tgz
diff --git a/rel-eng/packages/copr b/rel-eng/packages/copr
index 4c93271..ec3d4be 100644
--- a/rel-eng/packages/copr
+++ b/rel-eng/packages/copr
@@ -1 +1 @@
-1.3-1 ./
+1.4-1 ./
10 years, 7 months
[copr] master: add logrotate file (4f78ab2)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 4f78ab265dd9131cced2cc13bfb6489a0afc0a6d
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Sep 16 16:15:09 2013 +0200
add logrotate file
addressing:
copr-backend.noarch: W: log-files-without-logrotate /var/log/copr
>---------------------------------------------------------------
copr.spec | 4 ++++
logrotate/copr-backend | 23 +++++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/copr.spec b/copr.spec
index 0d383c9..234add0 100644
--- a/copr.spec
+++ b/copr.spec
@@ -132,12 +132,15 @@ install -d %{buildroot}%{_var}/log/copr/workers/
install -d %{buildroot}%{_pkgdocdir}/lighttpd/
install -d %{buildroot}%{_datadir}/copr/backend
install -d %{buildroot}%{_sysconfdir}/copr
+install -d %{buildroot}%{_sysconfdir}/logrotate.d/
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
cp -a backend-dist/lighttpd/* %{buildroot}%{_pkgdocdir}/lighttpd/
+cp -a logrotate/* %{buildroot}%{_sysconfdir}/logrotate.d/
+
# for ghost files
touch %{buildroot}%{_var}/log/copr/copr.log
for i in `seq 7`; do
@@ -194,6 +197,7 @@ service httpd condrestart
%dir %attr(0755, copr, copr) %{_var}/log/copr/workers
%ghost %{_var}/log/copr/copr.log
%ghost %{_var}/log/copr/workers/worker-*.log
+%config(noreplace) %{_sysconfdir}/logrotate.d/copr-backend
%doc %{_pkgdocdir}/lighttpd
%doc %{_pkgdocdir}/playbooks
%config(noreplace) %{_sysconfdir}/copr/copr-be.conf
diff --git a/logrotate/copr-backend b/logrotate/copr-backend
new file mode 100644
index 0000000..0c4fe10
--- /dev/null
+++ b/logrotate/copr-backend
@@ -0,0 +1,23 @@
+# logrotation file for Copr backend
+
+/var/log/copr/copr.log {
+ weekly
+ rotate 5
+ copytruncate
+ compress
+ notifempty
+ missingok
+ size=10M
+ create 640 copr copr
+}
+
+/var/log/copr/workers/worker-*.log {
+ weekly
+ rotate 5
+ copytruncate
+ compress
+ notifempty
+ missingok
+ size=10M
+ create 640 copr copr
+}
10 years, 7 months