Skip to content

Commit

Permalink
[Issue 5887]Fix old version download link error (apache#5897)
Browse files Browse the repository at this point in the history
Fix old version download link error

Fixes apache#5887 

### Motivation

Old version download link error

### Modifications

Change the download link to https://archive.apache.org/dist/pulsar/
  • Loading branch information
huangdx0726 authored and sijie committed Jan 13, 2020
1 parent fa71c49 commit 348cedd
Showing 1 changed file with 46 additions and 40 deletions.
86 changes: 46 additions & 40 deletions site2/website/scripts/replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,67 +22,67 @@ function downloadPageUrl() {
}

function binaryReleaseUrl(version) {
if (version.includes('incubating')) {
return `https://archive.apache.org/dist/incubator/pulsar/pulsar-${version}/apache-pulsar-${version}-bin.tar.gz`
} else {
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/apache-pulsar-${version}-bin.tar.gz`
}
if (version.includes('incubating')) {
return `https://archive.apache.org/dist/incubator/pulsar/pulsar-${version}/apache-pulsar-${version}-bin.tar.gz`
} else {
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/apache-pulsar-${version}-bin.tar.gz`
}
}

function connectorReleaseUrl(version) {
if (version.includes('incubating')) {
return `https://archive.apache.org/dist/incubator/pulsar/pulsar-${version}/apache-pulsar-io-connectors-${version}-bin.tar.gz`
} else if (version >= '2.3.0') {
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/connectors`
} else {
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/apache-pulsar-io-connectors-${version}-bin.tar.gz`
}
if (version.includes('incubating')) {
return `https://archive.apache.org/dist/incubator/pulsar/pulsar-${version}/apache-pulsar-io-connectors-${version}-bin.tar.gz`
} else if (version >= '2.3.0') {
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/connectors`
} else {
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/apache-pulsar-io-connectors-${version}-bin.tar.gz`
}
}

function offloaderReleaseUrl(version) {
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/apache-pulsar-offloaders-${version}-bin.tar.gz`
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/apache-pulsar-offloaders-${version}-bin.tar.gz`
}

function prestoPulsarReleaseUrl(version) {
if (version.includes('incubating')) {
return `https://archive.apache.org/dist/incubator/pulsar/pulsar-${version}/pulsar-presto-connector-${version}.tar.gz`
} else {
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/pulsar-presto-connector-${version}.tar.gz`
}
if (version.includes('incubating')) {
return `https://archive.apache.org/dist/incubator/pulsar/pulsar-${version}/pulsar-presto-connector-${version}.tar.gz`
} else {
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/pulsar-presto-connector-${version}.tar.gz`
}
}

function rpmReleaseUrl(version, type) {
rpmVersion = version.replace('incubating', '1_incubating');
if (version.includes('incubating')) {
return `https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=incubator/pulsar/pulsar-${version}/RPMS/apache-pulsar-client${type}-${rpmVersion}.x86_64.rpm`
return `https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=incubator/pulsar/pulsar-${version}/RPMS/apache-pulsar-client${type}-${rpmVersion}.x86_64.rpm`
} else {
return `https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=pulsar/pulsar-${version}/RPMS/apache-pulsar-client${type}-${rpmVersion}-1.x86_64.rpm`
return `https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=pulsar/pulsar-${version}/RPMS/apache-pulsar-client${type}-${rpmVersion}-1.x86_64.rpm`
}
}

function debReleaseUrl(version, type) {
if (version.includes('incubating')) {
return `https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=incubator/pulsar/pulsar-${version}/DEB/apache-pulsar-client${type}.deb`
} else {
return `https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=pulsar/pulsar-${version}/DEB/apache-pulsar-client${type}.deb`
}
if (version.includes('incubating')) {
return `https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=incubator/pulsar/pulsar-${version}/DEB/apache-pulsar-client${type}.deb`
} else {
return `https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=pulsar/pulsar-${version}/DEB/apache-pulsar-client${type}.deb`
}
}

function rpmDistUrl(version, type) {
rpmVersion = version.replace('incubating', '1_incubating');
if (version.includes('incubating')) {
return `https://archive.apache.org/dist/incubator/pulsar/pulsar-${version}/RPMS/apache-pulsar-client${type}-${rpmVersion}.x86_64.rpm`
return `https://archive.apache.org/dist/incubator/pulsar/pulsar-${version}/RPMS/apache-pulsar-client${type}-${rpmVersion}.x86_64.rpm`
} else {
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/RPMS/apache-pulsar-client${type}-${rpmVersion}-1.x86_64.rpm`
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/RPMS/apache-pulsar-client${type}-${rpmVersion}-1.x86_64.rpm`
}
}

function debDistUrl(version, type) {
if (version.includes('incubating')) {
return `https://archive.apache.org/dist/incubator/pulsar/pulsar-${version}/DEB/apache-pulsar-client${type}.deb`
} else {
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/DEB/apache-pulsar-client${type}.deb`
}
if (version.includes('incubating')) {
return `https://archive.apache.org/dist/incubator/pulsar/pulsar-${version}/DEB/apache-pulsar-client${type}.deb`
} else {
return `https://archive.apache.org/dist/pulsar/pulsar-${version}/DEB/apache-pulsar-client${type}.deb`
}
}

function doReplace(options) {
Expand Down Expand Up @@ -122,7 +122,7 @@ const from = [
/{{pulsar:dist_rpm:client-debuginfo}}/g,
/{{pulsar:dist_rpm:client-devel}}/g,
/{{pulsar:dist_deb:client}}/g,
/{{pulsar:dist_deb:client-devel}}/g,
/{{pulsar:dist_deb:client-devel}}/g
];

const options = {
Expand Down Expand Up @@ -151,7 +151,7 @@ const options = {
rpmDistUrl(`${latestVersion}`, "-debuginfo"),
rpmDistUrl(`${latestVersion}`, "-devel"),
debDistUrl(`${latestVersion}`, ""),
debDistUrl(`${latestVersion}`, "-dev"),
debDistUrl(`${latestVersion}`, "-dev")
],
dry: false
};
Expand All @@ -178,13 +178,19 @@ for (v of versions) {
`${v}`,
binaryReleaseUrl(`${v}`),
connectorReleaseUrl(`${v}`),
prestoPulsarReleaseUrl(`${latestVersion}`),
offloaderReleaseUrl(`${v}`),
prestoPulsarReleaseUrl(`${v}`),
downloadPageUrl(),
rpmReleaseUrl(`${v}`, ""),
rpmReleaseUrl(`${v}`, "-debuginfo"),
rpmReleaseUrl(`${v}`, "-devel"),
debReleaseUrl(`${v}`, ""),
debReleaseUrl(`${v}`, "-dev"),
rpmDistUrl(`${v}`, ""),
rpmDistUrl(`${v}`, "-debuginfo"),
rpmDistUrl(`${v}`, "-devel"),
debDistUrl(`${v}`, ""),
debDistUrl(`${v}`, "-dev"),
rpmDistUrl(`${v}`, ""),
rpmDistUrl(`${v}`, "-debuginfo"),
rpmDistUrl(`${v}`, "-devel"),
debDistUrl(`${v}`, ""),
debDistUrl(`${v}`, "-dev")
],
dry: false
};
Expand Down

0 comments on commit 348cedd

Please sign in to comment.