autobuild 1.5.59 → 1.5.60
Sign up to get free protection for your applications and to get access to all the features.
- data/Changes.txt +10 -0
- data/lib/autobuild/importer.rb +92 -36
- data/lib/autobuild/version.rb +1 -1
- metadata +5 -5
data/Changes.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
== Version 1.5.60
|
2
|
+
* patching: fix some more issues regarding the interaction of patching and VCS:
|
3
|
+
* autobuild will now properly remove patches before we try to update
|
4
|
+
This fixes un-updateable systems on which the update would fail before
|
5
|
+
the patch, but autobuild would try to update before removing the patches
|
6
|
+
* if a patch conflicts with a VCS update, the reported error will now be
|
7
|
+
that the patch can't be applied, NOT that the VCS cannot update. The
|
8
|
+
latter behaviour was too confusing.
|
9
|
+
* patching: better progress messages.
|
10
|
+
|
1
11
|
== Version 1.5.59
|
2
12
|
* orogen: try to autodetect the orogen_file value earlier, if not provided
|
3
13
|
* added Autobuild.color? and Autobuild.color= to control whether the output
|
data/lib/autobuild/importer.rb
CHANGED
@@ -77,22 +77,79 @@ class Importer
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
def perform_update(package)
|
81
|
+
cur_patches = currently_applied_patches(package)
|
82
|
+
needed_patches = self.patches
|
83
|
+
kept_patches = (cur_patches & needed_patches)
|
84
|
+
if kept_patches != cur_patches
|
85
|
+
patch(package, kept_patches)
|
86
|
+
end
|
87
|
+
|
88
|
+
package.progress "updating %s"
|
89
|
+
update(package)
|
90
|
+
patch(package)
|
91
|
+
package.updated = true
|
92
|
+
rescue Interrupt
|
93
|
+
raise
|
94
|
+
rescue ::Exception => original_error
|
95
|
+
# If the package is patched, it might be that the update
|
96
|
+
# failed because we needed to unpatch first. Try it out
|
97
|
+
#
|
98
|
+
# This assumes that importing data with conflict will
|
99
|
+
# make the import fail, but not make the patch
|
100
|
+
# un-appliable. Importers that do not follow this rule
|
101
|
+
# will have to unpatch by themselves.
|
102
|
+
cur_patches = currently_applied_patches(package)
|
103
|
+
if cur_patches.empty?
|
104
|
+
return fallback(original_error, package, :import, package)
|
105
|
+
end
|
106
|
+
|
107
|
+
package.progress "update failed and some patches are applied, retrying after removing all patches first"
|
108
|
+
begin
|
109
|
+
patch(package, [])
|
110
|
+
|
111
|
+
rescue ::Exception => e
|
112
|
+
# The unpatching failed. The importer probably did
|
113
|
+
# change the files in a way that made the patching
|
114
|
+
# impossible to reverse. Just raise the original
|
115
|
+
# error (which hopefully should be the importer
|
116
|
+
# message that says that there are conflicts)
|
117
|
+
raise original_error
|
118
|
+
end
|
119
|
+
|
120
|
+
begin
|
121
|
+
package.progress "updating %s"
|
122
|
+
update(package)
|
123
|
+
patch(package)
|
124
|
+
package.updated = true
|
125
|
+
rescue Interrupt
|
126
|
+
raise
|
127
|
+
rescue ::Exception => e
|
128
|
+
fallback(e, package, :import, package)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def perform_checkout(package)
|
133
|
+
package.progress "checking out %s"
|
134
|
+
checkout(package)
|
135
|
+
patch(package)
|
136
|
+
package.updated = true
|
137
|
+
rescue Autobuild::Exception => e
|
138
|
+
FileUtils.rm_rf package.srcdir
|
139
|
+
fallback(e, package, :import, package)
|
140
|
+
rescue ::Exception
|
141
|
+
package.progress "checkout of %s failed, deleting the source directory #{package.srcdir}"
|
142
|
+
FileUtils.rm_rf package.srcdir
|
143
|
+
raise
|
144
|
+
end
|
145
|
+
|
80
146
|
# Performs the import of +package+
|
81
147
|
def import(package)
|
82
148
|
srcdir = package.srcdir
|
83
149
|
if File.directory?(srcdir)
|
84
150
|
package.isolate_errors(false) do
|
85
151
|
if Autobuild.do_update
|
86
|
-
package
|
87
|
-
begin
|
88
|
-
update(package)
|
89
|
-
patch(package)
|
90
|
-
package.updated = true
|
91
|
-
rescue Interrupt
|
92
|
-
raise
|
93
|
-
rescue ::Exception => e
|
94
|
-
fallback(e, package, :import, package)
|
95
|
-
end
|
152
|
+
perform_update(package)
|
96
153
|
else
|
97
154
|
if Autobuild.verbose
|
98
155
|
puts " not updating #{package.name}"
|
@@ -104,21 +161,8 @@ class Importer
|
|
104
161
|
elsif File.exists?(srcdir)
|
105
162
|
raise ConfigException, "#{srcdir} exists but is not a directory"
|
106
163
|
else
|
107
|
-
|
108
|
-
package.progress "checking out %s"
|
109
|
-
checkout(package)
|
110
|
-
patch(package)
|
111
|
-
package.updated = true
|
112
|
-
rescue Autobuild::Exception => e
|
113
|
-
FileUtils.rm_rf package.srcdir
|
114
|
-
fallback(e, package, :import, package)
|
115
|
-
rescue ::Exception
|
116
|
-
package.progress "checkout of %s failed, deleting the source directory #{package.srcdir}"
|
117
|
-
FileUtils.rm_rf package.srcdir
|
118
|
-
raise
|
119
|
-
end
|
164
|
+
perform_checkout(package)
|
120
165
|
end
|
121
|
-
|
122
166
|
end
|
123
167
|
|
124
168
|
# Tries to find a fallback importer because of the given error.
|
@@ -154,27 +198,37 @@ class Importer
|
|
154
198
|
def apply(package, path); call_patch(package, false, path) end
|
155
199
|
def unapply(package, path); call_patch(package, true, path) end
|
156
200
|
|
201
|
+
def currently_applied_patches(package)
|
202
|
+
patches_file = patchlist(package)
|
203
|
+
if !File.exists?(patches_file) then []
|
204
|
+
else
|
205
|
+
File.open(patches_file) do |f|
|
206
|
+
f.readlines.collect { |path| path.rstrip }
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
157
211
|
def patch(package, patches = self.patches)
|
158
212
|
# Get the list of already applied patches
|
159
|
-
|
160
|
-
cur_patches = if !File.exists?(patches_file) then []
|
161
|
-
else
|
162
|
-
File.open(patches_file) do |f|
|
163
|
-
f.readlines.collect { |path| path.rstrip }
|
164
|
-
end
|
165
|
-
end
|
213
|
+
cur_patches = currently_applied_patches(package)
|
166
214
|
|
167
215
|
if cur_patches == patches
|
168
|
-
return
|
216
|
+
return false
|
169
217
|
end
|
170
218
|
|
171
|
-
if !patches.empty?
|
172
|
-
package.progress "patching %s"
|
173
|
-
end
|
174
|
-
|
175
219
|
# Do not be smart, remove all already applied patches
|
176
220
|
# and then apply the new ones
|
177
221
|
begin
|
222
|
+
apply_count = (patches - cur_patches).size
|
223
|
+
unapply_count = (cur_patches - patches).size
|
224
|
+
if apply_count > 0 && unapply_count > 0
|
225
|
+
package.progress "patching %s: applying #{apply_count} and unapplying #{unapply_count} patch(es)"
|
226
|
+
elsif apply_count > 0
|
227
|
+
package.progress "patching %s: applying #{apply_count} patch(es)"
|
228
|
+
else
|
229
|
+
package.progress "patching %s: unapplying #{unapply_count} patch(es)"
|
230
|
+
end
|
231
|
+
|
178
232
|
while p = cur_patches.last
|
179
233
|
unapply(package, p)
|
180
234
|
cur_patches.pop
|
@@ -189,6 +243,8 @@ class Importer
|
|
189
243
|
f.write(cur_patches.join("\n"))
|
190
244
|
end
|
191
245
|
end
|
246
|
+
|
247
|
+
return true
|
192
248
|
end
|
193
249
|
end
|
194
250
|
end
|
data/lib/autobuild/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autobuild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 123
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 60
|
10
|
+
version: 1.5.60
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sylvain Joyeux
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-28 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
requirements: []
|
165
165
|
|
166
166
|
rubyforge_project: autobuild
|
167
|
-
rubygems_version: 1.8.
|
167
|
+
rubygems_version: 1.8.15
|
168
168
|
signing_key:
|
169
169
|
specification_version: 3
|
170
170
|
summary: Rake-based utility to build and install multiple packages with dependencies
|