Skip to content

Commit

Permalink
Merge pull request #1 from AlmirKadric/master
Browse files Browse the repository at this point in the history
Initial implementation work for centos6
  • Loading branch information
MiLk committed Jan 6, 2016
2 parents 62cf1d5 + 7b64d6e commit cc28c01
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 1 deletion.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Wizcorp

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.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
# ansible-devtoolset2
devtoolset2
===========

This role allows a user to install packages available inside the slc6-devtoolset2 repository.
This may include packages such as GCC 4.8 and other related toolchain tools.

Configuration
--------------

* `devtoolset_2_packages`: List of devtoolset2 packages to install.

See also
---------

* [devtoolset @ CERN](http://linux.web.cern.ch/linux/devtoolset/)
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
devtoolset_2_packages: []
30 changes: 30 additions & 0 deletions files/centos6/sudo
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#! /bin/sh

# Reset in case getopts has been used previously in the shell
OPTIND=1

# Parse & pass-through sudo options from $@
sudo_options="-E"
while getopts ":AbC:Eg:hHi:l:k:Knp:Pr:Ss:t:u:U:vV" OPT; do
if [ "$OPT" == "?" ]; then
OPTIND=$((OPTIND+1))
break
elif [ "$OPT" == ":" ]; then
sudo_options="$sudo_options -$OPTARG"
elif [ -n "$OPTARG" ]; then
sudo_options="$sudo_options -$OPT \"$OPTARG\""
else
sudo_options="$sudo_options -$OPT"
fi
done

# Remove all parsed options from argument list
shift $((OPTIND-1))
cmd_options="$@"

# Execute sudo command persisting devtoolset
if [ -z "$cmd_options" ]; then
eval "/usr/bin/sudo $sudo_options"
else
eval "/usr/bin/sudo $sudo_options LD_LIBRARY_PATH=$(/usr/bin/sudo printenv LD_LIBRARY_PATH):$LD_LIBRARY_PATH PATH=$(/usr/bin/sudo printenv PATH):$PATH scl enable devtoolset-2 \"$cmd_options\""
fi
19 changes: 19 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
galaxy_info:
author: Almir Kadric <[email protected]>
description: Installs devtoolset2 gcc toolchain on a server
company: Wizcorp K.K.
license: MIT
min_ansible_version: 1.8.1
platforms:
- name: EL
versions:
- 6
categories:
- development
- web
dependencies:
- role: aeriscloud.repos
repositories:
centos6:
- slc6-devtoolset
- role: aeriscloud.yum
40 changes: 40 additions & 0 deletions tasks/centos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
- name: "Ensure devtoolset2 packages are installed"
yum: >
name="{{ devtoolset_2_packages|join(',') }}"
state=present
enablerepo=slc6-devtoolset
when: devtoolset_2_packages|length > 0
tags:
- devtoolset2
- pkgs

# Since the devtoolset tries to persist through sudo when compiling, they made a sudo wrapper. However
# this wrapper was severely broken. We patched this up and got it to work under most cases, however
# until this is merged into the devtoolset package we will have to manually patch it here.
# References:
# - https://access.redhat.com/documentation/en-US/Red_Hat_Developer_Toolset/2/html-single/2.1_Release_Notes/index.html
# "This script does not currently parse or pass normal sudo options, only sudo COMMAND ARGS ...."
#
# - https://bugzilla.redhat.com/show_bug.cgi?id=849452
#
# - https://bugzilla.redhat.com/attachment.cgi?id=632150
# "TODO: parse & pass-through sudo options from $@"
- name: "Patch devtoolset2 sudo script"
copy: >
src="{{centos_distribution}}/sudo"
dest="/opt/rh/devtoolset-2/root/usr/bin/sudo"
owner=root
group=root
mode=0555
tags:
- devtoolset2
- pkgs

- name: "Enable devtoolset2 packages"
file: >
src=/opt/rh/devtoolset-2/enable
dest=/etc/profile.d/devtoolset2.sh
state=link
tags:
- devtoolset2
- pkgs
4 changes: 4 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Tasks for gcc 4.8 toolchain

- include: centos.yml centos_distribution='centos6'
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int == 6"

0 comments on commit cc28c01

Please sign in to comment.