pkgr 1.4.4 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -2
- data/data/build_dependencies/sles.yml +7 -2
- data/data/build_dependencies/ubuntu.yml +2 -0
- data/data/buildpacks/sles-11 +2 -0
- data/data/buildpacks/sles-12 +1 -1
- data/data/buildpacks/ubuntu-16.04 +3 -0
- data/data/cli/cli.sh.erb +32 -24
- data/data/dependencies/debian.yml +6 -0
- data/data/dependencies/sles.yml +7 -2
- data/data/dependencies/ubuntu.yml +6 -0
- data/data/hooks/postinstall.sh +1 -1
- data/data/init/upstart/1.5/master.conf.erb +2 -8
- data/lib/pkgr.rb +6 -1
- data/lib/pkgr/builder.rb +19 -2
- data/lib/pkgr/buildpack.rb +15 -13
- data/lib/pkgr/cli.rb +28 -2
- data/lib/pkgr/config.rb +17 -1
- data/lib/pkgr/distributions/base.rb +8 -0
- data/lib/pkgr/distributions/sles.rb +6 -5
- data/lib/pkgr/distributions/ubuntu.rb +6 -1
- data/lib/pkgr/fpm_command.rb +3 -1
- data/lib/pkgr/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06310dd9deefd66e4d67362d37d7dccdcdf0c67a
|
4
|
+
data.tar.gz: 3510327310565582d099096ca2a1f5d1d45c0a8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aef9f329e3ae1f861d301d93ebb57b09e694220cc67ff981b1c626f37b903d656236a4d2eeef63c27209b876cd95a98e508995c3265c1df2942fbe51d3207413
|
7
|
+
data.tar.gz: 846f1f6ae5c13d848cae05bed22b896e608a7160c455c9836246cb95a7872c41c3712f4281921291fe8794f3758011fb335cc91bdd895df1daa40455ca9101d0
|
data/README.md
CHANGED
@@ -32,7 +32,11 @@ See <https://packager.io/> for examples of apps packaged with `pkgr` (Gitlab, Op
|
|
32
32
|
|
33
33
|
## Installation
|
34
34
|
|
35
|
-
|
35
|
+
You can find DEB and RPM packages for a wide range of distributions on Packager.io:
|
36
|
+
|
37
|
+
<https://packager.io/gh/crohr/pkgr>
|
38
|
+
|
39
|
+
Or, installing as a gem, on debian-based machines:
|
36
40
|
|
37
41
|
sudo apt-get update
|
38
42
|
sudo apt-get install -y build-essential ruby1.9.1-full rubygems1.9.1
|
@@ -57,11 +61,14 @@ Full command line options are given below:
|
|
57
61
|
[--buildpack-list=BUILDPACK_LIST] # Specify a file containing a list of buildpacks to use (--buildpack takes precedence if given)
|
58
62
|
[--changelog=CHANGELOG] # Changelog
|
59
63
|
[--maintainer=MAINTAINER] # Maintainer
|
64
|
+
[--vendor=VENDOR] # Package vendor
|
60
65
|
[--architecture=ARCHITECTURE] # Target architecture for the package
|
61
66
|
# Default: x86_64
|
62
67
|
[--runner=RUNNER] # Force a specific runner (e.g. upstart-1.5, sysv-lsb-1.3)
|
63
68
|
[--homepage=HOMEPAGE] # Project homepage
|
64
69
|
[--description=DESCRIPTION] # Project description
|
70
|
+
[--category=CATEGORY] # Category this package belongs to
|
71
|
+
# Default: none
|
65
72
|
[--version=VERSION] # Package version (if git directory given, it will use the latest git tag available)
|
66
73
|
[--iteration=ITERATION] # Package iteration (you should keep the default here)
|
67
74
|
# Default: 20141015024539
|
@@ -73,6 +80,8 @@ Full command line options are given below:
|
|
73
80
|
[--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.
|
74
81
|
[--before-install=BEFORE_INSTALL] # Provide a script to run just before a package gets installated or updated, on the target machine.
|
75
82
|
[--after-install=AFTER_INSTALL] # Provide a script to run just after a package gets installated or updated, on the target machine.
|
83
|
+
[--before-remove=BEFORE_REMOVE] # Provide a script to run just before a package gets uninstallated, on the target machine.
|
84
|
+
[--after-remove=AFTER_REMOVE] # Provide a script to run just after a package gets uninstallated, on the target machine.
|
76
85
|
[--dependencies=one two three] # Specific system dependencies that you want to install with the package
|
77
86
|
[--build-dependencies=one two three] # Specific system dependencies that must be present before building
|
78
87
|
[--host=HOST] # Remote host to build on (default: local machine)
|
@@ -84,6 +93,11 @@ Full command line options are given below:
|
|
84
93
|
[--env=one two three] # Specify environment variables for buildpack (--env "CURL_TIMEOUT=2" "BUNDLE_WITHOUT=development test")
|
85
94
|
[--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.
|
86
95
|
[--store-cache], [--no-store-cache] # Output a tarball of the cache in the current directory (name: cache.tar.gz)
|
96
|
+
[--verify], [--no-verify] # Verifies output package
|
97
|
+
# Default: true
|
98
|
+
[--data-dir=DATA_DIR] # Custom path to data directory. Can be used for overriding default templates, hooks(pre-, post- scripts), configs (buildpacks, distro dependencies), environments, etc.
|
99
|
+
# Default: ./pkgr/data
|
100
|
+
[--directories=DIRECTORIES] # Recursively mark a directory as being owned by the package
|
87
101
|
[--verbose], [--no-verbose] # Run verbosely
|
88
102
|
[--debug], [--no-debug] # Run very verbosely
|
89
103
|
[--name=NAME] # Application name (if directory given, it will default to the directory name)
|
@@ -92,7 +106,7 @@ Full command line options are given below:
|
|
92
106
|
|
93
107
|
## Why?
|
94
108
|
|
95
|
-
Tools such as [Capistrano](http://
|
109
|
+
Tools such as [Capistrano](http://capistranorb.com/) are great for deploying
|
96
110
|
applications, but the deployment recipe can quickly become a mess, and scaling
|
97
111
|
the deployment to more than a few servers can prove to be difficult. Plus, if
|
98
112
|
you're already using automation tools such as
|
@@ -2,12 +2,17 @@ default:
|
|
2
2
|
- curl
|
3
3
|
- gcc
|
4
4
|
- gcc-c++
|
5
|
-
- kernel-devel
|
6
5
|
- libopenssl-devel
|
7
6
|
- readline-devel
|
8
7
|
- libxml2-devel
|
9
8
|
- libxslt-devel
|
10
9
|
- libevent-devel
|
11
|
-
- postgresql-devel
|
12
10
|
- libmysqlclient-devel
|
13
11
|
- sqlite3-devel
|
12
|
+
- timezone
|
13
|
+
sles-11:
|
14
|
+
- kernel-default-devel
|
15
|
+
- postgresql94-devel
|
16
|
+
sles-12:
|
17
|
+
- kernel-devel
|
18
|
+
- postgresql-devel
|
data/data/buildpacks/sles-12
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
https://github.com/pkgr/heroku-buildpack-ruby.git#universal
|
1
|
+
https://github.com/pkgr/heroku-buildpack-ruby.git#universal,BUILDPACK_NODE_VERSION="0.6.8",CURL_CONNECT_TIMEOUT=60,CURL_TIMEOUT=300
|
2
2
|
https://github.com/heroku/heroku-buildpack-nodejs.git#v58
|
data/data/cli/cli.sh.erb
CHANGED
@@ -50,6 +50,7 @@ fi
|
|
50
50
|
|
51
51
|
# Source all environment variables for the app. This must be done as
|
52
52
|
# privileged user since the config variables are only readable by root.
|
53
|
+
PORT_WAS=$PORT
|
53
54
|
for file in $(_p "/etc/${APP_NAME}/conf.d")/*; do
|
54
55
|
if [ -f $file ]; then . $file; fi
|
55
56
|
done
|
@@ -142,14 +143,6 @@ scale_up() {
|
|
142
143
|
echo "Scaling up..."
|
143
144
|
|
144
145
|
if [ "${APP_RUNNER_TYPE}" = "upstart" ]; then
|
145
|
-
# copy initd
|
146
|
-
cp $(_p "${APP_HOME}/vendor/pkgr/scaling/upstart/${APP_NAME}") $(_p "/etc/init.d/")
|
147
|
-
chmod 0755 $(_p "/etc/init.d/${APP_NAME}")
|
148
|
-
# copy master
|
149
|
-
cp $(_p "${APP_HOME}/vendor/pkgr/scaling/upstart/${APP_NAME}.conf") $(_p "/etc/init/")
|
150
|
-
# copy master process
|
151
|
-
cp $(_p "${APP_HOME}/vendor/pkgr/scaling/upstart/${APP_NAME}-${PROCESS_NAME}.conf") $(_p "/etc/init/")
|
152
|
-
|
153
146
|
for i in $(seq ${SCALE_DELTA}); do
|
154
147
|
index=$((${i} + ${CURRENT_SCALE}))
|
155
148
|
PROCESS_ID="${APP_NAME}-${PROCESS_NAME}-${index}"
|
@@ -165,15 +158,6 @@ scale_up() {
|
|
165
158
|
$APP_RUNNER_CLI start ${APP_NAME}-${PROCESS_NAME} || true
|
166
159
|
$APP_RUNNER_CLI start ${APP_NAME} || true
|
167
160
|
elif [ "$APP_RUNNER_TYPE" = "systemd" ]; then
|
168
|
-
local source=$(_p "${APP_HOME}/vendor/pkgr/scaling/systemd")
|
169
|
-
# copy master
|
170
|
-
cp ${source}/${APP_NAME}.service $SYSTEMD_DIR
|
171
|
-
# copy master process
|
172
|
-
cp ${source}/${APP_NAME}-${PROCESS_NAME}.service $SYSTEMD_DIR
|
173
|
-
|
174
|
-
$APP_RUNNER_CLI enable ${APP_NAME}.service || true
|
175
|
-
$APP_RUNNER_CLI enable ${APP_NAME}-${PROCESS_NAME}.service || true
|
176
|
-
|
177
161
|
for i in $(seq ${SCALE_DELTA}); do
|
178
162
|
index=$((${i} + ${CURRENT_SCALE}))
|
179
163
|
PROCESS_ID="${APP_NAME}-${PROCESS_NAME}-${index}"
|
@@ -189,12 +173,6 @@ scale_up() {
|
|
189
173
|
$APP_RUNNER_CLI start ${APP_NAME}-${PROCESS_NAME}.service
|
190
174
|
$APP_RUNNER_CLI start ${APP_NAME}.service
|
191
175
|
else
|
192
|
-
cp $(_p "${APP_HOME}/vendor/pkgr/scaling/sysv/${APP_NAME}") $(_p /etc/init.d/)
|
193
|
-
chmod a+x $(_p "/etc/init.d/${APP_NAME}")
|
194
|
-
sysv_enable ${APP_NAME}
|
195
|
-
cp $(_p "${APP_HOME}/vendor/pkgr/scaling/sysv/${APP_NAME}-${PROCESS_NAME}") $(_p /etc/init.d/)
|
196
|
-
chmod a+x $(_p "/etc/init.d/${APP_NAME}-${PROCESS_NAME}")
|
197
|
-
sysv_enable ${APP_NAME}-${PROCESS_NAME}
|
198
176
|
for i in $(seq ${SCALE_DELTA}); do
|
199
177
|
index=$((${i} + ${CURRENT_SCALE}))
|
200
178
|
PROCESS_ID="${APP_NAME}-${PROCESS_NAME}-${index}"
|
@@ -247,6 +225,32 @@ scale() {
|
|
247
225
|
CURRENT_SCALE=${CURRENT_SCALE:="0"}
|
248
226
|
SCALE_DELTA=$((${NEW_SCALE} - ${CURRENT_SCALE}))
|
249
227
|
|
228
|
+
if [ "${APP_RUNNER_TYPE}" = "upstart" ]; then
|
229
|
+
# copy initd
|
230
|
+
cp $(_p "${APP_HOME}/vendor/pkgr/scaling/upstart/${APP_NAME}") $(_p "/etc/init.d/")
|
231
|
+
chmod 0755 $(_p "/etc/init.d/${APP_NAME}")
|
232
|
+
# copy master
|
233
|
+
cp $(_p "${APP_HOME}/vendor/pkgr/scaling/upstart/${APP_NAME}.conf") $(_p "/etc/init/")
|
234
|
+
# copy master process
|
235
|
+
cp $(_p "${APP_HOME}/vendor/pkgr/scaling/upstart/${APP_NAME}-${PROCESS_NAME}.conf") $(_p "/etc/init/")
|
236
|
+
elif [ "$APP_RUNNER_TYPE" = "systemd" ]; then
|
237
|
+
local source=$(_p "${APP_HOME}/vendor/pkgr/scaling/systemd")
|
238
|
+
# copy master
|
239
|
+
cp ${source}/${APP_NAME}.service $SYSTEMD_DIR
|
240
|
+
# copy master process
|
241
|
+
cp ${source}/${APP_NAME}-${PROCESS_NAME}.service $SYSTEMD_DIR
|
242
|
+
|
243
|
+
$APP_RUNNER_CLI enable ${APP_NAME}.service || true
|
244
|
+
$APP_RUNNER_CLI enable ${APP_NAME}-${PROCESS_NAME}.service || true
|
245
|
+
else
|
246
|
+
cp $(_p "${APP_HOME}/vendor/pkgr/scaling/sysv/${APP_NAME}") $(_p /etc/init.d/)
|
247
|
+
chmod a+x $(_p "/etc/init.d/${APP_NAME}")
|
248
|
+
sysv_enable ${APP_NAME}
|
249
|
+
cp $(_p "${APP_HOME}/vendor/pkgr/scaling/sysv/${APP_NAME}-${PROCESS_NAME}") $(_p /etc/init.d/)
|
250
|
+
chmod a+x $(_p "/etc/init.d/${APP_NAME}-${PROCESS_NAME}")
|
251
|
+
sysv_enable ${APP_NAME}-${PROCESS_NAME}
|
252
|
+
fi
|
253
|
+
|
250
254
|
if [ $SCALE_DELTA -gt 0 ]; then
|
251
255
|
scale_up "${PROCESS_NAME}" $CURRENT_SCALE $NEW_SCALE $SCALE_DELTA
|
252
256
|
elif [ $SCALE_DELTA -lt 0 ]; then
|
@@ -290,6 +294,9 @@ while : ; do
|
|
290
294
|
runnable="${runnable}$(printf " %q" ${COMMAND} "$@")"
|
291
295
|
fi
|
292
296
|
|
297
|
+
# fix port
|
298
|
+
export PORT=$PORT_WAS
|
299
|
+
|
293
300
|
# Do not use su, to avoid creating a new process. Note: chroot version
|
294
301
|
# is too old on Ubuntu Lucid, so this will fail. It works on Debian
|
295
302
|
# Squeeze though (and later).
|
@@ -297,7 +304,8 @@ while : ; do
|
|
297
304
|
if [ $(id -u) = $(id -u ${APP_USER}) ]; then
|
298
305
|
exec sh -c "cd $(_p ${APP_HOME}) && $runnable"
|
299
306
|
else
|
300
|
-
|
307
|
+
additional_groups="$(id -Gn ${APP_USER} | tr ' ' ',')"
|
308
|
+
exec chroot --userspec ${APP_USER}:${APP_GROUP} --groups="${additional_groups}" "/" sh -c "cd $(_p ${APP_HOME}) && $runnable"
|
301
309
|
fi
|
302
310
|
|
303
311
|
break ;;
|
data/data/dependencies/sles.yml
CHANGED
data/data/hooks/postinstall.sh
CHANGED
@@ -1,8 +1,2 @@
|
|
1
|
-
start on
|
2
|
-
|
3
|
-
or started networking) and filesystem
|
4
|
-
|
5
|
-
# The `networking` job is a task, which means it will be stopped after the network interfaces have been configured.
|
6
|
-
# That's why we don't stop on "stopping networking".
|
7
|
-
# See <https://github.com/ddollar/foreman/issues/263>
|
8
|
-
stop on runlevel [!2345]
|
1
|
+
start on runlevel [2345]
|
2
|
+
stop on runlevel [06]
|
data/lib/pkgr.rb
CHANGED
@@ -13,8 +13,13 @@ module Pkgr
|
|
13
13
|
class ConfigurationInvalid < Base; end
|
14
14
|
end
|
15
15
|
|
16
|
+
def data_dir=(path)
|
17
|
+
@data_dir = path
|
18
|
+
end
|
19
|
+
module_function :data_dir=
|
20
|
+
|
16
21
|
def data_dir
|
17
|
-
File.expand_path("../../data", __FILE__)
|
22
|
+
@data_dir ||= File.expand_path("../../data", __FILE__)
|
18
23
|
end
|
19
24
|
module_function :data_dir
|
20
25
|
end
|
data/lib/pkgr/builder.rb
CHANGED
@@ -68,6 +68,7 @@ module Pkgr
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
config.distribution = distribution
|
71
|
+
config.env.variables.push("TARGET=#{distribution.target}")
|
71
72
|
# useful for templates that need to read files
|
72
73
|
config.source_dir = source_dir
|
73
74
|
config.build_dir = build_dir
|
@@ -109,11 +110,17 @@ module Pkgr
|
|
109
110
|
if buildpack_for_app
|
110
111
|
puts "-----> #{buildpack_for_app.banner} app"
|
111
112
|
|
113
|
+
begin
|
114
|
+
FileUtils.mkdir_p(app_home_dir)
|
115
|
+
rescue Errno::EACCES => e
|
116
|
+
Pkgr.logger.warn "Can't create #{app_home_dir.inspect}, which may be needed by some buildpacks."
|
117
|
+
end
|
112
118
|
FileUtils.mkdir_p(compile_cache_dir)
|
119
|
+
FileUtils.mkdir_p(compile_env_dir)
|
113
120
|
|
114
121
|
run_hook config.before_hook
|
115
|
-
buildpack_for_app.compile(source_dir, compile_cache_dir)
|
116
|
-
buildpack_for_app.release(source_dir
|
122
|
+
buildpack_for_app.compile(source_dir, compile_cache_dir, compile_env_dir)
|
123
|
+
buildpack_for_app.release(source_dir)
|
117
124
|
run_hook config.after_hook
|
118
125
|
else
|
119
126
|
raise Errors::UnknownAppType, "Can't find a buildpack for your app"
|
@@ -258,11 +265,21 @@ module Pkgr
|
|
258
265
|
File.join(source_dir, "Procfile")
|
259
266
|
end
|
260
267
|
|
268
|
+
# Some buildpacks may need the target home dir to exist
|
269
|
+
def app_home_dir
|
270
|
+
config.home
|
271
|
+
end
|
272
|
+
|
261
273
|
# Directory where the buildpacks can store stuff.
|
262
274
|
def compile_cache_dir
|
263
275
|
config.compile_cache_dir || File.join(source_dir, ".git/cache")
|
264
276
|
end
|
265
277
|
|
278
|
+
# Directory where the buildpacks can store config envs.
|
279
|
+
def compile_env_dir
|
280
|
+
config.compile_env_dir ||= Dir.mktmpdir
|
281
|
+
end
|
282
|
+
|
266
283
|
# Returns the current distribution we're packaging for.
|
267
284
|
def distribution
|
268
285
|
@distribution ||= Distributions.current(config)
|
data/lib/pkgr/buildpack.rb
CHANGED
@@ -35,8 +35,8 @@ module Pkgr
|
|
35
35
|
buildpack_detect.exitstatus == 0
|
36
36
|
end
|
37
37
|
|
38
|
-
def compile(path, compile_cache_dir)
|
39
|
-
cmd = %{env -i PATH="$PATH"#{env} #{dir}/bin/compile "#{path}" "#{compile_cache_dir}" }
|
38
|
+
def compile(path, compile_cache_dir, compile_env_dir)
|
39
|
+
cmd = %{env -i PATH="$PATH"#{env} #{dir}/bin/compile "#{path}" "#{compile_cache_dir}" "#{compile_env_dir}" }
|
40
40
|
Pkgr.debug "Running #{cmd.inspect}"
|
41
41
|
|
42
42
|
Dir.chdir(path) do
|
@@ -52,8 +52,8 @@ module Pkgr
|
|
52
52
|
true
|
53
53
|
end
|
54
54
|
|
55
|
-
def release(path
|
56
|
-
buildpack_release = Mixlib::ShellOut.new("#{dir}/bin/release \"#{path}\"
|
55
|
+
def release(path)
|
56
|
+
buildpack_release = Mixlib::ShellOut.new("#{dir}/bin/release \"#{path}\" > #{path}/.release")
|
57
57
|
buildpack_release.logger = Pkgr.logger
|
58
58
|
buildpack_release.run_command
|
59
59
|
buildpack_release.exitstatus == 0
|
@@ -75,7 +75,7 @@ module Pkgr
|
|
75
75
|
def refresh(edge = true)
|
76
76
|
return if !edge
|
77
77
|
Dir.chdir(dir) do
|
78
|
-
buildpack_refresh = Mixlib::ShellOut.new("git fetch origin && git reset --hard
|
78
|
+
buildpack_refresh = Mixlib::ShellOut.new("git fetch origin && ( git reset --hard #{branch} || git reset --hard origin/#{branch} )")
|
79
79
|
buildpack_refresh.logger = Pkgr.logger
|
80
80
|
buildpack_refresh.run_command
|
81
81
|
buildpack_refresh.error!
|
@@ -83,20 +83,22 @@ module Pkgr
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def install
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
86
|
+
unless exists?
|
87
|
+
FileUtils.mkdir_p(buildpack_cache_dir)
|
88
|
+
Dir.chdir(buildpack_cache_dir) do
|
89
|
+
puts "-----> Fetching buildpack #{url} at #{branch}"
|
90
|
+
buildpack_install = Mixlib::ShellOut.new("git clone '#{url}'")
|
91
|
+
buildpack_install.logger = Pkgr.logger
|
92
|
+
buildpack_install.run_command
|
93
|
+
buildpack_install.error!
|
94
|
+
end
|
93
95
|
end
|
94
96
|
refresh(true)
|
95
97
|
end
|
96
98
|
|
97
99
|
def replace_app_with_app_home(app_home)
|
98
100
|
Dir.chdir(dir) do
|
99
|
-
buildpack_replace = Mixlib::ShellOut.new("find . -type f -print0 | xargs -0 perl -pi -e s,/app
|
101
|
+
buildpack_replace = Mixlib::ShellOut.new("find . -type f -not -path '*/.git/*' -print0 | xargs -0 perl -pi -e s,/app/,#{app_home}/,g")
|
100
102
|
buildpack_replace.logger = Pkgr.logger
|
101
103
|
buildpack_replace.run_command
|
102
104
|
buildpack_replace.error!
|
data/lib/pkgr/cli.rb
CHANGED
@@ -5,6 +5,12 @@ require 'pkgr/env'
|
|
5
5
|
|
6
6
|
module Pkgr
|
7
7
|
class CLI < Thor
|
8
|
+
no_tasks do
|
9
|
+
def self.default_data_dir
|
10
|
+
File.expand_path("../../../data", __FILE__)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
8
14
|
class_option :verbose,
|
9
15
|
:type => :boolean,
|
10
16
|
:default => false,
|
@@ -37,8 +43,7 @@ module Pkgr
|
|
37
43
|
:desc => "Maintainer"
|
38
44
|
method_option :vendor,
|
39
45
|
:type => :string,
|
40
|
-
:desc => "Package vendor"
|
41
|
-
:default => "pkgr <https://github.com/crohr/pkgr>"
|
46
|
+
:desc => "Package vendor"
|
42
47
|
method_option :architecture,
|
43
48
|
:type => :string,
|
44
49
|
:default => "x86_64",
|
@@ -52,6 +57,10 @@ module Pkgr
|
|
52
57
|
method_option :description,
|
53
58
|
:type => :string,
|
54
59
|
:desc => "Project description"
|
60
|
+
method_option :category,
|
61
|
+
:type => :string,
|
62
|
+
:default => "none",
|
63
|
+
:desc => "Category this package belongs to"
|
55
64
|
method_option :version,
|
56
65
|
:type => :string,
|
57
66
|
:desc => "Package version (if git directory given, it will use the latest git tag available)"
|
@@ -100,6 +109,10 @@ module Pkgr
|
|
100
109
|
:type => :array,
|
101
110
|
:default => [],
|
102
111
|
:desc => "Specific system dependencies that must be present before building"
|
112
|
+
method_option :disable_default_dependencies,
|
113
|
+
:type => :boolean,
|
114
|
+
:default => false,
|
115
|
+
:desc => "Disable default dependencies"
|
103
116
|
method_option :host,
|
104
117
|
:type => :string,
|
105
118
|
:desc => "Remote host to build on (default: local machine)"
|
@@ -129,10 +142,23 @@ module Pkgr
|
|
129
142
|
:type => :boolean,
|
130
143
|
:default => true,
|
131
144
|
:desc => "Verifies output package"
|
145
|
+
method_option :data_dir,
|
146
|
+
:type => :string,
|
147
|
+
:default => default_data_dir,
|
148
|
+
:desc => "Custom path to data directory. Can be used for overriding default templates, hooks(pre-, post- scripts), configs (buildpacks, distro dependencies), environments, etc."
|
149
|
+
method_option :directories,
|
150
|
+
:type => :string,
|
151
|
+
:default => nil,
|
152
|
+
:desc => "Recursively mark a directory as being owned by the package"
|
153
|
+
method_option :disable_cli,
|
154
|
+
:type => :boolean,
|
155
|
+
:default => false,
|
156
|
+
:desc => "Disable installing CLI"
|
132
157
|
|
133
158
|
def package(tarball)
|
134
159
|
Pkgr.level = Logger::INFO if options[:verbose]
|
135
160
|
Pkgr.level = Logger::DEBUG if options[:debug]
|
161
|
+
Pkgr.data_dir = options[:data_dir]
|
136
162
|
|
137
163
|
Pkgr::Buildpack.buildpacks_cache_dir = options[:buildpacks_cache_dir] if options[:buildpacks_cache_dir]
|
138
164
|
|
data/lib/pkgr/config.rb
CHANGED
@@ -73,7 +73,19 @@ module Pkgr
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def cli?
|
76
|
-
|
76
|
+
if disable_cli.nil?
|
77
|
+
@table.has_key?(:cli) ? @table[:cli] : true
|
78
|
+
else
|
79
|
+
!disable_cli
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def skip_default_dependencies?
|
84
|
+
if disable_default_dependencies.nil?
|
85
|
+
@table[:default_dependencies] === false
|
86
|
+
else
|
87
|
+
disable_default_dependencies == true
|
88
|
+
end
|
77
89
|
end
|
78
90
|
|
79
91
|
def home
|
@@ -104,6 +116,10 @@ module Pkgr
|
|
104
116
|
@table[:maintainer] || "<someone@pkgr>"
|
105
117
|
end
|
106
118
|
|
119
|
+
def vendor
|
120
|
+
@table[:vendor] || "pkgr <https://github.com/crohr/pkgr>"
|
121
|
+
end
|
122
|
+
|
107
123
|
def env
|
108
124
|
@table[:env].is_a?(Pkgr::Env) ? @table[:env] : Pkgr::Env.new(@table[:env])
|
109
125
|
end
|
@@ -27,6 +27,13 @@ module Pkgr
|
|
27
27
|
[os, release].join("-")
|
28
28
|
end # def slug
|
29
29
|
|
30
|
+
def target
|
31
|
+
{
|
32
|
+
"centos-6" => "el:6",
|
33
|
+
"centos-7" => "el:7"
|
34
|
+
}.fetch(slug, slug.sub("-", ":"))
|
35
|
+
end
|
36
|
+
|
30
37
|
def package_test_command(package)
|
31
38
|
raise NotImplementedError, "package_test_command must be implemented"
|
32
39
|
end
|
@@ -80,6 +87,7 @@ module Pkgr
|
|
80
87
|
|
81
88
|
def dependencies(other_dependencies = nil)
|
82
89
|
deps = YAML.load_file(data_file("dependencies", "#{os}.yml"))
|
90
|
+
deps = {} if config.skip_default_dependencies?
|
83
91
|
(deps["default"] || []) | (deps[slug] || []) | (other_dependencies || [])
|
84
92
|
end # def dependencies
|
85
93
|
|
@@ -5,7 +5,6 @@ require 'pkgr/fpm_command'
|
|
5
5
|
|
6
6
|
module Pkgr
|
7
7
|
module Distributions
|
8
|
-
# Contains the various components required to make a packaged app integrate well with a Debian system.
|
9
8
|
class Sles < Base
|
10
9
|
# Only keep major digits
|
11
10
|
def release
|
@@ -25,7 +24,12 @@ module Pkgr
|
|
25
24
|
end
|
26
25
|
|
27
26
|
def installer_dependencies
|
28
|
-
|
27
|
+
if release.to_i > 11
|
28
|
+
super.push("which").push("net-tools").uniq
|
29
|
+
else
|
30
|
+
# sles-11 already has which installed
|
31
|
+
super.push("net-tools").uniq
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
def fpm_command(build_dir)
|
@@ -42,6 +46,3 @@ module Pkgr
|
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
45
|
-
|
46
|
-
require 'pkgr/distributions/redhat'
|
47
|
-
require 'pkgr/distributions/centos'
|
@@ -10,7 +10,12 @@ module Pkgr
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def runner
|
13
|
-
@runner ||=
|
13
|
+
@runner ||= case release
|
14
|
+
when /^16.04/
|
15
|
+
Runner.new("systemd", "default", "systemctl")
|
16
|
+
else
|
17
|
+
Runner.new("upstart", "1.5", "initctl")
|
18
|
+
end
|
14
19
|
end
|
15
20
|
|
16
21
|
def templates
|
data/lib/pkgr/fpm_command.rb
CHANGED
@@ -31,11 +31,13 @@ module Pkgr
|
|
31
31
|
list << "--description" << config.description
|
32
32
|
list << "--maintainer" << config.maintainer
|
33
33
|
list << "--vendor" << config.vendor
|
34
|
-
list <<
|
34
|
+
list << "--category" << config.category
|
35
|
+
list << "--template-scripts"
|
35
36
|
list << "--before-install" << distribution.preinstall_file
|
36
37
|
list << "--after-install" << distribution.postinstall_file
|
37
38
|
list << "--before-remove" << distribution.preuninstall_file
|
38
39
|
list << "--after-remove" << distribution.postuninstall_file
|
40
|
+
list << "--directories" << config.directories unless config.directories.nil?
|
39
41
|
distribution.dependencies(config.dependencies).each{|d| list << "-d" << d}
|
40
42
|
list.compact
|
41
43
|
end
|
data/lib/pkgr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pkgr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Rohr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -136,10 +136,12 @@ files:
|
|
136
136
|
- data/buildpacks/debian-7
|
137
137
|
- data/buildpacks/debian-8
|
138
138
|
- data/buildpacks/fedora-20
|
139
|
+
- data/buildpacks/sles-11
|
139
140
|
- data/buildpacks/sles-12
|
140
141
|
- data/buildpacks/ubuntu-10.04
|
141
142
|
- data/buildpacks/ubuntu-12.04
|
142
143
|
- data/buildpacks/ubuntu-14.04
|
144
|
+
- data/buildpacks/ubuntu-16.04
|
143
145
|
- data/cli/cli.sh.erb
|
144
146
|
- data/dependencies/amazon.yml
|
145
147
|
- data/dependencies/centos.yml
|