Skip to content

Commit

Permalink
app-admin/clsync: add live ebuild
Browse files Browse the repository at this point in the history
- Add live ebuild to facilitate development and testing
- Merge all clsync components (libclsync, clsync-docs) back to the
  main package.

Package-Manager: Portage-2.3.82, Repoman-2.3.20
Signed-off-by: Andrew Savchenko <[email protected]>
  • Loading branch information
bircoph committed May 31, 2020
1 parent f90fb72 commit 12ef9b3
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 0 deletions.
143 changes: 143 additions & 0 deletions app-admin/clsync/clsync-9999.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

if [[ ${PV} == "9999" ]] ; then
EGIT_REPO_URI="https://github.com/clsync/clsync.git"
inherit git-r3
KEYWORDS=""
else
SRC_URI="https://github.com/clsync/${MY_PN}/archive/v${PV}.tar.gz -> ${MY_P}.tar.gz"
KEYWORDS="~amd64 ~x86"
fi

inherit autotools linux-info systemd

DESCRIPTION="Live sync tool based on inotify, written in GNU C"
HOMEPAGE="https://github.com/clsync/clsync http://ut.mephi.ru/oss/clsync"
LICENSE="GPL-3+"
SLOT="0"
IUSE="apidoc +caps +clsync cluster control-socket cgroups doc debug
examples extra-debug extra-hardened gio +hardened +highload-locks
+inotify mhash namespaces seccomp socket-library static-libs"

REQUIRED_USE="
|| ( clsync socket-library )
|| ( gio inotify )
mhash? ( cluster )
seccomp? ( caps )
"
BDEPEND="
virtual/pkgconfig
apidoc? ( app-doc/doxygen[dot] )
"
DEPEND="
caps? ( sys-libs/libcap )
cgroups? ( dev-libs/libcgroup )
clsync? ( dev-libs/glib:2 )
mhash? ( app-crypt/mhash )
"
RDEPEND="${DEPEND}
!app-doc/clsync-docs
!dev-libs/libclsync
"

pkg_pretend() {
if use clsync; then
use inotify && CONFIG_CHECK+=" ~INOTIFY_USER"
use namespaces && CONFIG_CHECK="~NAMESPACES ~UTS_NS ~IPC_NS ~USER_NS ~PID_NS ~NET_NS"
use seccomp && CONFIG_CHECK+=" ~SECCOMP"
check_extra_config
fi
}

src_prepare() {
eapply_user
eautoreconf
}

src_configure() {
local harden_level=0
use hardened && harden_level=1
use extra-hardened && harden_level=2

local debug_level=0
use debug && debug_level=1
use extra-debug && debug_level=2

econf \
--enable-debug=${debug_level} \
--enable-paranoid=${harden_level} \
--without-bsm \
--without-kqueue \
$(use_enable caps capabilities) \
$(use_enable clsync) \
$(use_enable cluster) \
$(use_enable control-socket socket) \
$(use_enable highload-locks) \
$(use_enable namespaces unshare) \
$(use_enable seccomp) \
$(use_enable socket-library) \
$(use_with cgroups libcgroup) \
$(use_with gio gio lib) \
$(use_with inotify inotify native) \
$(use_with mhash)
}

src_compile() {
default
if use apidoc; then
doxygen .doxygen || die "doxygen failed"
fi
}

src_install() {
emake DESTDIR="${D}" install

if use socket-library; then
find "${ED}" -name "*.la" -delete
use static-libs || find "${ED}" -name "*.a" -delete || die "failed to remove static libs"
fi

if use clsync; then
newinitd "${FILESDIR}/${PN}.initd" "${PN}"
newconfd "${FILESDIR}/${PN}.confd" "${PN}"

# filter rules and sync scripts are supposed to be here
insinto /etc/${PN}
newins "${FILESDIR}/${PN}.conf" "${PN}.conf"
keepdir /etc/${PN}

systemd_dounit "examples/[email protected]"
fi

if use doc; then
dodoc -r DEVELOPING NOTES PROTOCOL SHORTHANDS TODO doc/devel/*
else
rm "${ED}/usr/share/doc/${PF}/"{DEVELOPING,LICENSE,PROTOCOL,TODO}* || die
fi
use apidoc && dodoc -r doc/doxygen/html
if ! use examples; then
rm -r "${ED}/usr/share/doc/${PF}/examples" || die
fi
}

pkg_postinst() {
einfo "${PN} is just a convenient way to run synchronization tools on live data,"
einfo "it doesn't copy data itself, so you need to install software to do actual"
einfo "data transfer. Usually net-misc/rsync is a good choise, but ${PN} is"
einfo "is flexible enough to use any user tool, see manual page for details."
einfo
einfo "${PN} init script can be multiplexed, to use symlink init script to"
einfo "othername and use conf.d/othername to configure it."
einfo
einfo "If you're interested in improved security, enable"
einfo "USE=\"caps cgroups extra-hardened namespaces seccomp\""

if use socket-library; then
einfo
einfo "clsync instances you are going to use _must_ be compiled"
einfo "with control-socket support"
fi
}
3 changes: 3 additions & 0 deletions app-admin/clsync/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
namespaces, seccomp, code hardening.
</longdescription>
<use>
<flag name="apidoc">Provide doxygen generated API docs.</flag>
<flag name="clsync">Build clsync binary. Most likely you want it. However it is possible to build only libclsync without clsync itself. </flag>
<flag name="cluster">Enable clustering support (allows master-master clsync on multiple hosts). Not fully implemented yet.</flag>
<flag name="control-socket">Enable AF_UNIX control socket support.</flag>
<flag name="cgroups">Use cgroups to limit /dev access.</flag>
Expand All @@ -23,6 +25,7 @@
<flag name="gio">Enable GIO for FS monitoring (glib based alternative to inotify interface, not recommended; if both are compiled, may be selected at runtime).</flag>
<flag name="highload-locks">Allows to use spinlocks for short delays instead of mutexes, but only on SMP systems.</flag>
<flag name="namespaces">Enable namespaces isolation.</flag>
<flag name="socket-library">Build the control and monitoring socket library: libclsync.</flag>
</use>
<upstream>
<remote-id type="github">clsync/clsync</remote-id>
Expand Down

0 comments on commit 12ef9b3

Please sign in to comment.