pkgr 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc9860507ebe18fd497f6cd0c2eafb4b43fa3e84
4
- data.tar.gz: d1bc91d07dcab8e62cf382dd6b1317cbe6866065
3
+ metadata.gz: c4957e699c5faccb2beb397df7d38bbdc4bf0fb9
4
+ data.tar.gz: 8519e2b2f524e20c44a4df5353551c56f37f8e3f
5
5
  SHA512:
6
- metadata.gz: 34286f726b3d4dc61931239d8ffd3570ea524ceddcf3b0d5a06635123904b6fc31af1be63b8a5e9a937766da79c888748f4b9eec49b51235905a863ec0cf9700
7
- data.tar.gz: 56ea0451c22d005d56852efeb0c87ff231de587e4d833b6658fc10a102372c53098e23b9f0aa89a02af9be14453846d46307ef953537bff3a9d1803d02e05c5d
6
+ metadata.gz: 11d14b4e33696c5a7dbcafe08f65847a4524f153022829f5b29c37b21f2f8739fda1659b80fd4f0b51050be8a75e4c1028d004ac92304d7f0dbffcf3b80b1fc7
7
+ data.tar.gz: 99bb15a764f2716e7cddac6e5cd9ce852ff070c8b5237df322e762118110ce5ddf550c09b06057d361682483ff7992226fc2814753c98c9c67f5f0a8e71e23af
@@ -0,0 +1,13 @@
1
+ default:
2
+ - curl
3
+ - gcc
4
+ - gcc-c++
5
+ - kernel-devel
6
+ - libopenssl-devel
7
+ - readline-devel
8
+ - libxml2-devel
9
+ - libxslt-devel
10
+ - libevent-devel
11
+ - postgresql-devel
12
+ - libmysqlclient-devel
13
+ - sqlite3-devel
@@ -0,0 +1,2 @@
1
+ https://github.com/pkgr/heroku-buildpack-ruby.git#universal-staging,BUILDPACK_NODE_VERSION="0.6.8",CURL_CONNECT_TIMEOUT=60,CURL_TIMEOUT=300
2
+ https://github.com/heroku/heroku-buildpack-nodejs.git#v58
data/data/cli/cli.sh.erb CHANGED
@@ -24,57 +24,35 @@ usage() {
24
24
  echo " $APP_NAME logs [--tail|-n NUMBER]"
25
25
  echo " $APP_NAME config:get VAR"
26
26
  echo " $APP_NAME config:set VAR=VALUE"
27
+ echo " $APP_NAME configure"
27
28
  echo " $APP_NAME reconfigure"
28
29
  }
29
30
 
31
+ DEFAULT_FILE=$(_p "/etc/default/${APP_NAME}")
30
32
 
