commit:     e97c09256d7ce5f699b333a3642d87c5c324130d
Author:     Justin Lecher <jlec <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 18 07:37:41 2014 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Tue Nov 18 07:37:41 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/betagarden.git;a=commit;h=e97c0925

app-emulation/lxc: Import tree changes

Package-Manager: portage-2.2.14

---
 app-emulation/lxc/ChangeLog                        |  5 +++
 .../lxc/files/lxc-9999-bash-completion.patch       | 39 +++++++++++++++++++
 .../lxc/files/{lxc.initd.2 => lxc.initd.3}         | 45 ++++++++++++----------
 app-emulation/lxc/lxc-9999.ebuild                  | 26 +++++++------
 app-emulation/lxc/metadata.xml                     |  7 ----
 5 files changed, 84 insertions(+), 38 deletions(-)

diff --git a/app-emulation/lxc/ChangeLog b/app-emulation/lxc/ChangeLog
index e6e8494..2fd2940 100644
--- a/app-emulation/lxc/ChangeLog
+++ b/app-emulation/lxc/ChangeLog
@@ -2,6 +2,11 @@
 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+  18 Nov 2014; Justin Lecher <[email protected]> lxc-9999.ebuild,
+  +files/lxc-9999-bash-completion.patch, -files/lxc.initd.2,
+  +files/lxc.initd.3, metadata.xml:
+  Import tree changes
+
   08 Jun 2014; Justin Lecher <[email protected]> lxc-9999.ebuild,
   +files/lxc.initd.2, +files/lxc_at.service, metadata.xml:
   Drop installation of non existing TODO file; import tree changes

