dr 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/dr/gitpackage.rb +92 -80
  2. data/lib/dr/version.rb +1 -1
  3. metadata +27 -17
  4. checksums.yaml +0 -7
@@ -117,64 +117,79 @@ module Dr
117
117
  branch = @default_branch unless branch
118
118
 
119
119
  version = nil
120
+
120
121
  orig_rev, curr_rev = update_from_origin branch
121
- if curr_rev != orig_rev || force
122
- Dir.mktmpdir do |src_dir|
123
- checkout branch, src_dir
122
+ log :info, "Branch #{branch.fg "blue"}, revision #{curr_rev[0..7].fg "blue"}"
123
+ unless @force
124
+ history.each do |v|
125
+ metadata = @repo.get_build_metadata @name, v
126
+ if metadata.has_key?("revision") && metadata["revision"] == curr_rev
127
+ msg = "This revision of #{@name.style "pkg-name"} has alredy " +
128
+ "been built and is available as #{v.to_s.style "version"}"
129
+ log :info, msg
130
+ return
131
+ end
132
+ end
133
+ end
124
134
 
125
- version = PkgVersion.new get_version "#{src_dir}/debian/changelog"
126
- log :info, "Source version: #{version.source.style "version"}"
135
+ Dir.mktmpdir do |src_dir|
136
+ checkout branch, src_dir
127
137
 
128
- while build_exists? version
129
- version.increment!
130
- end
131
- log :info, "Build version: #{version.to_s.style "version"}"
132
-
133
- log :info, "Updating changelog"
134
- now = Time.new.strftime("%a, %-d %b %Y %T %z")
135
- ch_entry = "#{@name} (#{version}) kano; urgency=low\n"
136
- ch_entry << "\n"
137
- ch_entry << " * Package rebuilt, updated to revision #{curr_rev[0..7]}.\n"
138
- ch_entry << "\n"
139
- ch_entry << " -- Team Kano <dev@kano.me> #{now}\n\n"
140
-
141
- changelog = ""
142
- File.open "#{src_dir}/debian/changelog", "r" do |f|
143
- changelog = f.read
144
- end
138
+ version = PkgVersion.new get_version "#{src_dir}/debian/changelog"
139
+ log :info, "Source version: #{version.source.style "version"}"
145
140
 
146
- File.open "#{src_dir}/debian/changelog", "w" do |f|
147
- f.write ch_entry
148
- f.write changelog
149
- end
141
+ while build_exists? version
142
+ version.increment!
143
+ end
144
+ log :info, "Build version: #{version.to_s.style "version"}"
145
+
146
+ log :info, "Updating changelog"
147
+ now = Time.new.strftime("%a, %-d %b %Y %T %z")
148
+ ch_entry = "#{@name} (#{version}) kano; urgency=low\n"
149
+ ch_entry << "\n"
150
+ ch_entry << " * Package rebuilt, updated to revision #{curr_rev[0..7]}.\n"
151
+ ch_entry << "\n"
152
+ ch_entry << " -- Team Kano <dev@kano.me> #{now}\n\n"
153
+
154
+ changelog = ""
155
+ File.open "#{src_dir}/debian/changelog", "r" do |f|
156
+ changelog = f.read
157
+ end
150
158
 
151
- repo_arches = @repo.get_architectures
152
- pkg_arches = get_architectures("#{src_dir}/debian/control")
153
- arches = case
159
+ File.open "#{src_dir}/debian/changelog", "w" do |f|
160
+ f.write ch_entry
161
+ f.write changelog
162
+ end
163
+
164
+ repo_arches = @repo.get_architectures
165
+ pkg_arches = get_architectures("#{src_dir}/debian/control")
166
+ arches = case
154
167
  when pkg_arches.include?("any") || pkg_arches.include?("all")
155
168
  repo_arches
156
169
  else
157
170
  repo_arches & pkg_arches
158
171
  end