31
- # Returns the type of process manager supported by the current distribution.
32
- setup_runner() {
33
- if [ -f $(_p /etc/debian_version) ]; then
34
- case "$(cat $(_p /etc/debian_version))" in
35
- wheezy*|squeeze*|jessie*)
36
- APP_RUNNER="upstart"
37
- ;;
38
- *)
39
- APP_RUNNER="sysv"
40
- SYSV_MANAGER="update-rc.d"
41
- ;;
42
- esac
43
- elif [ -f $(_p /etc/redhat-release) ]; then
44
- case "$(cat $(_p /etc/redhat-release))" in
45
- CentOS*)
46
- APP_RUNNER="upstart"
47
- ;;
48
- *)
49
- APP_RUNNER="sysv"
50
- SYSV_MANAGER="chkconfig"
51
- ;;
52
- esac
53
- fi
54
- }
33
+ . ${DEFAULT_FILE}
34
+
35
+ for file in $(_p "${APP_HOME}/.profile.d")/*.sh; do
36
+ # .profile.d scripts assume HOME indicates the path to the app directory
37
+ if [ -f $file ]; then HOME=${APP_HOME} . $file; fi
38
+ done
39
+
40
+ if [ "$APP_CLI" != "" ] ; then
41
+ exec $APP_HOME/bin/$APP_CLI "$@"
42
+ fi
55
43
 
56
- if [ ! 0 -eq ${EUID} ]; then
44
+ if [ `id -u` -ne 0 ]; then
57
45
  echo "You must be executing with root privileges to launch commands."
58
46
  echo "Either log in as root, use sudo, or add sudo privileges for running ${APP_NAME} with your user."
59
47
  exit 1
60
48
  fi
61
49
 
62
- setup_runner
63
- DEFAULT_FILE=$(_p "/etc/default/${APP_NAME}")
64
-
65
50
  # Source all environment variables for the app. This must be done as
66
51
  # privileged user since the config variables are only readable by root.
67
- . ${DEFAULT_FILE}
68
-
69
52
  for file in $(_p "/etc/${APP_NAME}/conf.d")/*; do
70
53
  if [ -f $file ]; then . $file; fi
71
54
  done
72
55
 
73
- for file in $(_p "${APP_HOME}/.profile.d")/*.sh; do
74
- # .profile.d scripts assume HOME indicates the path to the app directory
75
- if [ -f $file ]; then HOME=${APP_HOME} . $file; fi
76
- done
77
-
78
56
  # Return all the environment variables accessible to the app.
79
57
  show_env() {
80
58
  env -i ROOT_PATH=${ROOT_PATH} ${0} run env | sort
@@ -97,7 +75,7 @@ tail_logs() {
97
75
 
98
76
  current_number_of_processes() {
99
77
  PROCESS_NAME="$1"
100
- if [ "${APP_RUNNER}" = "upstart" ]; then
78
+ if [ "${APP_RUNNER_TYPE}" = "upstart" ]; then
101
79
  echo $(ls -rv1 $(_p /etc/init/)${APP_NAME}-${PROCESS_NAME}-*.conf 2>/dev/null | head -1 | sed -r 's/.*\-([0-9]+)\.conf/\1/g')
102
80
  else
103
81
  echo $(ls -rv1 $(_p /etc/init.d/)${APP_NAME}-${PROCESS_NAME}-* 2>/dev/null | head -1 | sed -r 's/.*\-([0-9]+)/\1/g')
@@ -123,19 +101,19 @@ update_port() {
123
101
 
124
102
  sysv_enable() {
125
103
  local name="$1"
126
- if [ "$SYSV_MANAGER" = "chkconfig" ] ; then
127
- $SYSV_MANAGER "$name" on
128
- elif [ "$SYSV_MANAGER" = "update-rc.d" ] ; then
129
- $SYSV_MANAGER "$name" defaults
104
+ if [ "$APP_RUNNER_CLI" = "chkconfig" ] ; then
105
+ $APP_RUNNER_CLI "$name" on
106
+ elif [ "$APP_RUNNER_CLI" = "update-rc.d" ] ; then
107
+ $APP_RUNNER_CLI "$name" defaults
130
108
  fi
131
109
  }
132
110
 
133
111
  sysv_disable() {
134
112
  local name="$1"
135
- if [ "$SYSV_MANAGER" = "chkconfig" ] ; then
136
- $SYSV_MANAGER "$name" off
137
- elif [ "$SYSV_MANAGER" = "update-rc.d" ] ; then
138
- $SYSV_MANAGER -f "$name" remove
113
+ if [ "$APP_RUNNER_CLI" = "chkconfig" ] ; then
114
+ $APP_RUNNER_CLI "$name" off
115
+ elif [ "$APP_RUNNER_CLI" = "update-rc.d" ] ; then
116
+ $APP_RUNNER_CLI -f "$name" remove
139
117
  fi
140
118
  }
141
119
 
@@ -147,7 +125,7 @@ scale_up() {
147
125
 
148
126
  echo "Scaling up..."
149
127
 
150
- if [ "${APP_RUNNER}" = "upstart" ]; then
128
+ if [ "${APP_RUNNER_TYPE}" = "upstart" ]; then
151
129
  # copy initd
152
130
  cp $(_p "${APP_HOME}/vendor/pkgr/scaling/upstart/${APP_NAME}") $(_p "/etc/init.d/")
153
131
  chmod 0755 $(_p "/etc/init.d/${APP_NAME}")
@@ -165,11 +143,11 @@ scale_up() {
165
143
  update_port $(_p "/etc/init/${PROCESS_ID}.conf") "${PROCESS_NAME}" $port $index
166
144
 
167
145
  # directly call initctl instead of service, otherwise CentOS 6.x does not understand.
168
- initctl start "${PROCESS_ID}"
146
+ $APP_RUNNER_CLI start "${PROCESS_ID}"
169
147
  done
170
148
 
171
- initctl start ${APP_NAME}-${PROCESS_NAME} || true
172
- initctl start ${APP_NAME} || true
149
+ $APP_RUNNER_CLI start ${APP_NAME}-${PROCESS_NAME} || true
150
+ $APP_RUNNER_CLI start ${APP_NAME} || true
173
151
  else
174
152
  cp $(_p "${APP_HOME}/vendor/pkgr/scaling/sysv/${APP_NAME}") $(_p /etc/init.d/)
175
153
  chmod a+x $(_p "/etc/init.d/${APP_NAME}")
@@ -204,8 +182,8 @@ scale_down() {
204
182
  index=$((${i} + ${NEW_SCALE}))
205
183
  PROCESS_ID="${APP_NAME}-${PROCESS_NAME}-${index}"
206
184
 
207
- if [ "${APP_RUNNER}" = "upstart" ]; then
208
- initctl stop "${PROCESS_ID}"
185
+ if [ "${APP_RUNNER_TYPE}" = "upstart" ]; then
186
+ $APP_RUNNER_CLI stop "${PROCESS_ID}"
209
187
  rm -f $(_p "/etc/init/${PROCESS_ID}.conf")
210
188
  else
211
189
  $(_p "/etc/init.d/${PROCESS_ID}") stop
@@ -318,14 +296,14 @@ while : ; do
318
296
  CONFIG=(${2//=/ })
319
297
 
320
298
  VAR=${CONFIG[0]:?"Invalid variable name"}
321
- VALUE=${CONFIG[1]:?"Invalid value"}
299
+ VALUE="${2:$((${#VAR} + 1))}"
322
300
 
323
301
  CONFIG_FILE=$(_p "/etc/${APP_NAME}/conf.d/other")
324
302
  touch ${CONFIG_FILE}
325
303
 
326
- sed -i -r "s/^.*${VAR}.*$//g" $(_p "/etc/${APP_NAME}/conf.d")/*
304
+ sed -i -r "s/^\s*export\s+${VAR}.*$//g" $(_p "/etc/${APP_NAME}/conf.d")/*
327
305
 
328
- echo "export ${VAR}=${VALUE}" >> "${CONFIG_FILE}"
306
+ echo "export ${VAR}=\"${VALUE}\"" >> "${CONFIG_FILE}"
329
307
 
330
308
  break;;
331
309
 
@@ -0,0 +1,10 @@
1
+ default:
2
+ - openssl
3
+ - readline
4
+ - libxml2
5
+ - libxslt
6
+ - libevent
7
+ - postgresql93
8
+ - libmysqlclient18
9
+ - sqlite3
10
+ - shadow
@@ -5,10 +5,14 @@ export APP_SAFE_NAME="<%= safe_name %>"
5
5
  export APP_GROUP="<%= group %>"
6
6
  export APP_USER="<%= user %>"
7
7
  export APP_WIZARDS="<%= wizards.map{|wizard_group| wizard_group.map{|w| w.name}.join("|")}.join(",") %>"
8
+ export APP_RUNNER_TYPE="<%= distribution.runner.type %>"
9
+ export APP_RUNNER_CLI="<%= distribution.runner.cli %>"
8
10
  # Legacy addons
9
11
  export APP_ADDONS="<%= addons.map{|addon| addon.name}.join(" ") %>"
10
- export HOME="/home/<%= user %>"
11
12
  export PORT=${PORT:=6000}
12
- <% if runner %>
13
- export PROCESS_MANAGER="<%= runner.split("-").first %>"
13
+ <% if cli.is_a?(String) %>
14
+ export HOME=${HOME:="/home/<%= user %>"}
15
+ export APP_CLI="<%= cli %>"
16
+ <% else %>
17
+ export HOME="/home/<%= user %>"
14
18
  <% end %>
@@ -8,11 +8,11 @@ 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 ]; then
11
+ if [ -f /etc/redhat-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
15
- adduser "${APP_USER}" -g "${APP_GROUP}" --system --create-home --shell /bin/bash
15
+ useradd "${APP_USER}" -g "${APP_GROUP}" --system --create-home --shell /bin/bash
16
16
  else
17
17
  if ! getent group "${APP_GROUP}" > /dev/null; then
18
18
  addgroup "${APP_GROUP}" --system --quiet
data/lib/pkgr/builder.rb CHANGED
@@ -36,6 +36,7 @@ module Pkgr
36
36
  write_init
37
37
  setup_crons
38
38
  package
39
+ verify
39
40
  store_cache
40
41
  ensure
41
42
  teardown if config.clean
@@ -73,6 +74,7 @@ module Pkgr
73
74
  distribution.runner = Distributions::Runner.new(type, version.join("-"))
74
75
  end
75
76
  end
77
+ config.distribution = distribution
76
78
  # required to build proper Addon objects
77
79
  config.addons_dir = addons_dir
78
80
  # useful for templates that need to read files
@@ -193,6 +195,11 @@ module Pkgr
193
195
  app_package.error!
194
196
  end
195
197
 
198
+ def verify
199
+ return true unless config.verify
200
+ distribution.verify(Dir.pwd)
201
+ end
202
+
196
203
  def store_cache
197
204
  return true unless config.store_cache
198
205
  generate_cache_tarball = Mixlib::ShellOut.new %{tar czf cache.tar.gz -C #{compile_cache_dir} .}
data/lib/pkgr/cli.rb CHANGED
@@ -35,6 +35,10 @@ module Pkgr
35
35
  method_option :maintainer,
36
36
  :type => :string,
37
37
  :desc => "Maintainer"
38
+ method_option :vendor,
39
+ :type => :string,
40
+ :desc => "Package vendor",
41
+ :default => "pkgr <https://github.com/crohr/pkgr>"
38
42
  method_option :architecture,
39
43
  :type => :string,
40
44
  :default => "x86_64",
@@ -113,6 +117,10 @@ module Pkgr
113
117
  method_option :store_cache,
114
118
  :type => :boolean,
115
119
  :desc => 'Output a tarball of the cache in the current directory (name: cache.tar.gz)'
120
+ method_option :verify,
121
+ :type => :boolean,
122
+ :default => true,
123
+ :desc => "Verifies output package"
116
124
 
117
125
  def package(tarball)
118
126
  Pkgr.level = Logger::INFO if options[:verbose]
data/lib/pkgr/config.rb CHANGED
@@ -26,8 +26,11 @@ module Pkgr
26
26
  end
27
27
  end
28
28
 
29
- (targets[distribution.to_s] || {}).each do |k,v|
30
- config[k] = v
29
+ distro_config = targets[distribution.to_s]
30
+ if distro_config.is_a?(Hash)
31
+ distro_config.each do |k,v|
32
+ config[k] = v
33
+ end
31
34
  end
32
35
 
33
36
  self.new(config)
@@ -68,8 +71,12 @@ module Pkgr
68
71
  name.gsub("-", "_")
69
72
  end
70
73
 
74
+ def cli?
75
+ @table.has_key?(:cli) ? @table[:cli] : true
76
+ end
77
+
71
78
  def home
72
- "/opt/#{name}"
79
+ @table[:home] || "/opt/#{name}"
73
80
  end
74
81
 
75
82
  def user
@@ -204,7 +211,8 @@ module Pkgr
204
211
  "--homepage \"#{homepage}\"",
205
212
  "--architecture \"#{architecture}\"",
206
213
  "--description \"#{description}\"",
207
- "--maintainer \"#{maintainer}\""
214
+ "--maintainer \"#{maintainer}\"",
215
+ "--vendor \"#{vendor}\""
208
216
  ]
209
217
  args.push "--dependencies #{dependencies.map{|d| "\"#{d}\""}.join}" unless dependencies.nil? || dependencies.empty?
210
218
  args.push "--build-dependencies #{build_dependencies.map{|d| "\"#{d}\""}.join}" unless build_dependencies.nil? || build_dependencies.empty?
@@ -226,6 +234,7 @@ module Pkgr
226
234
  args.push "--verbose" if verbose
227
235
  args.push "--store-cache" if store_cache
228
236
  args.push "--debug" if debug
237
+ args.push "--verify" if verify
229
238
  args.push "--no-clean" if !clean
230
239
  args.push "--no-edge" if !edge
231
240
  args
@@ -7,7 +7,7 @@ module Pkgr
7
7
 
8
8
  def initialize(path, opts = {})
9
9
  opts = opts.dup
10
- @path = File.expand_path(path)
10
+ @path = path == '-' ? path : File.expand_path(path)
11
11
  @host = opts.delete(:host)
12
12
  @config = Config.new(opts)
13
13
  end
@@ -20,7 +20,7 @@ module Pkgr
20
20
  setup
21
21
 
22
22
  if remote?
23
- command = %{ ( cat "#{path}" | ssh "#{host}" pkgr package - #{config.to_args.join(" ")} ) && rsync "#{host}":~/*.deb .}
23
+ command = %{ ( cat "#{path}" | ssh "#{host}" pkgr package - #{config.to_args.join(" ")} ) && rsync -av --include './' --include '*.deb' --include '*.rpm' --exclude '*' "#{host}":~/ .}
24
24
  Pkgr.debug command
25
25
  IO.popen(command) do |io|
26
26
  until io.eof?
@@ -51,4 +51,4 @@ module Pkgr
51
51
  !host.nil?
52
52
  end
53
53
  end
54
- end
54
+ end
@@ -57,6 +57,11 @@ module Pkgr
57
57
  end
58
58
  end
59
59
 
60
+ # Verifies packages
61
+ def verify(output_dir)
62
+ true
63
+ end
64
+
60
65
  # e.g. data/buildpacks/ubuntu/12.04
61
66
  def default_buildpack_list
62
67
  data_file(File.join("buildpacks", slug))
@@ -102,18 +107,18 @@ module Pkgr
102
107
  list.push Templates::FileTemplate.new("etc/default/#{app_name}", data_file("environment", "default.erb"))
103
108
  list.push Templates::FileTemplate.new("etc/logrotate.d/#{app_name}", data_file("logrotate", "logrotate.erb"))
104
109
 
105
- # Put cli in /usr/bin, as redhat based distros don't have /usr/local/bin in their sudo PATH.
106
- list.push Templates::FileTemplate.new("usr/bin/#{app_name}", data_file("cli", "cli.sh.erb"), mode: 0755)
110
+ if config.cli?
111
+ # Put cli in /usr/bin, as redhat based distros don't have /usr/local/bin in their sudo PATH.
112
+ list.push Templates::FileTemplate.new("usr/bin/#{app_name}", data_file("cli", "cli.sh.erb"), mode: 0755)
113
+ end
107
114
 
108
- # NOTE: /etc/appname/conf.d/* files are no longer installed here, since we don't want to overwrite any pre-existing config.
109
- # They're now installed in the postinstall script.
110
115
  list
111
116
  end
112
117
 
113
118
  # Returns a list of <Process, FileTemplate> tuples.
114
119
  def initializers_for(app_name, procfile_entries)
115
120
  list = []
116
- procfile_entries.select(&:daemon?).each do |process|
121
+ procfile_entries.each do |process|
117
122
  Pkgr.debug "Adding #{process.inspect} to initialization scripts"
118
123
  runner.templates(process, app_name).each do |template|
119
124
  list.push [process, template]
@@ -185,3 +190,4 @@ end # module Pkgr
185
190
 
186
191
  require 'pkgr/distributions/debian'
187
192
  require 'pkgr/distributions/fedora'
193
+ require 'pkgr/distributions/sles'
@@ -7,7 +7,7 @@ module Pkgr
7
7
  def runner
8
8
  # in truth it is 0.6.5, but it also works with 1.5 templates.
9
9
  # maybe adopt the same structure as pleaserun, with defaults, etc.
10
- @runner ||= Runner.new("upstart", "1.5")
10
+ @runner ||= Runner.new("upstart", "1.5", "initctl")
11
11
  end
12
12
 
13
13
  def templates
@@ -1,6 +1,7 @@
1
1
  require 'pkgr/buildpack'
2
2
  require 'pkgr/process'
3
3
  require 'pkgr/distributions/base'
4
+ require 'pkgr/fpm_command'
4
5
 
5
6
  module Pkgr
6
7
  module Distributions
@@ -12,7 +13,7 @@ module Pkgr
12
13
  end
13
14
 
14
15
  def runner
15
- @runner ||= Runner.new("sysv", "lsb-3.1")
16
+ @runner ||= Runner.new("sysv", "lsb-3.1", "update-rc.d")
16
17
  end
17
18
 
18
19
  def package_test_command(package)
@@ -28,7 +29,19 @@ module Pkgr
28
29
  end
29
30
 
30
31
  def fpm_command(build_dir)
31
- DebianFpm.new(self, build_dir).command
32
+ DebianFpmCommand.new(self, build_dir).command
33
+ end
34
+
35
+ def verify(output_dir)
36
+ Dir.glob(File.join(output_dir, "*deb")).each do |package|
37
+ puts "-----> Verifying package #{File.basename(package)}"
38
+ Dir.mktmpdir do |dir|
39
+ verify_package = Mixlib::ShellOut.new %{dpkg-deb -x #{package} #{dir}}
40
+ verify_package.logger = Pkgr.logger
41
+ verify_package.run_command
42
+ verify_package.error!
43
+ end
44
+ end
32
45
  end
33
46
 
34
47
  def debconfig
@@ -58,47 +71,13 @@ module Pkgr
58
71
  addon.debian_dependency_name
59
72
  end
60
73
 
61
- class DebianFpm
62
- attr_reader :distribution, :build_dir, :config
63
-
64
- def initialize(distribution, build_dir)
65
- @distribution = distribution
66
- @build_dir = build_dir
67
- @config = distribution.config
68
- end
69
-
70
- def command
71
- %{fpm #{args.join(" ")} .}
72
- end
73
-
74
+ class DebianFpmCommand < FpmCommand
74
75
  def args
75
- list = []
76
+ list = super
76
77
  list << "-t deb"
77
- list << "-s dir"
78
- list << "--verbose"
79
- list << "--force"
80
- list << "--exclude '**/.git**'"
81
- list << %{-C "#{build_dir}"}
82
- list << %{-n "#{config.name}"}
83
- list << %{--version "#{config.version}"}
84
- list << %{--iteration "#{config.iteration}"}
85
- list << %{--url "#{config.homepage}"}
86
- list << %{--provides "#{config.name}"}
87
78
  list << %{--deb-user "root"}
