You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
6.2 KiB
173 lines
6.2 KiB
## |
|
## gogs.spec -- OpenPKG RPM Package Specification |
|
## Copyright (c) 2000-2015 OpenPKG Foundation e.V. <http://openpkg.net/> |
|
## |
|
## Permission to use, copy, modify, and distribute this software for |
|
## any purpose with or without fee is hereby granted, provided that |
|
## the above copyright notice and this permission notice appear in all |
|
## copies. |
|
## |
|
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
|
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
## SUCH DAMAGE. |
|
## |
|
|
|
# package information |
|
%define V_gogs_base 0.5.13 |
|
%define V_gogs_snap 20150323 |
|
|
|
# package information |
|
Name: gogs |
|
Summary: Git Hosting Service |
|
URL: http://gogs.io/ |
|
Vendor: GoGits |
|
Packager: OpenPKG Foundation e.V. |
|
Distribution: OpenPKG Community |
|
Class: EVAL |
|
Group: Database |
|
License: MIT |
|
Version: %{V_gogs_base} |
|
Release: 20150323 |
|
|
|
# list of sources |
|
Source0: http://download.openpkg.org/components/versioned/gogs/gogs-%{V_gogs_snap}.tar.xz |
|
Source1: rc.gogs |
|
Source2: app.ini |
|
|
|
# build information |
|
BuildPreReq: OpenPKG, openpkg >= 20140101, go |
|
PreReq: OpenPKG, openpkg >= 20140101 |
|
PreReq: git |
|
|
|
%description |
|
Gogs is a hosting service for the Git version control system. |
|
|
|
%track |
|
prog gogs = { |
|
version = %{V_gogs_snap} |
|
url = https://github.com/gogits/gogs/releases |
|
regex = v(__VER__)\.tar\.gz |
|
} |
|
|
|
%prep |
|
%setup -q -n gogs |
|
|
|
%build |
|
# build program |
|
( export GOPATH=`pwd` |
|
cd $GOPATH/src/github.com/gogits/gogs |
|
go build -tags "sqlite" -x -o gogs |
|
) || exit $? |
|
|
|
# remove spaces from filenames |
|
( cd src/github.com/gogits/gogs/conf/license |
|
mv "Mozilla Public License Version 2.0" MPL-2.0 |
|
mv "CC0 1.0 Universal" CC0-1.0 |
|
mv "MIT License" MIT |
|
mv "BSD license" BSD |
|
mv "GPL v2" GPL-2.0 |
|
mv "Eclipse Public License v1.0" EPL-1.0 |
|
mv "Affero GPL" AGPL-3.0 |
|
mv "LGPL v2.1" LGPL-2.1 |
|
mv "Apache v2 License" Apache-2.0 |
|
mv "LGPL v3" LGPL-3.0 |
|
mv "BSD (3-Clause) License" BSD-3C |
|
mv "ISC license" ISC |
|
mv "Artistic License 2.0" Artistic-2.0 |
|
mv "GPL v3" GPL-3.0 |
|
) || exit $? |
|
( cd src/github.com/gogits/gogs/conf/gitignore |
|
mv "C Sharp" "C-Sharp" |
|
mv "Google Go" "Google-Go" |
|
) || exit $? |
|
|
|
%install |
|
# create directory hierarchy |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/bin \ |
|
$RPM_BUILD_ROOT%{l_prefix}/sbin \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/gogs \ |
|
$RPM_BUILD_ROOT%{l_prefix}/share/gogs/custom/conf \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/gogs/run \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/gogs/log \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/gogs/tmp \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/gogs/db \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/gogs/data \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/gogs/repo |
|
|
|
# install program |
|
%{l_shtool} install -c -s -m 755 \ |
|
src/github.com/gogits/gogs/gogs \ |
|
$RPM_BUILD_ROOT%{l_prefix}/sbin/ |
|
|
|
# install run-time files |
|
( cd src/github.com/gogits/gogs |
|
cp -r conf public templates \ |
|
$RPM_BUILD_ROOT%{l_prefix}/share/gogs/ |
|
) || exit $? |
|
|
|
# install default configuration |
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
%{SOURCE app.ini} \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/gogs/ |
|
|
|
# provide links to final location |
|
ln -s ../../../../etc/gogs/app.ini \ |
|
$RPM_BUILD_ROOT%{l_prefix}/share/gogs/custom/conf/app.ini |
|
ln -s ../../var/gogs/data \ |
|
$RPM_BUILD_ROOT%{l_prefix}/share/gogs/data |
|
ln -s ../../sbin/gogs \ |
|
$RPM_BUILD_ROOT%{l_prefix}/share/gogs/gogs |
|
|
|
# install run-command script |
|
%{l_shtool} install -c -m 755 %{l_value -s -a} \ |
|
%{SOURCE rc.gogs} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
|
|
|
# determine installation files |
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
|
%{l_files_std} \ |
|
'%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/gogs/*' \ |
|
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/gogs/*' \ |
|
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/gogs/*/*' |
|
|
|
%files -f files |
|
|
|
%clean |
|
|
|
%post |
|
# after upgrade, restart service |
|
if [ $1 -eq 1 ]; then |
|
# display information about next steps |
|
( echo "After starting Gogs with" |
|
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc gogs start" |
|
echo "you should configure it by visiting:" |
|
echo " http://localhost:3000/" |
|
) | %{l_rpmtool} msg -b -t notice |
|
elif [ $1 -eq 2 ] || exit 0 |
|
eval `%{l_rc} gogs status 2>/dev/null` |
|
[ ".$gogs_active" = .yes ] && %{l_rc} gogs restart |
|
fi |
|
exit 0 |
|
|
|
%preun |
|
# before erase, stop service and remove log files |
|
[ $1 -eq 0 ] || exit 0 |
|
%{l_rc} gogs stop 2>/dev/null |
|
rm -rf $RPM_INSTALL_PREFIX/var/gogs/log/* >/dev/null 2>&1 || true |
|
rm -rf $RPM_INSTALL_PREFIX/var/gogs/run/* >/dev/null 2>&1 || true |
|
rm -rf $RPM_INSTALL_PREFIX/var/gogs/tmp/* >/dev/null 2>&1 || true |
|
rm -rf $RPM_INSTALL_PREFIX/var/gogs/db/* >/dev/null 2>&1 || true |
|
rm -rf $RPM_INSTALL_PREFIX/var/gogs/repo/* >/dev/null 2>&1 || true |
|
rm -rf $RPM_INSTALL_PREFIX/var/gogs/data/* >/dev/null 2>&1 || true |
|
exit 0 |
|
|
|
|