159
- arches.each do |arch|
160
- @repo.buildroot(arch).open do |br|
161
- log :info, "Building the #{@name.style "pkg-name"} package " +
162
- "version #{version.to_s.style "version"} for #{arch}"
163
-
164
- # Moving to the proper directory
165
- build_dir_name = "#{@name}-#{version.upstream}"
166
- build_dir = "#{br}/#{build_dir_name}"
167
- FileUtils.cp_r src_dir, build_dir
168
-
169
- # Make orig tarball
170
- log :info, "Creating orig source tarball"
171
- tar = "tar cz -C #{build_dir} --exclude=debian " +
172
- "-f #{br}/#{@name}_#{version.upstream}.orig.tar.gz " +
173
- "`ls -1 #{build_dir}`"
174
- ShellCmd.new tar, :tag => "tar"
175
-
176
- apt = "sudo chroot #{br} apt-get update"
177
- deps = <<-EOS
172
+
173
+ arches.each do |arch|
174
+ @repo.buildroot(arch).open do |br|
175
+ log :info, "Building the #{@name.style "pkg-name"} package " +
176
+ "version #{version.to_s.style "version"} for #{arch}"
177
+
178
+ # Moving to the proper directory
179
+ build_dir_name = "#{@name}-#{version.upstream}"
180
+ build_dir = "#{br}/#{build_dir_name}"
181
+ FileUtils.cp_r src_dir, build_dir
182
+
183
+ # Make orig tarball
184
+ files = Dir["#{build_dir}/*"].map { |f| "\"#{f}\"" }.join " "
185
+ log :info, "Creating orig source tarball"
186
+ tar = "tar cz -C #{build_dir} --exclude=debian " +
187
+ "-f #{br}/#{@name}_#{version.upstream}.orig.tar.gz " +
188
+ "#{files}"
189
+ ShellCmd.new tar, :tag => "tar"
190
+
191
+ apt = "sudo chroot #{br} apt-get update"
192
+ deps = <<-EOS
178
193
  sudo chroot #{br} <<EOF
179
194
  dpkg-source -b "/#{build_dir_name}"
180
195
  mk-build-deps *.dsc -i -t "apt-get --no-install-recommends -y"
@@ -188,49 +203,46 @@ debuild -i -uc -us -b
188
203
  EOF
189
204
  EOS
190
205
 
191
- log :info, "Updating the sources lists"
192
- ShellCmd.new apt, :tag => "apt-get", :show_out => true
206
+ log :info, "Updating the sources lists"
207
+ ShellCmd.new apt, :tag => "apt-get", :show_out => true
193
208
 
194
- log :info, "Installing build dependencies"
195
- ShellCmd.new deps, :tag => "mk-build-deps", :show_out => true
209
+ log :info, "Installing build dependencies"
210
+ ShellCmd.new deps, :tag => "mk-build-deps", :show_out => true
196
211
 
197
- log :info, "Building the package"
198
- ShellCmd.new build, :tag => "debuild", :show_out => true
212
+ log :info, "Building the package"
213
+ ShellCmd.new build, :tag => "debuild", :show_out => true
199
214
 
