pkgr 1.4.3 → 1.4.4
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 -4
- data/data/build_dependencies/amazon.yml +13 -0
- data/data/buildpacks/amazon-2014 +3 -0
- data/data/buildpacks/amazon-2015 +3 -0
- data/data/buildpacks/centos-7 +3 -0
- data/data/buildpacks/debian-8 +3 -0
- data/data/cli/cli.sh.erb +37 -13
- data/data/dependencies/amazon.yml +9 -0
- data/data/environment/default.erb +0 -2
- data/data/hooks/postuninstall.sh +1 -1
- data/data/hooks/preinstall.sh +2 -2
- data/data/hooks/preuninstall.sh +1 -1
- data/data/init/systemd/default/master.service.erb +9 -0
- data/data/init/systemd/default/process.service.erb +15 -0
- data/data/init/systemd/default/process_master.service.erb +11 -0
- data/data/init/upstart/1.5/master.conf.erb +1 -1
- data/lib/pkgr/addon.rb +31 -86
- data/lib/pkgr/builder.rb +1 -24
- data/lib/pkgr/config.rb +7 -9
- data/lib/pkgr/dispatcher.rb +5 -0
- data/lib/pkgr/distributions/amazon.rb +6 -0
- data/lib/pkgr/distributions/base.rb +0 -4
- data/lib/pkgr/distributions/centos.rb +2 -14
- data/lib/pkgr/distributions/debian.rb +6 -14
- data/lib/pkgr/distributions/redhat.rb +20 -1
- data/lib/pkgr/distributions/runner.rb +12 -0
- data/lib/pkgr/installer.rb +1 -5
- data/lib/pkgr/version.rb +1 -1
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cff78ecb5e5e84c04eb9c36a903664cdfc4195c2
|
4
|
+
data.tar.gz: f09cd0f332a66eceee72cf9afd32dba516acf7ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f620bd526031ff7a80fd21a6fdd745b6fa69578f11215addae6c1105f1670dff0037f504452350bbf9a0edbcc8bd24ca61461be81b7d083aaceb6407ae1eb50
|
7
|
+
data.tar.gz: 07443778726b8dbd8d703a4fd71b7677b3cc6414aa9d5a08156495bb26eb2efcfc2903c0496a9877728a83de56567d1aaa516d5026cdd93bd47a088244c3750e
|
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
## Goal
|
4
4
|
|
5
|
-
Make debian or rpm packages out of any app, including init script, logrotate, etc. Excellent way to distribute apps or command line tools without complicated installation instructions.
|
5
|
+
Make debian or rpm packages out of any app, including init script, crons, logrotate, etc. Excellent way to distribute apps or command line tools without complicated installation instructions.
|
6
6
|
|
7
|
-
Hosted service available at <https://packager.io/>.
|
7
|
+
Hosted service available at <https://packager.io/>. Free for OpenSource apps.
|
8
8
|
|
9
9
|
## Officially supported languages
|
10
10
|
|
@@ -12,15 +12,19 @@ Hosted service available at <https://packager.io/>.
|
|
12
12
|
* NodeJS
|
13
13
|
* Go
|
14
14
|
|
15
|
-
You can also point to other buildpacks ([doc](https://packager.io/documentation/
|
15
|
+
You can also point to other buildpacks ([doc](https://packager.io/documentation/customizing-the-build/#buildpack)). They may just work.
|
16
16
|
|
17
17
|
## Supported distributions (64bits only)
|
18
18
|
|
19
19
|
* Ubuntu 14.04 ("trusty")
|
20
20
|
* Ubuntu 12.04 ("precise")
|
21
|
+
* Debian 8 ("jessie")
|
21
22
|
* Debian 7 ("wheezy")
|
22
|
-
*
|
23
|
+
* RHEL/CentOS 7
|
24
|
+
* RHEL/CentOS 6
|
25
|
+
* Suse Linux Enterprise Server 12
|
23
26
|
* Fedora 20
|
27
|
+
* Amazon Linux AMI 2014
|
24
28
|
|
25
29
|
## Examples
|
26
30
|
|
@@ -146,6 +150,14 @@ If you get the following error `ERROR: While executing gem ... (ArgumentError)
|
|
146
150
|
export LC_ALL=en_US.UTF-8
|
147
151
|
sudo gem install pkgr
|
148
152
|
|
153
|
+
Looking for the init script? It is created the first time you run this command
|
154
|
+
|
155
|
+
sudo my-app scale web=1 worker=1
|
156
|
+
|
157
|
+
Issue getting nokogiri to compile? Try the following based on this [comment](https://github.com/crohr/pkgr/issues/60#issuecomment-96631181):
|
158
|
+
|
159
|
+
bundle config --local build.nokogiri "--use-system-libraries --with-xml2-include=/usr/include/libxml2"
|
160
|
+
|
149
161
|
## Authors
|
150
162
|
|
151
163
|
* Cyril Rohr <cyril.rohr@gmail.com> - <http://crohr.me>, <https://packager.io>
|
data/data/cli/cli.sh.erb
CHANGED
@@ -29,6 +29,7 @@ usage() {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
DEFAULT_FILE=$(_p "/etc/default/${APP_NAME}")
|
32
|
+
SYSTEMD_DIR=$(_p "/etc/systemd/system")
|
32
33
|
|
33
34
|
. ${DEFAULT_FILE}
|
34
35
|
|
@@ -86,6 +87,8 @@ current_number_of_processes() {
|
|
86
87
|
PROCESS_NAME="$1"
|
87
88
|
if [ "${APP_RUNNER_TYPE}" = "upstart" ]; then
|
88
89
|
echo $(ls -rv1 $(_p /etc/init/)${APP_NAME}-${PROCESS_NAME}-*.conf 2>/dev/null | head -1 | sed -r 's/.*\-([0-9]+)\.conf/\1/g')
|
90
|
+
elif [ "${APP_RUNNER_TYPE}" = "systemd" ]; then
|
91
|
+
echo $(ls -rv1 $SYSTEMD_DIR/${APP_NAME}-${PROCESS_NAME}-*.service 2>/dev/null | head -1 | sed -r 's/.*\-([0-9]+)\.service/\1/g')
|
89
92
|
else
|
90
93
|
echo $(ls -rv1 $(_p /etc/init.d/)${APP_NAME}-${PROCESS_NAME}-* 2>/dev/null | head -1 | sed -r 's/.*\-([0-9]+)/\1/g')
|
91
94
|
fi
|
@@ -114,6 +117,8 @@ sysv_enable() {
|
|
114
117
|
$APP_RUNNER_CLI "$name" on
|
115
118
|
elif [ "$APP_RUNNER_CLI" = "update-rc.d" ] ; then
|
116
119
|
$APP_RUNNER_CLI "$name" defaults
|
120
|
+
elif [ "$APP_RUNNER_CLI" = "systemctl" ] ; then
|
121
|
+
$APP_RUNNER_CLI enable "$name"
|
117
122
|
fi
|
118
123
|
}
|
119
124
|
|
@@ -123,6 +128,8 @@ sysv_disable() {
|
|
123
128
|
$APP_RUNNER_CLI "$name" off
|
124
129
|
elif [ "$APP_RUNNER_CLI" = "update-rc.d" ] ; then
|
125
130
|
$APP_RUNNER_CLI -f "$name" remove
|
131
|
+
elif [ "$APP_RUNNER_CLI" = "systemctl" ] ; then
|
132
|
+
$APP_RUNNER_CLI disable "$name"
|
126
133
|
fi
|
127
134
|
}
|
128
135
|
|
@@ -157,6 +164,30 @@ scale_up() {
|
|
157
164
|
|
158
165
|
$APP_RUNNER_CLI start ${APP_NAME}-${PROCESS_NAME} || true
|
159
166
|
$APP_RUNNER_CLI start ${APP_NAME} || true
|
167
|
+
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
|
+
for i in $(seq ${SCALE_DELTA}); do
|
178
|
+
index=$((${i} + ${CURRENT_SCALE}))
|
179
|
+
PROCESS_ID="${APP_NAME}-${PROCESS_NAME}-${index}"
|
180
|
+
cp ${source}/${APP_NAME}-${PROCESS_NAME}-PROCESS_NUM.service $SYSTEMD_DIR/${PROCESS_ID}.service
|
181
|
+
port=$((${PORT} + ${index} - 1))
|
182
|
+
|
183
|
+
update_port $SYSTEMD_DIR/${PROCESS_ID}.service "${PROCESS_NAME}" $port $index
|
184
|
+
|
185
|
+
$APP_RUNNER_CLI enable "${PROCESS_ID}.service"
|
186
|
+
done
|
187
|
+
|
188
|
+
$APP_RUNNER_CLI daemon-reload
|
189
|
+
$APP_RUNNER_CLI start ${APP_NAME}-${PROCESS_NAME}.service
|
190
|
+
$APP_RUNNER_CLI start ${APP_NAME}.service
|
160
191
|
else
|
161
192
|
cp $(_p "${APP_HOME}/vendor/pkgr/scaling/sysv/${APP_NAME}") $(_p /etc/init.d/)
|
162
193
|
chmod a+x $(_p "/etc/init.d/${APP_NAME}")
|
@@ -192,8 +223,12 @@ scale_down() {
|
|
192
223
|
PROCESS_ID="${APP_NAME}-${PROCESS_NAME}-${index}"
|
193
224
|
|
194
225
|
if [ "${APP_RUNNER_TYPE}" = "upstart" ]; then
|
195
|
-
$APP_RUNNER_CLI stop "${PROCESS_ID}" ||
|
226
|
+
$APP_RUNNER_CLI stop "${PROCESS_ID}" || true # dont fail if server stopped differently
|
196
227
|
rm -f $(_p "/etc/init/${PROCESS_ID}.conf")
|
228
|
+
elif [ "${APP_RUNNER_TYPE}" = "systemd" ]; then
|
229
|
+
$APP_RUNNER_CLI stop "${PROCESS_ID}.service" || true # dont fail if server stopped differently
|
230
|
+
$APP_RUNNER_CLI disable "${PROCESS_ID}.service" || true
|
231
|
+
rm -f $SYSTEMD_DIR/${PROCESS_ID}.service
|
197
232
|
else
|
198
233
|
$(_p "/etc/init.d/${PROCESS_ID}") stop
|
199
234
|
sysv_disable ${PROCESS_ID}
|
@@ -231,18 +266,7 @@ configure() {
|
|
231
266
|
}
|
232
267
|
|
233
268
|
reconfigure() {
|
234
|
-
|
235
|
-
configure --reconfigure
|
236
|
-
else
|
237
|
-
# only available for debian for now
|
238
|
-
if which dpkg-reconfigure &>/dev/null ; then
|
239
|
-
for addon in ${APP_ADDONS}; do
|
240
|
-
dpkg-reconfigure "${APP_NAME}-${addon}"
|
241
|
-
done
|
242
|
-
# always reconfigure main package as well
|
243
|
-
dpkg-reconfigure "${APP_NAME}"
|
244
|
-
fi
|
245
|
-
fi
|
269
|
+
configure --reconfigure
|
246
270
|
}
|
247
271
|
|
248
272
|
while : ; do
|
@@ -7,8 +7,6 @@ export APP_USER="<%= user %>"
|
|
7
7
|
export APP_WIZARDS="<%= wizards.map{|wizard_group| wizard_group.map{|w| w.name}.join("|")}.join(",") %>"
|
8
8
|
export APP_RUNNER_TYPE="<%= distribution.runner.type %>"
|
9
9
|
export APP_RUNNER_CLI="<%= distribution.runner.cli %>"
|
10
|
-
# Legacy addons
|
11
|
-
export APP_ADDONS="<%= addons.map{|addon| addon.name}.join(" ") %>"
|
12
10
|
export PORT=${PORT:=6000}
|
13
11
|
<% if cli.is_a?(String) %>
|
14
12
|
export HOME=${HOME:="/home/<%= user %>"}
|
data/data/hooks/postuninstall.sh
CHANGED
data/data/hooks/preinstall.sh
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/
|
1
|
+
#!/bin/bash
|
2
2
|
|
3
3
|
set -e
|
4
4
|
|
@@ -8,7 +8,7 @@ export APP_GROUP="<%= group %>"
|
|
8
8
|
export APP_HOME="<%= home %>"
|
9
9
|
|
10
10
|
if ! getent passwd "${APP_USER}" > /dev/null; then
|
11
|
-
if [ -f /etc/redhat-release ] || [ -f /etc/SuSE-release ]; then
|
11
|
+
if [ -f /etc/redhat-release ] || [ -f /etc/system-release ] || [ -f /etc/SuSE-release ]; then
|
12
12
|
if ! getent group "${APP_GROUP}" > /dev/null ; then
|
13
13
|
groupadd --system "${APP_GROUP}"
|
14
14
|
fi
|
data/data/hooks/preuninstall.sh
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
[Unit]
|
2
|
+
StopWhenUnneeded=true
|
3
|
+
Requires=<%= name %>-<%= process_name %>.service
|
4
|
+
After=<%= name %>-<%= process_name %>.service
|
5
|
+
|
6
|
+
[Service]
|
7
|
+
Environment=PORT=PORT_NUM
|
8
|
+
ExecStart=/usr/bin/<%= name %> run <%= process_name %>
|
9
|
+
Restart=always
|
10
|
+
StandardOutput=syslog
|
11
|
+
StandardError=syslog
|
12
|
+
SyslogIdentifier=%n
|
13
|
+
|
14
|
+
[Install]
|
15
|
+
WantedBy=<%= name %>-<%= process_name %>.service
|
@@ -1,6 +1,6 @@
|
|
1
1
|
start on (started network-interface
|
2
2
|
or started network-manager
|
3
|
-
or started networking)
|
3
|
+
or started networking) and filesystem
|
4
4
|
|
5
5
|
# The `networking` job is a task, which means it will be stopped after the network interfaces have been configured.
|
6
6
|
# That's why we don't stop on "stopping networking".
|
data/lib/pkgr/addon.rb
CHANGED
@@ -1,110 +1,55 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
1
3
|
module Pkgr
|
2
4
|
class Addon
|
3
|
-
|
4
|
-
attr_reader :config
|
5
|
-
|
6
|
-
def initialize(nickname, addons_dir, config)
|
5
|
+
def initialize(nickname)
|
7
6
|
@nickname = nickname
|
8
|
-
@addons_dir = addons_dir
|
9
|
-
@config = config
|
10
7
|
end
|
11
8
|
|
12
9
|
def name
|
13
|
-
File.basename(
|
10
|
+
File.basename(url).sub("addon-", "")
|
14
11
|
end
|
15
12
|
|
16
|
-
def
|
17
|
-
|
13
|
+
def install!(dir, shell = Command.new(Pkgr.logger))
|
14
|
+
addon_dir = "#{dir}/#{name}"
|
15
|
+
FileUtils.mkdir_p addon_dir
|
16
|
+
puts "-----> [wizard] adding #{name} wizard (#{url}##{branch})"
|
17
|
+
if url.is_a?(Pathname)
|
18
|
+
shell.run! "cp -r #{url}/* #{addon_dir}"
|
19
|
+
else
|
20
|
+
shell.run! "curl -L --max-redirs 3 --retry 5 -s '#{tarball_url}' | tar xzf - --strip-components=1 -C '#{addon_dir}'"
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
|
-
|
21
|
-
if nickname.start_with?("http")
|
22
|
-
url_without_branch
|
23
|
-
else
|
24
|
-
user, repo = nickname.split("/", 2)
|
25
|
-
user, repo = "pkgr", user if repo.nil?
|
26
|
-
repo = "addon-#{repo}" unless repo.start_with?("addon-")
|
24
|
+
private
|
27
25
|
|
28
|
-
|
26
|
+
def url
|
27
|
+
@url ||= begin
|
28
|
+
if @nickname.is_a?(Pathname)
|
29
|
+
@nickname
|
30
|
+
elsif @nickname.start_with?("http")
|
31
|
+
url_without_branch
|
32
|
+
else
|
33
|
+
user, repo = @nickname.split("/", 2)
|
34
|
+
user, repo = "pkgr", user if repo.nil?
|
35
|
+
repo = "addon-#{repo}" unless repo.start_with?("addon-")
|
36
|
+
|
37
|
+
"https://github.com/#{user}/#{repo}"
|
38
|
+
end
|
29
39
|
end
|
30
40
|
end
|
31
41
|
|
32
42
|
def branch
|
33
|
-
|
43
|
+
return if url.is_a?(Pathname)
|
44
|
+
@nickname.split("#")[1] || "master"
|
34
45
|
end
|
35
46
|
|
36
47
|
def tarball_url
|
37
48
|
"#{url}/archive/#{branch}.tar.gz"
|
38
49
|
end
|
39
50
|
|
40
|
-
def
|
41
|
-
[
|
42
|
-
[config.name, name].join("-"),
|
43
|
-
"(= #{config.version}-#{config.iteration})"
|
44
|
-
].join(" ")
|
45
|
-
end
|
46
|
-
|
47
|
-
def debtemplates
|
48
|
-
debtemplates_file = File.join(dir, "debian", "templates")
|
49
|
-
if File.exists?(debtemplates_file)
|
50
|
-
File.new(debtemplates_file)
|
51
|
-
else
|
52
|
-
StringIO.new
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def debconfig
|
57
|
-
debconfig_file = File.join(dir, "debian", "config")
|
58
|
-
if File.exists?(debconfig_file)
|
59
|
-
File.new(debconfig_file)
|
60
|
-
else
|
61
|
-
StringIO.new
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def install!(src_dir)
|
66
|
-
install_addon = Mixlib::ShellOut.new %{curl -L --max-redirs 3 --retry 5 -s '#{tarball_url}' | tar xzf - --strip-components=1 -C '#{dir}'}
|
67
|
-
install_addon.logger = Pkgr.logger
|
68
|
-
install_addon.run_command
|
69
|
-
install_addon.error!
|
70
|
-
|
71
|
-
# TODO: remove args from command once all addons use env variables
|
72
|
-
compile_addon = Mixlib::ShellOut.new(%{#{dir}/bin/compile '#{config.name}' '#{config.version}' '#{config.iteration}' '#{src_dir}' 2>&1}, {
|
73
|
-
:environment => {
|
74
|
-
"APP_NAME" => config.name,
|
75
|
-
"APP_VERSION" => config.version,
|
76
|
-
"APP_ITERATION" => config.iteration,
|
77
|
-
"APP_SAFE_NAME" => config.name.gsub("-", "_"),
|
78
|
-
"APP_USER" => config.user,
|
79
|
-
"APP_GROUP" => config.group,
|
80
|
-
"APP_WORKSPACE" => src_dir
|
81
|
-
}
|
82
|
-
})
|
83
|
-
compile_addon.logger = Pkgr.logger
|
84
|
-
compile_addon.live_stream = LiveStream.new(STDOUT)
|
85
|
-
compile_addon.run_command
|
86
|
-
compile_addon.error!
|
87
|
-
end
|
88
|
-
|
89
|
-
def dir
|
90
|
-
@dir ||= begin
|
91
|
-
directory = File.join(addons_dir, File.basename(name))
|
92
|
-
FileUtils.mkdir_p(directory)
|
93
|
-
directory
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
class LiveStream
|
98
|
-
attr_reader :stream
|
99
|
-
def initialize(stream = STDOUT)
|
100
|
-
@stream = stream
|
101
|
-
end
|
102
|
-
|
103
|
-
def <<(data)
|
104
|
-
data.split("\n").each do |line|
|
105
|
-
stream.puts " #{line}"
|
106
|
-
end
|
107
|
-
end
|
51
|
+
def url_without_branch
|
52
|
+
@nickname.split("#")[0].sub(/\.git$/,'')
|
108
53
|
end
|
109
54
|
end
|
110
55
|
end
|
data/lib/pkgr/builder.rb
CHANGED
@@ -24,13 +24,7 @@ module Pkgr
|
|
24
24
|
update_config
|
25
25
|
check
|
26
26
|
setup
|
27
|
-
|
28
|
-
if config.installer
|
29
|
-
setup_pipeline
|
30
|
-
else
|
31
|
-
setup_addons
|
32
|
-
end
|
33
|
-
|
27
|
+
setup_pipeline
|
34
28
|
compile
|
35
29
|
write_env
|
36
30
|
write_init
|
@@ -74,8 +68,6 @@ module Pkgr
|
|
74
68
|
end
|
75
69
|
end
|
76
70
|
config.distribution = distribution
|
77
|
-
# required to build proper Addon objects
|
78
|
-
config.addons_dir = addons_dir
|
79
71
|
# useful for templates that need to read files
|
80
72
|
config.source_dir = source_dir
|
81
73
|
config.build_dir = build_dir
|
@@ -112,17 +104,6 @@ module Pkgr
|
|
112
104
|
end
|
113
105
|
end
|
114
106
|
|
115
|
-
# LEGACY, remove once openproject no longer needs it
|
116
|
-
# If addons are declared in .pkgr.yml, add them
|
117
|
-
def setup_addons
|
118
|
-
config.addons.each do |addon|
|
119
|
-
puts "-----> [addon] #{addon.name} (#{addon.url} @ #{addon.branch})"
|
120
|
-
addon.install!(source_dir)
|
121
|
-
dependency = distribution.add_addon(addon)
|
122
|
-
config.dependencies.push(dependency) if dependency
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
107
|
# Pass the app through the buildpack
|
127
108
|
def compile
|
128
109
|
if buildpack_for_app
|
@@ -263,10 +244,6 @@ module Pkgr
|
|
263
244
|
File.join(source_dir, "vendor", "pkgr")
|
264
245
|
end
|
265
246
|
|
266
|
-
def addons_dir
|
267
|
-
File.join(vendor_dir, "addons")
|
268
|
-
end
|
269
|
-
|
270
247
|
# Directory where binstubs will be created for the corresponding Procfile commands.
|
271
248
|
def proc_dir
|
272
249
|
File.join(vendor_dir, "processes")
|
data/lib/pkgr/config.rb
CHANGED
@@ -9,7 +9,8 @@ module Pkgr
|
|
9
9
|
"ubuntu-lucid" => "ubuntu-10.04",
|
10
10
|
"ubuntu-precise" => "ubuntu-12.04",
|
11
11
|
"debian-squeeze" => "debian-6",
|
12
|
-
"debian-wheezy" => "debian-7"
|
12
|
+
"debian-wheezy" => "debian-7",
|
13
|
+
"debian-jessie" => "debian-8"
|
13
14
|
}
|
14
15
|
|
15
16
|
class << self
|
@@ -122,13 +123,6 @@ module Pkgr
|
|
122
123
|
@errors ||= []
|
123
124
|
end
|
124
125
|
|
125
|
-
def addons
|
126
|
-
# make proper Addon objects out of existing addon slugs
|
127
|
-
(@table[:addons] || []).map do |addon_slug|
|
128
|
-
Addon.new(addon_slug, addons_dir, self)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
126
|
def installer
|
133
127
|
return nil if @table[:installer].nil? || @table[:installer] == false
|
134
128
|
@table[:installer]
|
@@ -137,7 +131,11 @@ module Pkgr
|
|
137
131
|
def wizards
|
138
132
|
@wizards ||= (@table[:wizards] || []).map do |wizard_string|
|
139
133
|
wizard_string.split(/\s*\|\s*/).map do |wizard|
|
140
|
-
|
134
|
+
if wizard.start_with?('.')
|
135
|
+
wizard = Pathname.new(source_dir).join(wizard).realpath
|
136
|
+
end
|
137
|
+
|
138
|
+
Addon.new(wizard)
|
141
139
|
end
|
142
140
|
end
|
143
141
|
end
|
data/lib/pkgr/dispatcher.rb
CHANGED
@@ -40,6 +40,11 @@ module Pkgr
|
|
40
40
|
# Remove any non-digit characters that may be before the version number
|
41
41
|
config.version ||= begin
|
42
42
|
v = (Git.new(path).latest_tag || "").gsub(/^[^\d]+(\d.*)/, '\1')
|
43
|
+
# If it's not a Git archive, try to figure out svn revision number
|
44
|
+
begin
|
45
|
+
v = `cd #{path.to_s}&&svn info|grep Revision`.to_s.gsub!(/\D/, "") if (v !~ /^\d/)
|
46
|
+
rescue
|
47
|
+
end
|
43
48
|
v = "0.0.0" if v !~ /^\d/
|
44
49
|
v
|
45
50
|
end
|
@@ -1,20 +1,8 @@
|
|
1
|
-
require "pkgr/distributions/
|
1
|
+
require "pkgr/distributions/redhat"
|
2
2
|
|
3
3
|
module Pkgr
|
4
4
|
module Distributions
|
5
|
-
|
6
|
-
class Centos < Fedora
|
7
|
-
def runner
|
8
|
-
# in truth it is 0.6.5, but it also works with 1.5 templates.
|
9
|
-
# maybe adopt the same structure as pleaserun, with defaults, etc.
|
10
|
-
@runner ||= Runner.new("upstart", "1.5", "initctl")
|
11
|
-
end
|
12
|
-
|
13
|
-
def templates
|
14
|
-
list = super
|
15
|
-
list.push Templates::DirTemplate.new("etc/init")
|
16
|
-
list
|
17
|
-
end
|
5
|
+
class Centos < Redhat
|
18
6
|
end
|
19
7
|
end
|
20
8
|
end
|
@@ -13,7 +13,12 @@ module Pkgr
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def runner
|
16
|
-
@runner ||=
|
16
|
+
@runner ||= case release
|
17
|
+
when /^8/
|
18
|
+
Runner.new("systemd", "default", "systemctl")
|
19
|
+
else
|
20
|
+
Runner.new("sysv", "lsb-3.1", "update-rc.d")
|
21
|
+
end
|
17
22
|
end
|
18
23
|
|
19
24
|
def package_test_command(package)
|
@@ -58,19 +63,6 @@ module Pkgr
|
|
58
63
|
@debtemplates ||= Tempfile.new("debtemplates")
|
59
64
|
end
|
60
65
|
|
61
|
-
def add_addon(addon)
|
62
|
-
# make a debian package out of the addon
|
63
|
-
Dir.chdir(addon.dir) do
|
64
|
-
make_package = Mixlib::ShellOut.new %{dpkg-buildpackage -b -d}
|
65
|
-
make_package.logger = Pkgr.logger
|
66
|
-
make_package.run_command
|
67
|
-
make_package.error!
|
68
|
-
end
|
69
|
-
FileUtils.mv(Dir.glob(File.join(File.dirname(addon.dir), "*.deb")), Dir.pwd)
|
70
|
-
# return name of the dependency
|
71
|
-
addon.debian_dependency_name
|
72
|
-
end
|
73
|
-
|
74
66
|
class DebianFpmCommand < FpmCommand
|
75
67
|
def args
|
76
68
|
list = super
|
@@ -2,8 +2,27 @@ module Pkgr
|
|
2
2
|
module Distributions
|
3
3
|
class Redhat < Fedora
|
4
4
|
def runner
|
5
|
-
@runner ||=
|
5
|
+
@runner ||= case release
|
6
|
+
when /^6/
|
7
|
+
Runner.new("upstart", "1.5", "initctl")
|
8
|
+
else
|
9
|
+
# newer releases default to using systemd as the init system
|
10
|
+
Runner.new("systemd", "default", "systemctl")
|
11
|
+
end
|
6
12
|
end
|
13
|
+
|
14
|
+
def templates
|
15
|
+
if ["centos-6", "redhat-6"].include?(slug)
|
16
|
+
list = super
|
17
|
+
list.push Templates::DirTemplate.new("etc/init")
|
18
|
+
list
|
19
|
+
else
|
20
|
+
super
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
7
24
|
end
|
8
25
|
end
|
9
26
|
end
|
27
|
+
|
28
|
+
require 'pkgr/distributions/amazon'
|
@@ -9,6 +9,10 @@ module Pkgr
|
|
9
9
|
type == "upstart"
|
10
10
|
end
|
11
11
|
|
12
|
+
def systemd?
|
13
|
+
type == "systemd"
|
14
|
+
end
|
15
|
+
|
12
16
|
def templates(process, app_name)
|
13
17
|
send("templates_#{type}", process, app_name)
|
14
18
|
end
|
@@ -31,6 +35,14 @@ module Pkgr
|
|
31
35
|
]
|
32
36
|
end
|
33
37
|
|
38
|
+
def templates_systemd(process, app_name)
|
39
|
+
[
|
40
|
+
Templates::FileTemplate.new("systemd/#{app_name}.service", data_file("master.service.erb")),
|
41
|
+
Templates::FileTemplate.new("systemd/#{app_name}-#{process.name}.service", data_file("process_master.service.erb")),
|
42
|
+
Templates::FileTemplate.new("systemd/#{app_name}-#{process.name}-PROCESS_NUM.service", data_file("process.service.erb"))
|
43
|
+
]
|
44
|
+
end
|
45
|
+
|
34
46
|
def data_file(name)
|
35
47
|
File.new(File.join(Pkgr.data_dir, "init", type, version, name))
|
36
48
|
end
|
data/lib/pkgr/installer.rb
CHANGED
@@ -29,11 +29,7 @@ module Pkgr
|
|
29
29
|
Dir.chdir(installer_tmp_dir) do
|
30
30
|
config.wizards.each do |addon_group|
|
31
31
|
addon_group.each do |addon|
|
32
|
-
|
33
|
-
FileUtils.mkdir_p addon_dir
|
34
|
-
puts "-----> [wizard] adding #{addon.name} wizard (#{addon.url}##{addon.branch})"
|
35
|
-
shell.run!(
|
36
|
-
"curl -L --max-redirs 3 --retry 5 -s '#{addon.tarball_url}' | tar xzf - --strip-components=1 -C '#{addon_dir}'")
|
32
|
+
addon.install! 'addons'
|
37
33
|
end
|
38
34
|
end
|
39
35
|
|
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.
|
4
|
+
version: 1.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Rohr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -122,20 +122,26 @@ files:
|
|
122
122
|
- LICENSE
|
123
123
|
- README.md
|
124
124
|
- bin/pkgr
|
125
|
+
- data/build_dependencies/amazon.yml
|
125
126
|
- data/build_dependencies/centos.yml
|
126
127
|
- data/build_dependencies/debian.yml
|
127
128
|
- data/build_dependencies/fedora.yml
|
128
129
|
- data/build_dependencies/sles.yml
|
129
130
|
- data/build_dependencies/ubuntu.yml
|
131
|
+
- data/buildpacks/amazon-2014
|
132
|
+
- data/buildpacks/amazon-2015
|
130
133
|
- data/buildpacks/centos-6
|
134
|
+
- data/buildpacks/centos-7
|
131
135
|
- data/buildpacks/debian-6
|
132
136
|
- data/buildpacks/debian-7
|
137
|
+
- data/buildpacks/debian-8
|
133
138
|
- data/buildpacks/fedora-20
|
134
139
|
- data/buildpacks/sles-12
|
135
140
|
- data/buildpacks/ubuntu-10.04
|
136
141
|
- data/buildpacks/ubuntu-12.04
|
137
142
|
- data/buildpacks/ubuntu-14.04
|
138
143
|
- data/cli/cli.sh.erb
|
144
|
+
- data/dependencies/amazon.yml
|
139
145
|
- data/dependencies/centos.yml
|
140
146
|
- data/dependencies/debian.yml
|
141
147
|
- data/dependencies/fedora.yml
|
@@ -146,6 +152,9 @@ files:
|
|
146
152
|
- data/hooks/postuninstall.sh
|
147
153
|
- data/hooks/preinstall.sh
|
148
154
|
- data/hooks/preuninstall.sh
|
155
|
+
- data/init/systemd/default/master.service.erb
|
156
|
+
- data/init/systemd/default/process.service.erb
|
157
|
+
- data/init/systemd/default/process_master.service.erb
|
149
158
|
- data/init/sysv/lsb-3.1/master.erb
|
150
159
|
- data/init/sysv/lsb-3.1/process.erb
|
151
160
|
- data/init/sysv/lsb-3.1/process_master.erb
|
@@ -164,6 +173,7 @@ files:
|
|
164
173
|
- lib/pkgr/cron.rb
|
165
174
|
- lib/pkgr/dispatcher.rb
|
166
175
|
- lib/pkgr/distributions.rb
|
176
|
+
- lib/pkgr/distributions/amazon.rb
|
167
177
|
- lib/pkgr/distributions/base.rb
|
168
178
|
- lib/pkgr/distributions/centos.rb
|
169
179
|
- lib/pkgr/distributions/debian.rb
|