author | herrick |
Wed, 16 Oct 2019 09:57:23 -0400 | |
branch | JDK-8200758-branch |
changeset 58647 | 2c43b89b1679 |
parent 58418 | 7cd20dbeee36 |
child 58791 | fca9cb5f4953 |
permissions | -rw-r--r-- |
57038 | 1 |
/* |
57106
ea870b9ce89a
8216492: Update copyright of all new jpackage fils to 2019
kcr
parents:
57103
diff
changeset
|
2 |
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. |
57038 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
57039 | 26 |
package jdk.jpackage.internal; |
57038 | 27 |
|
28 |
import java.io.*; |
|
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
29 |
import java.nio.file.Path; |
57038 | 30 |
import java.text.MessageFormat; |
31 |
import java.util.*; |
|
32 |
import java.util.regex.Matcher; |
|
33 |
import java.util.regex.Pattern; |
|
58417
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
34 |
import java.util.stream.Collectors; |
57038 | 35 |
|
57039 | 36 |
import static jdk.jpackage.internal.StandardBundlerParam.*; |
37 |
import static jdk.jpackage.internal.LinuxAppBundler.LINUX_INSTALL_DIR; |
|
58647
2c43b89b1679
8231862: Decouple DesktopIntegration and LinuxPackageBundler classes
herrick
parents:
58418
diff
changeset
|
38 |
import static jdk.jpackage.internal.OverridableResource.createResource; |
57038 | 39 |
|
57742
e3d4b9bc5093
8215447: Investigate if current implementation of --license-file is correct for RPM packages
herrick
parents:
57741
diff
changeset
|
40 |
/** |
e3d4b9bc5093
8215447: Investigate if current implementation of --license-file is correct for RPM packages
herrick
parents:
57741
diff
changeset
|
41 |
* There are two command line options to configure license information for RPM |
e3d4b9bc5093
8215447: Investigate if current implementation of --license-file is correct for RPM packages
herrick
parents:
57741
diff
changeset
|
42 |
* packaging: --linux-rpm-license-type and --license-file. Value of |
e3d4b9bc5093
8215447: Investigate if current implementation of --license-file is correct for RPM packages
herrick
parents:
57741
diff
changeset
|
43 |
* --linux-rpm-license-type command line option configures "License:" section |
e3d4b9bc5093
8215447: Investigate if current implementation of --license-file is correct for RPM packages
herrick
parents:
57741
diff
changeset
|
44 |
* of RPM spec. Value of --license-file command line option specifies a license |
e3d4b9bc5093
8215447: Investigate if current implementation of --license-file is correct for RPM packages
herrick
parents:
57741
diff
changeset
|
45 |
* file to be added to the package. License file is a sort of documentation file |
e3d4b9bc5093
8215447: Investigate if current implementation of --license-file is correct for RPM packages
herrick
parents:
57741
diff
changeset
|
46 |
* but it will be installed even if user selects an option to install the |
e3d4b9bc5093
8215447: Investigate if current implementation of --license-file is correct for RPM packages
herrick
parents:
57741
diff
changeset
|
47 |
* package without documentation. --linux-rpm-license-type is the primary option |
e3d4b9bc5093
8215447: Investigate if current implementation of --license-file is correct for RPM packages
herrick
parents:
57741
diff
changeset
|
48 |
* to set license information. --license-file makes little sense in case of RPM |
e3d4b9bc5093
8215447: Investigate if current implementation of --license-file is correct for RPM packages
herrick
parents:
57741
diff
changeset
|
49 |
* packaging. |
e3d4b9bc5093
8215447: Investigate if current implementation of --license-file is correct for RPM packages
herrick
parents:
57741
diff
changeset
|
50 |
*/ |
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
51 |
public class LinuxRpmBundler extends LinuxPackageBundler { |
57038 | 52 |
|
53 |
// Fedora rules for package naming are used here |
|
54 |
// https://fedoraproject.org/wiki/Packaging:NamingGuidelines?rd=Packaging/NamingGuidelines |
|
55 |
// |
|
56 |
// all Fedora packages must be named using only the following ASCII |
|
57 |
// characters. These characters are displayed here: |
|
58 |
// |
|
59 |
// abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._+ |
|
60 |
// |
|
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
61 |
private static final Pattern RPM_PACKAGE_NAME_PATTERN = |
57038 | 62 |
Pattern.compile("[a-z\\d\\+\\-\\.\\_]+", Pattern.CASE_INSENSITIVE); |
63 |
||
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
64 |
public static final BundlerParamInfo<String> PACKAGE_NAME = |
57038 | 65 |
new StandardBundlerParam<> ( |
66 |
Arguments.CLIOptions.LINUX_BUNDLE_NAME.getId(), |
|
67 |
String.class, |
|
68 |
params -> { |
|
69 |
String nm = APP_NAME.fetchFrom(params); |
|
70 |
if (nm == null) return null; |
|
71 |
||
72 |
// make sure to lower case and spaces become dashes |
|
73 |
nm = nm.toLowerCase().replaceAll("[ ]", "-"); |
|
74 |
||
75 |
return nm; |
|
76 |
}, |
|
77 |
(s, p) -> { |
|
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
78 |
if (!RPM_PACKAGE_NAME_PATTERN.matcher(s).matches()) { |
57038 | 79 |
String msgKey = "error.invalid-value-for-package-name"; |
80 |
throw new IllegalArgumentException( |
|
81 |
new ConfigException(MessageFormat.format( |
|
82 |
I18N.getString(msgKey), s), |
|
83 |
I18N.getString(msgKey + ".advice"))); |
|
84 |
} |
|
85 |
||
86 |
return s; |
|
87 |
} |
|
88 |
); |
|
89 |
||
90 |
public static final BundlerParamInfo<String> LICENSE_TYPE = |
|
91 |
new StandardBundlerParam<>( |
|
92 |
Arguments.CLIOptions.LINUX_RPM_LICENSE_TYPE.getId(), |
|
93 |
String.class, |
|
94 |
params -> I18N.getString("param.license-type.default"), |
|
95 |
(s, p) -> s |
|
96 |
); |
|
57909
c7de06ed4b54
8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents:
57908
diff
changeset
|
97 |
|
c7de06ed4b54
8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents:
57908
diff
changeset
|
98 |
public static final BundlerParamInfo<String> GROUP = |
57790 | 99 |
new StandardBundlerParam<>( |
100 |
Arguments.CLIOptions.LINUX_CATEGORY.getId(), |
|
101 |
String.class, |
|
102 |
params -> null, |
|
103 |
(s, p) -> s); |
|
57038 | 104 |
|
105 |
private final static String DEFAULT_SPEC_TEMPLATE = "template.spec"; |
|
106 |
||
58417
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
107 |
public final static String TOOL_RPM = "rpm"; |
57038 | 108 |
public final static String TOOL_RPMBUILD = "rpmbuild"; |
58417
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
109 |
public final static String TOOL_RPMBUILD_MIN_VERSION = "4.0"; |
57038 | 110 |
|
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
111 |
public LinuxRpmBundler() { |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
112 |
super(PACKAGE_NAME); |
57038 | 113 |
} |
114 |
||
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
115 |
@Override |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
116 |
public void doValidate(Map<String, ? super Object> params) |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
117 |
throws ConfigException { |
58417
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
118 |
} |
57038 | 119 |
|
58417
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
120 |
private static ToolValidator createRpmbuildToolValidator() { |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
121 |
Pattern pattern = Pattern.compile(" (\\d+\\.\\d+)"); |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
122 |
return new ToolValidator(TOOL_RPMBUILD).setMinimalVersion( |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
123 |
TOOL_RPMBUILD_MIN_VERSION).setVersionParser(lines -> { |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
124 |
String versionString = lines.limit(1).collect( |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
125 |
Collectors.toList()).get(0); |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
126 |
Matcher matcher = pattern.matcher(versionString); |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
127 |
if (matcher.find()) { |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
128 |
return matcher.group(1); |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
129 |
} |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
130 |
return null; |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
131 |
}); |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
132 |
} |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
133 |
|
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
134 |
@Override |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
135 |
protected List<ToolValidator> getToolValidators( |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
136 |
Map<String, ? super Object> params) { |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
137 |
return List.of(createRpmbuildToolValidator()); |
57038 | 138 |
} |
139 |
||
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
140 |
@Override |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
141 |
protected File buildPackageBundle( |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
142 |
Map<String, String> replacementData, |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
143 |
Map<String, ? super Object> params, File outputParentDir) throws |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
144 |
PackagerException, IOException { |
57038 | 145 |
|
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
146 |
Path specFile = specFile(params); |
57390 | 147 |
|
148 |
// prepare spec file |
|
58647
2c43b89b1679
8231862: Decouple DesktopIntegration and LinuxPackageBundler classes
herrick
parents:
58418
diff
changeset
|
149 |
createResource(DEFAULT_SPEC_TEMPLATE, params) |
2c43b89b1679
8231862: Decouple DesktopIntegration and LinuxPackageBundler classes
herrick
parents:
58418
diff
changeset
|
150 |
.setCategory(I18N.getString("resource.rpm-spec-file")) |
2c43b89b1679
8231862: Decouple DesktopIntegration and LinuxPackageBundler classes
herrick
parents:
58418
diff
changeset
|
151 |
.setSubstitutionData(replacementData) |
2c43b89b1679
8231862: Decouple DesktopIntegration and LinuxPackageBundler classes
herrick
parents:
58418
diff
changeset
|
152 |
.saveToFile(specFile); |
57038 | 153 |
|
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
154 |
return buildRPM(params, outputParentDir); |
57038 | 155 |
} |
156 |
||
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
157 |
@Override |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
158 |
protected Map<String, String> createReplacementData( |
57080 | 159 |
Map<String, ? super Object> params) throws IOException { |
57038 | 160 |
Map<String, String> data = new HashMap<>(); |
161 |
||
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
162 |
data.put("APPLICATION_DIRECTORY", Path.of(LINUX_INSTALL_DIR.fetchFrom( |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
163 |
params), PACKAGE_NAME.fetchFrom(params)).toString()); |
57255
f686bda3b831
8215574: Investigate and document usage of --category, --copyright, --vendor and --description
herrick
parents:
57150
diff
changeset
|
164 |
data.put("APPLICATION_SUMMARY", APP_NAME.fetchFrom(params)); |
57038 | 165 |
data.put("APPLICATION_LICENSE_TYPE", LICENSE_TYPE.fetchFrom(params)); |
58418
7cd20dbeee36
8230974: creating rpm, get error for relative path to the license.txt
herrick
parents:
58417
diff
changeset
|
166 |
|
7cd20dbeee36
8230974: creating rpm, get error for relative path to the license.txt
herrick
parents:
58417
diff
changeset
|
167 |
String licenseFile = LICENSE_FILE.fetchFrom(params); |
58647
2c43b89b1679
8231862: Decouple DesktopIntegration and LinuxPackageBundler classes
herrick
parents:
58418
diff
changeset
|
168 |
if (licenseFile != null) { |
58418
7cd20dbeee36
8230974: creating rpm, get error for relative path to the license.txt
herrick
parents:
58417
diff
changeset
|
169 |
licenseFile = Path.of(licenseFile).toAbsolutePath().normalize().toString(); |
7cd20dbeee36
8230974: creating rpm, get error for relative path to the license.txt
herrick
parents:
58417
diff
changeset
|
170 |
} |
7cd20dbeee36
8230974: creating rpm, get error for relative path to the license.txt
herrick
parents:
58417
diff
changeset
|
171 |
data.put("APPLICATION_LICENSE_FILE", licenseFile); |
58647
2c43b89b1679
8231862: Decouple DesktopIntegration and LinuxPackageBundler classes
herrick
parents:
58418
diff
changeset
|
172 |
data.put("APPLICATION_GROUP", GROUP.fetchFrom(params)); |
57742
e3d4b9bc5093
8215447: Investigate if current implementation of --license-file is correct for RPM packages
herrick
parents:
57741
diff
changeset
|
173 |
|
57038 | 174 |
return data; |
175 |
} |
|
176 |
||
58417
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
177 |
@Override |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
178 |
protected void initLibProvidersLookup( |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
179 |
Map<String, ? super Object> params, |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
180 |
LibProvidersLookup libProvidersLookup) { |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
181 |
libProvidersLookup.setPackageLookup(file -> { |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
182 |
return Executor.of(TOOL_RPM, |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
183 |
"-q", "--queryformat", "%{name}\\n", |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
184 |
"-q", "--whatprovides", file.toString()) |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
185 |
.saveOutput(true).executeExpectSuccess().getOutput().stream(); |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
186 |
}); |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
187 |
} |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
188 |
|
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
189 |
private Path specFile(Map<String, ? super Object> params) { |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
190 |
return TEMP_ROOT.fetchFrom(params).toPath().resolve(Path.of("SPECS", |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
191 |
PACKAGE_NAME.fetchFrom(params) + ".spec")); |
57038 | 192 |
} |
193 |
||
194 |
private File buildRPM(Map<String, ? super Object> params, |
|
195 |
File outdir) throws IOException { |
|
196 |
Log.verbose(MessageFormat.format(I18N.getString( |
|
197 |
"message.outputting-bundle-location"), |
|
198 |
outdir.getAbsolutePath())); |
|
199 |
||
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
200 |
PlatformPackage thePackage = createMetaPackage(params); |
57038 | 201 |
|
202 |
//run rpmbuild |
|
58417
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
203 |
Executor.of( |
57038 | 204 |
TOOL_RPMBUILD, |
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
205 |
"-bb", specFile(params).toAbsolutePath().toString(), |
58417
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
206 |
"--define", String.format("%%_sourcedir %s", |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
207 |
thePackage.sourceRoot()), |
57038 | 208 |
// save result to output dir |
58417
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
209 |
"--define", String.format("%%_rpmdir %s", |
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
210 |
outdir.getAbsolutePath()), |
57038 | 211 |
// do not use other system directories to build as current user |
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
212 |
"--define", String.format("%%_topdir %s", |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58116
diff
changeset
|
213 |
TEMP_ROOT.fetchFrom(params).toPath().toAbsolutePath()) |
58417
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
214 |
).executeExpectSuccess(); |
57038 | 215 |
|
216 |
Log.verbose(MessageFormat.format( |
|
217 |
I18N.getString("message.output-bundle-location"), |
|
218 |
outdir.getAbsolutePath())); |
|
219 |
||
220 |
// presume the result is the ".rpm" file with the newest modified time |
|
221 |
// not the best solution, but it is the most reliable |
|
222 |
File result = null; |
|
223 |
long lastModified = 0; |
|
224 |
File[] list = outdir.listFiles(); |
|
225 |
if (list != null) { |
|
226 |
for (File f : list) { |
|
227 |
if (f.getName().endsWith(".rpm") && |
|
228 |
f.lastModified() > lastModified) { |
|
229 |
result = f; |
|
230 |
lastModified = f.lastModified(); |
|
231 |
} |
|
232 |
} |
|
233 |
} |
|
234 |
||
235 |
return result; |
|
236 |
} |
|
237 |
||
238 |
@Override |
|
239 |
public String getName() { |
|
57059 | 240 |
return I18N.getString("rpm.bundler.name"); |
57038 | 241 |
} |
242 |
||
243 |
@Override |
|
244 |
public String getID() { |
|
245 |
return "rpm"; |
|
246 |
} |
|
247 |
||
248 |
@Override |
|
57150 | 249 |
public boolean supported(boolean runtimeInstaller) { |
58417
67ffaf3a2b75
8231280: Linux packages produced by jpackage should have correct dependencies
herrick
parents:
58301
diff
changeset
|
250 |
return Platform.isLinux() && (createRpmbuildToolValidator().validate() == null); |
57038 | 251 |
} |
252 |
||
58114
42df7de58e39
8230519: jpackage "--package-type" values and default
herrick
parents:
57909
diff
changeset
|
253 |
@Override |
42df7de58e39
8230519: jpackage "--package-type" values and default
herrick
parents:
57909
diff
changeset
|
254 |
public boolean isDefault() { |
42df7de58e39
8230519: jpackage "--package-type" values and default
herrick
parents:
57909
diff
changeset
|
255 |
return !LinuxDebBundler.isDebian(); |
42df7de58e39
8230519: jpackage "--package-type" values and default
herrick
parents:
57909
diff
changeset
|
256 |
} |
42df7de58e39
8230519: jpackage "--package-type" values and default
herrick
parents:
57909
diff
changeset
|
257 |
|
57038 | 258 |
} |