9c9db9d
# Review bug: https://bugzilla.redhat.com/479723
9c9db9d
f94e06c
# Defaults
395011e
%global gitver      2.18.0
a94947b
%global cachedir    %{_localstatedir}/cache/%{name}
a602a24
%global filterdir   %{_libexecdir}/%{name}/filters
a94947b
%global scriptdir   %{_localstatedir}/www/cgi-bin
a94947b
%global cgitdata    %{_datadir}/%{name}
9c9db9d
9febbf3
# Disable automatic compilation of *.py files outside of python sitelib,
9febbf3
# the *.py files in cgit are not importable python modules
9febbf3
%global _python_bytecompile_extra 0
9febbf3
f94e06c
# Settings for Fedora and EL > 7
f94e06c
%if 0%{?fedora} || 0%{?rhel} > 7
f94e06c
%global use_perl_interpreter    1
f94e06c
%else
f94e06c
%global use_perl_interpreter    0
f94e06c
%endif
f94e06c
a4d1cbe
# The highlight package is not available in epel-7-ppc64
a4d1cbe
%if 0%{?rhel} == 7 && %{_arch} == ppc64
a4d1cbe
%bcond_with     highlight
a4d1cbe
%else
a4d1cbe
%bcond_without  highlight
8b04e6e
%endif
8b04e6e
1a94c57
# Older epel lacks httpd-filesystem
1a94c57
%if 0%{?fedora} || 0%{?rhel} > 7
1a94c57
%bcond_without  httpd_filesystem
1a94c57
%else
1a94c57
%bcond_with     httpd_filesystem
1a94c57
%endif
1a94c57
9c9db9d
Name:           cgit
395011e
Version:        1.2
395011e
Release:        1%{?dist}
a94947b
Summary:        A fast web interface for git
9c9db9d
9c9db9d
License:        GPLv2
bc633ab
URL:            https://git.zx2c4.com/cgit/
bc633ab
Source0:        https://git.zx2c4.com/cgit/snapshot/%{name}-%{version}.tar.xz
395011e
Source1:        https://www.kernel.org/pub/software/scm/git/git-%{gitver}.tar.xz
9c9db9d
Source2:        cgitrc
18e201b
Source3:        README.SELinux
8b04e6e
a4d1cbe
# All supported releases use highlight version 3.
a4d1cbe
Patch0:         cgit-0.9.1-highlightv3.patch
a4d1cbe
2f6d0d2
# Security guys might try to repoquery for this.
2f6d0d2
Provides:       bundled(git) = %gitver
2f6d0d2
a4d1cbe
%if %{with highlight}
1f090cf
BuildRequires:  highlight
0133e5a
%endif
9c9db9d
593cd4b
BuildRequires:  asciidoc
560e30f
BuildRequires:  gcc
9c9db9d
BuildRequires:  libcurl-devel
9c9db9d
BuildRequires:  openssl-devel
591edd3
BuildRequires:  lua-devel
560e30f
BuildRequires:  make
d552c46
f94e06c
# Test dependencies
f94e06c
BuildRequires:  gettext
f94e06c
%if %{use_perl_interpreter}
f94e06c
BuildRequires:  perl-interpreter
f94e06c
%else
f94e06c
BuildRequires:  perl
f94e06c
%endif
f94e06c
BuildRequires:  perl(ExtUtils::MakeMaker)
f94e06c
BuildRequires:  strace
f94e06c
BuildRequires:  tidy
f94e06c
1a94c57
%if %{with httpd_filesystem}
1a94c57
# httpd-filesystem provides the basic apache directory layout
d552c46
Requires:       httpd-filesystem
8cc47a6
%endif
cc6123c
Requires:       webserver
d552c46
9c9db9d
9c9db9d
%description
a94947b
Cgit is a fast web interface for git.  It uses caching to increase performance.
9c9db9d
9c9db9d
%prep
282adf4
%autosetup -a 1 -p1
9c9db9d
9c9db9d
# setup the git dir
9c9db9d
rm -rf git
9c9db9d
mv git-%{gitver} git
5038a3a
9eedf28
# add README.SELinux
9eedf28
cp -p %{SOURCE3} .
9eedf28
5038a3a
# Use the same options for every invocation of 'make'.
5038a3a
# Otherwise it will rebuild in %%install due to flags changes.
5038a3a
cat << \EOF > cgit.conf
5038a3a
V = 1
5038a3a
CFLAGS = %{optflags}
5038a3a
LDFLAGS = %{?__global_ldflags}
5038a3a
CACHE_ROOT = %{cachedir}
5038a3a
CGIT_SCRIPT_PATH = %{scriptdir}
5038a3a
CGIT_SCRIPT_NAME = cgit
5038a3a
CGIT_DATA_PATH = %{cgitdata}
e75beaa
COPYTREE = %{__cp} -rp
5038a3a
docdir = %{docdir}
5038a3a
filterdir = %{filterdir}
5038a3a
prefix = %{_prefix}
5038a3a
EOF
5038a3a
5038a3a
# git build flags
5038a3a
cat << \EOF > git/config.mak
5038a3a
V = 1
5038a3a
CFLAGS = %{optflags}
5038a3a
LDFLAGS = %{?__global_ldflags}
bb6278b
BLK_SHA1 = YesPlease
5038a3a
EOF
9c9db9d
25692dc
# remove env shebang's from filter scripts
25692dc
grep -rl '#!.*/env' filters/ | xargs -r sed -Ei 's@^(.+/)env (.+)$@\1\2@'
25692dc
650d316
# remove execute permissions from contrib file
650d316
find contrib -type f | xargs -r chmod -x
650d316
e9d2470
# default httpd config
18e201b
cat > httpd.conf <
18e201b
Alias /cgit-data /usr/share/cgit
18e201b
ScriptAlias /cgit /var/www/cgi-bin/cgit
e9d2470
%if 0%{?fedora} || 0%{?rhel} >= 7
18e201b
<Directory "/usr/share/cgit">
18e201b
    Require all granted
