< prev index next >

src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java

Print this page

        

*** 171,190 **** return false; } } @Override ! public boolean validate(Map<String, ? super Object> p) throws UnsupportedPlatformException, ConfigException { try { ! if (p == null) throw new ConfigException( I18N.getString("error.parameters-null"), I18N.getString("error.parameters-null.advice")); // run basic validation to ensure requirements are met // we are not interested in return code, only possible exception ! APP_BUNDLER.fetchFrom(p).validate(p); // validate presense of required tools if (!testTool(TOOL_RPMBUILD, TOOL_RPMBUILD_MIN_VERSION)){ throw new ConfigException( MessageFormat.format( --- 171,190 ---- return false; } } @Override ! public boolean validate(Map<String, ? super Object> params) throws UnsupportedPlatformException, ConfigException { try { ! if (params == null) throw new ConfigException( I18N.getString("error.parameters-null"), I18N.getString("error.parameters-null.advice")); // run basic validation to ensure requirements are met // we are not interested in return code, only possible exception ! APP_BUNDLER.fetchFrom(params).validate(params); // validate presense of required tools if (!testTool(TOOL_RPMBUILD, TOOL_RPMBUILD_MIN_VERSION)){ throw new ConfigException( MessageFormat.format(
*** 195,205 **** TOOL_RPMBUILD_MIN_VERSION)); } // only one mime type per association, at least one file extension List<Map<String, ? super Object>> associations = ! FILE_ASSOCIATIONS.fetchFrom(p); if (associations != null) { for (int i = 0; i < associations.size(); i++) { Map<String, ? super Object> assoc = associations.get(i); List<String> mimes = FA_CONTENT_TYPE.fetchFrom(assoc); if (mimes == null || mimes.isEmpty()) { --- 195,205 ---- TOOL_RPMBUILD_MIN_VERSION)); } // only one mime type per association, at least one file extension List<Map<String, ? super Object>> associations = ! FILE_ASSOCIATIONS.fetchFrom(params); if (associations != null) { for (int i = 0; i < associations.size(); i++) { Map<String, ? super Object> assoc = associations.get(i); List<String> mimes = FA_CONTENT_TYPE.fetchFrom(assoc); if (mimes == null || mimes.isEmpty()) {
*** 218,228 **** } } // bundle name has some restrictions // the string converter will throw an exception if invalid ! BUNDLE_NAME.getStringConverter().apply(BUNDLE_NAME.fetchFrom(p), p); return true; } catch (RuntimeException re) { if (re.getCause() instanceof ConfigException) { throw (ConfigException) re.getCause(); --- 218,229 ---- } } // bundle name has some restrictions // the string converter will throw an exception if invalid ! BUNDLE_NAME.getStringConverter().apply( ! BUNDLE_NAME.fetchFrom(params), params); return true; } catch (RuntimeException re) { if (re.getCause() instanceof ConfigException) { throw (ConfigException) re.getCause();
*** 230,258 **** throw new ConfigException(re); } } } ! private boolean prepareProto(Map<String, ? super Object> p) throws PackagerException, IOException { ! File appImage = StandardBundlerParam.getPredefinedAppImage(p); File appDir = null; // we either have an application image or need to build one if (appImage != null) { ! appDir = new File(RPM_IMAGE_DIR.fetchFrom(p), ! APP_NAME.fetchFrom(p)); // copy everything from appImage dir into appDir/name IOUtils.copyRecursive(appImage.toPath(), appDir.toPath()); } else { ! appDir = APP_BUNDLER.fetchFrom(p).doBundle(p, ! RPM_IMAGE_DIR.fetchFrom(p), true); } return appDir != null; } ! public File bundle(Map<String, ? super Object> p, File outdir) throws PackagerException { if (!outdir.isDirectory() && !outdir.mkdirs()) { throw new PackagerException( "error.cannot-create-output-dir", outdir.getAbsolutePath()); --- 231,259 ---- throw new ConfigException(re); } } } ! private boolean prepareProto(Map<String, ? super Object> params) throws PackagerException, IOException { ! File appImage = StandardBundlerParam.getPredefinedAppImage(params); File appDir = null; // we either have an application image or need to build one if (appImage != null) { ! appDir = new File(RPM_IMAGE_DIR.fetchFrom(params), ! APP_NAME.fetchFrom(params)); // copy everything from appImage dir into appDir/name IOUtils.copyRecursive(appImage.toPath(), appDir.toPath()); } else { ! appDir = APP_BUNDLER.fetchFrom(params).doBundle(params, ! RPM_IMAGE_DIR.fetchFrom(params), true); } return appDir != null; } ! public File bundle(Map<String, ? super Object> params, File outdir) throws PackagerException { if (!outdir.isDirectory() && !outdir.mkdirs()) { throw new PackagerException( "error.cannot-create-output-dir", outdir.getAbsolutePath());
*** 261,277 **** throw new PackagerException( "error.cannot-write-to-output-dir", outdir.getAbsolutePath()); } ! File imageDir = RPM_IMAGE_DIR.fetchFrom(p); try { imageDir.mkdirs(); ! if (prepareProto(p) && prepareProjectConfig(p)) { ! return buildRPM(p, outdir); } return null; } catch (IOException ex) { Log.verbose(ex); throw new PackagerException(ex); --- 262,278 ---- throw new PackagerException( "error.cannot-write-to-output-dir", outdir.getAbsolutePath()); } ! File imageDir = RPM_IMAGE_DIR.fetchFrom(params); try { imageDir.mkdirs(); ! if (prepareProto(params) && prepareProjectConfig(params)) { ! return buildRPM(params, outdir); } return null; } catch (IOException ex) { Log.verbose(ex); throw new PackagerException(ex);
< prev index next >