diff options
author | Richard Yao <ryao@gentoo.org> | 2013-11-21 16:21:23 +0000 |
---|---|---|
committer | Richard Yao <ryao@gentoo.org> | 2013-11-21 16:21:23 +0000 |
commit | 6d5b6f3a9c6c2ceb6ba98539577633d2c6a5d16c (patch) | |
tree | d205ff770b13b7edfdad294f3be20173568c9059 /sys-fs | |
parent | Version bump - bug #491832 (diff) | |
download | gentoo-2-6d5b6f3a9c6c2ceb6ba98539577633d2c6a5d16c.tar.gz gentoo-2-6d5b6f3a9c6c2ceb6ba98539577633d2c6a5d16c.tar.bz2 gentoo-2-6d5b6f3a9c6c2ceb6ba98539577633d2c6a5d16c.zip |
Python 3 support; Fix memory leak in libzfs; Import updated bash completion script from Ubuntu (with silent sudo functionality commented out)
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 0xBEE84C64)
Diffstat (limited to 'sys-fs')
-rw-r--r-- | sys-fs/zfs/ChangeLog | 9 | ||||
-rw-r--r-- | sys-fs/zfs/files/bash-completion-r1 | 391 | ||||
-rw-r--r-- | sys-fs/zfs/zfs-0.6.2-r3.ebuild | 152 | ||||
-rw-r--r-- | sys-fs/zfs/zfs-9999.ebuild | 21 |
4 files changed, 566 insertions, 7 deletions
diff --git a/sys-fs/zfs/ChangeLog b/sys-fs/zfs/ChangeLog index a1ead7a30ca3..92e76d999375 100644 --- a/sys-fs/zfs/ChangeLog +++ b/sys-fs/zfs/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-fs/zfs # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/ChangeLog,v 1.76 2013/10/18 16:26:04 ryao Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/ChangeLog,v 1.77 2013/11/21 16:21:23 ryao Exp $ + +*zfs-0.6.2-r3 (21 Nov 2013) + + 21 Nov 2013; Richard Yao <ryao@gentoo.org> +files/bash-completion-r1, + +zfs-0.6.2-r3.ebuild, zfs-9999.ebuild: + Python 3 support; Fix memory leak in libzfs; Import updated bash completion + script from Ubuntu (with silent sudo functionality commented out) *zfs-0.6.2-r2 (18 Oct 2013) diff --git a/sys-fs/zfs/files/bash-completion-r1 b/sys-fs/zfs/files/bash-completion-r1 new file mode 100644 index 000000000000..b1aded368e85 --- /dev/null +++ b/sys-fs/zfs/files/bash-completion-r1 @@ -0,0 +1,391 @@ +# Copyright (c) 2013, Aneurin Price <aneurin.price@gmail.com> + +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +#if [[ -w /dev/zfs ]]; then + __ZFS_CMD="zfs" + __ZPOOL_CMD="zpool" +#else +# __ZFS_CMD="sudo zfs" +# __ZPOOL_CMD="sudo zpool" +#fi + +__zfs_get_commands() +{ + $__ZFS_CMD 2>&1 | awk '/^\t[a-z]/ {print $1}' | cut -f1 -d '|' | uniq +} + +__zfs_get_properties() +{ + $__ZFS_CMD get 2>&1 | awk '$2 == "YES" || $2 == "NO" {print $1}'; echo all name space +} + +__zfs_get_editable_properties() +{ + $__ZFS_CMD get 2>&1 | awk '$2 == "YES" {print $1"="}' +} + +__zfs_get_inheritable_properties() +{ + $__ZFS_CMD get 2>&1 | awk '$3 == "YES" {print $1}' +} + +__zfs_list_datasets() +{ + $__ZFS_CMD list -H -o name -t filesystem,volume +} + +__zfs_list_filesystems() +{ + $__ZFS_CMD list -H -o name -t filesystem +} + +__zfs_match_snapshot() +{ + local base_dataset=${cur%@*} + if [[ $base_dataset != $cur ]] + then + $__ZFS_CMD list -H -o name -t snapshot -d 1 $base_dataset + else + $__ZFS_CMD list -H -o name -t filesystem,volume | awk '{print $1"@"}' + fi +} + +__zfs_match_explicit_snapshot() +{ + local base_dataset=${cur%@*} + if [[ $base_dataset != $cur ]] + then + $__ZFS_CMD list -H -o name -t snapshot -d 1 $base_dataset + fi +} + +__zfs_match_multiple_snapshots() +{ + local existing_opts=$(expr "$cur" : '\(.*\)[%,]') + if [[ $existing_opts ]] + then + local base_dataset=${cur%@*} + if [[ $base_dataset != $cur ]] + then + local cur=${cur##*,} + if [[ $cur =~ ^%|%.*% ]] + then + # correct range syntax is start%end + return 1 + fi + local range_start=$(expr "$cur" : '\(.*%\)') + $__ZFS_CMD list -H -o name -t snapshot -d 1 $base_dataset | sed 's$.*@$'$range_start'$g' + fi + else + __zfs_match_explicit_snapshot; __zfs_list_datasets + fi +} + +__zfs_list_volumes() +{ + $__ZFS_CMD list -H -o name -t volume +} + +__zfs_argument_chosen() +{ + local word property + for word in $(seq $((COMP_CWORD-1)) -1 2) + do + local prev="${COMP_WORDS[$word]}" + if [[ ${COMP_WORDS[$word-1]} != -[tos] ]] + then + if [[ "$prev" == [^,]*,* ]] || [[ "$prev" == *[@:]* ]] + then + return 0 + fi + for property in $@ + do + if [[ $prev == "$property" ]] + then + return 0 + fi + done + fi + done + return 1 +} + +__zfs_complete_ordered_arguments() +{ + local list1=$1 + local list2=$2 + local cur=$3 + local extra=$4 + if __zfs_argument_chosen $list1 + then + COMPREPLY=($(compgen -W "$list2 $extra" -- "$cur")) + else + COMPREPLY=($(compgen -W "$list1 $extra" -- "$cur")) + fi +} + +__zfs_complete_multiple_options() +{ + local options=$1 + local cur=$2 + + COMPREPLY=($(compgen -W "$options" -- "${cur##*,}")) + local existing_opts=$(expr "$cur" : '\(.*,\)') + if [[ $existing_opts ]] + then + COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" ) + fi +} + +__zfs_complete_switch() +{ + local options=$1 + if [[ ${cur:0:1} == - ]] + then + COMPREPLY=($(compgen -W "-{$options}" -- "$cur")) + return 0 + else + return 1 + fi +} + +__zfs_complete() +{ + local cur prev cmd cmds + COMPREPLY=() + # Don't split on colon + _get_comp_words_by_ref -n : -c cur -p prev -w COMP_WORDS -i COMP_CWORD + cmd="${COMP_WORDS[1]}" + + if [[ ${prev##*/} == zfs ]] + then + cmds=$(__zfs_get_commands) + COMPREPLY=($(compgen -W "$cmds -?" -- "$cur")) + return 0 + fi + + case "${cmd}" in + clone) + case "${prev}" in + -o) + COMPREPLY=($(compgen -W "$(__zfs_get_editable_properties)" -- "$cur")) + ;; + *) + if ! __zfs_complete_switch "o,p" + then + if __zfs_argument_chosen + then + COMPREPLY=($(compgen -W "$(__zfs_list_datasets)" -- "$cur")) + else + COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur")) + fi + fi + ;; + esac + ;; + get) + case "${prev}" in + -d) + COMPREPLY=($(compgen -W "" -- "$cur")) + ;; + -t) + __zfs_complete_multiple_options "filesystem volume snapshot all" "$cur" + ;; + -s) + __zfs_complete_multiple_options "local default inherited temporary none" "$cur" + ;; + -o) + __zfs_complete_multiple_options "name property value source received all" "$cur" + ;; + *) + if ! __zfs_complete_switch "H,r,p,d,o,t,s" + then + if __zfs_argument_chosen $(__zfs_get_properties) + then + COMPREPLY=($(compgen -W "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" -- "$cur")) + else + __zfs_complete_multiple_options "$(__zfs_get_properties)" "$cur" + fi + fi + ;; + esac + ;; + inherit) + if ! __zfs_complete_switch "r" + then + __zfs_complete_ordered_arguments "$(__zfs_get_inheritable_properties)" "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" $cur + fi + ;; + list) + case "${prev}" in + -d) + COMPREPLY=($(compgen -W "" -- "$cur")) + ;; + -t) + __zfs_complete_multiple_options "filesystem volume snapshot all" "$cur" + ;; + -o) + __zfs_complete_multiple_options "$(__zfs_get_properties)" "$cur" + ;; + -s|-S) + COMPREPLY=($(compgen -W "$(__zfs_get_properties)" -- "$cur")) + ;; + *) + if ! __zfs_complete_switch "H,r,d,o,t,s,S" + then + COMPREPLY=($(compgen -W "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" -- "$cur")) + fi + ;; + esac + ;; + promote) + COMPREPLY=($(compgen -W "$(__zfs_list_filesystems)" -- "$cur")) + ;; + rollback) + if ! __zfs_complete_switch "r,R,f" + then + COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur")) + fi + ;; + send) + if ! __zfs_complete_switch "d,n,P,p,R,v,i,I" + then + COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur")) + fi + ;; + snapshot) + case "${prev}" in + -o) + COMPREPLY=($(compgen -W "$(__zfs_get_editable_properties)" -- "$cur")) + ;; + *) + if ! __zfs_complete_switch "o,r" + then + COMPREPLY=($(compgen -W "$(__zfs_list_datasets | awk '{print $1"@"}')" -- "$cur")) + fi + ;; + esac + ;; + set) + __zfs_complete_ordered_arguments "$(__zfs_get_editable_properties)" "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" $cur + ;; + upgrade) + case "${prev}" in + -a|-V|-v) + COMPREPLY=($(compgen -W "" -- "$cur")) + ;; + *) + if ! __zfs_complete_switch "a,V,v,r" + then + COMPREPLY=($(compgen -W "$(__zfs_list_filesystems)" -- "$cur")) + fi + ;; + esac + ;; + destroy) + if ! __zfs_complete_switch "d,f,n,p,R,r,v" + then + __zfs_complete_multiple_options "$(__zfs_match_multiple_snapshots)" $cur + fi + ;; + *) + COMPREPLY=($(compgen -W "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" -- "$cur")) + ;; + esac + __ltrim_colon_completions "$cur" + return 0 +} + +__zpool_get_commands() +{ + $__ZPOOL_CMD 2>&1 | awk '/^\t[a-z]/ {print $1}' | uniq +} + +__zpool_get_properties() +{ + $__ZPOOL_CMD get 2>&1 | awk '$2 == "YES" || $2 == "NO" {print $1}'; echo all +} + +__zpool_get_editable_properties() +{ + $__ZPOOL_CMD get 2>&1 | awk '$2 == "YES" {print $1"="}' +} + +__zpool_list_pools() +{ + $__ZPOOL_CMD list -H -o name +} + +__zpool_complete() +{ + local cur prev cmd cmds + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + cmd="${COMP_WORDS[1]}" + + if [[ ${prev##*/} == zpool ]] + then + cmds=$(__zpool_get_commands) + COMPREPLY=($(compgen -W "$cmds" -- "$cur")) + return 0 + fi + + case "${cmd}" in + get) + __zfs_complete_ordered_arguments "$(__zpool_get_properties)" "$(__zpool_list_pools)" $cur + return 0 + ;; + import) + if [[ $prev == -d ]] + then + _filedir -d + else + COMPREPLY=($(compgen -W "$(__zpool_list_pools) -d" -- "$cur")) + fi + return 0 + ;; + set) + __zfs_complete_ordered_arguments "$(__zpool_get_editable_properties)" "$(__zpool_list_pools)" $cur + return 0 + ;; + add|attach|clear|create|detach|offline|online|remove|replace) + local pools="$(__zpool_list_pools)" + if __zfs_argument_chosen $pools + then + _filedir + else + COMPREPLY=($(compgen -W "$pools" -- "$cur")) + fi + return 0 + ;; + *) + COMPREPLY=($(compgen -W "$(__zpool_list_pools)" -- "$cur")) + return 0 + ;; + esac + +} + +complete -F __zfs_complete zfs +complete -F __zpool_complete zpool diff --git a/sys-fs/zfs/zfs-0.6.2-r3.ebuild b/sys-fs/zfs/zfs-0.6.2-r3.ebuild new file mode 100644 index 000000000000..7ab914bedff3 --- /dev/null +++ b/sys-fs/zfs/zfs-0.6.2-r3.ebuild @@ -0,0 +1,152 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-0.6.2-r3.ebuild,v 1.1 2013/11/21 16:21:23 ryao Exp $ + +EAPI="5" +PYTHON_COMPAT=( python{2_6,2_7,3_1,3_2,3_3} ) + +inherit python-r1 + +AT_M4DIR="config" +AUTOTOOLS_AUTORECONF="1" +AUTOTOOLS_IN_SOURCE_BUILD="1" + +if [ ${PV} == "9999" ] ; then + inherit git-2 linux-mod + EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git" +else + inherit eutils versionator + MY_PV=$(replace_version_separator 3 '-') + SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz + http://dev.gentoo.org/~ryao/dist/${PN}-kmod-${MY_PV}-p2.tar.xz" + S="${WORKDIR}/${PN}-${PN}-${MY_PV}" + KEYWORDS="~amd64" +fi + +inherit bash-completion-r1 flag-o-matic toolchain-funcs autotools-utils udev systemd + +DESCRIPTION="Userland utilities for ZFS Linux kernel module" +HOMEPAGE="http://zfsonlinux.org/" + +LICENSE="BSD-2 CDDL bash-completion? ( MIT )" +SLOT="0" +IUSE="bash-completion custom-cflags kernel-builtin +rootfs selinux test-suite static-libs" +RESTRICT="test" + +COMMON_DEPEND=" + selinux? ( sys-libs/libselinux ) + sys-apps/util-linux[static-libs?] + sys-libs/zlib[static-libs(+)?] + virtual/awk +" +DEPEND="${COMMON_DEPEND} + virtual/pkgconfig +" + +RDEPEND="${COMMON_DEPEND} + !=sys-apps/grep-2.13* + !kernel-builtin? ( =sys-fs/zfs-kmod-${PV}* ) + !sys-fs/zfs-fuse + !prefix? ( virtual/udev ) + test-suite? ( + sys-apps/util-linux + sys-devel/bc + sys-block/parted + sys-fs/lsscsi + sys-fs/mdadm + sys-process/procps + virtual/modutils + ) + rootfs? ( + app-arch/cpio + app-misc/pax-utils + !<sys-boot/grub-2.00-r2:2 + ) +" + +pkg_setup() { + : +} + +src_prepare() { + if [ ${PV} != "9999" ] + then + # Apply patch set + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + epatch "${WORKDIR}/${PN}-kmod-${MY_PV}-patches" + fi + + # Update paths + sed -e "s|/sbin/lsmod|/bin/lsmod|" \ + -e "s|/usr/bin/scsi-rescan|/usr/sbin/rescan-scsi-bus|" \ + -e "s|/sbin/parted|/usr/sbin/parted|" \ + -i scripts/common.sh.in + + autotools-utils_src_prepare +} + +src_configure() { + use custom-cflags || strip-flags + local myeconfargs=( + --bindir="${EPREFIX}/bin" + --sbindir="${EPREFIX}/sbin" + --with-config=user + --with-linux="${KV_DIR}" + --with-linux-obj="${KV_OUT_DIR}" + --with-udevdir="$(udev_get_udevdir)" + --with-blkid + $(use_with selinux) + ) + autotools-utils_src_configure + + # prepare systemd unit and helper script + cat "${FILESDIR}/zfs.service.in" | \ + sed -e "s:@sbindir@:${EPREFIX}/sbin:g" \ + -e "s:@sysconfdir@:${EPREFIX}/etc:g" \ + > "${T}/zfs.service" || die + cat "${FILESDIR}/zfs-init.sh.in" | \ + sed -e "s:@sbindir@:${EPREFIX}/sbin:g" \ + -e "s:@sysconfdir@:${EPREFIX}/etc:g" \ + > "${T}/zfs-init.sh" || die +} + +src_install() { + autotools-utils_src_install + gen_usr_ldscript -a uutil nvpair zpool zfs + rm -rf "${ED}usr/lib/dracut" + use test-suite || rm -rf "${ED}usr/share/zfs" + + use bash-completion && newbashcomp "${FILESDIR}/bash-completion-r1" zfs + + exeinto /usr/libexec + doexe "${T}/zfs-init.sh" + systemd_dounit "${T}/zfs.service" +} + +pkg_postinst() { + + if ! use kernel-builtin && [ ${PV} = "9999" ] + then + einfo "Adding ${P} to the module database to ensure that the" + einfo "kernel modules and userland utilities stay in sync." + update_moduledb + fi + + [ -e "${EROOT}/etc/runlevels/boot/zfs" ] \ + || ewarn 'You should add zfs to the boot runlevel.' + + if [ -e "${EROOT}/etc/runlevels/shutdown/zfs-shutdown" ] + then + einfo "The zfs-shutdown script is obsolete. Removing it from runlevel." + rm "${EROOT}/etc/runlevels/shutdown/zfs-shutdown" + fi + +} + +pkg_postrm() { + if ! use kernel-builtin && [ ${PV} = "9999" ] + then + remove_moduledb + fi +} diff --git a/sys-fs/zfs/zfs-9999.ebuild b/sys-fs/zfs/zfs-9999.ebuild index 388cff5586e4..8f01f1e119eb 100644 --- a/sys-fs/zfs/zfs-9999.ebuild +++ b/sys-fs/zfs/zfs-9999.ebuild @@ -1,11 +1,11 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-9999.ebuild,v 1.49 2013/10/11 23:17:02 ryao Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-9999.ebuild,v 1.50 2013/11/21 16:21:23 ryao Exp $ EAPI="5" -PYTHON_COMPAT=( python{2_6,2_7} ) +PYTHON_COMPAT=( python{2_6,2_7,3_1,3_2,3_3} ) -inherit python-single-r1 +inherit python-r1 AT_M4DIR="config" AUTOTOOLS_AUTORECONF="1" @@ -17,7 +17,8 @@ if [ ${PV} == "9999" ] ; then else inherit eutils versionator MY_PV=$(replace_version_separator 3 '-') - SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz" + SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz + http://dev.gentoo.org/~ryao/dist/${PN}-kmod-${MY_PV}-p2.tar.xz" S="${WORKDIR}/${PN}-${PN}-${MY_PV}" KEYWORDS="~amd64" fi @@ -27,7 +28,7 @@ inherit bash-completion-r1 flag-o-matic toolchain-funcs autotools-utils udev sys DESCRIPTION="Userland utilities for ZFS Linux kernel module" HOMEPAGE="http://zfsonlinux.org/" -LICENSE="BSD-2 CDDL MIT" +LICENSE="BSD-2 CDDL bash-completion? ( MIT )" SLOT="0" IUSE="bash-completion custom-cflags kernel-builtin +rootfs selinux test-suite static-libs" RESTRICT="test" @@ -68,6 +69,14 @@ pkg_setup() { } src_prepare() { + if [ ${PV} != "9999" ] + then + # Apply patch set + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + epatch "${WORKDIR}/${PN}-kmod-${MY_PV}-patches" + fi + # Update paths sed -e "s|/sbin/lsmod|/bin/lsmod|" \ -e "s|/usr/bin/scsi-rescan|/usr/sbin/rescan-scsi-bus|" \ @@ -108,7 +117,7 @@ src_install() { rm -rf "${ED}usr/lib/dracut" use test-suite || rm -rf "${ED}usr/share/zfs" - use bash-completion && newbashcomp "${FILESDIR}/bash-completion" zfs + use bash-completion && newbashcomp "${FILESDIR}/bash-completion-r1" zfs exeinto /usr/libexec doexe "${T}/zfs-init.sh" |