diff --git a/app-emulation/lxc/files/lxc-9999-bash-completion.patch 
b/app-emulation/lxc/files/lxc-9999-bash-completion.patch
new file mode 100644
index 0000000..942c12f
--- /dev/null
+++ b/app-emulation/lxc/files/lxc-9999-bash-completion.patch
@@ -0,0 +1,39 @@
+ config/bash/Makefile.am | 8 ++++----
+ config/bash/lxc.in      | 2 --
+ 2 files changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/config/bash/Makefile.am b/config/bash/Makefile.am
+index b1768c9..3fbbe8e 100644
+--- a/config/bash/Makefile.am
++++ b/config/bash/Makefile.am
+@@ -2,12 +2,12 @@ EXTRA_DIST = lxc
+ 
+ if ENABLE_BASH
+ install-bash:
+-      $(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
+-      $(INSTALL_DATA) lxc $(DESTDIR)$(sysconfdir)/bash_completion.d/
++      $(MKDIR_P) $(DESTDIR)$(datarootdir)/bash-completion/completions/
++      $(INSTALL_DATA) lxc 
$(DESTDIR)$(datarootdir)/bash-completion/completions/
+ 
+ uninstall-bash:
+-      rm -f $(DESTDIR)$(sysconfdir)/bash_completion.d/lxc
+-      rmdir $(DESTDIR)$(sysconfdir)/bash_completion.d/ || :
++      rm -f $(DESTDIR)$(datarootdir)/bash-completion/completions/lxc
++      rmdir $(DESTDIR)$(datarootdir)/bash-completion/ || :
+ 
+ install-data-local: install-bash
+ uninstall-local: uninstall-bash
+diff --git a/config/bash/lxc.in b/config/bash/lxc.in
+index 18fd48f..8fff725 100644
+--- a/config/bash/lxc.in
++++ b/config/bash/lxc.in
+@@ -1,4 +1,3 @@
+-have lxc-start && {
+     _lxc_names() {
+         COMPREPLY=( $( compgen -W "$( lxc-ls )" "$cur" ) )
+     }
+@@ -100,4 +99,3 @@ have lxc-start && {
+ 
+     complete -o default -F _lxc-generic-o lxc-clone
+     complete -o default -F _lxc-generic-o lxc-start-ephemeral
+-}

diff --git a/app-emulation/lxc/files/lxc.initd.2 
b/app-emulation/lxc/files/lxc.initd.3
similarity index 78%
rename from app-emulation/lxc/files/lxc.initd.2
rename to app-emulation/lxc/files/lxc.initd.3
index 554019a..b2a1ee2 100644
--- a/app-emulation/lxc/files/lxc.initd.2
+++ b/app-emulation/lxc/files/lxc.initd.3
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.6 
2012/11/14 02:15:10 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.3,v 1.1 
2014/10/18 17:00:37 hwoarang Exp $
 
 CONTAINER=${SVCNAME#*.}
 
@@ -24,6 +24,16 @@ lxc_get_var() {
        awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' 
${CONFIGFILE}
 }
 
+lxc_get_net_link_type() {
+       awk 'BEGIN { FS="[ \t]*=[ \t]*"; _link=""; _type="" }
+               $1 == "lxc.network.type" {_type=$2;}
+               $1 == "lxc.network.link" {_link=$2;}
+               {if(_link != "" && _type != ""){
+                       printf("%s:%s\n", _link, _type );
+                       _link=""; _type="";
+               }; }' <${CONFIGFILE}
+}
+
 checkconfig() {
        if [ ${CONTAINER} = ${SVCNAME} ]; then
                eerror "You have to create an init script for each container:"
@@ -50,24 +60,19 @@ depend() {
        config ${CONFIGFILE}
        need localmount
 
-       # find out which network interface the container is linked to,
-       # and then require that to be enabled, so that the
-       # dependencies are correct.
-       netif=$(lxc_get_var lxc.network.link)
-
-       # when the network type is set to phys, we can make use of a
-       # network service (for instance to set it up before we disable
-       # the net_admin capability), but we might also not set it up
-       # at all on the host and leave the net_admin capable service
-       # to take care of it.
-       nettype=$(lxc_get_var lxc.network.type)
-
-       if [ -n "${netif}" ]; then
-           case "${nettype}" in
-               phys)   use net.${netif} ;;
-               *)      need net.${netif} ;;
-           esac
-       fi
+       local _x _if
+       for _x in $(lxc_get_net_link_type); do
+               _if=${_x%:*}
+               case "${_x##*:}" in
+                       # when the network type is set to phys, we can make use 
of a
+                       # network service (for instance to set it up before we 
disable
+                       # the net_admin capability), but we might also not set 
it up
+                       # at all on the host and leave the net_admin capable 
service
+                       # to take care of it.
+                       phys)   use net.${_if} ;;
+                       *)      need net.${_if} ;;
+               esac
+       done
 }
 
 start() {
@@ -106,7 +111,7 @@ stop() {
 
        init_pid=$(lxc-info -n ${CONTAINER} --pid | awk '{ print $2 }')
 
-       if [ "${init_pid}" = "-1" ]; then
+       if [ -z "${init_pid}" ]; then
            ewarn "${CONTAINER} doesn't seem to be running."
            return 0
        fi

diff --git a/app-emulation/lxc/lxc-9999.ebuild 
b/app-emulation/lxc/lxc-9999.ebuild
index 5adf1b5..a4d29d4 100644
--- a/app-emulation/lxc/lxc-9999.ebuild
+++ b/app-emulation/lxc/lxc-9999.ebuild
@@ -6,8 +6,9 @@ EAPI=5
 
 MY_P="${P/_/-}"
 PYTHON_COMPAT=( python{3_2,3_3,3_4} )
+DISTUTILS_OPTIONAL=1
 
-inherit autotools distutils-r1 eutils git-r3 linux-info versionator 
flag-o-matic systemd
+inherit autotools bash-completion-r1 distutils-r1 eutils git-r3 linux-info 
versionator flag-o-matic systemd
 
 DESCRIPTION="LinuX Containers userspace utilities"
 HOMEPAGE="http://lxc.sourceforge.net/";
@@ -78,7 +79,7 @@ ERROR_GRKERNSEC_CHROOT_PIVOT=":CONFIG_GRKERNSEC_CHROOT_PIVOT  
some GRSEC features
 ERROR_GRKERNSEC_CHROOT_CHMOD=":CONFIG_GRKERNSEC_CHROOT_CHMOD   some GRSEC 
features make LXC unusable see postinst notes"
 ERROR_GRKERNSEC_CHROOT_CAPS=":CONFIG_GRKERNSEC_CHROOT_CAPS     some GRSEC 
features make LXC unusable see postinst notes"
 
-DOCS=( AUTHORS CONTRIBUTING MAINTAINERS README doc/FAQ.txt )
+DOCS=( AUTHORS CONTRIBUTING MAINTAINERS NEWS README doc/FAQ.txt )
 
 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
 
@@ -87,11 +88,8 @@ src_prepare() {
        if [[ -n ${BACKPORTS} ]]; then
                epatch "${WORKDIR}"/patches/*
        fi
-       if use python; then
-               python_setup
-               # We will handle python on our own
-               echo > "${S}/src/python-${PN}/Makefile.am";
-       fi
+
+       epatch "${FILESDIR}"/${P}-bash-completion.patch
 
        eautoreconf
 }
@@ -109,7 +107,7 @@ src_configure() {
                --disable-apparmor \
                $(use_enable examples) \
                $(use_enable lua) \
-               $(use_enable python)
+               --disable-python
 }
 
 python_compile() {
@@ -129,6 +127,10 @@ src_compile() {
 src_install() {
        default
 
+       mv "${ED}"/usr/share/bash-completion/completions/${PN} 
"${ED}"/$(get_bashcompdir)/${PN}-start || die
+       bashcomp_alias ${PN}-start \
+               
${PN}-{attach,cgroup,clone,console,create,destroy,device,execute,freeze,info,monitor,snapshot,start-ephemeral,stop,unfreeze,wait}
+
        if use python; then
                pushd "${S}/src/python-lxc" > /dev/null
                # Unset DOCS. This has been handled by the default target
@@ -139,16 +141,18 @@ src_install() {
 
        keepdir /etc/lxc /usr/lib/lxc/rootfs /var/log/lxc
 
-       find "${D}" -name '*.la' -delete
+       prune_libtool_files
 
        # Gentoo-specific additions!
-       newinitd "${FILESDIR}/${PN}.initd.2" ${PN}
+       # Use initd.3 per #517144
+       newinitd "${FILESDIR}/${PN}.initd.3" ${PN}
+
        # lxc-devsetup script
        exeinto /usr/libexec/${PN}
        doexe config/init/systemd/${PN}-devsetup
        # Use that script with the systemd service (Similar to upstream
        # Makefile.am
-       cp "${FILESDIR}"/${PN}_at.service ${PN}_at.service
+       cp "${FILESDIR}"/${PN}_at.service ${PN}_at.service || die
        sed -i \
                "/Restart=always/a 
ExecStartPre=/usr/libexec/${PN}/${PN}-devsetup" \
                ${PN}_at.service \

diff --git a/app-emulation/lxc/metadata.xml b/app-emulation/lxc/metadata.xml
index 7b3a2fe..d5cc2b7 100644
--- a/app-emulation/lxc/metadata.xml
+++ b/app-emulation/lxc/metadata.xml
@@ -6,12 +6,5 @@
   </maintainer>
   <use>
     <flag name="seccomp">Use seccomp syscall filters using 
<pkg>sys-libs/libseccomp</pkg></flag>
-    <flag name="vanilla">
-      Avoid adding Gentoo Linux-specific modifications, which include
-      the custom init script. This is present as a flag to avoid
-      forcing dependencies over users that might not want have them
-      around as they use LXC in contexts where the init script is not
-      useful.
-    </flag>
   </use>
 </pkgmetadata>

Reply via email to