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.
 
 
 
 
 
 

142 lines
4.9 KiB

##
## git-lfs.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2020 OpenPKG Project <http://openpkg.org/>
##
## 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 version
%define V_opkg 2.9.1
%define V_dist 20191127
# package information
Name: git-lfs
Summary: Git Large File System (LFS)
URL: https://git-lfs.github.com/
Vendor: Github
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: EVAL
Group: SCM
License: MIT
Version: %{V_opkg}.%{V_dist}
Release: 20191127
# list of sources
Source0: http://download.openpkg.org/components/versioned/git-lfs/git-lfs-%{V_dist}.tar.xz
Source1: rc.git-lfs
Source2: git-lfs-server.cf
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101, go
PreReq: OpenPKG, openpkg >= 20160101
%description
Git LFS is a command line extension and specification for managing
large files with Git. By design, every Git repository contains every
version of every file. But for some types of projects, this is not
reasonable or even practical. Multiple revisions of a large file
take up space quickly, slowing down repository operations and making
fetches unwieldy. Git LFS overcomes this limitation by storing the
metadata for large files in Git and syncing the file contents to a
configurable Git LFS server.
%track
prog git-lfs:release = {
version = %{V_opkg}
url = https://git-lfs.github.com/
regex = /v(__VER__)/
}
prog git-lfs:snapshot = {
version = %{V_dist}
url = http://download.openpkg.org/components/versioned/git-lfs/
regex = git-lfs-(__VER__)\.tar\.xz
}
%prep
%setup -q -n git-lfs
%build
# prepare Go build environment
export GOPATH=`pwd`
# build program
( cd src/github.com/git-lfs/git-lfs
go build -v -o git-lfs git-lfs.go
) || exit $?
( cd src/github.com/git-lfs/lfs-test-server
go build -v -o git-lfs-server .
) || exit $?
%install
# create directory hierarchy
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/sbin \
$RPM_BUILD_ROOT%{l_prefix}/libexec/git \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/git-lfs \
$RPM_BUILD_ROOT%{l_prefix}/var/git-lfs/log \
$RPM_BUILD_ROOT%{l_prefix}/var/git-lfs/run \
$RPM_BUILD_ROOT%{l_prefix}/var/git-lfs/data
# install program
%{l_shtool} install -c -s -m 755 \
src/github.com/git-lfs/git-lfs/git-lfs \
$RPM_BUILD_ROOT%{l_prefix}/libexec/git/git-lfs
%{l_shtool} install -c -s -m 755 \
src/github.com/git-lfs/lfs-test-server/git-lfs-server \
$RPM_BUILD_ROOT%{l_prefix}/sbin/
# install server configuration
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE git-lfs-server.cf} \
$RPM_BUILD_ROOT%{l_prefix}/etc/git-lfs/
# install run-command script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.git-lfs} $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/git-lfs/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/git-lfs/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/git-lfs/*/*'
%files -f files
%clean
%post
# after upgrade, restart service
if [ $1 -eq 2 ]; then
eval `%{l_rc} git-lfs status 2>/dev/null`
[ ".$git_lfs_active" = .yes ] && %{l_rc} git-lfs restart
fi
exit 0
%preun
# before erase, stop service and remove log files
[ $1 -eq 0 ] || exit 0
%{l_rc} git-lfs stop 2>/dev/null
rm -rf $RPM_INSTALL_PREFIX/var/git-lfs/log/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/git-lfs/run/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/git-lfs/data/* >/dev/null 2>&1 || true
exit 0