18e201b
</Directory>
18e201b
%endif
18e201b
EOF
18e201b
a9267ec
9c9db9d
%build
bd1a101
%make_build all doc-man doc-html
593cd4b
a4d1cbe
%if %{with highlight}
1f090cf
highlight --print-style --style-outfile=stdout >> cgit.css
1f090cf
%endif
1f090cf
9c9db9d
9c9db9d
%install
5038a3a
%make_install install install-man
9c9db9d
install -d -m0755 %{buildroot}%{_sysconfdir}/httpd/conf.d
9c9db9d
install -p -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/cgitrc
18e201b
install -p -m0644 httpd.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/cgit.conf
9c9db9d
install -d -m0755 %{buildroot}%{cachedir}
9c9db9d
a94947b
f94e06c
%check
f94e06c
make test
f94e06c
f94e06c
9c9db9d
%files
650d316
%doc README* contrib *.html
e9d2470
%license COPYING
9c9db9d
%config(noreplace) %{_sysconfdir}/cgitrc
1a94c57
%if ! %{with httpd_filesystem}
1a94c57
# own httpd config dirs on systems without httpd-filesystem
c55a610
%dir %{_sysconfdir}/httpd
c55a610
%dir %{_sysconfdir}/httpd/conf.d
c55a610
%endif
9c9db9d
%config(noreplace) %{_sysconfdir}/httpd/conf.d/cgit.conf
9c9db9d
%dir %attr(-,apache,root) %{cachedir}
9c9db9d
%{cgitdata}
a602a24
%{filterdir}
9febbf3
# exclude byte-compiled python files (relevant on Fedora < 29 and RHEL < 8)
9febbf3
%exclude %{filterdir}/*.py[co]
9c9db9d
%{scriptdir}/*
593cd4b
%{_mandir}/man*/*
9c9db9d
9c9db9d
9c9db9d
%changelog
395011e
* Fri Jul 13 2018 Todd Zullinger <tmz@pobox.com> - 1.2-1
395011e
- Update to 1.2
650d316
- Include contrib dir in docs
e9b490c
- Update example cgtirc settings
395011e
1c72d90
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-12
1c72d90
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
1c72d90
9febbf3
* Fri Jun 15 2018 Todd Zullinger <tmz@pobox.com> - 1.1-11
9febbf3
- disable automatic compilation of *.py files outside of python sitelib
a4d1cbe
- use %%bcond_(with|without) to toggle highlight
282adf4
- use %%autosetup macro
70a14e8
- drop crufty curl-devel conditional
bd1a101
- fix parallel make issues in docs
9eedf28
- simplify README.SELinux install
1a94c57
- use %%bcond_(with|without) to handle httpd-filesystem
bb6278b
- avoid libcrypto.so requires
f94e06c
- run test suite in %%check
9febbf3
e75beaa
* Mon Jun 04 2018 Todd Zullinger <tmz@pobox.com>
e75beaa
- make config: drop redundant DESTDIR/INSTALL, add COPYTREE
25692dc
- remove env shebang's from filter scripts
e75beaa
bc633ab
* Sun Feb 18 2018 Todd Zullinger <tmz@pobox.com> - 1.1-10
bc633ab
- Use https for source URLs
99d5ca6
- Remove el5 conditionals
5038a3a
- Use cgit.conf and config.mak for cgit/git build options
fa4377d
- Drop obsolete %%{buildroot} cleanup
560e30f
- Add gcc and make BuildRequires
bc633ab
d4346e9
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-9
d4346e9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
d4346e9
c05ff11
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-8
c05ff11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
c05ff11
df5d04f
* Sun Jul 30 2017 Florian Weimer <fweimer@redhat.com> - 1.1-7
df5d04f
- Rebuild with binutils fix for ppc64le (#1475636)
df5d04f
9d2a9ee
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-6
9d2a9ee
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
9d2a9ee
cc6123c
* Mon Jul 24 2017 Todd Zullinger <tmz@pobox.com> - 1.1-5
cc6123c
- Require webserver on all dists (#1468839)
cc6123c
c55a610
* Mon Jul 24 2017 Kevin Fenzi <kevin@scrye.com> - 1.1-4
c55a610
- Fix httpd requirements on epel7. Fixes bug #1468839
c55a610
3ede86e
* Tue Mar 07 2017 Pavel Raiskup <praiskup@redhat.com> - 1.1-3
3ede86e
- suggest using correct selinux context (rhbz#1429790)
3ede86e
0fafc50
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-2
0fafc50
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
0fafc50
1800ff9
* Wed Nov 23 2016 Kevin Fenzi <kevin@scrye.com> - 1.1-1
1800ff9
- Update to 1.1. Fixes bug #1397820
1800ff9
2f6d0d2
* Mon Sep 19 2016 Pavel Raiskup <praiskup@redhat.com> - 1.0-2
2f6d0d2
- ensure we inform about git bundling appropriately
2f6d0d2
c76a1ca
* Tue Jun 07 2016 Kevin Fenzi <kevin@scrye.com> - 1.0-1
c76a1ca
- Update to 1.0
c76a1ca
156ecba
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.12-2
156ecba
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
156ecba
32eb1d5
* Sat Jan 16 2016 Kevin Fenzi <kevin@scrye.com> - 0.12-1
32eb1d5
- Update to 0.12. Fixes bug #1298912
32eb1d5
- Fixes CVE-2016-1899 CVE-2016-1900 CVE-2016-1901
32eb1d5
8cc47a6
* Sat Sep 05 2015 Kevin Fenzi <kevin@scrye.com> 0.11.2-3
8cc47a6
- Fix up logic around webserver and httpd.
8cc47a6
- On Fedora require webserver and httpd-filesystem
8cc47a6
- On EPEL require httpd.
8cc47a6
11f4cd7
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.11.2-2
11f4cd7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
11f4cd7
6b1d161
* Sat Mar 14 2015 Kevin Fenzi <kevin@scrye.com> 0.11.2-1
6b1d161
- Update to 0.11.2
6b1d161
9248f75
* Tue Mar 10 2015 Kevin Fenzi <kevin@scrye.com> 0.11.1-1
9248f75
- Update to 0.11.1
9248f75
09f7552
* Mon Feb 16 2015 Kevin Fenzi <kevin@scrye.com> 0.11.0-1
09f7552
- Update to 0.11.0
09f7552
d552c46
* Mon Feb 09 2015 Pavel Raiskup <praiskup@redhat.com> - 0.10.2-5
d552c46
- require "any" 'webserver' instead of concrete 'httpd' (#1138599)
d552c46
44c7db8
* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.2-4
44c7db8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
44c7db8
8b04e6e
* Tue Jul 08 2014 Pavel Raiskup <praiskup@redhat.com> - 0.10.2-3
8b04e6e
- currently epel-7-ppc64 does not have highlight package (#1117261)
8b04e6e
18e201b
* Tue Jul 08 2014 Pavel Raiskup <praiskup@redhat.com> - 0.10.2-2
a9267ec
- install README.SELinux documentation again (#1036123)
18e201b
- generate cgit.conf for httpd >= 2.4 when needed
a9267ec
f017a6c
* Tue Jul 01 2014 Kevin Fenzi <kevin@scrye.com> 0.10.2-1
f017a6c
- Update to 0.10.2. Fixes bug #1114970
f017a6c
d0b0c57
* Wed Jun 11 2014 Kevin Fenzi <kevin@scrye.com> 0.10.1-4
d0b0c57
- Add patch to fix raw patch handling
d0b0c57
0084c70
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.1-3
0084c70
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
0084c70
1f090cf
* Thu Mar 20 2014 Ville Skyttä <ville.skytta@iki.fi> - 0.10.1-2
1f090cf
- Include highlight styles in cgit.css
1f090cf
591edd3
* Thu Feb 27 2014 Kevin Fenzi <kevin@scrye.com> 0.10.1-1
591edd3
- Update to 0.10.1
591edd3
- Correctly enable lua filters. 
591edd3
f7db80f
* Wed Feb 19 2014 Kevin Fenzi <kevin@scrye.com> 0.10-1
f7db80f
- Update to 0.10
f7db80f
e8ca97b
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.2-2
e8ca97b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
e8ca97b
0cb92fb
* Mon May 27 2013 Todd Zullinger <tmz@pobox.com> - 0.9.2-1
0cb92fb
- Update to 0.9.2, fixes CVE-2013-2117
0cb92fb
9aaef07
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.1-4
9aaef07
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
9aaef07
836c846
* Wed Nov 21 2012 Kevin Fenzi <kevin@scrye.com> 0.9.1-3
836c846
- Fixed ldflags. Fixes bug 878611
836c846
0133e5a
* Sat Nov 17 2012 Kevin Fenzi <kevin@scrye.com> 0.9.1-2
0133e5a
- Add patch to use correct version of highlight for all branches except epel5
0133e5a
e40abfe
* Thu Nov 15 2012 Kevin Fenzi <kevin@scrye.com> 0.9.1-1
e40abfe
- Update to 0.9.1
e40abfe
- Fixes bug #870714 - CVE-2012-4548
e40abfe
- Fixes bug #820733 - CVE-2012-4465
e40abfe
22a6465
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.0.2-4
22a6465
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
22a6465
2a8cd42
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.0.2-3
2a8cd42
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
2a8cd42
e92f127
* Fri Jul 22 2011 Todd Zullinger <tmz@pobox.com> - 0.9.0.2-2
e92f127
- Fix potential XSS vulnerability in rename hint
e92f127
c7cf646
* Thu Jul 21 2011 Todd Zullinger <tmz@pobox.com> - 0.9.0.2-1
c7cf646
- Update to 0.9.0.2
c7cf646
a94947b
* Sun Mar 06 2011 Todd Zullinger <tmz@pobox.com> - 0.9-1
a94947b
- Update to 0.9
a94947b
- Fixes: CVE-2011-1027
a94947b
  http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-1027
593cd4b
- Generate and install man page and html docs
7e88cbe
- Use libcurl-devel on RHEL >= 6
a602a24
- Include example filter scripts
2f0e005
- Update example cgitrc
a94947b
abc359a
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.2.1-5
abc359a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
abc359a
637b845
* Mon Sep 27 2010 Todd Zullinger <tmz@pobox.com> - 0.8.2.1-4
637b845
- Appy upstream git patch for CVE-2010-2542 (#618108)
637b845
d6e9b1c
* Fri Aug 21 2009 Tomas Mraz <tmraz@redhat.com> - 0.8.2.1-3
d6e9b1c
- rebuilt with new openssl
d6e9b1c
99cd6f2
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.2.1-2
99cd6f2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
99cd6f2
39fe829
* Sun Mar 15 2009 Todd Zullinger <tmz@pobox.com> - 0.8.2.1-1
39fe829
- Update to 0.8.2.1
39fe829
45a6845
* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.2-2
45a6845
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
45a6845
8585ea8
* Sun Feb 01 2009 Todd Zullinger <tmz@pobox.com> - 0.8.2-1
8585ea8
- Update to 0.8.2
8585ea8
- Drop upstreamed Makefile patch
8585ea8
0541f93
* Sun Jan 18 2009 Todd Zullinger <tmz@pobox.com> - 0.8.1-2
0541f93
- Rebuild with new openssl
0541f93
9c9db9d
* Mon Jan 12 2009 Todd Zullinger <tmz@pobox.com> - 0.8.1-1
9c9db9d
- Initial package