summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--development/cgit/README7
-rw-r--r--development/cgit/cgit.SlackBuild31
-rw-r--r--development/cgit/cgit.info10
-rw-r--r--development/cgit/config/cgitrc.sample3
-rw-r--r--development/cgit/config/email-gravatar-sbo-additions.css28
-rw-r--r--development/cgit/config/email-gravatar-sbo.lua26
-rw-r--r--development/cgit/config/email-libravatar-korg-additions.css28
-rw-r--r--development/cgit/config/email-libravatar-korg.lua15
-rw-r--r--development/cgit/patches/0001-filter-add-libravatar-email-filter-lua-script.patch45
9 files changed, 178 insertions, 15 deletions
diff --git a/development/cgit/README b/development/cgit/README
index a8555e7edc..e6da0e958e 100644
--- a/development/cgit/README
+++ b/development/cgit/README
@@ -4,3 +4,10 @@ The folder /var/cache/cgit, must be owned by your webserver user.
A sample /etc/cgitrc (you must provide one) is in the $DOCS folder,
and so are some example configuration files for apache and lighttpd.
+
+luacrypto or lua-md5 are optional dependencies (for avatars support),
+but first you have to build this against lua.
+
+If you want to use the email-libravatar-korg.lua filter or the
+email-gravatar-sbo.lua one, have a look also to the suggested css
+additions (in the doc folder).
diff --git a/development/cgit/cgit.SlackBuild b/development/cgit/cgit.SlackBuild
index a5570e5a30..37b85b4c1f 100644
--- a/development/cgit/cgit.SlackBuild
+++ b/development/cgit/cgit.SlackBuild
@@ -1,7 +1,7 @@
#!/bin/sh
# Slackware build script for cgit
-# Copyright 2013 Matteo Bernardini <ponce@slackbuilds.org>, Pisa, Italy
+# Copyright 2013, 2014 Matteo Bernardini <ponce@slackbuilds.org>, Pisa, Italy
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,7 +22,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=cgit
-VERSION=${VERSION:-20130826_d62e71a}
+VERSION=${VERSION:-0.10.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -55,11 +55,13 @@ else
LIBDIRSUFFIX=""
fi
-CGIT_VERSION=${CGIT_VERSION:-v0.9.2-21-gd62e}
-GIT_VERSION=${GIT_VERSION:-1.8.4}
+CGIT_VERSION=${CGIT_VERSION:-v0.10.1}
+GIT_VERSION=${GIT_VERSION:-1.9.0}
DOCS="cgitrc.5.txt COPYING README $CWD/config/cgitrc.sample \
- $CWD/config/cgit-lighttpd.conf $CWD/config/cgit-httpd.conf"
+ $CWD/config/cgit-lighttpd.conf $CWD/config/cgit-httpd.conf \
+ $CWD/config/email-libravatar-korg-additions.css \
+ $CWD/config/email-gravatar-sbo-additions.css"
set -e
@@ -67,14 +69,17 @@ rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
-tar xvf $CWD/$PRGNAM-$VERSION.tar.?z*
+tar xvf $CWD/v$VERSION.tar.gz || tar xvf $CWD/$PRGNAM-$VERSION.tar.?z*
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
- \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
- -exec chmod 755 {} \; -o \
- \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
- -exec chmod 644 {} \;
+\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+# apply upstream patches
+for i in $CWD/patches/* ; do patch -p1 < $i ; done
# prepare sources
sed -i Makefile \
@@ -96,6 +101,12 @@ make install DESTDIR=$PKG
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+# Install additionals lua scripts
+install -m 0644 -D $CWD/config/email-libravatar-korg.lua \
+ $PKG/usr/share/cgit/filters/email-libravatar-korg.lua
+install -m 0644 -D $CWD/config/email-gravatar-sbo.lua \
+ $PKG/usr/share/cgit/filters/email-gravatar-sbo.lua
+
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
install -m0644 -oroot $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
sed -i "s|@DOCROOT@|$DOCROOT|g" $PKG/usr/doc/$PRGNAM-$VERSION/*
diff --git a/development/cgit/cgit.info b/development/cgit/cgit.info
index 5e6e70b8e2..977a202035 100644
--- a/development/cgit/cgit.info
+++ b/development/cgit/cgit.info
@@ -1,10 +1,10 @@
PRGNAM="cgit"
-VERSION="20130826_d62e71a"
+VERSION="0.10.1"
HOMEPAGE="http://git.zx2c4.com/cgit/about/"
-DOWNLOAD="http://ponce.cc/slackware/sources/repo/cgit-20130826_d62e71a.tar.xz \
- http://ponce.cc/slackware/sources/repo/git-1.8.4.tar.xz"
-MD5SUM="e416a2ce78307ab3ea93bd7256d8409c \
- fafd083b8286f901f3a373f0a985bf01"
+DOWNLOAD="https://github.com/zx2c4/cgit/archive/v0.10.1.tar.gz \
+ http://ponce.cc/slackware/sources/repo/git-1.9.0.tar.xz"
+MD5SUM="e4adc12f086103a7dd4560cab28392a4 \
+ 7debe72e09d6c725fd291d4d68c5f638"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
diff --git a/development/cgit/config/cgitrc.sample b/development/cgit/config/cgitrc.sample
index 0f3c91a60a..cd23168d04 100644
--- a/development/cgit/config/cgitrc.sample
+++ b/development/cgit/config/cgitrc.sample
@@ -7,6 +7,9 @@ root-desc=a fast interface to these git repositories
virtual-root=/
snapshots=tar.gz
branch-sort=age
+# for this to work you have to build cgit against lua
+# and install luacrypto too
+email-filter=lua:/usr/share/cgit/filters/email-gravatar-sbo.lua
#css=/static/cgit.css
#logo=/static/cgit.png
diff --git a/development/cgit/config/email-gravatar-sbo-additions.css b/development/cgit/config/email-gravatar-sbo-additions.css
new file mode 100644
index 0000000000..f7dbc32f41
--- /dev/null
+++ b/development/cgit/config/email-gravatar-sbo-additions.css
@@ -0,0 +1,28 @@
+div#cgit span.gravatar img.onhover {
+ display: none;
+ border: 1px solid gray;
+ padding: 0px;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+ width: 128px;
+ height: 128px;
+}
+
+div#cgit span.gravatar img.inline {
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+ width: 13px;
+ height: 13px;
+ margin-right: 0.2em;
+ opacity: 0.8;
+}
+
+div#cgit span.gravatar:hover > img.onhover {
+ display: block;
+ position: absolute;
+ margin-left: 1.5em;
+ background-color: #eeeeee;
+ box-shadow: 5px 5px 3px #bbb;
+}
diff --git a/development/cgit/config/email-gravatar-sbo.lua b/development/cgit/config/email-gravatar-sbo.lua
new file mode 100644
index 0000000000..0b8cb17ea2
--- /dev/null
+++ b/development/cgit/config/email-gravatar-sbo.lua
@@ -0,0 +1,26 @@
+-- This script may be used with the email-filter or repo.email-filter settings in cgitrc.
+-- It adds gravatar icons to author names. It is designed to be used with the lua:
+-- prefix in filters. It takes some part from the kernel.org's one.
+--
+-- Requirements:
+-- luacrypto >= 0.3
+-- <http://mkottman.github.io/luacrypto/>
+--
+
+local crypto = require("crypto")
+
+function filter_open(email, page)
+ buffer = ""
+ md5 = crypto.digest("md5", email:sub(2, -2):lower())
+end
+
+function filter_close()
+ html("<span class='gravatar'><img class='inline' src='//www.gravatar.com/avatar/" .. md5 .. "?s=13&amp;d=retro' /><img class='onhover' src='//www.gravatar.com/avatar/" .. md5 .. "?s=128&d=retro' /></span> " .. buffer)
+ return 0
+end
+
+function filter_write(str)
+ buffer = buffer .. str
+end
+
+
diff --git a/development/cgit/config/email-libravatar-korg-additions.css b/development/cgit/config/email-libravatar-korg-additions.css
new file mode 100644
index 0000000000..e44d052865
--- /dev/null
+++ b/development/cgit/config/email-libravatar-korg-additions.css
@@ -0,0 +1,28 @@
+div#cgit span.libravatar img.onhover {
+ display: none;
+ border: 1px solid gray;
+ padding: 0px;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+ width: 128px;
+ height: 128px;
+}
+
+div#cgit span.libravatar img.inline {
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+ width: 13px;
+ height: 13px;
+ margin-right: 0.2em;
+ opacity: 0.4;
+}
+
+div#cgit span.libravatar:hover > img.onhover {
+ display: block;
+ position: absolute;
+ margin-left: 1.5em;
+ background-color: #eeeeee;
+ box-shadow: 5px 5px 3px #bbb;
+}
diff --git a/development/cgit/config/email-libravatar-korg.lua b/development/cgit/config/email-libravatar-korg.lua
new file mode 100644
index 0000000000..2d67991d5e
--- /dev/null
+++ b/development/cgit/config/email-libravatar-korg.lua
@@ -0,0 +1,15 @@
+local md5 = require("md5")
+
+function filter_open(email, page)
+ buffer = ""
+ hexdigest = md5.sumhexa(email:sub(2, -2):lower())
+end
+
+function filter_close()
+ html("<span class='libravatar'><img class='inline' src='//seccdn.libravatar.org/avatar/" .. hexdigest .. "?s=13&d=retro' /><img class='onhover' src='//seccdn.libravatar.org/avatar/" .. hexdigest .. "?s=128&d=retro' /></span>" .. buffer)
+ return 0
+end
+
+function filter_write(str)
+ buffer = buffer .. str
+end
diff --git a/development/cgit/patches/0001-filter-add-libravatar-email-filter-lua-script.patch b/development/cgit/patches/0001-filter-add-libravatar-email-filter-lua-script.patch
new file mode 100644
index 0000000000..d6a9a74ed4
--- /dev/null
+++ b/development/cgit/patches/0001-filter-add-libravatar-email-filter-lua-script.patch
@@ -0,0 +1,45 @@
+From e22e985416929adb735bd952db00fce82d883914 Mon Sep 17 00:00:00 2001
+From: Christian Hesse <mail@eworm.de>
+Date: Thu, 13 Mar 2014 11:55:49 +0100
+Subject: [PATCH] filter: add libravatar email-filter lua script
+
+---
+ filters/email-libravatar.lua | 26 ++++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+ create mode 100644 filters/email-libravatar.lua
+
+diff --git a/filters/email-libravatar.lua b/filters/email-libravatar.lua
+new file mode 100644
+index 0000000..a248be4
+--- /dev/null
++++ b/filters/email-libravatar.lua
+@@ -0,0 +1,26 @@
++-- This script may be used with the email-filter or repo.email-filter settings in cgitrc.
++-- It adds libravatar icons to author names. It is designed to be used with the lua:
++-- prefix in filters.
++--
++-- Requirements:
++-- luacrypto >= 0.3
++-- <http://mkottman.github.io/luacrypto/>
++--
++
++local crypto = require("crypto")
++
++function filter_open(email, page)
++ buffer = ""
++ md5 = crypto.digest("md5", email:sub(2, -2):lower())
++end
++
++function filter_close()
++ html("<img src='//cdn.libravatar.org/avatar/" .. md5 .. "?s=13&amp;d=retro' width='13' height='13' alt='Libravatar' /> " .. buffer)
++ return 0
++end
++
++function filter_write(str)
++ buffer = buffer .. str
++end
++
++
+--
+1.9.0
+