buildizer 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjQ2NDk2ZTA4OTQzYjQzYjYyN2E3NzY2MjFlYzUwZjE2ODI2MTM2Nw==
4
+ ZmJhNmZhMzlhYzZhZDRjZWYwNTFkZDJhYzU4YjNmMTk3ZjA5MWVhOQ==
5
5
  data.tar.gz: !binary |-
6
- YzNjNTg2ZWZmNDg2ZjBhNTE3YjQzMTdlMTRiYWQ4ODIyMzk0NjJhMQ==
6
+ MzZjZTE0MzQ3ODI2YzBkOTc5NzRjOGZhYjdhM2YyYjhhOWFjOWI4Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzdlZDRlN2JhODkwN2U5ZmM5MGYzNGU4NjMzOGJiNGU5Zjc5OWFjMzA1MWI2
10
- Zjg5NDQxODVhZGFiZmM5NWYxZWIxODliZTZkNGI1ZTRjM2Q2YTVjZWU4YWQw
11
- ZWE1ZWM5NjJjYTVhZGE3N2JiMDEyZDRiYjgwNDIwMDdkYjkzODk=
9
+ ZThhYTdlZjNmNTdmZDdmNzRhMTVjOGY1M2U3YjY1NzcxZTRhZTMwZDZiNTc2
10
+ YzZmZDY1NjhlYTI2ZWIzZmEzNTZhZDQ4NDE2M2ZiZmZmYzBkMTJkOGQwNzBj
11
+ YzA3MTYzMGNhY2I0YzgwOGU2Njc4MWE1OTVhZmE5M2RlYzk1OGY=
12
12
  data.tar.gz: !binary |-
13
- Yzk4YjIxMmQ2MGI4Y2Q0NDhmYTQ4ZTY4MDJmM2M2N2Y5ZjFkODY1OTczMWQ0
14
- ZTVmNjNlODJjMjRmNzAyMWQ3YTZkNGI2NTdlYzYxMjBjMTFiZjk2OTFjZjgy
15
- MDQ0ZjQ2NzQwNTlmODhlOTE5ODM5ZWI3MTExZGU4MWI0NzQyMzU=
13
+ OTIxMGYzZDI0N2JmYmQyZDcwYjdmM2QyNGRjMjg0NzE2NTUzNTJkMDFmY2I2
14
+ MGQ0NDhlNjlkMWFhNmFhYzMyOTVmZDkxZGUzNTk5NWNiOThkNzA2ZjExNzc2
15
+ NjZiN2NjOGVhY2U2YjE0MDg3NDAwOWZjYzM0YzAwMTI1NzU5Mzc=
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  GIT
2
2
  remote: https://github.com/flant/shellfold.git
3
- revision: 6b76a3438007ae7a01387ce77ed9e41e5517bfb3
3
+ revision: 51d8ff898ae1afbfb6463ed2e1ed25571cab347c
4
4
  specs:
5
- shellfold (0.0.1)
5
+ shellfold (0.0.3)
6
6
  mixlib-shellout (>= 2.2.6, < 3.0)
7
7
 
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- buildizer (0.0.5)
11
+ buildizer (0.0.6)
12
12
  net_status (>= 0.0.1, < 1.0)
13
13
  package_cloud (>= 0.2, < 1.0)
14
14
  shellfold (>= 0.0.1, < 1.0)
@@ -22,7 +22,7 @@ module Buildizer
22
22
  "build type is forbidden ",
23
23
  "(use TRAVIS_TAG, CI_BUILD_TAG env variables)",
24
24
  ].join) if params[:package_version]
25
- params[:package_version] = ENV['TRAVIS_TAG'] || ENV['CI_BUILD_TAG']
25
+ params[:package_version] = packager.package_version_tag
26
26
  params[:fpm_script] = Array(packager.buildizer_conf['fpm_script'])
27
27
  params[:fpm_config_files] = packager.buildizer_conf['fpm_config_files'].to_h
28
28
  params[:fpm_files] = packager.buildizer_conf['fpm_files'].to_h
@@ -0,0 +1,23 @@
1
+ module Buildizer
2
+ module Builder
3
+ class Native < Base
4
+ def build_type
5
+ 'native'
6
+ end
7
+
8
+ def target_klass
9
+ Target::Native
10
+ end
11
+
12
+ def initial_target_params
13
+ super.tap do |params|
14
+ params[:package_version] = packager.package_version_tag
15
+ end
16
+ end
17
+
18
+ def build_instructions(target)
19
+ target.image.native_build_instructions(self, target)
20
+ end
21
+ end # Native
22
+ end # Builder
23
+ end # Buildizer
@@ -51,6 +51,10 @@ module Buildizer
51
51
  def instruction(instruction, cmd)
52
52
  instructions << [instruction.to_s.upcase, cmd].join(' ')
53
53
  end
54
+
55
+ def native_build_instructions(builder, target)
56
+ raise
57
+ end
54
58
  end # Base
55
59
  end # Image
56
60
  end # Buildizer
@@ -47,6 +47,25 @@ module Buildizer
47
47
 
48
48
  instruction :RUN, "bash -lec \"echo -e '#{repo}' >> /etc/yum.repos.d/CentOS-Extra-Buildizer.repo\""