88
79
  list << %{--deb-group "root"}
89
- list << %{--license "#{config.license}"} unless config.license.nil?
90
- list << %{-a "#{config.architecture}"}
91
- list << %{--description "#{config.description}"}
92
- list << %{--maintainer "#{config.maintainer}"}
93
- list << %{--template-scripts}
94
- list << %{--deb-config #{distribution.debconfig.path}}
95
- list << %{--deb-templates #{distribution.debtemplates.path}}
96
- list << %{--before-install #{distribution.preinstall_file}}
97
- list << %{--after-install #{distribution.postinstall_file}}
98
- list << %{--before-remove #{distribution.preuninstall_file}}
99
- list << %{--after-remove #{distribution.postuninstall_file}}
100
- distribution.dependencies(config.dependencies).each{|d| list << "-d '#{d}'"}
101
- list.compact
80
+ list
102
81
  end
103
82
  end
104
83
  end
@@ -1,6 +1,7 @@
1
1
  require 'pkgr/buildpack'
2
2
  require 'pkgr/process'
3
3
  require 'pkgr/distributions/base'
4
+ require 'pkgr/fpm_command'
4
5
 
5
6
  module Pkgr
6
7
  module Distributions
@@ -12,7 +13,7 @@ module Pkgr
12
13
  end
13
14
 
14
15
  def runner
15
- @runner ||= Runner.new("sysv", "lsb-3.1")
16
+ @runner ||= Runner.new("sysv", "lsb-3.1", "chkconfig")
16
17
  end
17
18
 
18
19
  def package_test_command(package)
@@ -28,28 +29,17 @@ module Pkgr
28
29
  end
29
30
 
30
31
  def fpm_command(build_dir)
31
- %{
32
- fpm -t rpm -s dir --verbose --force \
33
- -C "#{build_dir}" \
34
- -n "#{config.name}" \
35
- --version "#{config.version}" \
36
- --iteration "#{config.iteration}" \
37
- --url "#{config.homepage}" \
38
- --provides "#{config.name}" \
39
- --deb-user "root" \
40
- --deb-group "root" \
41
- -a "#{config.architecture}" \
42
- --description "#{config.description}" \
43
- --maintainer "#{config.maintainer}" \
44
- --template-scripts \
45
- --before-install #{preinstall_file} \
46
- --after-install #{postinstall_file} \
47
- --before-remove #{preuninstall_file} \
48
- --after-remove #{postuninstall_file} \
49
- #{dependencies(config.dependencies).map{|d| "-d '#{d}'"}.join(" ")} \
50
- .
51
- }
32
+ FedoraFpmCommand.new(self, build_dir).command
52
33
  end
34
+
35
+ class FedoraFpmCommand < FpmCommand
36
+ def args
37
+ list = super
38
+ list << "-t rpm"
39
+ list
40
+ end
41
+ end
42
+
53
43
  end
54
44
  end
55
45
  end
@@ -2,7 +2,7 @@ module Pkgr
2
2
  module Distributions
3
3
  class Redhat < Fedora
4
4
  def runner
5
- @runner ||= Runner.new("sysv", "lsb-3.1")
5
+ @runner ||= Runner.new("sysv", "lsb-3.1", "chkconfig")
6
6
  end
7
7
  end
8
8
  end
@@ -1,6 +1,6 @@
1
1
  module Pkgr
2
2
  module Distributions
3
- class Runner < Struct.new(:type, :version)
3
+ class Runner < Struct.new(:type, :version, :cli)
4
4
  def sysv?
5
5
  type == "sysv"
6
6
  end
@@ -0,0 +1,47 @@
1
+ require 'pkgr/buildpack'
2
+ require 'pkgr/process'
3
+ require 'pkgr/distributions/base'
4
+ require 'pkgr/fpm_command'
5
+
6
+ module Pkgr
7
+ module Distributions
8
+ # Contains the various components required to make a packaged app integrate well with a Debian system.
9
+ class Sles < Base
10
+ # Only keep major digits
11
+ def release
12
+ @release[/^[0-9]+/]
13
+ end
14
+
15
+ def runner
16
+ @runner ||= Runner.new("sysv", "lsb-3.1", "chkconfig")
17
+ end
18
+
19
+ def package_test_command(package)
20
+ "rpm -qa '#{package}' | grep '#{package}' > /dev/null 2>&1"
21
+ end
22
+
23
+ def package_install_command(packages)
24
+ "sudo zypper refresh ; sudo zypper install -y #{packages.map{|package| "\"#{package}\""}.join(" ")}"
25
+ end
26
+
27
+ def installer_dependencies
28
+ super.push("which").push("net-tools").uniq
29
+ end
30
+
31
+ def fpm_command(build_dir)
32
+ SlesFpmCommand.new(self, build_dir).command
33
+ end
34
+
35
+ class SlesFpmCommand < FpmCommand
36
+ def args
37
+ list = super
38
+ list << "-t rpm"
39
+ list
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ require 'pkgr/distributions/redhat'
47
+ require 'pkgr/distributions/centos'
@@ -10,7 +10,7 @@ module Pkgr
10
10
  end
11
11
 
12
12
  def runner
13
- @runner ||= Runner.new("upstart", "1.5")
13
+ @runner ||= Runner.new("upstart", "1.5", "initctl")
14
14
  end
15
15
 
16
16
  def templates
@@ -0,0 +1,41 @@
1
+ module Pkgr
2
+ class FpmCommand
3
+ attr_reader :distribution, :build_dir, :config
4
+
5
+ def initialize(distribution, build_dir)
6
+ @distribution = distribution
7
+ @build_dir = build_dir
8
+ @config = distribution.config
9
+ end
10
+
11
+ def command
12
+ %{fpm #{args.join(" ")} .}
13
+ end
14
+
15
+ def args
16
+ list = []
17
+ list << "-s dir"
18
+ list << "--verbose"
19
+ list << "--force"
20
+ list << "--exclude '**/.git**'"
21
+ list << %{-C "#{build_dir}"}
22
+ list << %{-n "#{config.name}"}
23
+ list << %{--version "#{config.version}"}
24
+ list << %{--iteration "#{config.iteration}"}
25
+ list << %{--url "#{config.homepage}"}
26
+ list << %{--provides "#{config.name}"}
27
+ list << %{--license "#{config.license}"} unless config.license.nil?
28
+ list << %{-a "#{config.architecture}"}
29
+ list << %{--description "#{config.description}"}
30
+ list << %{--maintainer "#{config.maintainer}"}
31
+ list << %{--vendor "#{config.vendor}"}
32
+ list << %{--template-scripts}
33
+ list << %{--before-install #{distribution.preinstall_file}}
34
+ list << %{--after-install #{distribution.postinstall_file}}
35
+ list << %{--before-remove #{distribution.preuninstall_file}}
36
+ list << %{--after-remove #{distribution.postuninstall_file}}
37
+ distribution.dependencies(config.dependencies).each{|d| list << "-d '#{d}'"}
38
+ list.compact
39
+ end
40
+ end
41
+ end
data/lib/pkgr/process.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  module Pkgr
2
2
  class Process
3
- DAEMON_PROCESSES = ["web", "worker"]
4
-
5
3
  attr_reader :name, :command
6
4
  attr_accessor :scale
7
5
 
@@ -10,9 +8,5 @@ module Pkgr
10
8
  @command = command
11
9
  @scale = scale || 1
12
10
  end
13
-
14
- def daemon?
15
- DAEMON_PROCESSES.include?(name)
16
- end
17
11
  end
18
12
  end
data/lib/pkgr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pkgr
2
- VERSION = "1.4.0"
2
+ VERSION = "1.4.1"
3
3
  end
metadata CHANGED
@@ -1,99 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkgr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Rohr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-15 00:00:00.000000000 Z
11
+ date: 2015-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '10.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '10.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: thor
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.19'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '0.19'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: fpm
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '1.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '1.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: facter
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '2.1'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '2.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mixlib-log
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '1.6'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '1.6'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mixlib-shellout
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '1.4'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '1.4'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,9 +108,8 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '2'
111
- description: Embeds your app dependencies (e.g. a specific ruby version and you gems
112
- in the case of Rails apps) into a debian package, for easy installation. Provides
113
- init scripts and more.
111
+ description: Simplify the deployment of your applications by automatically packaging
112
+ your application and its dependencies on multiple platforms.
114
113
  email:
115
114
  - cyril.rohr@gmail.com
116
115
  executables:
@@ -126,11 +125,13 @@ files:
126
125
  - data/build_dependencies/centos.yml
127
126
  - data/build_dependencies/debian.yml
128
127
  - data/build_dependencies/fedora.yml
128
+ - data/build_dependencies/sles.yml
129
129
  - data/build_dependencies/ubuntu.yml
130
130
  - data/buildpacks/centos-6
131
131
  - data/buildpacks/debian-6
132
132
  - data/buildpacks/debian-7
133
133
  - data/buildpacks/fedora-20
134
+ - data/buildpacks/sles-12
134
135
  - data/buildpacks/ubuntu-10.04
135
136
  - data/buildpacks/ubuntu-12.04
136
137
  - data/buildpacks/ubuntu-14.04
@@ -138,6 +139,7 @@ files:
138
139
  - data/dependencies/centos.yml
139
140
  - data/dependencies/debian.yml
140
141
  - data/dependencies/fedora.yml
142
+ - data/dependencies/sles.yml
141
143
  - data/dependencies/ubuntu.yml
142
144
  - data/environment/default.erb
143
145
  - data/hooks/postinstall.sh
@@ -168,8 +170,10 @@ files:
168
170
  - lib/pkgr/distributions/fedora.rb
169
171
  - lib/pkgr/distributions/redhat.rb
170
172
  - lib/pkgr/distributions/runner.rb
173
+ - lib/pkgr/distributions/sles.rb
171
174
  - lib/pkgr/distributions/ubuntu.rb
172
175
  - lib/pkgr/env.rb
176
+ - lib/pkgr/fpm_command.rb
173
177
  - lib/pkgr/git.rb
174
178
  - lib/pkgr/installer.rb
175
179
  - lib/pkgr/process.rb
@@ -200,6 +204,6 @@ rubyforge_project:
200
204
  rubygems_version: 2.2.2
201
205
  signing_key:
202
206
  specification_version: 4
203
- summary: Package any app as a debian package
207
+ summary: Package any Ruby, NodeJS or Go app as a deb or rpm package
204
208
  test_files: []
205
209
  has_rdoc: