Skip to content

Commit

Permalink
Updated eselect to support pure64 profile. Quick testing mask
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Harris committed Jun 24, 2013
1 parent feb1d28 commit 7861104
Show file tree
Hide file tree
Showing 5 changed files with 1,583 additions and 0 deletions.
1 change: 1 addition & 0 deletions app-admin/eselect/Manifest
@@ -1 +1,2 @@
DIST eselect-1.3.3.tar.xz 164872 SHA256 09132a0e7512da5c0e5907d04736445101c83b0dd0e6283374ebbc9d76bf6b74 SHA512 480c9c0cd844471b84b2e44440b23ab7538cb6ecb953648ea63057d65ac0f475f057294313f00d3c8cf4b1f1b4effb960cafdd636421302100b8ad7b82213114 WHIRLPOOL c91c91d5e52a9eeba0e8ef86a741838ce3dec2f5b0f0911ada3de3d51a5eba7b9addd9a4e4696171fa4ff3c71f7db494cd8f356d0d7b5daf943b0c24129ac2ea
DIST eselect-1.3.5.tar.xz 165780 SHA256 aa27fa55863630f81c74486cdca4d3b206d8d8ee71fe3d57fb5c5c5d0117ab9a SHA512 f95400b638ca1a11d7779a80dd742e5b02c68f090beff68090e323d970a18bb35b197bf3c79aea6d12b7c31654b77d57bb01c8d728eff12702ab9854ced0d29d WHIRLPOOL ff45c5dcc061a112f536f271b8b547af1d593f79899c28d6843cb979ecc19a9948ea8123dd64198af0215bfa8f1f2cb0c9a6cf4a627d19f40e2d74f9360026a0
67 changes: 67 additions & 0 deletions app-admin/eselect/eselect-1.3.5.ebuild
@@ -0,0 +1,67 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect/eselect-1.3.5.ebuild,v 1.1 2013/06/22 16:20:11 ulm Exp $

EAPI=4

inherit eutils bash-completion-r1

DESCRIPTION="Gentoo's multi-purpose configuration and management tool"
HOMEPAGE="http://www.gentoo.org/proj/en/eselect/"
SRC_URI="mirror://gentoo/${P}.tar.xz"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="doc"

RDEPEND="sys-apps/sed
|| (
sys-apps/coreutils
sys-freebsd/freebsd-bin
app-misc/realpath
)"
DEPEND="${RDEPEND}
app-arch/xz-utils
doc? ( dev-python/docutils )"
RDEPEND="!app-admin/eselect-news
${RDEPEND}
sys-apps/file
sys-libs/ncurses"

# Commented out: only few users of eselect will edit its source
#PDEPEND="emacs? ( app-emacs/gentoo-syntax )
# vim-syntax? ( app-vim/eselect-syntax )"

src_compile() {
emake
use doc && emake html
}