200
- debs = Dir["#{br}/*.deb"]
201
- expected_pkgs = get_subpackage_names "#{src_dir}/debian/control"
202
- expected_pkgs.each do |subpkg_name|
203
- includes = debs.inject(false) do |r, n|
204
- r || ((/^#{br}\/#{subpkg_name}_#{version}/ =~ n) != nil)
205
- end
215
+ debs = Dir["#{br}/*.deb"]
216
+ expected_pkgs = get_subpackage_names "#{src_dir}/debian/control"
217
+ expected_pkgs.each do |subpkg_name|
218
+ includes = debs.inject(false) do |r, n|
219
+ r || ((/^#{br}\/#{subpkg_name}_#{version}/ =~ n) != nil)
220
+ end
206
221
 
207
- unless includes
208
- log :err, "Subpackage #{subpkg_name} did not build properly"
209
- raise "Building #{name} failed"
210
- end
222
+ unless includes
223
+ log :err, "Subpackage #{subpkg_name} did not build properly"
224
+ raise "Building #{name} failed"
211
225
  end
226
+ end
212
227
 
213
- build_dir = "#{@repo.location}/packages/#{@name}/builds/#{version}"
214
- FileUtils.mkdir_p build_dir
215
- debs.each do |pkg|
216
- FileUtils.cp pkg, build_dir
228
+ build_dir = "#{@repo.location}/packages/#{@name}/builds/#{version}"
229
+ FileUtils.mkdir_p build_dir
230
+ debs.each do |pkg|
231
+ FileUtils.cp pkg, build_dir
217
232
 
218
- deb_filename = File.basename(pkg)
219
- log :info, "Signing the #{deb_filename.style "subpkg-name"} package"
220
- @repo.sign_deb "#{build_dir}/#{deb_filename}"
221
- end
233
+ deb_filename = File.basename(pkg)
234
+ log :info, "Signing the #{deb_filename.style "subpkg-name"} package"
235
+ @repo.sign_deb "#{build_dir}/#{deb_filename}"
236
+ end
222
237
 
223
- log :info, "Writing package metadata"
224
- File.open "#{build_dir}/.metadata", "w" do |f|
225
- YAML.dump({"branch" => branch}, f)
226
- end
227
- log :info, "The #{@name.style "pkg-name"} package has been " +
228
- "built successfully."
238
+ log :info, "Writing package metadata"
239
+ File.open "#{build_dir}/.metadata", "w" do |f|
240
+ YAML.dump({"branch" => branch, "revision" => curr_rev}, f)
229
241
  end
242
+ log :info, "The #{@name.style "pkg-name"} package was " +
243
+ "built successfully."
230
244
  end
231
245
  end
232
- else
233
- log :info, "There were no changes in the #{@name.style "pkg-name"} package"
234
246
  end
235
247
  version
236
248
  end
@@ -1,3 +1,3 @@
1
1
  module Dr
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Radek Pazdera
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
12
+ date: 2014-04-13 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: thor
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: tco
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: bundler
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
@@ -55,37 +62,39 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rake
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: rspec
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
- description: |-
84
- dr works with distribution-level packaging
85
- tools and helps you make and distribute your own
86
- Debian packages through your own repository.
87
- This is a super early release, certainly NOT ready
88
- for production.
94
+ description: ! "dr works with distribution-level packaging\n tools
95
+ and helps you make and distribute your own\n Debian packages
96
+ through your own repository.\n This is a super early release,
97
+ certainly NOT ready\n for production."
89
98
  email:
90
99
  - radek@kano.me
91
100
  executables:
@@ -116,26 +125,27 @@ files:
116
125
  homepage: http://github.com/KanoComputing/kano-package-system
117
126
  licenses:
118
127
  - GPLv2
119
- metadata: {}
120
128
  post_install_message:
121
129
  rdoc_options: []
122
130
  require_paths:
123
131
  - lib
124
132
  required_ruby_version: !ruby/object:Gem::Requirement
133
+ none: false
125
134
  requirements:
126
- - - '>='
135
+ - - ! '>='
127
136
  - !ruby/object:Gem::Version
128
137
  version: '0'
129
138
  required_rubygems_version: !ruby/object:Gem::Requirement
139
+ none: false
130
140
  requirements:
131
- - - '>='
141
+ - - ! '>='
132
142
  - !ruby/object:Gem::Version
133
143
  version: '0'
134
144
  requirements: []
135
145
  rubyforge_project:
136
- rubygems_version: 2.0.3
146
+ rubygems_version: 1.8.23
137
147
  signing_key:
138
- specification_version: 4
148
+ specification_version: 3
139
149
  summary: dr stands for debian-repository. It is a packaging tool that helps you make,
140
150
  distribute and maintain you own disto packages and repositories. It's in a very
141
151
  early stage, NOT READY for production.
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: a853b8d13242f1b101720affa5ed4a47ca70ca83
4
- data.tar.gz: a08d2d29dc77d00cc9e14fa260e5c62a160ce5ee
5
- SHA512:
6
- metadata.gz: c47cbc373eca126e7956b2b1b39d53434e3cca6cc2c8a5655ae66a844ebf1e6d14162a0e53452f8c754924c4f9c659f9bb0788103330147a412e6c7b58a467b1
7
- data.tar.gz: a0ab608937f6065e8604b2296ad1b50ea2317e88c3c65e4ee915e5ed761b7eb67285f2fc50267fc25198a321a0b9974ac6794288758d8ee391035ed2b85848a8