MCPcopy Create free account
hub / github.com/archlinux-de/pkgstats-cli / createPkgstatsConf

Function createPkgstatsConf

cmd/testhelper_pacman_test.go:63–83  ·  view source on GitHub ↗
(t *testing.T, packages []string, mirrors []string)

Source from the content-addressed store, hash-verified

61}
62
63func createPkgstatsConf(t *testing.T, packages []string, mirrors []string) string {
64 t.Helper()
65
66 var content strings.Builder
67 content.WriteString("blocklist:\n")
68 content.WriteString(" packages:\n")
69 for _, pkg := range packages {
70 fmt.Fprintf(&content, " - \"%s\"\n", pkg)
71 }
72 content.WriteString(" mirrors:\n")
73 for _, mirror := range mirrors {
74 fmt.Fprintf(&content, " - \"%s\"\n", mirror)
75 }
76
77 pkgstatsConfFile := filepath.Join(t.TempDir(), "pkgstats.yaml")
78 if err := os.WriteFile(pkgstatsConfFile, []byte(content.String()), 0o600); err != nil {
79 t.Fatalf("Failed to create pkgstats.conf: %v", err)
80 }
81
82 return pkgstatsConfFile
83}

Callers 1

pkgstatsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected