Skip to content

Commit

Permalink
net-proxy/haproxy: Version bump to 1.6.0. Also fixes bug 555864
Browse files Browse the repository at this point in the history
Package-Manager: portage-2.2.23
  • Loading branch information
idl0r committed Oct 16, 2015
1 parent 1600c8d commit baa4e24
Show file tree
Hide file tree
Showing 5 changed files with 252 additions and 0 deletions.
1 change: 1 addition & 0 deletions net-proxy/haproxy/Manifest
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
DIST haproxy-1.4.26.tar.gz 837280 SHA256 a8787dae723c045eebd0ed9e0213514f909a67325d64e963eaf50c35b147d3d3 SHA512 f21901069f651f3320c2b7cb6aee96fced5d4d5d4a73eec0d94dd8bd109a391d8da85026389e7209f85026cdefc1b879afcfd0a9bc0970e41aedd59e35935454 WHIRLPOOL 406b7f8bb4b9b3f6b8080f58431a804abea1d834ef9b8d86ede328b27e4f3fe944fbdae5bad8c3f7da75c81c92ff0e030950e09feac28eac4f763e511b5e7dce
DIST haproxy-1.5.14.tar.gz 1345345 SHA256 9565dd38649064d0350a2883fa81ccfe92eb17dcda457ebdc01535e1ab0c8f99 SHA512 83d6101fd402f37845ab3febc914335e4c6d9bdebbb0ff81c8e048d5252ffa5a1b77c4250a434fed5dd541ef1f1f2c47d969b59f7a51d6ab9aea38a8646a9798 WHIRLPOOL 7d2c580589b9b31e1eba169e4bf930ac42d2564e21eb1c25adbdd39b701abd221fd671ebc227167ab956a48b2c30eeb740a6394355a8fa748c408ee42fdff6fc
DIST haproxy-1.6.0.tar.gz 1538022 SHA256 e83a272b7d3638cf1d37bba58d3e75f497c1862315ee5bb7f5efc1d98d26e25b SHA512 44bfcd040c87e0c3e7d925bb671009e8ed568a7a32ae32ac5d58921417aaa458b772a1368876fee8bf9252106fb315c1c3d29b7f03739a239567b86fb3c25e8e WHIRLPOOL 06afedc7dc7110e0985864f6d955261489997fd55644a16320203e47e14fc6f3bbb9020b772dfc571c01c76c7a55c8883a910f5b0553e70d4f321c1a14d97a2d
14 changes: 14 additions & 0 deletions net-proxy/haproxy/files/haproxy.confd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# HAProxy config file(s), space separated
#CONFIGS="/etc/haproxy/haproxy.cfg"

# Additional HAProxy command line options
HAPROXY_OPTS=""

# If you want to make use ot the new seamless reload you can just write your own
# reload_seamless function here. It will be called by the init script.
# For more information on how to use that feature please have a look at the
# "seamless_reload.txt" documentation file (requires net-proxy/haproxy[examples])
#reload_seamless() {
# checkpath -d -m 0700 haproxy:haproxy "/var/run/haproxy/"
# socat /var/run/haproxy/socket - <<< "show servers state" > /var/run/haproxy/global.state
#}
75 changes: 75 additions & 0 deletions net-proxy/haproxy/files/haproxy.initd-r3
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/sbin/runscript
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

extra_commands="checkconfig"
extra_started_commands="reload"

command="/usr/bin/haproxy"

pidfile="${HAPROXY_PIDFILE:-/var/run/${SVCNAME}.pid}"

configs=

if [ -z "${CONFIGS}" ]; then
if [ -f "/etc/haproxy/${SVCNAME}.cfg" ]; then
CONFIGS=/etc/haproxy/${SVCNAME}.cfg
elif [ -f "/etc/${SVCNAME}.cfg" ]; then
CONFIGS=/etc/${SVCNAME}.cfg # Deprecated
fi
fi

for conf in $CONFIGS; do
configs="${configs} -f ${conf}"
done

command_args="-D -p ${pidfile} ${configs} ${HAPROXY_OPTS}"

depend() {
need net
use dns logger
}

checkconfig() {
if [ -z "${CONFIGS}" ]; then
eerror "No config(s) has been specified"
return 1
fi

for conf in $CONFIGS; do
if [ ! -f "${conf}" ]; then
eerror "${conf} does not exist!"
return 1
fi
done

ebegin "Checking ${CONFIGS}"
$command -q -c $configs $HAPROXY_OPTS
eend $?
}

start_pre() {
if [ "${RC_CMD}" != "restart" ]; then
checkconfig || return 1
fi
}

stop_pre() {
if [ "${RC_CMD}" = "restart" ]; then
checkconfig || return 1
fi
}

reload() {
checkconfig || { eerror "Reloading failed, please fix your config(s) first"; return 1; }

if [ "$(command -v reload_seamless)" = "reload_seamless" ]; then
einfo "Calling user-defined reload_seamless()"
reload_seamless || { eerror "reload_seamless() failed!"; return 1; }
fi

ebegin "Reloading ${SVCNAME}"
$command -D -p "${pidfile}" $configs $HAPROXY_OPTS -sf $(cat "${pidfile}")
eend $?
}
161 changes: 161 additions & 0 deletions net-proxy/haproxy/haproxy-1.6.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI="5"

inherit user versionator toolchain-funcs flag-o-matic systemd linux-info

MY_P="${PN}-${PV/_beta/-dev}"

DESCRIPTION="A TCP/HTTP reverse proxy for high availability environments"
HOMEPAGE="http://haproxy.1wt.eu"
SRC_URI="http://haproxy.1wt.eu/download/$(get_version_component_range 1-2)/src/${MY_P}.tar.gz"

LICENSE="GPL-2 LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="+crypt doc examples net_ns +pcre pcre-jit ssl tools vim-syntax +zlib" # lua

DEPEND="pcre? ( dev-libs/libpcre
pcre-jit? ( dev-libs/libpcre[jit] )
)
ssl? ( dev-libs/openssl:0[zlib?] )
zlib? ( sys-libs/zlib )"
# lua? ( dev-lang/lua:5.3 )
RDEPEND="${DEPEND}"

S="${WORKDIR}/${MY_P}"

pkg_setup() {
enewgroup haproxy
enewuser haproxy -1 -1 -1 haproxy

if use net_ns; then
CONFIG_CHECK="~NET_NS"
linux-info_pkg_setup
fi
}

src_prepare() {
sed -e 's:@SBINDIR@:'/usr/bin':' contrib/systemd/haproxy.service.in \
> contrib/systemd/haproxy.service || die

sed -ie 's:/usr/sbin/haproxy:/usr/bin/haproxy:' src/haproxy-systemd-wrapper.c || die
}

src_compile() {
local args="TARGET=linux2628 USE_GETADDRINFO=1"

if use crypt ; then
args="${args} USE_LIBCRYPT=1"
else
args="${args} USE_LIBCRYPT="
fi

# bug 541042
# if use lua; then
# args="${args} USE_LUA=1"
# else
args="${args} USE_LUA="
# fi

if use net_ns; then
args="${args} USE_NS=1"
else
args="${args} USE_NS="
fi

if use pcre ; then
args="${args} USE_PCRE=1"
if use pcre-jit; then
args="${args} USE_PCRE_JIT=1"
else
args="${args} USE_PCRE_JIT="
fi
else
args="${args} USE_PCRE= USE_PCRE_JIT="
fi

# if use kernel_linux; then
# args="${args} USE_LINUX_SPLICE=1 USE_LINUX_TPROXY=1"
# else
# args="${args} USE_LINUX_SPLICE= USE_LINUX_TPROXY="
# fi

if use ssl ; then
args="${args} USE_OPENSSL=1"
else
args="${args} USE_OPENSSL="
fi

if use zlib ; then
args="${args} USE_ZLIB=1"
else
args="${args} USE_ZLIB="
fi

# For now, until the strict-aliasing breakage will be fixed
append-cflags -fno-strict-aliasing

emake CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args}

if use tools ; then
for contrib in halog iprange ; do
emake -C contrib/${contrib} \
CFLAGS="${CFLAGS}" OPTIMIZE="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args}
done
fi
}

src_install() {
dobin haproxy

newconfd "${FILESDIR}/${PN}.confd" $PN
newinitd "${FILESDIR}/${PN}.initd-r3" $PN

dodoc CHANGELOG CONTRIBUTING MAINTAINERS
doman doc/haproxy.1

dobin haproxy-systemd-wrapper
systemd_dounit contrib/systemd/haproxy.service

if use doc; then
dodoc ROADMAP doc/{close-options,configuration,cookie-options,intro,linux-syn-cookies,management,proxy-protocol}.txt
fi

if use tools ; then
for contrib in halog iprange ; do
dobin contrib/${contrib}/${contrib}
done
fi

if use net_ns && use doc; then
dodoc doc/network-namespaces.txt
fi

if use examples ; then
docinto examples
dodoc examples/*.cfg
dodoc examples/seamless_reload.txt
fi

if use vim-syntax ; then
insinto /usr/share/vim/vimfiles/syntax
doins examples/haproxy.vim
fi
}

pkg_postinst() {
if [[ ! -f "${ROOT}/etc/haproxy/haproxy.cfg" ]] ; then
ewarn "You need to create /etc/haproxy/haproxy.cfg before you start the haproxy service."
ewarn "It's best practice to not run haproxy as root, user and group haproxy was therefore created."
ewarn "Make use of them with the \"user\" and \"group\" directives."

if [[ -d "${ROOT}/usr/share/doc/${PF}" ]]; then
einfo "Please consult the installed documentation for learning the configuration file's syntax."
einfo "The documentation and sample configuration files are installed here:"
einfo " ${ROOT}usr/share/doc/${PF}"
fi
fi
}
1 change: 1 addition & 0 deletions net-proxy/haproxy/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ It can:
Its event-driven architecture allows it to easily handle thousands of simultaneous connections on hundreds of instances without risking the system's stability.
</longdescription>
<use>
<flag name="net_ns">Enable network namespace support (CONFIG_NET_NS)</flag>
<flag name="pcre-jit">Use JIT support for PCRE</flag>
<flag name="tools">Install additional tools (halog, iprange)</flag>
</use>
Expand Down

0 comments on commit baa4e24

Please sign in to comment.