From 9c9db9d979a91cd5fe414afb9789ee6b83d35beb Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Tue, 13 Jan 2009 21:48:56 +0000 Subject: Import cgit on devel branch --- .cvsignore | 3 ++ README.SELinux | 24 +++++++++++ cgit-0.8.1-Makefile-install.patch | 33 +++++++++++++++ cgit.httpd | 2 + cgit.spec | 88 +++++++++++++++++++++++++++++++++++++++ cgitrc | 54 ++++++++++++++++++++++++ sources | 2 + 7 files changed, 206 insertions(+) create mode 100644 README.SELinux create mode 100644 cgit-0.8.1-Makefile-install.patch create mode 100644 cgit.httpd create mode 100644 cgit.spec create mode 100644 cgitrc diff --git a/.cvsignore b/.cvsignore index e69de29..c6a8266 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1,3 @@ +*.rpm +*.tar.bz2 +clog diff --git a/README.SELinux b/README.SELinux new file mode 100644 index 0000000..329b816 --- /dev/null +++ b/README.SELinux @@ -0,0 +1,24 @@ +If you use SELinux, there are a few things you'll need to take care of +for cgit to work smoothly. (Most of these should be fixed in the +official selinux-policy packages before cgit makes it into Fedora). + +1. Enable the httpd_enable_cgi boolean + $ setsebool -P httpd_enable_cgi 1 + +2. Set proper file contexts + (These should be taken care of in the selinux-policy package before + cgit makes it into stable Fedora versions.) + + a) The cache dir needs to be writable by the cgi + # semanage fcontext -a -t httpd_sys_content_rw_t "/var/cache/cgit(/.*)?" + + b) The git repositories need to be readable by the cgi + # semanage fcontext -a -t httpd_sys_content_t "/var/lib/git(/.*)?" + + If your git repositories are somewhere other than /var/lib/git, use that + path in the command above. If you have other confined daemons that need + to access the git repositories, you may want to use public_content_t + instead of httpd_sys_content_t. + + c) Run restorecon to update the contexts + # restorecon -R /var/cache/cgit /var/lib/git diff --git a/cgit-0.8.1-Makefile-install.patch b/cgit-0.8.1-Makefile-install.patch new file mode 100644 index 0000000..89825e9 --- /dev/null +++ b/cgit-0.8.1-Makefile-install.patch @@ -0,0 +1,33 @@ +diff -up cgit-0.8.1/Makefile.install cgit-0.8.1/Makefile +--- cgit-0.8.1/Makefile.install 2008-10-11 14:22:57.000000000 -0400 ++++ cgit-0.8.1/Makefile 2009-01-11 11:56:51.000000000 -0500 +@@ -1,11 +1,13 @@ + CGIT_VERSION = v0.8.1 + CGIT_SCRIPT_NAME = cgit.cgi + CGIT_SCRIPT_PATH = /var/www/htdocs/cgit ++CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) + CGIT_CONFIG = /etc/cgitrc + CACHE_ROOT = /var/cache/cgit + SHA1_HEADER = + GIT_VER = 1.6.0.2 + GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 ++INSTALL = install + + # + # Let the user override the above settings. +@@ -112,10 +114,11 @@ test: all + $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all + + install: all +- mkdir -p $(DESTDIR)$(CGIT_SCRIPT_PATH) +- install cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) +- install cgit.css $(DESTDIR)$(CGIT_SCRIPT_PATH)/cgit.css +- install cgit.png $(DESTDIR)$(CGIT_SCRIPT_PATH)/cgit.png ++ $(INSTALL) -m0755 -d $(DESTDIR)$(CGIT_SCRIPT_PATH) ++ $(INSTALL) -m0755 cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) ++ $(INSTALL) -m0755 -d $(DESTDIR)$(CGIT_DATA_PATH) ++ $(INSTALL) -m0644 cgit.css $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css ++ $(INSTALL) -m0644 cgit.png $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png + + uninstall: + rm -f $(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) diff --git a/cgit.httpd b/cgit.httpd new file mode 100644 index 0000000..791d01b --- /dev/null +++ b/cgit.httpd @@ -0,0 +1,2 @@ +Alias /cgit-data /usr/share/cgit +ScriptAlias /cgit /var/www/cgi-bin/cgit diff --git a/cgit.spec b/cgit.spec new file mode 100644 index 0000000..67f71e9 --- /dev/null +++ b/cgit.spec @@ -0,0 +1,88 @@ +# Review bug: https://bugzilla.redhat.com/479723 + +%define gitver 1.6.0.2 +%define cachedir %{_localstatedir}/cache/cgit +%define scriptdir %{_localstatedir}/www/cgi-bin +%define cgitdata %{_datadir}/cgit + +%define make_cgit \ +export CFLAGS="%{optflags}" \ +make V=1 %{?_smp_mflags} \\\ + DESTDIR=%{buildroot} \\\ + INSTALL="install -p" \\\ + CACHE_ROOT=%{cachedir} \\\ + CGIT_SCRIPT_PATH=%{scriptdir} \\\ + CGIT_SCRIPT_NAME=cgit \\\ + CGIT_DATA_PATH=%{cgitdata} + +Name: cgit +Version: 0.8.1 +Release: 1%{?dist} +Summary: A fast webinterface for git + +Group: Development/Tools +License: GPLv2 +URL: http://hjemli.net/git/cgit/ +Source0: http://hjemli.net/git/cgit/snapshot/cgit-0.8.1.tar.bz2 +Source1: http://www.kernel.org/pub/software/scm/git/git-%{gitver}.tar.bz2 +Source2: cgitrc +Source3: cgit.httpd +Source4: README.SELinux +# Applied upstream stable branch (4ac89ec and d529c6f) +Patch0: cgit-0.8.1-Makefile-install.patch +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) + +%if 0%{?fedora} +BuildRequires: libcurl-devel +%else +BuildRequires: curl-devel +%endif +BuildRequires: openssl-devel +Requires: httpd + +%description +This is an attempt to create a fast web interface for the git scm, +using a builtin cache to decrease server io-pressure. + +%prep +%setup -q -a 1 +%patch0 -p1 -b .install + +# setup the git dir +rm -rf git +mv git-%{gitver} git +sed -i 's/^\(CFLAGS = \).*/\1%{optflags}/' git/Makefile + +# add README.SELinux +cp -p %{SOURCE4} . + + +%build +%{make_cgit} + + +%install +rm -rf %{buildroot} +%{make_cgit} install +install -d -m0755 %{buildroot}%{_sysconfdir}/httpd/conf.d +install -p -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/cgitrc +install -p -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/httpd/conf.d/cgit.conf +install -d -m0755 %{buildroot}%{cachedir} + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%doc COPYING README* cgitrc.5.txt +%config(noreplace) %{_sysconfdir}/cgitrc +%config(noreplace) %{_sysconfdir}/httpd/conf.d/cgit.conf +%dir %attr(-,apache,root) %{cachedir} +%{cgitdata} +%{scriptdir}/* + + +%changelog +* Mon Jan 12 2009 Todd Zullinger - 0.8.1-1 +- Initial package diff --git a/cgitrc b/cgitrc new file mode 100644 index 0000000..d3f811a --- /dev/null +++ b/cgitrc @@ -0,0 +1,54 @@ +# +# See /usr/share/doc/cgit-*/cgitrc.5.txt for details +# + +# Enable caching of up to 1000 output entries +cache-size=1000 + +# Specify some default clone prefixes +#clone-prefix=git://example.com ssh://example.com/pub/git http://example.com/git + +# Specify the css url +css=/cgit-data/cgit.css + +# Show extra links for each repository on the index page +enable-index-links=1 + +# Show number of affected files per commit on the log pages +enable-log-filecount=1 + +# Show number of added/removed lines per commit on the log pages +enable-log-linecount=1 + +# Add a cgit favicon +#favicon=/favicon.ico + +# Use a custom logo +logo=/cgit-data/cgit.png + +# Set the title and heading of the repository index page +#root-title=example.com git repositories + +# Set a subheading for the repository index page +#root-desc=tracking the foobar development + +# Include some more info about this site on the index page +#root-readme=/var/www/html/about.html + +# Allow download of tar.gz, tar.bz2 and zip-files +#snapshots=tar.gz tar.bz2 zip + +## +## List of repositories. +## PS: Any repositories listed when repo.group is unset will not be +## displayed under a group heading +## PPS: This list could be kept in a different file (e.g. '/etc/cgitrepos') +## and included like this: +## include=/etc/cgitrepos +## + +#repo.url=foo +#repo.path=/var/lib/git/foo.git +#repo.desc=the master foo repository +#repo.owner=fooman@example.com +#repo.readme=info/web/about.html diff --git a/sources b/sources index e69de29..502b172 100644 --- a/sources +++ b/sources @@ -0,0 +1,2 @@ +654850ded01dd2f6b732aa7c1b0856dc cgit-0.8.1.tar.bz2 +1e4d9bfc1cb0abf165d4de93b5172324 git-1.6.0.2.tar.bz2 -- cgit