src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java
branchJDK-8200758-branch
changeset 57140 3dcb33ce7ced
parent 57119 b3dda8d77d8a
child 57150 fa68c2ab636d
equal deleted inserted replaced
57127:1e4dceb0da58 57140:3dcb33ce7ced
   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 {
   699                 VENDOR
   700                 VENDOR
   700         );
   701         );
   701     }
   702     }
   702 
   703 
   703     @Override
   704     @Override
   704     public File execute(
   705     public File execute(Map<String, ? super Object> params,
   705             Map<String, ? super Object> params, File outputParentDir) {
   706             File outputParentDir) throws PackagerException {
   706         return bundle(params, outputParentDir);
   707         return bundle(params, outputParentDir);
   707     }
   708     }
   708 
   709 
   709     @Override
   710     @Override
   710     public boolean supported() {
   711     public boolean supported() {