Add Gentoo support to nodepool

This commit adds Gentoo support to elements needed to build a Gentoo
nodepool image.  The previous version of this commit had the default
section of the pkg-map in the wrong area, specifically in the following
file.

nodepool/elements/infra-package-needs/pkg-map

Change-Id: Ic686c325bc06564585a2e3ac50cadd7556612333
This commit is contained in:
Matthew Thode 2016-04-28 12:06:09 -05:00
parent 6acc7bc4cc
commit 9231f9b57d
No known key found for this signature in database
GPG Key ID: 64A37BEAAE19A4E8
8 changed files with 55 additions and 1 deletions

View File

@ -46,6 +46,10 @@ until $BINDEP -b -f $PACKAGES test; do
sudo PATH=/usr/sbin:/sbin:$PATH DEBIAN_FRONTEND=noninteractive \
apt-get -q --option "Dpkg::Options::=--force-confold" \
--assume-yes install `$BINDEP -b -f $PACKAGES test`
elif emerge --version >/dev/null 2>&1 ; then
sudo emerge -uDNq --jobs=4 @world
sudo PATH=/usr/sbin:/sbin:$PATH emerge -q --jobs=4 \
`$BINDEP -b -f $PACKAGES`
else
sudo PATH=/usr/sbin:/sbin:$PATH $YUM install -y \
`$BINDEP -b -f $PACKAGES test`

View File

@ -51,6 +51,17 @@ PACKAGELIST=`echo "$PACKAGES" | /usr/bindep-env/bin/bindep -b -f - || true`
if [ -f /usr/bin/apt-get ] ; then
# --ignore-missing conflicts with set -e, so force it to be ok
apt-get -y --ignore-missing -d install $PACKAGELIST || true
elif [ -f /usr/bin/emerge ] ; then
# write out use config (won't install/fetch without it)
# This lays down install / compile time options needed for bindep to
# install / fetch the needed packages.
USE_FILE=/etc/portage/package.use/bindep.use
cat > $USE_FILE <<EOF
x11-libs/cairo X
x11-libs/gdk-pixbuf X
media-libs/gd truetype png fontconfig jpeg
EOF
emerge -q --fetchonly $PACKAGELIST || true
else
${YUM:-yum} install -y --downloadonly $PACKAGELIST
fi

View File

@ -161,6 +161,16 @@ def local_prep(distribution):
tokenize(fn, rpms, distribution, comment='#')
branch_data['rpms'] = rpms
if os.path.exists(os.path.join(TMP_MOUNT_PATH, 'usr/bin/emerge')):
ebuilds = []
ebuilddir = os.path.join(DEVSTACK, 'files', 'ebuilds')
if not os.path.exists(ebuilddir):
ebuilddir = os.path.join(DEVSTACK, 'files', 'ebuilds')
for fn in os.listdir(ebuilddir):
fn = os.path.join(ebuilddir, fn)
tokenize(fn, ebuilds, distribution, comment='#')
branch_data['ebuilds'] = ebuilds
images = _find_images(DEVSTACK)
if not images:
images = _legacy_find_images(DEVSTACK)
@ -180,6 +190,8 @@ def main():
pkgs.write(" ".join(branch_data['debs']) + "\n")
elif branch_data.get('rpms'):
pkgs.write(" ".join(branch_data['rpms']) + "\n")
elif branch_data.get('ebuilds'):
pkgs.write(" ".join(branch_data['ebuilds']) + "\n")
else:
sys.exit('No supported package data found.')

View File

@ -8,3 +8,4 @@ python3-dev:
uuid-runtime:
traceroute:
ntpdate:
gentoolkit:

View File

@ -2,6 +2,15 @@
"distro": {
"fedora": {
"python3-dev": "python3-devel"
},
"gentoo": {
"build-essential": "",
"cron": "sys-process/cronie",
"python-dev": "",
"python3-dev": "",
"openssh-server": "openssh",
"traceroute": "net-analyzer/traceroute",
"uuid-runtime": ""
}
},
"family": {
@ -12,5 +21,8 @@
"python3-dev": "",
"uuid-runtime": ""
}
},
"default": {
"gentoolkit": ""
}
}

View File

@ -31,8 +31,13 @@ if [ -f /etc/default/grub ] ; then
if which update-grub &> /dev/null ; then
update-grub
else
if [[ $DISTRO_NAME == gentoo ]]; then
GRUB_CFG=/boot/grub/grub.cfg
else
GRUB_CFG=/boot/grub2/grub.cfg
fi
# If update-grub isn't available, use grub2-mkconfig directly
/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
/usr/sbin/grub2-mkconfig -o "${GRUB_CFG}"
fi
elif [ -f /boot/grub/grub.conf ] ; then
sed -i -e 's/^timeout=[0-9]\+/timeout=0/' /boot/grub/grub.conf

View File

@ -39,6 +39,12 @@ case $OS_FAMILY in
# time updating.
update=""
;;
"Gentoo")
# make a fake repo to satisfy the removal below
touch /tmp/fakerepo
repo=/tmp/fakerepo
update=""
;;
*)
die "Don't know how to cleanup!"
;;

View File

@ -2,6 +2,9 @@
"family": {
"debian": {
"libselinux-python": ""
},
"gentoo": {
"libselinux-python": "sys-libs/libselinux"
}
}
}