src_install() {
emake DESTDIR="${D}" install
newbashcomp misc/${PN}.bashcomp ${PN}
dodoc AUTHORS ChangeLog NEWS README TODO doc/*.txt
use doc && dohtml *.html doc/*

# needed by news module
keepdir /var/lib/gentoo/news
if ! use prefix; then
fowners root:portage /var/lib/gentoo/news
fperms g+w /var/lib/gentoo/news
fi

# tweaks for funtoo-1.0 profile
insinto /usr/share/eselect/modules
doins $FILESDIR/$PVR/profile.eselect || die
doins $FILESDIR/$PVR/kernel.eselect || die
}

pkg_postinst() {
# fowners in src_install doesn't work for the portage group:
# merging changes the group back to root
if ! use prefix; then
chgrp portage "${EROOT}/var/lib/gentoo/news" \
&& chmod g+w "${EROOT}/var/lib/gentoo/news"
fi
}
127 changes: 127 additions & 0 deletions app-admin/eselect/files/1.3.5/kernel.eselect
@@ -0,0 +1,127 @@
# -*-eselect-*- vim: ft=eselect
# Copyright 2005-2012 Gentoo Foundation
# Distributed under the terms of the GNU GPL version 2 or later
# $Id: $

# This version was modified by Funtoo to support all kernel sources in /usr/src

DESCRIPTION="Manage the /usr/src/linux symlink"
MAINTAINER="rh1@funtoo.org"
VERSION="funtoo-1.1_beta"

# sort function for kernel versions, to be used in a pipe
sort_kernel_versions() {
local vsort="sort --version-sort"
# Test if our sort supports the --version-sort option
# (should be GNU sort, since the kernel module is GNU/Linux specific)
${vsort} </dev/null &>/dev/null || vsort=sort

# We sort kernel versions as follows:
# 1. Run sed to prepend the version string by the numeric version
# and an additional rank indicator that is 0 for release candidates
# or 1 otherwise. After this step we have, for example:
# 2.6.29 1 linux-2.6.29
# 2.6.29 0 linux-2.6.29-rc8
# 2. sort --version-sort
# 3. Run sed again to remove the prepended keys from step 1.
sed -e 's/^\(linux-.*\)\?\([[:digit:].]\+\)[-_]rc/\2 0 &/' \
-e 't;s/^\(linux-.*\)\?\([[:digit:].]\+\)/\2 1 &/' \
| LC_ALL=C ${vsort} | sed 's/.* //'
}

# find a list of kernel symlink targets
find_targets() {
local f
for f in "${EROOT}"/usr/src/linux-[[:graph:]]*; do
[[ -d ${f} ]] && basename "${f}"
done | sort_kernel_versions
}

# remove the kernel symlink
remove_symlink() {
rm "${EROOT}/usr/src/linux"
}

# set the kernel symlink
set_symlink() {
local target=$1

if is_number "${target}"; then
local targets=( $(find_targets) )
target=${targets[target-1]}
fi

if [[ -z ${target} ]]; then
die -q "Target \"$1\" doesn't appear to be valid!"
elif [[ -d ${EROOT}/usr/src/${target} ]]; then
ln -s "${target}" "${EROOT}/usr/src/linux"
elif [[ -d ${EROOT}/usr/src/linux-${target} ]]; then
ln -s "linux-${target}" "${EROOT}/usr/src/linux"
else
die -q "Target \"$1\" doesn't appear to be valid!"
fi
}

### show action ###

describe_show() {
echo "Show the current kernel symlink"
}

do_show() {
write_list_start "Current kernel symlink:"
if [[ -L ${EROOT}/usr/src/linux ]]; then
local kernel=$(canonicalise "${EROOT}/usr/src/linux")
write_kv_list_entry "${kernel%/}" ""
else
write_kv_list_entry "(unset)" ""
fi
}

### list action ###

describe_list() {
echo "List available kernel symlink targets"
}

do_list() {
local i targets=( $(find_targets) )

write_list_start "Available kernel symlink targets:"
for (( i = 0; i < ${#targets[@]}; i++ )); do
[[ ${targets[i]} = \
$(basename "$(canonicalise "${EROOT}/usr/src/linux")") ]] \
&& targets[i]=$(highlight_marker "${targets[i]}")
done
write_numbered_list -m "(none found)" "${targets[@]}"
}

### set action ###

describe_set() {
echo "Set a new kernel symlink target"
}

describe_set_parameters() {
echo "<target>"
}

describe_set_options() {
echo "target : Target name or number (from 'list' action)"
}

do_set() {
[[ -z $1 ]] && die -q "You didn't tell me what to set the symlink to"
[[ $# -gt 1 ]] && die -q "Too many parameters"

if [[ -L ${EROOT}/usr/src/linux ]]; then
# existing symlink
remove_symlink || die -q "Couldn't remove existing symlink"
set_symlink "$1" || die -q "Couldn't set a new symlink"
elif [[ -e ${EROOT}/usr/src/linux ]]; then
# we have something strange
die -q "${EROOT}/usr/src/linux exists but is not a symlink"
else
set_symlink "$1" || die -q "Couldn't set a new symlink"
fi
}

0 comments on commit 7861104

Please sign in to comment.