summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore10
-rw-r--r--.kitchen.yml41
-rw-r--r--Berksfile12
-rw-r--r--Gemfile21
-rw-r--r--README.md123
-rw-r--r--config/projects/asdf.rb25
-rw-r--r--config/software/asdf-zlib.rb55
-rw-r--r--config/software/preparation.rb30
-rw-r--r--omnibus.rb55
-rwxr-xr-xpackage-scripts/asdf/postinst17
-rwxr-xr-xpackage-scripts/asdf/postrm9
-rwxr-xr-xpackage-scripts/asdf/preinst7
-rwxr-xr-xpackage-scripts/asdf/prerm15
-rw-r--r--resources/asdf/deb/conffiles.erb3
-rw-r--r--resources/asdf/deb/control.erb25
-rw-r--r--resources/asdf/deb/md5sums.erb3
16 files changed, 451 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cd0f4a1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.gem
+.bundle
+.kitchen/
+.kitchen.local.yml
+vendor/bundle
+pkg/*
+.vagrant
+bin/*
+files/**/cache/
+vendor/cookbooks
diff --git a/.kitchen.yml b/.kitchen.yml
new file mode 100644
index 0000000..7878e0b
--- /dev/null
+++ b/.kitchen.yml
@@ -0,0 +1,41 @@
+driver:
+ name: vagrant
+ forward_agent: yes
+ customize:
+ cpus: 2
+ memory: 2048
+ synced_folders:
+ - ['.', '/home/vagrant/asdf']
+
+provisioner:
+ name: chef_zero
+
+platforms:
+ - name: centos-6
+ run_list: yum-epel::default
+ - name: centos-7
+ run_list: yum-epel::default
+ - name: debian-8
+ run_list: apt::default
+ - name: debian-9
+ run_list: apt::default
+ - name: freebsd-10
+ run_list: freebsd::portsnap
+ - name: freebsd-11
+ run_list: freebsd::portsnap
+ - name: ubuntu-14.04
+ run_list: apt::default
+ - name: ubuntu-16.04
+ run_list: apt::default
+ - name: ubuntu-18.04
+ run_list: apt::default
+
+suites:
+ - name: default
+ run_list: omnibus::default
+ attributes:
+ omnibus:
+ build_user: vagrant
+ build_user_group: vagrant
+ build_user_password: vagrant
+ install_dir: /opt/asdf
diff --git a/Berksfile b/Berksfile
new file mode 100644
index 0000000..acac58e
--- /dev/null
+++ b/Berksfile
@@ -0,0 +1,12 @@
+source 'https://supermarket.chef.io'
+
+cookbook 'omnibus'
+
+# Uncomment to use the latest version of the Omnibus cookbook from GitHub
+# cookbook 'omnibus', github: 'chef-cookbooks/omnibus'
+
+group :integration do
+ cookbook 'apt', '~> 2.8'
+ cookbook 'freebsd', '~> 0.3'
+ cookbook 'yum-epel', '~> 0.6'
+end
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..f2823df
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,21 @@
+source 'https://rubygems.org'
+
+# Install omnibus
+gem 'omnibus', '~> 7.0'
+
+# Use Chef's software definitions. It is recommended that you write your own
+# software definitions, but you can clone/fork Chef's to get you started.
+# gem 'omnibus-software', github: 'chef/omnibus-software'
+
+# This development group is installed by default when you run `bundle install`,
+# but if you are using Omnibus in a CI-based infrastructure, you do not need
+# the Test Kitchen-based build lab. You can skip these unnecessary dependencies
+# by running `bundle install --without development` to speed up build times.
+group :development do
+ # Use Berkshelf for resolving cookbook dependencies
+ gem 'berkshelf'
+
+ # Use Test Kitchen with Vagrant for converging the build environment
+ gem 'test-kitchen'
+ gem 'kitchen-vagrant'
+end
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..62f4f71
--- /dev/null
+++ b/README.md
@@ -0,0 +1,123 @@
+asdf Omnibus project
+====================
+This project creates full-stack platform-specific packages for
+`asdf`!
+
+Installation
+------------
+You must have a sane Ruby 2.0.0+ environment with Bundler installed. Ensure all
+the required gems are installed:
+
+```shell
+$ bundle install --binstubs
+```
+
+Usage
+-----
+### Build
+
+You create a platform-specific package using the `build project` command:
+
+```shell
+$ bin/omnibus build asdf
+```
+
+The platform/architecture type of the package created will match the platform
+where the `build project` command is invoked. For example, running this command
+on a MacBook Pro will generate a Mac OS X package. After the build completes
+packages will be available in the `pkg/` folder.
+
+### Clean
+
+You can clean up all temporary files generated during the build process with
+the `clean` command:
+
+```shell
+$ bin/omnibus clean asdf
+```
+
+Adding the `--purge` purge option removes __ALL__ files generated during the
+build including the project install directory (`/opt/asdf`) and
+the package cache directory (`/var/cache/omnibus/pkg`):
+
+```shell
+$ bin/omnibus clean asdf --purge
+```
+
+### Publish
+
+Omnibus has a built-in mechanism for releasing to a variety of "backends", such
+as Amazon S3. You must set the proper credentials in your
+[`omnibus.rb`](omnibus.rb) config file or specify them via the command line.
+
+```shell
+$ bin/omnibus publish path/to/*.deb --backend s3
+```
+
+### Help
+
+Full help for the Omnibus command line interface can be accessed with the
+`help` command:
+
+```shell
+$ bin/omnibus help
+```
+
+Version Manifest
+----------------
+
+Git-based software definitions may specify branches as their
+default_version. In this case, the exact git revision to use will be
+determined at build-time unless a project override (see below) or
+external version manifest is used. To generate a version manifest use
+the `omnibus manifest` command:
+
+```
+omnibus manifest PROJECT -l warn
+```
+
+This will output a JSON-formatted manifest containing the resolved
+version of every software definition.
+
+
+Kitchen-based Build Environment
+-------------------------------
+Every Omnibus project ships with a project-specific
+[Berksfile](https://docs.chef.io/berkshelf.html) that will allow you to build
+your omnibus projects on all of the platforms listed in the
+[`.kitchen.yml`](.kitchen.yml). You can add/remove additional platforms as
+needed by changing the list found in the [`.kitchen.yml`](.kitchen.yml)
+`platforms` YAML stanza.
+
+This build environment is designed to get you up-and-running quickly. However,
+there is nothing that restricts you from building on other platforms. Simply use
+the [omnibus cookbook](https://github.com/chef-cookbooks/omnibus) to setup your
+desired platform and execute the build steps listed above.
+
+The default build environment requires Test Kitchen and VirtualBox for local
+development. Test Kitchen also exposes the ability to provision instances using
+various cloud providers like AWS, DigitalOcean, or OpenStack. For more
+information, please see the [Test Kitchen documentation](https://kitchen.ci/).
+
+Once you have tweaked your [`.kitchen.yml`](.kitchen.yml) (or
+[`.kitchen.local.yml`](.kitchen.local.yml)) to your liking, you can bring up an
+individual build environment using the `kitchen` command.
+
+
+```shell
+$ bin/kitchen converge ubuntu-1804
+```
+
+Then login to the instance and build the project as described in the Usage
+section:
+
+```shell
+$ bin/kitchen login ubuntu-1804
+[vagrant@ubuntu...] $ . load-omnibus-toolchain.sh
+[vagrant@ubuntu...] $ cd asdf
+[vagrant@ubuntu...] $ bundle install
+[vagrant@ubuntu...] $ bin/omnibus build asdf
+```
+
+For a complete list of all commands and platforms, run `kitchen list` or
+`kitchen help`.
diff --git a/config/projects/asdf.rb b/config/projects/asdf.rb
new file mode 100644
index 0000000..f080c48
--- /dev/null
+++ b/config/projects/asdf.rb
@@ -0,0 +1,25 @@
+#
+# Copyright 2020 YOUR NAME
+#
+# All Rights Reserved.
+#
+
+name "asdf"
+maintainer "CHANGE ME"
+homepage "https://CHANGE-ME.com"
+
+# Defaults to C:/asdf on Windows
+# and /opt/asdf on all other platforms
+install_dir "#{default_root}/#{name}"
+
+build_version Omnibus::BuildVersion.semver
+build_iteration 1
+
+# Creates required build directories
+dependency "preparation"
+
+# asdf dependencies/components
+# dependency "somedep"
+
+exclude "**/.git"
+exclude "**/bundler/git"
diff --git a/config/software/asdf-zlib.rb b/config/software/asdf-zlib.rb
new file mode 100644
index 0000000..9e40776
--- /dev/null
+++ b/config/software/asdf-zlib.rb
@@ -0,0 +1,55 @@
+#
+# Copyright 2020 YOUR NAME
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# These options are required for all software definitions
+name "asdf-zlib"
+default_version "1.2.6"
+
+# A software can specify more than one version that is available for install
+version("1.2.6") { source md5: "618e944d7c7cd6521551e30b32322f4a" }
+version("1.2.8") { source md5: "44d667c142d7cda120332623eab69f40" }
+
+# Sources may be URLs, git locations, or path locations
+source url: "http://downloads.sourceforge.net/project/libpng/zlib/#{version}/zlib-#{version}.tar.gz"
+
+# This is the path, inside the tarball, where the source resides
+relative_path "zlib-#{version}"
+
+build do
+ # Setup a default environment from Omnibus - you should use this Omnibus
+ # helper everywhere. It will become the default in the future.
+ env = with_standard_compiler_flags(with_embedded_path)
+
+ # Manipulate any configure flags you wish:
+ # For some reason zlib needs this flag on solaris
+ env["CFLAGS"] << " -DNO_VIZ" if solaris?
+
+ # "command" is part of the build DSL. There are a number of handy options
+ # available, such as "copy", "sync", "ruby", etc. For a complete list, please
+ # consult the Omnibus gem documentation.
+ #
+ # "install_dir" is exposed and refers to the top-level projects +install_dir+
+ command "./configure" \
+ " --prefix=#{install_dir}/embedded", env: env
+
+ # You can have multiple steps - they are executed in the order in which they
+ # are read.
+ #
+ # "workers" is a DSL method that returns the most suitable number of
+ # builders for the currently running system.
+ command "make -j #{workers}", env: env
+ command "make -j #{workers} install", env: env
+end
diff --git a/config/software/preparation.rb b/config/software/preparation.rb
new file mode 100644
index 0000000..05ca827
--- /dev/null
+++ b/config/software/preparation.rb
@@ -0,0 +1,30 @@
+#
+# Copyright 2020 YOUR NAME
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name "preparation"
+description "the steps required to prepare the build"
+default_version "1.0.0"
+
+license :project_license
+skip_transitive_dependency_licensing true
+
+build do
+ block do
+ touch "#{install_dir}/embedded/lib/.gitkeep"
+ touch "#{install_dir}/embedded/bin/.gitkeep"
+ touch "#{install_dir}/bin/.gitkeep"
+ end
+end
diff --git a/omnibus.rb b/omnibus.rb
new file mode 100644
index 0000000..42b8eae
--- /dev/null
+++ b/omnibus.rb
@@ -0,0 +1,55 @@
+#
+# This file is used to configure the asdf project. It contains
+# some minimal configuration examples for working with Omnibus. For a full list
+# of configurable options, please see the documentation for +omnibus/config.rb+.
+#
+
+# Build internally
+# ------------------------------
+# By default, Omnibus uses system folders (like +/var+ and +/opt+) to build and
+# cache components. If you would to build everything internally, you can
+# uncomment the following options. This will prevent the need for root
+# permissions in most cases.
+#
+# Uncomment this line to change the default base directory to "local"
+# -------------------------------------------------------------------
+# base_dir './local'
+#
+# Alternatively you can tune the individual values
+# ------------------------------------------------
+# cache_dir './local/omnibus/cache'
+# git_cache_dir './local/omnibus/cache/git_cache'
+# source_dir './local/omnibus/src'
+# build_dir './local/omnibus/build'
+# package_dir './local/omnibus/pkg'
+# package_tmp './local/omnibus/pkg-tmp'
+
+# Disable git caching
+# ------------------------------
+# use_git_caching false
+
+# Enable S3 asset caching
+# ------------------------------
+# use_s3_caching true
+# s3_access_key ENV['AWS_ACCESS_KEY_ID']
+# s3_secret_key ENV['AWS_SECRET_ACCESS_KEY']
+# s3_profile ENV['AWS_S3_PROFILE']
+# s3_iam_role_arn ENV['S3_IAM_ROLE_ARN']
+# s3_bucket ENV['AWS_S3_BUCKET']
+
+# Customize compiler bits
+# ------------------------------
+# solaris_compiler 'gcc'
+# build_retries 5
+# fetcher_read_timeout 120
+# fetcher_retries 5
+
+# Load additional software
+# ------------------------------
+# software_gems ['omnibus-software', 'my-company-software']
+# local_software_dirs ['/path/to/local/software']
+
+# Windows architecture defaults
+# ------------------------------
+windows_arch %w{x86 x64}.include?((ENV['OMNIBUS_WINDOWS_ARCH'] || '').downcase) ?
+ ENV['OMNIBUS_WINDOWS_ARCH'].downcase.to_sym : :x86
diff --git a/package-scripts/asdf/postinst b/package-scripts/asdf/postinst
new file mode 100755
index 0000000..39d84e8
--- /dev/null
+++ b/package-scripts/asdf/postinst
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# Perform necessary asdf setup steps
+# after package is installed.
+#
+
+PROGNAME=`basename $0`
+
+error_exit()
+{
+ echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
+ exit 1
+}
+
+echo "Thank you for installing asdf!"
+
+exit 0
diff --git a/package-scripts/asdf/postrm b/package-scripts/asdf/postrm
new file mode 100755
index 0000000..560c896
--- /dev/null
+++ b/package-scripts/asdf/postrm
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Perform necessary asdf removal steps
+# after package is uninstalled.
+#
+
+echo "asdf has been uninstalled!"
+
+exit 0
diff --git a/package-scripts/asdf/preinst b/package-scripts/asdf/preinst
new file mode 100755
index 0000000..89d3cf0
--- /dev/null
+++ b/package-scripts/asdf/preinst
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# Perform necessary asdf setup steps
+# before package is installed.
+#
+
+echo "You're about to install asdf!"
diff --git a/package-scripts/asdf/prerm b/package-scripts/asdf/prerm
new file mode 100755
index 0000000..46749a1
--- /dev/null
+++ b/package-scripts/asdf/prerm
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# Perform necessary asdf setup steps
+# prior to installing package.
+#
+
+PROGNAME=`basename $0`
+
+error_exit()
+{
+ echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
+ exit 1
+}
+
+exit 0
diff --git a/resources/asdf/deb/conffiles.erb b/resources/asdf/deb/conffiles.erb
new file mode 100644
index 0000000..64282d6
--- /dev/null
+++ b/resources/asdf/deb/conffiles.erb
@@ -0,0 +1,3 @@
+<% config_files.each do |file| -%>
+<%= file %>
+<% end -%>
diff --git a/resources/asdf/deb/control.erb b/resources/asdf/deb/control.erb
new file mode 100644
index 0000000..df91e34
--- /dev/null
+++ b/resources/asdf/deb/control.erb
@@ -0,0 +1,25 @@
+Package: <%= name %>
+Version: <%= version %>-<%= iteration %>
+License: <%= license %>
+Vendor: <%= vendor %>
+Architecture: <%= architecture %>
+Maintainer: <%= maintainer %>
+Installed-Size: <%= installed_size %>
+<% unless dependencies.empty? -%>
+Depends: <%= dependencies.join(', ') %>
+<% end -%>
+<% unless conflicts.empty? -%>
+Conflicts: <%= conflicts.join(', ') %>
+<% end -%>
+<% unless replaces.empty? -%>
+Replaces: <%= replaces.join(', ') %>
+<% end -%>
+Section: <%= section %>
+Priority: <%= priority %>
+Homepage: <%= homepage %>
+<% lines = description.split("\n") -%>
+<% firstline, *remainder = lines -%>
+Description: <%= firstline %>
+<% if remainder.any? -%>
+<%= remainder.collect { |l| l =~ /^ *$/ ? " ." : " #{l}" }.join("\n") %>
+<% end -%>
diff --git a/resources/asdf/deb/md5sums.erb b/resources/asdf/deb/md5sums.erb
new file mode 100644
index 0000000..c8120ef
--- /dev/null
+++ b/resources/asdf/deb/md5sums.erb
@@ -0,0 +1,3 @@
+<% md5sums.each do |path, checksum| -%>
+<%= checksum %> <%= path %>
+<% end -%>