pkgr 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +37 -27
- data/data/buildpacks/ubuntu-14.04 +2 -0
- data/data/hooks/postinstall.sh +16 -4
- data/data/hooks/preinstall.sh +17 -1
- data/lib/pkgr/builder.rb +2 -0
- data/lib/pkgr/cli.rb +8 -2
- data/lib/pkgr/config.rb +14 -0
- data/lib/pkgr/version.rb +1 -1
- metadata +3 -2
data/README.md
CHANGED
@@ -8,6 +8,7 @@ More languages and target distributions will be added after thorough testing, th
|
|
8
8
|
|
9
9
|
## Supported distributions (64bits only)
|
10
10
|
|
11
|
+
* Ubuntu 14.04 ("Trusty")
|
11
12
|
* Ubuntu 12.04 ("Precise")
|
12
13
|
* Debian 7.4 ("Wheezy")
|
13
14
|
* Ubuntu 10.04 ("Lucid")
|
@@ -44,33 +45,42 @@ Full command line options are given below:
|
|
44
45
|
pkgr package TARBALL
|
45
46
|
|
46
47
|
Options:
|
47
|
-
[--
|
48
|
-
|
49
|
-
[--changelog=CHANGELOG]
|
50
|
-
[--
|
51
|
-
|
52
|
-
|
53
|
-
[--
|
54
|
-
[--
|
55
|
-
[--
|
56
|
-
|
57
|
-
[--
|
58
|
-
|
59
|
-
[--
|
60
|
-
[--
|
61
|
-
[--
|
62
|
-
[--
|
63
|
-
[--
|
64
|
-
[--
|
65
|
-
[--
|
66
|
-
|
67
|
-
[--
|
68
|
-
[--
|
69
|
-
|
70
|
-
[--
|
71
|
-
[--
|
72
|
-
|
73
|
-
[--
|
48
|
+
[--buildpack=BUILDPACK] # Custom buildpack to use
|
49
|
+
[--buildpack-list=BUILDPACK_LIST] # Specify a file containing a list of buildpacks to use (--buildpack takes precedence if given)
|
50
|
+
[--changelog=CHANGELOG] # Changelog
|
51
|
+
[--maintainer=MAINTAINER] # Maintainer
|
52
|
+
[--architecture=ARCHITECTURE] # Target architecture for the package
|
53
|
+
# Default: x86_64
|
54
|
+
[--runner=RUNNER] # Force a specific runner (e.g. upstart-1.5, sysv-lsb-1.3)
|
55
|
+
[--homepage=HOMEPAGE] # Project homepage
|
56
|
+
[--description=DESCRIPTION] # Project description
|
57
|
+
[--version=VERSION] # Package version (if git directory given, it will use the latest git tag available)
|
58
|
+
[--iteration=ITERATION] # Package iteration (you should keep the default here)
|
59
|
+
# Default: 20140502095614
|
60
|
+
[--license=LICENSE] # The license of your package (see <https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/#license-short-name>)
|
61
|
+
[--user=USER] # User to run the app under (defaults to your app name)
|
62
|
+
[--group=GROUP] # Group to run the app under (defaults to your app name)
|
63
|
+
[--compile-cache-dir=COMPILE_CACHE_DIR] # Where to store the files cached between packaging runs. Path will be resolved from the temporary code repository folder, so use absolute paths if needed.
|
64
|
+
[--before-precompile=BEFORE_PRECOMPILE] # Provide a script to run just before the buildpack compilation, on the build machine. Path will be resolved from the temporary code repository folder, so use absolute paths if needed.
|
65
|
+
[--after-precompile=AFTER_PRECOMPILE] # Provide a script to run just after the buildpack compilation, on the build machine. Path will be resolved from the temporary code repository folder, so use absolute paths if needed.
|
66
|
+
[--before-install=BEFORE_INSTALL] # Provide a script to run just before a package gets installated or updated, on the target machine.
|
67
|
+
[--after-install=AFTER_INSTALL] # Provide a script to run just after a package gets installated or updated, on the target machine.
|
68
|
+
[--dependencies=one two three] # Specific system dependencies that you want to install with the package
|
69
|
+
[--build-dependencies=one two three] # Specific system dependencies that must be present before building
|
70
|
+
[--host=HOST] # Remote host to build on (default: local machine)
|
71
|
+
[--auto], [--no-auto] # Automatically attempt to install missing dependencies
|
72
|
+
[--clean], [--no-clean] # Automatically clean up temporary dirs
|
73
|
+
# Default: true
|
74
|
+
[--edge], [--no-edge] # Always use the latest version of the buildpack if already installed
|
75
|
+
# Default: true
|
76
|
+
[--env=one two three] # Specify environment variables for buildpack (--env "CURL_TIMEOUT=2" "BUNDLE_WITHOUT=development test")
|
77
|
+
[--force-os=FORCE_OS] # Force a specific distribution to build for (e.g. --force-os "ubuntu-12.04"). This may result in a broken package.
|
78
|
+
[--verbose], [--no-verbose] # Run verbosely
|
79
|
+
[--debug], [--no-debug] # Run very verbosely
|
80
|
+
[--name=NAME] # Application name (if directory given, it will default to the directory name)
|
81
|
+
[--buildpacks-cache-dir=BUILDPACKS_CACHE_DIR] # Directory where to store the buildpacks
|
82
|
+
# Default: /home/vagrant/.pkgr/buildpacks
|
83
|
+
|
74
84
|
|
75
85
|
## Why?
|
76
86
|
|
@@ -0,0 +1,2 @@
|
|
1
|
+
https://github.com/pkgr/heroku-buildpack-ruby.git#487c79e8cc3ab038ac13fef82d1e59a9c6ac39e6,BUILDPACK_VENDOR_URL="https://s3-external-1.amazonaws.com/pkgr-buildpack-ruby/20140408175240-ubuntu-14.04",BUILDPACK_NODE_VERSION="0.6.8"
|
2
|
+
https://github.com/heroku/heroku-buildpack-nodejs.git#v58
|
data/data/hooks/postinstall.sh
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
|
3
3
|
set -e
|
4
4
|
|
5
|
-
APP_NAME="<%= name %>"
|
6
|
-
APP_USER="<%= user %>"
|
7
|
-
APP_GROUP="<%= group %>"
|
8
|
-
APP_HOME="<%= home %>"
|
5
|
+
export APP_NAME="<%= name %>"
|
6
|
+
export APP_USER="<%= user %>"
|
7
|
+
export APP_GROUP="<%= group %>"
|
8
|
+
export APP_HOME="<%= home %>"
|
9
|
+
|
9
10
|
HOME_LOGS="${APP_HOME}/log"
|
10
11
|
LOGS="/var/log/${APP_NAME}"
|
11
12
|
|
@@ -28,3 +29,14 @@ chown -R ${APP_USER}.${APP_GROUP} /etc/${APP_NAME}
|
|
28
29
|
|
29
30
|
chmod 0750 /etc/${APP_NAME} /etc/${APP_NAME}/conf.d
|
30
31
|
find /etc/${APP_NAME} -type f -exec chmod 0640 {} +
|
32
|
+
|
33
|
+
<% if after_install && File.readable?(after_install) %>
|
34
|
+
# Call custom postinstall script.
|
35
|
+
CUSTOM_POSTINSTALL_SCRIPT="<%= Base64.encode64 File.read(after_install) %>"
|
36
|
+
|
37
|
+
tmpfile=$(mktemp)
|
38
|
+
chmod a+x "${tmpfile}"
|
39
|
+
echo "${CUSTOM_POSTINSTALL_SCRIPT}" | base64 -d - > ${tmpfile}
|
40
|
+
|
41
|
+
"${tmpfile}" "$@"
|
42
|
+
<% end %>
|
data/data/hooks/preinstall.sh
CHANGED
@@ -2,7 +2,10 @@
|
|
2
2
|
|
3
3
|
set -e
|
4
4
|
|
5
|
-
|
5
|
+
export APP_NAME="<%= name %>"
|
6
|
+
export APP_USER="<%= user %>"
|
7
|
+
export APP_GROUP="<%= group %>"
|
8
|
+
export APP_HOME="<%= home %>"
|
6
9
|
|
7
10
|
if ! getent passwd "${APP_USER}" > /dev/null; then
|
8
11
|
if [ -f /etc/redhat-release ]; then
|
@@ -11,3 +14,16 @@ if ! getent passwd "${APP_USER}" > /dev/null; then
|
|
11
14
|
adduser "${APP_USER}" --disabled-login --group --system --quiet --shell /bin/bash
|
12
15
|
fi
|
13
16
|
fi
|
17
|
+
|
18
|
+
<% if before_install && File.readable?(before_install) %>
|
19
|
+
# Call custom preinstall script. The package will not yet be unpacked, so the
|
20
|
+
# preinst script cannot rely on any files included in its package.
|
21
|
+
# https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html
|
22
|
+
CUSTOM_PREINSTALL_SCRIPT="<%= Base64.encode64 File.read(before_install) %>"
|
23
|
+
|
24
|
+
tmpfile=$(mktemp)
|
25
|
+
chmod a+x "${tmpfile}"
|
26
|
+
echo "${CUSTOM_PREINSTALL_SCRIPT}" | base64 -d - > ${tmpfile}
|
27
|
+
|
28
|
+
"${tmpfile}" "$@"
|
29
|
+
<% end %>
|
data/lib/pkgr/builder.rb
CHANGED
@@ -38,6 +38,8 @@ module Pkgr
|
|
38
38
|
# Setup the build directory structure
|
39
39
|
def setup
|
40
40
|
Dir.chdir(build_dir) do
|
41
|
+
# useful for templates that need to read files
|
42
|
+
config.source_dir = source_dir
|
41
43
|
distribution.templates(config).each do |template|
|
42
44
|
template.install(config.sesame)
|
43
45
|
end
|
data/lib/pkgr/cli.rb
CHANGED
@@ -70,10 +70,16 @@ module Pkgr
|
|
70
70
|
:desc => "Where to store the files cached between packaging runs. Path will be resolved from the temporary code repository folder, so use absolute paths if needed."
|
71
71
|
method_option :before_precompile,
|
72
72
|
:type => :string,
|
73
|
-
:desc => "Provide a script to run just before the buildpack compilation. Path will be resolved from the temporary code repository folder, so use absolute paths if needed."
|
73
|
+
:desc => "Provide a script to run just before the buildpack compilation, on the build machine. Path will be resolved from the temporary code repository folder, so use absolute paths if needed."
|
74
74
|
method_option :after_precompile,
|
75
75
|
:type => :string,
|
76
|
-
:desc => "Provide a script to run just after the buildpack compilation. Path will be resolved from the temporary code repository folder, so use absolute paths if needed."
|
76
|
+
:desc => "Provide a script to run just after the buildpack compilation, on the build machine. Path will be resolved from the temporary code repository folder, so use absolute paths if needed."
|
77
|
+
method_option :before_install,
|
78
|
+
:type => :string,
|
79
|
+
:desc => "Provide a script to run just before a package gets installated or updated, on the target machine."
|
80
|
+
method_option :after_install,
|
81
|
+
:type => :string,
|
82
|
+
:desc => "Provide a script to run just after a package gets installated or updated, on the target machine."
|
77
83
|
method_option :dependencies,
|
78
84
|
:type => :array,
|
79
85
|
:default => [],
|
data/lib/pkgr/config.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
require 'yaml'
|
3
|
+
require 'pathname'
|
4
|
+
require 'base64'
|
3
5
|
|
4
6
|
module Pkgr
|
5
7
|
class Config < OpenStruct
|
@@ -143,6 +145,16 @@ module Pkgr
|
|
143
145
|
end
|
144
146
|
end
|
145
147
|
|
148
|
+
def before_install
|
149
|
+
return nil if @table[:before_install].nil?
|
150
|
+
Pathname.new(source_dir).join(@table[:before_install]).realpath.to_s
|
151
|
+
end
|
152
|
+
|
153
|
+
def after_install
|
154
|
+
return nil if @table[:after_install].nil?
|
155
|
+
Pathname.new(source_dir).join(@table[:after_install]).realpath.to_s
|
156
|
+
end
|
157
|
+
|
146
158
|
# TODO: DRY this with cli.rb
|
147
159
|
def to_args
|
148
160
|
args = [
|
@@ -161,6 +173,8 @@ module Pkgr
|
|
161
173
|
args.push "--compile-cache-dir \"#{compile_cache_dir}\"" unless compile_cache_dir.nil? || compile_cache_dir.empty?
|
162
174
|
args.push "--before-precompile \"#{before_precompile}\"" unless before_precompile.nil? || before_precompile.empty?
|
163
175
|
args.push "--after-precompile \"#{after_precompile}\"" unless after_precompile.nil? || after_precompile.empty?
|
176
|
+
args.push "--before-install \"#{before_install}\"" unless before_install.nil? || before_install.empty?
|
177
|
+
args.push "--after-install \"#{after_install}\"" unless after_install.nil? || after_install.empty?
|
164
178
|
args.push "--license \"#{license}\"" unless license.nil? || license.empty?
|
165
179
|
args.push "--buildpack \"#{buildpack}\"" unless buildpack.nil? || buildpack.empty?
|
166
180
|
args.push "--buildpack_list \"#{buildpack_list}\"" unless buildpack_list.nil? || buildpack_list.empty?
|
data/lib/pkgr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pkgr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- data/buildpacks/debian-7
|
163
163
|
- data/buildpacks/ubuntu-10.04
|
164
164
|
- data/buildpacks/ubuntu-12.04
|
165
|
+
- data/buildpacks/ubuntu-14.04
|
165
166
|
- data/cli/cli.sh.erb
|
166
167
|
- data/dependencies/centos.yml
|
167
168
|
- data/dependencies/debian.yml
|