Created
October 9, 2017 03:21
-
-
Save jude/1ed06603135cb47c4bb59e52e8c96af0 to your computer and use it in GitHub Desktop.
A Vagrantfile for building an Elixir rpm for Centos 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$script = <<'SCRIPT' | |
echo "elixir packaging" | |
# -------------------------------------- | |
# Change to the vagrant shared directory | |
# -------------------------------------- | |
cd /vagrant | |
# ------------------------------------------------------ | |
# Install git so the elixir packaging repo can be cloned | |
# Install wgt to pull down more recent erlang rpms | |
# Install rpmdevtools for spectool | |
# The other rpms are for rpmbuil support | |
# ------------------------------------------------------ | |
yum install -y git rpm-build redhat-rpm-config rpmdevtools wget | |
# ------------------------------ | |
# Setup the rpmbuild environment | |
# ------------------------------ | |
mkdir -p /home/vagrant/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} | |
echo '%_topdir /home/vagrant/rpmbuild' > ~/.rpmmacros | |
# -------------------------------------------------------------------- | |
# Pull down more a more recent erlang version from erlang-solutions.com | |
# elixir requires at least erlang 18 and epel's still at 16 | |
# --------------------------------------------------------------------- | |
rm -rf erlang-solutions-1.0-1.noarch.rpm | |
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm | |
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm | |
rm -rf erlang-solutions-1.0-1.noarch.rpm | |
# ------------------------------------------------------------------ | |
# Install erlang-rpm-macros for the %{rebar_*} macros in elixir.spec | |
# THis is done after installing the erlanbd-solutions rpm is installed | |
# so newer dependencies are pulled in | |
# ------------------------------------------------------------------ | |
yum install -y erlang-rpm-macros | |
# -------------------------------------------------- | |
# Install other erlang dependencies needed by elixir | |
# -------------------------------------------------- | |
yum install -y erlang-rebar | |
# ------------------------------- | |
# Clone the elixir packaging repo | |
# ------------------------------- | |
cd /vagrant | |
rm -rf ./elixir | |
git clone https://src.fedoraproject.org/git/rpms/elixir.git ./elixir | |
# -------------------------------------------------------- | |
# Use spectool to download the latest elixir source tar.gz | |
# ---------------------------------------------------------- | |
cd elixir | |
spectool -g -R elixir.spec | |
# Do the sweet sweet elixir build. | |
# Skipping over the %check block since the %{rebar_enuit} isn't | |
# in the latest EPEL version of erlang-rpm-macros | |
rpmbuild -bb --nocheck elixir.spec | |
# ------------------------------------ | |
# Put the rpm in your shared directory | |
# ------------------------------------ | |
cp /home/vagrant/rpmbuild/RPMS/x86_64/elixir*.rpm /vagrant | |
echo "PROFIT" | |
SCRIPT | |
Vagrant.configure("2") do |config| | |
config.vm.box = "centos/7" | |
config.vm.network :forwarded_port, guest: 8093, host: 8093 | |
config.vm.provision "shell", inline: $script | |
config.vm.synced_folder ".", "/vagrant", type: "sshfs" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment