Skip to content

Commit 1f1a9cc

Browse files
committed
hide libpq postgres from el appstream repo
1 parent 618f035 commit 1f1a9cc

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

cli/confgen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ repo_upstream_default:
985985
- { name: nginx ,description: 'Nginx Repo' ,module: infra ,releases: [8,9,10] ,arch: [x86_64, aarch64] ,baseurl: { default: 'https://nginx.org/packages/rhel/$releasever/$basearch/' }}
986986
- { name: docker-ce ,description: 'Docker CE' ,module: infra ,releases: [8,9,10] ,arch: [x86_64, aarch64] ,baseurl: { default: 'https://download.docker.com/linux/centos/$releasever/$basearch/stable' ,china: 'https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable' ,europe: 'https://mirrors.xtom.de/docker-ce/linux/centos/$releasever/$basearch/stable' } ,meta: { skip_if_unavailable: 1 }}
987987
- { name: baseos ,description: 'EL 8+ BaseOS' ,module: node ,releases: [8,9,10] ,arch: [x86_64, aarch64] ,baseurl: { default: 'https://dl.rockylinux.org/pub/rocky/$releasever/BaseOS/$basearch/os/' ,china: 'https://mirrors.aliyun.com/rockylinux/$releasever/BaseOS/$basearch/os/' ,europe: 'https://mirrors.xtom.de/rocky/$releasever/BaseOS/$basearch/os/' }}
988-
- { name: appstream ,description: 'EL 8+ AppStream' ,module: node ,releases: [8,9,10] ,arch: [x86_64, aarch64] ,baseurl: { default: 'https://dl.rockylinux.org/pub/rocky/$releasever/AppStream/$basearch/os/' ,china: 'https://mirrors.aliyun.com/rockylinux/$releasever/AppStream/$basearch/os/' ,europe: 'https://mirrors.xtom.de/rocky/$releasever/AppStream/$basearch/os/' }}
988+
- { name: appstream ,description: 'EL 8+ AppStream' ,module: node ,releases: [8,9,10] ,arch: [x86_64, aarch64] ,baseurl: { default: 'https://dl.rockylinux.org/pub/rocky/$releasever/AppStream/$basearch/os/' ,china: 'https://mirrors.aliyun.com/rockylinux/$releasever/AppStream/$basearch/os/' ,europe: 'https://mirrors.xtom.de/rocky/$releasever/AppStream/$basearch/os/' } ,meta: { excludepkgs: 'postgresql* libpq*' }}
989989
- { name: extras ,description: 'EL 8+ Extras' ,module: node ,releases: [8,9,10] ,arch: [x86_64, aarch64] ,baseurl: { default: 'https://dl.rockylinux.org/pub/rocky/$releasever/extras/$basearch/os/' ,china: 'https://mirrors.aliyun.com/rockylinux/$releasever/extras/$basearch/os/' ,europe: 'https://mirrors.xtom.de/rocky/$releasever/extras/$basearch/os/' }}
990990
- { name: powertools ,description: 'EL 8 PowerTools' ,module: node ,releases: [8 ] ,arch: [x86_64, aarch64] ,baseurl: { default: 'https://dl.rockylinux.org/pub/rocky/$releasever/PowerTools/$basearch/os/' ,china: 'https://mirrors.aliyun.com/rockylinux/$releasever/PowerTools/$basearch/os/' ,europe: 'https://mirrors.xtom.de/rocky/$releasever/PowerTools/$basearch/os/' }}
991991
- { name: crb ,description: 'EL 9 CRB' ,module: node ,releases: [ 9,10] ,arch: [x86_64, aarch64] ,baseurl: { default: 'https://dl.rockylinux.org/pub/rocky/$releasever/CRB/$basearch/os/' ,china: 'https://mirrors.aliyun.com/rockylinux/$releasever/CRB/$basearch/os/' ,europe: 'https://mirrors.xtom.de/rocky/$releasever/CRB/$basearch/os/' }}

cli/confgen_test.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,36 @@ func TestNodePackagesDefaultRenderedAsThreeAlignedGroups(t *testing.T) {
356356
}
357357
}
358358

359+
func TestRPMTemplateAppStreamExcludesDistroPostgreSQLProviders(t *testing.T) {
360+
const wantMeta = "meta: { excludepkgs: 'postgresql* libpq*' }"
361+
362+
for _, osCode := range []string{"el8", "el9", "el10"} {
363+
t.Run(osCode, func(t *testing.T) {
364+
rendered := renderRPMTemplateForTest(t, osCode+".x86_64", osCode)
365+
appstream := renderedRepoUpstreamLine(rendered, "appstream")
366+
if appstream == "" {
367+
t.Fatal("rendered RPM config missing appstream repo")
368+
}
369+
if !strings.Contains(appstream, "releases: [8,9,10]") {
370+
t.Fatalf("appstream repo no longer covers EL8/9/10: %q", appstream)
371+
}
372+
if !strings.Contains(appstream, wantMeta) {
373+
t.Fatalf("appstream repo missing distro PostgreSQL exclude meta: %q", appstream)
374+
}
375+
376+
for _, repo := range []string{"baseos", "extras", "powertools", "crb", "epel"} {
377+
line := renderedRepoUpstreamLine(rendered, repo)
378+
if line == "" {
379+
t.Fatalf("rendered RPM config missing %s repo", repo)
380+
}
381+
if strings.Contains(line, "excludepkgs") {
382+
t.Fatalf("%s repo should not carry PostgreSQL exclude meta: %q", repo, line)
383+
}
384+
}
385+
})
386+
}
387+
}
388+
359389
func TestNodePackagesDefaultPreservesLegacyPackagesExceptTcpdump(t *testing.T) {
360390
tests := []struct {
361391
name string
@@ -696,6 +726,17 @@ func renderedPackageAliasValue(rendered, alias string) string {
696726
return ""
697727
}
698728

729+
func renderedRepoUpstreamLine(rendered, name string) string {
730+
prefix := "- { name: " + name
731+
for _, line := range strings.Split(rendered, "\n") {
732+
line = strings.TrimSpace(line)
733+
if strings.HasPrefix(line, prefix) {
734+
return line
735+
}
736+
}
737+
return ""
738+
}
739+
699740
func assertContainsAllExcept(t *testing.T, current, legacy []string, except string) {
700741
t.Helper()
701742
currentSet := tokenSet(current)

0 commit comments

Comments
 (0)