Skip to content

Commit 9f790ee

Browse files
authored
Fix non-x64 bwc build targets (opensearch-project#16575)
There were a few issues here: the '-x64' suffix was being unconditionally appeneded, debian uses underscores not hyphens, and the rpm target uses the '.86_64' suffix. Signed-off-by: Andrew Ross <andrross@amazon.com>
1 parent 034bd2b commit 9f790ee

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java

+20-4
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,19 @@ private static List<DistributionProject> resolveArchiveProjects(File checkoutDir
181181
if (name.contains("zip") || name.contains("tar")) {
182182
int index = name.lastIndexOf('-');
183183
String baseName = name.substring(0, index);
184-
classifier = "-" + baseName + "-x64";
184+
classifier = "-" + baseName;
185+
// The x64 variants do not have the architecture built into the task name, so it needs to be appended
186+
if (name.equals("darwin-tar") || name.equals("linux-tar") || name.equals("windows-zip")) {
187+
classifier += "-x64";
188+
}
185189
extension = name.substring(index + 1);
186190
if (extension.equals("tar")) {
187191
extension += ".gz";
188192
}
189193
} else if (name.contains("deb")) {
190-
classifier = "-amd64";
194+
classifier = "_amd64";
191195
} else if (name.contains("rpm")) {
192-
classifier = "-x64";
196+
classifier = ".x86_64";
193197
}
194198
} else {
195199
extension = name.substring(4);
@@ -256,9 +260,21 @@ private static class DistributionProject {
256260
this.name = name;
257261
this.projectPath = baseDir + "/" + name;
258262
if (version.onOrAfter("1.1.0")) {
263+
// Deb uses underscores (I don't know why...):
264+
// https://github.com/opensearch-project/OpenSearch/blob/f6d9a86f0e2e8241fd58b7e8b6cdeaf931b5108f/distribution/packages/build.gradle#L139
265+
final String separator = name.equals("deb") ? "_" : "-";
259266
this.distFile = new File(
260267
checkoutDir,
261-
baseDir + "/" + name + "/build/distributions/opensearch-min-" + version + "-SNAPSHOT" + classifier + "." + extension
268+
baseDir
269+
+ "/"
270+
+ name
271+
+ "/build/distributions/opensearch-min"
272+
+ separator
273+
+ version
274+
+ "-SNAPSHOT"
275+
+ classifier
276+
+ "."
277+
+ extension
262278
);
263279
} else {
264280
this.distFile = new File(

0 commit comments

Comments
 (0)