diff --git a/aptly/const.go b/aptly/const.go new file mode 100644 index 000000000..9cca27ff8 --- /dev/null +++ b/aptly/const.go @@ -0,0 +1,3 @@ +package aptly + +var DistributionFocal = "focal" diff --git a/deb/index_files.go b/deb/index_files.go index 16c191140..01de3dd53 100644 --- a/deb/index_files.go +++ b/deb/index_files.go @@ -264,7 +264,7 @@ func (files *indexFiles) PackageIndex(component, arch string, udeb bool, install if udeb { relativePath = filepath.Join(component, "debian-installer", fmt.Sprintf("binary-%s", arch), "Packages") } else if installer { - if distribution == "focal" { + if distribution == aptly.DistributionFocal { relativePath = filepath.Join(component, fmt.Sprintf("installer-%s", arch), "current", "legacy-images", "SHA256SUMS") } else { relativePath = filepath.Join(component, fmt.Sprintf("installer-%s", arch), "current", "images", "SHA256SUMS") diff --git a/deb/package.go b/deb/package.go index c93d4d9de..2957b7f86 100644 --- a/deb/package.go +++ b/deb/package.go @@ -190,7 +190,7 @@ func NewInstallerPackageFromControlFile(input Stanza, repo *RemoteRepo, componen } var relPath string - if repo.Distribution == "focal" { + if repo.Distribution == aptly.DistributionFocal { relPath = filepath.Join("dists", repo.Distribution, component, fmt.Sprintf("%s-%s", p.Name, architecture), "current", "legacy-images") } else { relPath = filepath.Join("dists", repo.Distribution, component, fmt.Sprintf("%s-%s", p.Name, architecture), "current", "images") diff --git a/deb/publish.go b/deb/publish.go index f93f86c23..5932f926a 100644 --- a/deb/publish.go +++ b/deb/publish.go @@ -665,7 +665,7 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP } relPath = filepath.Join("pool", component, poolDir) } else { - if p.Distribution == "focal" { + if p.Distribution == aptly.DistributionFocal { relPath = filepath.Join("dists", p.Distribution, component, fmt.Sprintf("%s-%s", pkg.Name, arch), "current", "legacy-images") } else { relPath = filepath.Join("dists", p.Distribution, component, fmt.Sprintf("%s-%s", pkg.Name, arch), "current", "images") diff --git a/deb/remote.go b/deb/remote.go index 01550022f..f94dffaf9 100644 --- a/deb/remote.go +++ b/deb/remote.go @@ -259,11 +259,10 @@ func (repo *RemoteRepo) UdebPath(component string, architecture string) string { // InstallerPath returns path of Packages files for given component and // architecture func (repo *RemoteRepo) InstallerPath(component string, architecture string) string { - if repo.Distribution == "focal" { + if repo.Distribution == aptly.DistributionFocal { return fmt.Sprintf("%s/installer-%s/current/legacy-images/SHA256SUMS", component, architecture) - } else { - return fmt.Sprintf("%s/installer-%s/current/images/SHA256SUMS", component, architecture) } + return fmt.Sprintf("%s/installer-%s/current/images/SHA256SUMS", component, architecture) } // PackageURL returns URL of package file relative to repository root