Browse Source

genrpm changes (#1292)

* auto select latest version

* bash-completion comes with version 2.6.0

* version greater than 2.6.2 need submodules packed

* adjust version check order
pull/1379/head
was4444 7 years ago
committed by Max Lv
parent
commit
99e08e37b3
2 changed files with 31 additions and 4 deletions
  1. 8
      rpm/SPECS/shadowsocks-libev.spec.in
  2. 27
      rpm/genrpm.sh

8
rpm/SPECS/shadowsocks-libev.spec.in

@ -1,3 +1,6 @@
%bcond_with completion
Name: shadowsocks-libev
Version: VERSION
Release: 1%{?dist}
@ -73,8 +76,11 @@ install -m 644 %{_builddir}/%{buildsubdir}/debian/shadowsocks-libev.service %{bu
install -m 644 %{_builddir}/%{buildsubdir}/debian/shadowsocks-libev-*.service %{buildroot}%{_unitdir}/
%endif
install -m 644 %{_builddir}/%{buildsubdir}/debian/config.json %{buildroot}%{_sysconfdir}/shadowsocks-libev/config.json
%if %{with completion}
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions/
install -m 644 %{_builddir}/%{buildsubdir}/completions/bash/* %{buildroot}%{_datadir}/bash-completion/completions/
%endif
%pre
%if 0%{?use_systemd} && 0%{?suse_version}
@ -126,7 +132,9 @@ fi
%{_bindir}/*
%{_libdir}/*.so.*
%config(noreplace) %{_sysconfdir}/shadowsocks-libev/config.json
%if %{with completion}
%{_datadir}/bash-completion/completions/*
%endif
%doc %{_mandir}/*
%if ! 0%{?use_systemd}
%{_initddir}/shadowsocks-libev

27
rpm/genrpm.sh

@ -1,20 +1,28 @@
#!/usr/bin/env bash
set -e
g_version=$(git tag -l v* | sort --version-sort | tail -1)
g_version=${g_version#"v"}
show_help()
{
echo -e "`basename $0` [option] [argument]"
echo
echo -e "Options:"
echo -e " -h show this help."
echo -e " -v with argument version (3.0.2 by default)."
echo -e " -f with argument format (tar.xz by default) used by git archive."
echo -e " -v with argument version (${g_version} by default)."
echo -e " -f with argument format (tar.gz by default) used by git archive."
echo
echo -e "Examples:"
echo -e " to build base on version \`2.4.1' with format \`tar.xz', run:"
echo -e " `basename $0` -f tar.xz -v 2.4.1"
}
version_greater_equal()
{
[ "$1" = $(printf "$1\n$2\n" | sort --version-sort | tail -1) ]
}
while getopts "hv:f:" opt
do
case ${opt} in
@ -38,9 +46,15 @@ do
esac
done
: ${version:=3.0.2}
: ${version:=${g_version}}
: ${format:=tar.gz}
supported_max_version="2.6.2"
if ! version_greater_equal ${supported_max_version} ${version}; then
echo "version(${version}) greater than ${supported_max_version} are not currently supported."
exit 1
fi
name="shadowsocks-libev"
spec_name="shadowsocks-libev.spec"
@ -52,4 +66,9 @@ sed -e "s/^\(Version: \).*$/\1${version}/" \
-e "s/^\(Source0: \).*$/\1${name}-${version}.${format}/" \
SPECS/"${spec_name}".in > SPECS/"${spec_name}"
rpmbuild -bb SPECS/"${spec_name}" --define "%_topdir `pwd`"
completion_min_verion="2.6.0"
version_greater_equal ${version} ${completion_min_verion} \
&& with_completion="--with completion" || :
rpmbuild -bb SPECS/"${spec_name}" --define "%_topdir `pwd`" \
${with_completion}
Loading…
Cancel
Save