diff --git a/internal/classifypkg/classifypkg.go b/internal/classifypkg/classifypkg.go index 1fbca4e..4e7c7aa 100644 --- a/internal/classifypkg/classifypkg.go +++ b/internal/classifypkg/classifypkg.go @@ -77,6 +77,7 @@ func Package(pkg string, conf *installerconf.Conf, d *rawcache.Dir) ([]storage.A TagVariants(pkg, assets) NormalizeVersions(pkg, assets) assets = ApplyConfig(assets, conf) + assets = appendLegacy(pkg, assets) return assets, nil } @@ -160,6 +161,16 @@ func TagVariants(pkg string, assets []storage.Asset) { } } +// appendLegacy adds hardcoded legacy releases for packages that had +// releases from sources that no longer exist (e.g. EnterpriseDB binaries). +func appendLegacy(pkg string, assets []storage.Asset) []storage.Asset { + switch pkg { + case "postgres": + assets = append(assets, postgres.LegacyReleases()...) + } + return assets +} + // ApplyConfig applies asset_filter, exclude, and version prefix stripping // from a package's releases.conf. func ApplyConfig(assets []storage.Asset, conf *installerconf.Conf) []storage.Asset { diff --git a/internal/releases/postgres/versions.go b/internal/releases/postgres/versions.go index bdddaf4..8ffb95e 100644 --- a/internal/releases/postgres/versions.go +++ b/internal/releases/postgres/versions.go @@ -14,3 +14,67 @@ func NormalizeVersions(assets []storage.Asset) { assets[i].Version = strings.ReplaceAll(v, "_", ".") } } + +// LegacyReleases returns the old EnterpriseDB binary releases that predate +// the bnnanet/postgresql-releases GitHub repo. +func LegacyReleases() []storage.Asset { + edbURL := "https://get.enterprisedb.com/postgresql/" + return []storage.Asset{ + { + Filename: "postgresql-10.12-1-linux-x64-binaries.tar.gz", + Version: "10.12", + Channel: "stable", + OS: "linux", + Arch: "x86_64", + Libc: "gnu", + Format: ".tar.gz", + Download: edbURL + "postgresql-10.12-1-linux-x64-binaries.tar.gz?ls=Crossover&type=Crossover", + }, + { + Filename: "postgresql-10.12-1-linux-binaries.tar.gz", + Version: "10.12", + Channel: "stable", + OS: "linux", + Arch: "x86", + Libc: "gnu", + Format: ".tar.gz", + Download: edbURL + "postgresql-10.12-1-linux-binaries.tar.gz?ls=Crossover&type=Crossover", + }, + { + Filename: "postgresql-10.12-1-osx-binaries.zip", + Version: "10.12", + Channel: "stable", + OS: "darwin", + Arch: "x86_64", + Format: ".zip", + Download: edbURL + "postgresql-10.12-1-osx-binaries.zip?ls=Crossover&type=Crossover", + }, + { + Filename: "postgresql-10.13-1-osx-binaries.zip", + Version: "10.13", + Channel: "stable", + OS: "darwin", + Arch: "x86_64", + Format: ".zip", + Download: edbURL + "postgresql-10.13-1-osx-binaries.zip?ls=Crossover&type=Crossover", + }, + { + Filename: "postgresql-11.8-1-osx-binaries.zip", + Version: "11.8", + Channel: "stable", + OS: "darwin", + Arch: "x86_64", + Format: ".zip", + Download: edbURL + "postgresql-11.8-1-osx-binaries.zip?ls=Crossover&type=Crossover", + }, + { + Filename: "postgresql-12.3-1-osx-binaries.zip", + Version: "12.3", + Channel: "stable", + OS: "darwin", + Arch: "x86_64", + Format: ".zip", + Download: edbURL + "postgresql-12.3-1-osx-binaries.zip?ls=Crossover&type=Crossover", + }, + } +}