pkgr 1.8.0 → 1.9.1
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 +14 -4
- data/data/build_dependencies/centos.yml +8 -2
- data/data/build_dependencies/debian.yml +20 -1
- data/data/build_dependencies/sles.yml +6 -1
- data/data/build_dependencies/ubuntu.yml +14 -1
- data/data/buildpacks/amazon-2014 +3 -3
- data/data/buildpacks/amazon-2015 +3 -3
- data/data/buildpacks/centos-10 +4 -0
- data/data/buildpacks/centos-6 +3 -3
- data/data/buildpacks/centos-7 +3 -3
- data/data/buildpacks/centos-8 +3 -3
- data/data/buildpacks/centos-9 +4 -0
- data/data/buildpacks/debian-10 +3 -3
- data/data/buildpacks/debian-11 +4 -0
- data/data/buildpacks/debian-12 +4 -0
- data/data/buildpacks/debian-13 +4 -0
- data/data/buildpacks/debian-6 +2 -2
- data/data/buildpacks/debian-7 +3 -3
- data/data/buildpacks/debian-8 +3 -3
- data/data/buildpacks/debian-9 +3 -3
- data/data/buildpacks/fedora-20 +3 -3
- data/data/buildpacks/sles-11 +3 -3
- data/data/buildpacks/sles-12 +3 -3
- data/data/buildpacks/sles-15 +3 -0
- data/data/buildpacks/sles-16 +3 -0
- data/data/buildpacks/ubuntu-10.04 +3 -3
- data/data/buildpacks/ubuntu-12.04 +3 -3
- data/data/buildpacks/ubuntu-14.04 +3 -3
- data/data/buildpacks/ubuntu-16.04 +3 -3
- data/data/buildpacks/ubuntu-18.04 +3 -3
- data/data/buildpacks/ubuntu-20.04 +3 -3
- data/data/buildpacks/ubuntu-22.04 +4 -0
- data/data/buildpacks/ubuntu-24.04 +4 -0
- data/data/buildpacks/ubuntu-26.04 +4 -0
- data/data/cli/cli.sh.erb +98 -31
- data/data/dependencies/centos.yml +4 -1
- data/data/dependencies/debian.yml +0 -5
- data/data/dependencies/sles.yml +2 -3
- data/data/dependencies/ubuntu.yml +20 -7
- data/data/hooks/postinstall.sh +9 -5
- data/data/hooks/preinstall.sh +1 -1
- data/data/init/systemd/default/process.service.erb +2 -3
- data/data/init/sysv/lsb-3.1/process.erb +4 -2
- data/lib/pkgr/builder.rb +19 -4
- data/lib/pkgr/buildpack.rb +23 -2
- data/lib/pkgr/config.rb +12 -1
- data/lib/pkgr/cron.rb +1 -1
- data/lib/pkgr/distributions/amazon.rb +3 -5
- data/lib/pkgr/distributions/base.rb +16 -5
- data/lib/pkgr/distributions/debian.rb +8 -4
- data/lib/pkgr/distributions/fedora.rb +4 -0
- data/lib/pkgr/distributions/redhat.rb +0 -1
- data/lib/pkgr/distributions/sles.rb +15 -2
- data/lib/pkgr/env.rb +4 -3
- data/lib/pkgr/env_value.rb +4 -0
- data/lib/pkgr/fpm_command.rb +2 -0
- data/lib/pkgr/version.rb +1 -1
- data/lib/pkgr.rb +9 -0
- metadata +48 -11
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
default:
|
|
2
|
-
- mysql-common
|
|
3
2
|
- libpq5
|
|
4
3
|
- libsqlite3-0
|
|
5
4
|
- openssl
|
|
@@ -7,7 +6,6 @@ default:
|
|
|
7
6
|
- libxslt1.1
|
|
8
7
|
debian-6:
|
|
9
8
|
- libssl0.9.8
|
|
10
|
-
- libmysqlclient16
|
|
11
9
|
- libevent-1.4-2
|
|
12
10
|
- libevent-core-1.4-2
|
|
13
11
|
- libevent-extra-1.4-2
|
|
@@ -15,7 +13,6 @@ debian-6:
|
|
|
15
13
|
- libreadline6
|
|
16
14
|
debian-7:
|
|
17
15
|
- libssl1.0.0
|
|
18
|
-
- libmysqlclient18
|
|
19
16
|
- libevent-2.0-5
|
|
20
17
|
- libevent-core-2.0-5
|
|
21
18
|
- libevent-extra-2.0-5
|
|
@@ -23,7 +20,6 @@ debian-7:
|
|
|
23
20
|
- libreadline6
|
|
24
21
|
debian-8:
|
|
25
22
|
- libssl1.0.0
|
|
26
|
-
- libmysqlclient18
|
|
27
23
|
- libevent-2.0-5
|
|
28
24
|
- libevent-core-2.0-5
|
|
29
25
|
- libevent-extra-2.0-5
|
|
@@ -31,7 +27,6 @@ debian-8:
|
|
|
31
27
|
- libreadline6
|
|
32
28
|
debian-9:
|
|
33
29
|
- libssl1.0.2
|
|
34
|
-
- libmariadbclient18
|
|
35
30
|
- libevent-2.0-5
|
|
36
31
|
- libevent-core-2.0-5
|
|
37
32
|
- libevent-extra-2.0-5
|
data/data/dependencies/sles.yml
CHANGED
|
@@ -1,48 +1,61 @@
|
|
|
1
1
|
default:
|
|
2
|
-
- mysql-common
|
|
3
2
|
- libpq5
|
|
4
3
|
- libsqlite3-0
|
|
5
4
|
- openssl
|
|
6
|
-
- libxml2
|
|
7
5
|
- libxslt1.1
|
|
8
6
|
ubuntu-10.04:
|
|
9
7
|
- libreadline5
|
|
10
8
|
- libssl0.9.8
|
|
11
|
-
- libmysqlclient16
|
|
12
9
|
- libevent-1.4-2
|
|
13
10
|
- libevent-core-1.4-2
|
|
14
11
|
- libevent-extra-1.4-2
|
|
12
|
+
- libxml2
|
|
15
13
|
ubuntu-12.04:
|
|
16
14
|
- libreadline6
|
|
17
15
|
- libssl1.0.0
|
|
18
|
-
- libmysqlclient18
|
|
19
16
|
- libevent-2.0-5
|
|
20
17
|
- libevent-core-2.0-5
|
|
21
18
|
- libevent-extra-2.0-5
|
|
19
|
+
- libxml2
|
|
22
20
|
ubuntu-14.04:
|
|
23
21
|
- libreadline6
|
|
24
22
|
- libssl1.0.0
|
|
25
|
-
- libmysqlclient18
|
|
26
23
|
- libevent-2.0-5
|
|
27
24
|
- libevent-core-2.0-5
|
|
28
25
|
- libevent-extra-2.0-5
|
|
26
|
+
- libxml2
|
|
29
27
|
ubuntu-16.04:
|
|
30
28
|
- libreadline6
|
|
31
29
|
- libssl1.0.0
|
|
32
|
-
- libmysqlclient20
|
|
33
30
|
- libevent-2.0-5
|
|
34
31
|
- libevent-core-2.0-5
|
|
35
32
|
- libevent-extra-2.0-5
|
|
33
|
+
- libxml2
|
|
36
34
|
ubuntu-18.04:
|
|
37
35
|
- libreadline7
|
|
38
36
|
- libssl1.0.0
|
|
39
|
-
- libmysqlclient20
|
|
40
37
|
- libevent-2.1-6
|
|
41
38
|
- libevent-core-2.1-6
|
|
42
39
|
- libevent-extra-2.1-6
|
|
40
|
+
- libxml2
|
|
43
41
|
ubuntu-20.04:
|
|
44
42
|
- libreadline8
|
|
45
43
|
- libssl1.1
|
|
46
44
|
- libevent-2.1-7
|
|
47
45
|
- libevent-core-2.1-7
|
|
48
46
|
- libevent-extra-2.1-7
|
|
47
|
+
- libxml2
|
|
48
|
+
ubuntu-22.04:
|
|
49
|
+
- libreadline8
|
|
50
|
+
- libssl3
|
|
51
|
+
- libev4
|
|
52
|
+
- libxml2
|
|
53
|
+
ubuntu-24.04:
|
|
54
|
+
- libreadline8
|
|
55
|
+
- libssl3
|
|
56
|
+
- libev4
|
|
57
|
+
- libxml2
|
|
58
|
+
ubuntu-26.04:
|
|
59
|
+
- libreadline8
|
|
60
|
+
- libssl3
|
|
61
|
+
- libev4
|
data/data/hooks/postinstall.sh
CHANGED
|
@@ -10,23 +10,27 @@ export APP_HOME="<%= home %>"
|
|
|
10
10
|
HOME_LOGS="${APP_HOME}/log"
|
|
11
11
|
LOGS="/var/log/${APP_NAME}"
|
|
12
12
|
|
|
13
|
-
chown -R ${APP_USER}
|
|
13
|
+
chown -R ${APP_USER}:${APP_GROUP} ${APP_HOME}
|
|
14
14
|
|
|
15
15
|
# link app log directory to /var/log/NAME
|
|
16
16
|
mkdir -p ${LOGS}
|
|
17
17
|
rm -rf ${HOME_LOGS}
|
|
18
|
-
ln -
|
|
19
|
-
chown -R ${APP_USER}
|
|
18
|
+
ln -nfs ${LOGS} ${HOME_LOGS}
|
|
19
|
+
chown -R ${APP_USER}:${APP_GROUP} ${LOGS}
|
|
20
20
|
|
|
21
21
|
# Add default conf.d file
|
|
22
22
|
[ -f /etc/${APP_NAME}/conf.d/other ] || touch /etc/${APP_NAME}/conf.d/other
|
|
23
23
|
|
|
24
|
-
chown -R ${APP_USER}
|
|
25
|
-
chown ${APP_USER}
|
|
24
|
+
chown -R ${APP_USER}:${APP_GROUP} /etc/${APP_NAME}
|
|
25
|
+
chown ${APP_USER}:${APP_GROUP} /var/db/${APP_NAME}
|
|
26
26
|
|
|
27
27
|
chmod 0750 /etc/${APP_NAME} /etc/${APP_NAME}/conf.d
|
|
28
28
|
find /etc/${APP_NAME} -type f -exec chmod 0640 {} +
|
|
29
29
|
|
|
30
|
+
<% if crons.any? %>
|
|
31
|
+
mkdir -p "<%= crons_dir %>"
|
|
32
|
+
<% end %>
|
|
33
|
+
|
|
30
34
|
<% crons.each do |cron| %>
|
|
31
35
|
rm -f <%= cron.destination %>
|
|
32
36
|
cp <%= cron.source %> <%= cron.destination %>
|
data/data/hooks/preinstall.sh
CHANGED
|
@@ -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
|
|
11
|
+
if command -v groupadd &>/dev/null ; then
|
|
12
12
|
if ! getent group "${APP_GROUP}" > /dev/null ; then
|
|
13
13
|
groupadd --system "${APP_GROUP}"
|
|
14
14
|
fi
|
|
@@ -4,12 +4,11 @@ Requires=<%= name %>-<%= process_name %>.service
|
|
|
4
4
|
After=<%= name %>-<%= process_name %>.service
|
|
5
5
|
|
|
6
6
|
[Service]
|
|
7
|
+
User=<%= user %>
|
|
8
|
+
Group=<%= group %>
|
|
7
9
|
Environment=APP_PROCESS_INDEX=__PROCESS_INDEX__
|
|
8
10
|
ExecStart=/usr/bin/<%= name %> run <%= process_name %>
|
|
9
11
|
Restart=always
|
|
10
|
-
StandardOutput=syslog
|
|
11
|
-
StandardError=syslog
|
|
12
|
-
SyslogIdentifier=%n
|
|
13
12
|
|
|
14
13
|
[Install]
|
|
15
14
|
WantedBy=<%= name %>-<%= process_name %>.service
|
|
@@ -24,8 +24,10 @@ full_process_name="${name}-${process_name}-${APP_PROCESS_INDEX}"
|
|
|
24
24
|
pidfile="/var/run/${full_process_name}.pid"
|
|
25
25
|
|
|
26
26
|
start() {
|
|
27
|
-
# Run the program!
|
|
28
|
-
|
|
27
|
+
# Run the program! /var/log/${name} is writable by the app user, so the log
|
|
28
|
+
# file is only opened once privileges are dropped.
|
|
29
|
+
chroot --userspec "${user}:${group}" --groups="$(id -Gn ${user} | tr ' ' ',')" / \
|
|
30
|
+
sh -c 'exec "$@" >> "$0" 2>&1' "/var/log/${name}/${process_name}-${APP_PROCESS_INDEX}.log" ${name} run ${process_name} &
|
|
29
31
|
|
|
30
32
|
# Generate the pidfile from here. If we instead made the forked process
|
|
31
33
|
# generate it there will be a race condition between the pidfile writing
|
data/lib/pkgr/builder.rb
CHANGED
|
@@ -45,7 +45,7 @@ module Pkgr
|
|
|
45
45
|
opts[:input] = $stdin.read
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
tarball_extract = Mixlib::ShellOut.new("tar xzf #{tarball} -C #{source_dir}", opts)
|
|
48
|
+
tarball_extract = Mixlib::ShellOut.new("tar xzf #{tarball} --no-same-owner -C #{source_dir}", opts)
|
|
49
49
|
tarball_extract.logger = Pkgr.logger
|
|
50
50
|
tarball_extract.run_command
|
|
51
51
|
tarball_extract.error!
|
|
@@ -69,6 +69,8 @@ module Pkgr
|
|
|
69
69
|
end
|
|
70
70
|
config.distribution = distribution
|
|
71
71
|
config.env.variables.push("TARGET=#{distribution.target}")
|
|
72
|
+
config.env.variables.push("APP_PKG_VERSION=#{config.version}")
|
|
73
|
+
config.env.variables.push("APP_PKG_ITERATION=#{config.iteration}")
|
|
72
74
|
# useful for templates that need to read files
|
|
73
75
|
config.source_dir = source_dir
|
|
74
76
|
config.build_dir = build_dir
|
|
@@ -163,12 +165,18 @@ module Pkgr
|
|
|
163
165
|
end
|
|
164
166
|
end
|
|
165
167
|
|
|
166
|
-
# Write cron files
|
|
168
|
+
# Write cron files. They are installed as root, so they get installed from a
|
|
169
|
+
# root-owned copy rather than from the app directory, which the app user
|
|
170
|
+
# can write to.
|
|
167
171
|
def setup_crons
|
|
168
172
|
crons_dir = File.join("/", distribution.crons_dir)
|
|
173
|
+
config.crons_dir = crons_dir
|
|
169
174
|
|
|
170
175
|
config.crons.map! do |cron_path|
|
|
171
|
-
|
|
176
|
+
source = File.join("/", shared_dir, "crons", File.basename(cron_path))
|
|
177
|
+
FileUtils.mkdir_p File.dirname(File.join(build_dir, source))
|
|
178
|
+
FileUtils.cp File.join(build_dir, File.expand_path(cron_path, config.home)), File.join(build_dir, source)
|
|
179
|
+
Cron.new(source, File.join(crons_dir, File.basename(cron_path)))
|
|
172
180
|
end
|
|
173
181
|
|
|
174
182
|
config.crons.each do |cron|
|
|
@@ -259,8 +267,15 @@ module Pkgr
|
|
|
259
267
|
File.join(vendor_dir, "processes")
|
|
260
268
|
end
|
|
261
269
|
|
|
270
|
+
# Root-owned directory for files that are read as root at install time.
|
|
271
|
+
def shared_dir
|
|
272
|
+
File.join("usr", "share", config.name)
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# Init templates are copied to system locations as root, so keep them out
|
|
276
|
+
# of the app directory.
|
|
262
277
|
def scaling_dir
|
|
263
|
-
File.join(
|
|
278
|
+
File.join(build_dir, shared_dir, "scaling")
|
|
264
279
|
end
|
|
265
280
|
|
|
266
281
|
# Returns the path to the app's (supposedly present) Procfile.
|
data/lib/pkgr/buildpack.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'fileutils'
|
|
2
2
|
require 'digest/sha1'
|
|
3
|
+
require 'shellwords'
|
|
3
4
|
|
|
4
5
|
module Pkgr
|
|
5
6
|
class Buildpack
|
|
@@ -24,7 +25,7 @@ module Pkgr
|
|
|
24
25
|
def initialize(url, type = :builtin, env = nil)
|
|
25
26
|
@uuid = Digest::SHA1.hexdigest(url)
|
|
26
27
|
@url, @branch = url.split("#")
|
|
27
|
-
@branch ||= "
|
|
28
|
+
@branch ||= "main"
|
|
28
29
|
@type = type
|
|
29
30
|
@env = env || Env.new
|
|
30
31
|
end
|
|
@@ -85,7 +86,12 @@ module Pkgr
|
|
|
85
86
|
def refresh(edge = true)
|
|
86
87
|
return if !edge
|
|
87
88
|
Dir.chdir(dir) do
|
|
88
|
-
|
|
89
|
+
git_fetch = Mixlib::ShellOut.new("git fetch --tags origin")
|
|
90
|
+
git_fetch.logger = Pkgr.logger
|
|
91
|
+
git_fetch.run_command
|
|
92
|
+
git_fetch.error!
|
|
93
|
+
|
|
94
|
+
buildpack_refresh = Mixlib::ShellOut.new("git reset --hard #{Shellwords.shellescape(ref_for_checkout)} && chmod -f +x bin/detect && chmod -f +x bin/compile && chmod -f +x bin/release")
|
|
89
95
|
buildpack_refresh.logger = Pkgr.logger
|
|
90
96
|
buildpack_refresh.run_command
|
|
91
97
|
buildpack_refresh.error!
|
|
@@ -117,6 +123,21 @@ module Pkgr
|
|
|
117
123
|
|
|
118
124
|
private
|
|
119
125
|
|
|
126
|
+
def ref_for_checkout
|
|
127
|
+
[
|
|
128
|
+
"refs/remotes/origin/#{branch}",
|
|
129
|
+
"refs/tags/#{branch}",
|
|
130
|
+
"refs/heads/#{branch}"
|
|
131
|
+
].find { |ref| git_ref_exists?(ref) } || branch
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def git_ref_exists?(ref)
|
|
135
|
+
git_ref = Mixlib::ShellOut.new("git rev-parse --verify --quiet #{Shellwords.shellescape(ref)}")
|
|
136
|
+
git_ref.logger = Pkgr.logger
|
|
137
|
+
git_ref.run_command
|
|
138
|
+
git_ref.exitstatus == 0
|
|
139
|
+
end
|
|
140
|
+
|
|
120
141
|
def compound_environment(path, local_env = Env.new)
|
|
121
142
|
Env.new(['PATH=$PATH']).merge(local_env).merge(env).merge(exported_environment(File.join(path, "export")))
|
|
122
143
|
end
|
data/lib/pkgr/config.rb
CHANGED
|
@@ -27,6 +27,12 @@ module Pkgr
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
# Check if targets are defined but current target is not
|
|
31
|
+
if !targets.empty? && !targets.has_key?(distribution.to_s)
|
|
32
|
+
available_targets = targets.keys.join(", ")
|
|
33
|
+
raise Pkgr::Errors::TargetNotDefined, "Target '#{distribution}' is not defined in .pkgr.yml. Available targets: #{available_targets}"
|
|
34
|
+
end
|
|
35
|
+
|
|
30
36
|
distro_config = targets[distribution.to_s]
|
|
31
37
|
if distro_config.is_a?(Hash)
|
|
32
38
|
distro_config.each do |k,v|
|
|
@@ -133,13 +139,18 @@ module Pkgr
|
|
|
133
139
|
end
|
|
134
140
|
|
|
135
141
|
def env
|
|
136
|
-
@table[:env].is_a?(Pkgr::Env) ? @table[:env] : Pkgr::Env.new(@table[:env])
|
|
142
|
+
@env ||= @table[:env].is_a?(Pkgr::Env) ? @table[:env] : Pkgr::Env.new(@table[:env])
|
|
137
143
|
end
|
|
138
144
|
|
|
139
145
|
def buildpacks
|
|
140
146
|
@table[:buildpack].is_a?(String) ? @table[:buildpack].split(",") : @table[:buildpack]
|
|
141
147
|
end
|
|
142
148
|
|
|
149
|
+
def name
|
|
150
|
+
# handle GITHUB_REPOSITORY-like names
|
|
151
|
+
(@table[:name] || "").split("/").last
|
|
152
|
+
end
|
|
153
|
+
|
|
143
154
|
def valid?
|
|
144
155
|
@errors = []
|
|
145
156
|
@errors.push("name can't be blank") if name.nil? || name.empty?
|
data/lib/pkgr/cron.rb
CHANGED
|
@@ -22,17 +22,21 @@ module Pkgr
|
|
|
22
22
|
self.class.name.split("::")[-1].downcase
|
|
23
23
|
end # def os
|
|
24
24
|
|
|
25
|
+
def rpm?
|
|
26
|
+
false
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def deb?
|
|
30
|
+
false
|
|
31
|
+
end
|
|
32
|
+
|
|
25
33
|
# e.g. ubuntu-12.04
|
|
26
34
|
def slug
|
|
27
35
|
[os, release].join("-")
|
|
28
36
|
end # def slug
|
|
29
37
|
|
|
30
38
|
def target
|
|
31
|
-
|
|
32
|
-
"centos-6" => "el:6",
|
|
33
|
-
"centos-7" => "el:7",
|
|
34
|
-
"centos-8" => "el:8"
|
|
35
|
-
}.fetch(slug, slug.sub("-", ":"))
|
|
39
|
+
slug.sub("-", ":").sub("centos", "el")
|
|
36
40
|
end
|
|
37
41
|
|
|
38
42
|
def package_test_command(package)
|
|
@@ -123,6 +127,13 @@ module Pkgr
|
|
|
123
127
|
list
|
|
124
128
|
end
|
|
125
129
|
|
|
130
|
+
def config_files
|
|
131
|
+
templates
|
|
132
|
+
.filter { |template| template.is_a?(Templates::FileTemplate) }
|
|
133
|
+
.map(&:target)
|
|
134
|
+
.filter { |target| target.start_with?("etc/") }
|
|
135
|
+
end
|
|
136
|
+
|
|
126
137
|
# Returns a list of <Process, FileTemplate> tuples.
|
|
127
138
|
def initializers_for(app_name, procfile_entries)
|
|
128
139
|
list = []
|
|
@@ -7,6 +7,10 @@ module Pkgr
|
|
|
7
7
|
module Distributions
|
|
8
8
|
# Contains the various components required to make a packaged app integrate well with a Debian system.
|
|
9
9
|
class Debian < Base
|
|
10
|
+
def deb?
|
|
11
|
+
true
|
|
12
|
+
end
|
|
13
|
+
|
|
10
14
|
# Only keep major digits
|
|
11
15
|
def release
|
|
12
16
|
@release[/^[0-9]+/]
|
|
@@ -14,10 +18,10 @@ module Pkgr
|
|
|
14
18
|
|
|
15
19
|
def runner
|
|
16
20
|
@runner ||= case release
|
|
17
|
-
when /^
|
|
18
|
-
Runner.new("systemd", "default", "systemctl")
|
|
19
|
-
else
|
|
21
|
+
when /^6/, /^7/
|
|
20
22
|
Runner.new("sysv", "lsb-3.1", "update-rc.d")
|
|
23
|
+
else
|
|
24
|
+
Runner.new("systemd", "default", "systemctl")
|
|
21
25
|
end
|
|
22
26
|
end
|
|
23
27
|
|
|
@@ -41,7 +45,7 @@ module Pkgr
|
|
|
41
45
|
Dir.glob(File.join(output_dir, "*deb")).each do |package|
|
|
42
46
|
puts "-----> Verifying package #{File.basename(package)}"
|
|
43
47
|
Dir.mktmpdir do |dir|
|
|
44
|
-
verify_package = Mixlib::ShellOut.new %{dpkg-deb -x #{package} #{dir}}
|
|
48
|
+
verify_package = Mixlib::ShellOut.new %{dpkg-deb -x "#{package}" "#{dir}"}
|
|
45
49
|
verify_package.logger = Pkgr.logger
|
|
46
50
|
verify_package.run_command
|
|
47
51
|
verify_package.error!
|
|
@@ -6,13 +6,21 @@ require 'pkgr/fpm_command'
|
|
|
6
6
|
module Pkgr
|
|
7
7
|
module Distributions
|
|
8
8
|
class Sles < Base
|
|
9
|
+
def rpm?
|
|
10
|
+
true
|
|
11
|
+
end
|
|
12
|
+
|
|
9
13
|
# Only keep major digits
|
|
10
14
|
def release
|
|
11
15
|
@release[/^[0-9]+/]
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
def runner
|
|
15
|
-
@runner ||=
|
|
19
|
+
@runner ||= if release.to_i > 12
|
|
20
|
+
Runner.new("systemd", "default", "systemctl")
|
|
21
|
+
else
|
|
22
|
+
Runner.new("sysv", "lsb-3.1", "chkconfig")
|
|
23
|
+
end
|
|
16
24
|
end
|
|
17
25
|
|
|
18
26
|
def package_test_command(package)
|
|
@@ -20,7 +28,12 @@ module Pkgr
|
|
|
20
28
|
end
|
|
21
29
|
|
|
22
30
|
def package_install_command(packages)
|
|
23
|
-
|
|
31
|
+
# --no-gpg-checks helps with outdated repos for SLES
|
|
32
|
+
zypper_flags = []
|
|
33
|
+
if release.to_i <= 12
|
|
34
|
+
zypper_flags.push("--no-gpg-checks")
|
|
35
|
+
end
|
|
36
|
+
"sudo zypper refresh ; sudo zypper #{zypper_flags.join(" ")} install -y #{packages.map{|package| "\"#{package}\""}.join(" ")}"
|
|
24
37
|
end
|
|
25
38
|
|
|
26
39
|
def installer_dependencies
|
data/lib/pkgr/env.rb
CHANGED
|
@@ -9,8 +9,7 @@ module Pkgr
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def initialize(variables = nil)
|
|
12
|
-
@variables = variables || []
|
|
13
|
-
@variables.compact!
|
|
12
|
+
@variables = (variables || []).map{|v| v && v.split("\n")}.flatten.select{|v| v && v.length > 0}
|
|
14
13
|
end
|
|
15
14
|
|
|
16
15
|
def to_s
|
|
@@ -35,7 +34,9 @@ module Pkgr
|
|
|
35
34
|
|
|
36
35
|
variables.inject({}) do |h, var|
|
|
37
36
|
name, value = var.split('=', 2)
|
|
38
|
-
|
|
37
|
+
unless name.nil?
|
|
38
|
+
h[name.strip] = EnvValue.new(value || "").strip.unquote
|
|
39
|
+
end
|
|
39
40
|
h
|
|
40
41
|
end
|
|
41
42
|
end
|
data/lib/pkgr/env_value.rb
CHANGED
data/lib/pkgr/fpm_command.rb
CHANGED
|
@@ -38,7 +38,9 @@ module Pkgr
|
|
|
38
38
|
list << "--before-remove" << distribution.preuninstall_file
|
|
39
39
|
list << "--after-remove" << distribution.postuninstall_file
|
|
40
40
|
list << "--directories" << config.directories unless config.directories.nil?
|
|
41
|
+
list << "--rpm-digest" << "sha256" if distribution.rpm?
|
|
41
42
|
distribution.dependencies(config.dependencies).each{|d| list << "-d" << d}
|
|
43
|
+
distribution.config_files.each{|f| list << "--config-files" << f}
|
|
42
44
|
list.compact
|
|
43
45
|
end
|
|
44
46
|
end
|
data/lib/pkgr/version.rb
CHANGED
data/lib/pkgr.rb
CHANGED
|
@@ -2,6 +2,14 @@ require 'pkgr/version'
|
|
|
2
2
|
require 'pkgr/cli'
|
|
3
3
|
require 'pkgr/dispatcher'
|
|
4
4
|
require 'mixlib/log'
|
|
5
|
+
require 'yaml'
|
|
6
|
+
|
|
7
|
+
# https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias/71192990#71192990
|
|
8
|
+
module YAML
|
|
9
|
+
class << self
|
|
10
|
+
alias_method :load, :unsafe_load if YAML.respond_to? :unsafe_load
|
|
11
|
+
end
|
|
12
|
+
end
|
|
5
13
|
|
|
6
14
|
module Pkgr
|
|
7
15
|
extend Mixlib::Log
|
|
@@ -11,6 +19,7 @@ module Pkgr
|
|
|
11
19
|
class UnknownAppType < Base; end
|
|
12
20
|
class UnknownDistribution < Base; end
|
|
13
21
|
class ConfigurationInvalid < Base; end
|
|
22
|
+
class TargetNotDefined < Base; end
|
|
14
23
|
end
|
|
15
24
|
|
|
16
25
|
def data_dir=(path)
|