235 } |
235 } |
236 } |
236 } |
237 } |
237 } |
238 |
238 |
239 private boolean prepareProto(Map<String, ? super Object> p) |
239 private boolean prepareProto(Map<String, ? super Object> p) |
240 throws IOException { |
240 throws PackagerException, IOException { |
241 File appImage = StandardBundlerParam.getPredefinedAppImage(p); |
241 File appImage = StandardBundlerParam.getPredefinedAppImage(p); |
242 File appDir = null; |
242 File appDir = null; |
243 |
243 |
244 // we either have an application image or need to build one |
244 // we either have an application image or need to build one |
245 if (appImage != null) { |
245 if (appImage != null) { |
252 RPM_IMAGE_DIR.fetchFrom(p), true); |
252 RPM_IMAGE_DIR.fetchFrom(p), true); |
253 } |
253 } |
254 return appDir != null; |
254 return appDir != null; |
255 } |
255 } |
256 |
256 |
257 public File bundle(Map<String, ? super Object> p, File outdir) { |
257 public File bundle(Map<String, ? super Object> p, |
|
258 File outdir) throws PackagerException { |
258 if (!outdir.isDirectory() && !outdir.mkdirs()) { |
259 if (!outdir.isDirectory() && !outdir.mkdirs()) { |
259 throw new RuntimeException(MessageFormat.format( |
260 throw new PackagerException( |
260 I18N.getString("error.cannot-create-output-dir"), |
261 "error.cannot-create-output-dir", |
261 outdir.getAbsolutePath())); |
262 outdir.getAbsolutePath()); |
262 } |
263 } |
263 if (!outdir.canWrite()) { |
264 if (!outdir.canWrite()) { |
264 throw new RuntimeException(MessageFormat.format( |
265 throw new PackagerException( |
265 I18N.getString("error.cannot-write-to-output-dir"), |
266 "error.cannot-write-to-output-dir", |
266 outdir.getAbsolutePath())); |
267 outdir.getAbsolutePath()); |
267 } |
268 } |
268 |
269 |
269 File imageDir = RPM_IMAGE_DIR.fetchFrom(p); |
270 File imageDir = RPM_IMAGE_DIR.fetchFrom(p); |
270 try { |
271 try { |
271 |
272 |
274 if (prepareProto(p) && prepareProjectConfig(p)) { |
275 if (prepareProto(p) && prepareProjectConfig(p)) { |
275 return buildRPM(p, outdir); |
276 return buildRPM(p, outdir); |
276 } |
277 } |
277 return null; |
278 return null; |
278 } catch (IOException ex) { |
279 } catch (IOException ex) { |
279 ex.printStackTrace(); |
280 Log.verbose(ex); |
280 return null; |
281 throw new PackagerException(ex); |
281 } |
282 } |
282 } |
283 } |
283 |
284 |
284 private String getLicenseFileString(Map<String, ? super Object> params) |
285 private String getLicenseFileString(Map<String, ? super Object> params) |
285 throws IOException { |
286 throws IOException { |