49
49
  end
50
+
51
+ def native_build_instructions(builder, target)
52
+ version, release = target.package_version.split('-')
53
+ source_name = "#{target.package_name}-#{version}"
54
+ source_archive_path = Pathname.new('/package.tar.gz')
55
+ target_spec_name = "#{target.package_name}.spec"
56
+
57
+ ["cp -r #{builder.docker.container_package_path} /tmp/#{source_name}",
58
+ "cd /tmp",
59
+ "tar -zcvf #{source_archive_path} #{source_name}",
60
+ "ln -fs #{builder.docker.container_build_path} ~/rpmbuild",
61
+ "rpmdev-setuptree",
62
+ "cp #{source_archive_path} ~/rpmbuild/SOURCES",
63
+ "cp #{builder.docker.container_package_path.join(target_spec_name)} ~/rpmbuild/SPECS",
64
+ "cd ~/rpmbuild/SPECS",
65
+ "rpmbuild -ba #{target_spec_name}",
66
+ "cp $(find #{builder.docker.container_build_path.join('RPMS')} -name '*.rpm') #{builder.docker.container_build_path}",
67
+ ]
68
+ end
50
69
  end # Centos
51
70
  end # Image
52
71
  end # Buildizer
@@ -20,6 +20,10 @@ module Buildizer
20
20
  os_codename
21
21
  end
22
22
 
23
+ def build_dep(build_dep)
24
+ instruction :RUN, "apt-get build-dep -y #{build_dep.to_a.join(' ')}" if build_dep.any?
25
+ end
26
+
23
27
  def fpm_output_type
24
28
  'deb'
25
29
  end
@@ -30,10 +34,6 @@ module Buildizer
30
34
  res << '--deb-no-default-config-files'
31
35
  end
32
36
  end
33
-
34
- def build_dep(build_dep)
35
- instruction :RUN, "apt-get build-dep -y #{build_dep.to_a.join(' ')}" if build_dep.any?
36
- end
37
37
  end # Ubuntu
38
38
  end # Image
39
39
  end # Buildizer
@@ -54,7 +54,7 @@ module Buildizer
54
54
  end
55
55
 
56
56
  def buildizer_conf
57
- @buildizer_conf ||= YAML.load(buildizer_conf_path.read)
57
+ @buildizer_conf ||= (YAML.load((buildizer_conf_path.read rescue "")) || {})
58
58
  end
59
59
 
60
60
  def options
@@ -155,6 +155,10 @@ git add -v .travis.yml
155
155
  buildizer_conf['package_version']
156
156
  end
157
157
 
158
+ def package_version_tag
159
+ ENV['TRAVIS_TAG'] || ENV['CI_BUILD_TAG']
160
+ end
161
+
158
162
  def os_params(os)
159
163
  buildizer_conf['os'].to_h[os.to_s].to_h
160
164
  end
@@ -226,7 +230,9 @@ git add -v .travis.yml
226
230
  def builder
227
231
  @builder ||= begin
228
232
  build_type = buildizer_conf['build_type']
229
- klass = {'fpm' => Builder::Fpm}[build_type]
233
+ raise Error, error: :input_error, message: "no build_type given" unless build_type
234
+ klass = {fpm: Builder::Fpm,
235
+ native: Builder::Native}[build_type.to_s.to_sym]
230
236
  raise Error, error: :input_error, message: "unknown build_type '#{build_type}'" unless klass
231
237
  klass.new(self)
232
238
  end
@@ -0,0 +1,6 @@
1
+ module Buildizer
2
+ module Target
3
+ class Native < Base
4
+ end # Native
5
+ end # Target
6
+ end # Buildizer
@@ -1,3 +1,3 @@
1
1
  module Buildizer
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
data/lib/buildizer.rb CHANGED
@@ -13,9 +13,11 @@ require 'buildizer/packager'
13
13
  require 'buildizer/target'
14
14
  require 'buildizer/target/base'
15
15
  require 'buildizer/target/fpm'
16
+ require 'buildizer/target/native'
16
17
  require 'buildizer/builder'
17
18
  require 'buildizer/builder/base'
18
19
  require 'buildizer/builder/fpm'
20
+ require 'buildizer/builder/native'
19
21
  require 'buildizer/image'
20
22
  require 'buildizer/image/base'
21
23
  require 'buildizer/image/centos'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - flant
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-17 00:00:00.000000000 Z
11
+ date: 2016-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -222,6 +222,7 @@ files:
222
222
  - lib/buildizer/builder.rb
223
223
  - lib/buildizer/builder/base.rb
224
224
  - lib/buildizer/builder/fpm.rb
225
+ - lib/buildizer/builder/native.rb
225
226
  - lib/buildizer/cli.rb
226
227
  - lib/buildizer/docker.rb
227
228
  - lib/buildizer/error.rb
@@ -238,6 +239,7 @@ files:
238
239
  - lib/buildizer/target.rb
239
240
  - lib/buildizer/target/base.rb
240
241
  - lib/buildizer/target/fpm.rb
242
+ - lib/buildizer/target/native.rb
241
243
  - lib/buildizer/version.rb
242
244
  homepage: https://github.com/flant/buildizer
243
245
  licenses: