From 099db0f18e755337de0433580af2f8d5d4fdae15 Mon Sep 17 00:00:00 2001 From: jguer Date: Fri, 15 Sep 2023 10:47:16 +0200 Subject: [PATCH] add test fixes --- pkg/runtime/pacman_test.go | 51 +++++++++-------- testdata/pacman.conf | 109 ++++++++++++++++++++++++++++++------- 2 files changed, 115 insertions(+), 45 deletions(-) diff --git a/pkg/runtime/pacman_test.go b/pkg/runtime/pacman_test.go index 8b1890c00..dd0b96ee0 100644 --- a/pkg/runtime/pacman_test.go +++ b/pkg/runtime/pacman_test.go @@ -16,33 +16,32 @@ func TestPacmanConf(t *testing.T) { t.Parallel() expectedPacmanConf := &pacmanconf.Config{ - RootDir: "/", - DBPath: "//var/lib/pacman/", - CacheDir: []string{"/cachedir/", "/another/"}, - HookDir: []string{"/hookdir/"}, - GPGDir: "/gpgdir/", - LogFile: "/logfile", - HoldPkg: []string(nil), - IgnorePkg: []string{"ignore", "this", "package"}, - IgnoreGroup: []string{"ignore", "this", "group"}, - Architecture: []string{"8086"}, - XferCommand: "", - NoUpgrade: []string{"noupgrade"}, - NoExtract: []string{"noextract"}, - CleanMethod: []string{"KeepInstalled"}, - SigLevel: []string{"PackageOptional", "PackageTrustedOnly", "DatabaseOptional", "DatabaseTrustedOnly"}, - LocalFileSigLevel: []string(nil), - RemoteFileSigLevel: []string(nil), - UseSyslog: false, - Color: false, - UseDelta: 0, - TotalDownload: false, - CheckSpace: true, - VerbosePkgLists: true, - DisableDownloadTimeout: false, + RootDir: "/", DBPath: "/var/lib/pacman/", + CacheDir: []string{"/var/cache/pacman/pkg/"}, + HookDir: []string{"/etc/pacman.d/hooks/"}, + GPGDir: "/etc/pacman.d/gnupg/", LogFile: "/var/log/pacman.log", + HoldPkg: []string{"pacman", "glibc"}, IgnorePkg: []string{"xorm"}, + IgnoreGroup: []string{"yorm"}, Architecture: []string{"x86_64"}, + XferCommand: "/usr/bin/wget --passive-ftp -c -O %o %u", + NoUpgrade: []string(nil), NoExtract: []string(nil), CleanMethod: []string{"KeepInstalled"}, + SigLevel: []string{"PackageRequired", "PackageTrustedOnly", "DatabaseOptional", "DatabaseTrustedOnly"}, + LocalFileSigLevel: []string{"PackageOptional", "PackageTrustedOnly"}, + RemoteFileSigLevel: []string{"PackageRequired", "PackageTrustedOnly"}, UseSyslog: true, + Color: true, UseDelta: 0, TotalDownload: false, CheckSpace: true, + VerbosePkgLists: true, DisableDownloadTimeout: false, Repos: []pacmanconf.Repository{ - {Name: "repo1", Servers: []string{"repo1"}, SigLevel: []string(nil), Usage: []string{"All"}}, - {Name: "repo2", Servers: []string{"repo2"}, SigLevel: []string(nil), Usage: []string{"All"}}, + { + Name: "core", Servers: []string{"Core"}, + SigLevel: []string(nil), Usage: []string{"All"}, + }, + { + Name: "extra", Servers: []string{"Extra"}, SigLevel: []string(nil), + Usage: []string{"All"}, + }, + { + Name: "multilib", Servers: []string{"repo3", "multilib"}, + SigLevel: []string(nil), Usage: []string{"All"}, + }, }, } diff --git a/testdata/pacman.conf b/testdata/pacman.conf index 12e026b56..9a61ffaf4 100644 --- a/testdata/pacman.conf +++ b/testdata/pacman.conf @@ -1,26 +1,97 @@ +# +# /etc/pacman.conf +# +# See the pacman.conf(5) manpage for option and repository directives + +# +# GENERAL OPTIONS +# [options] +# The following paths are commented out with their default values listed. +# If you wish to use different paths, uncomment and update the paths. RootDir = / -CacheDir = /cachedir/ /another/ -LogFile = /logfile -GPGDir = /gpgdir/ -HookDir = /hookdir/ -UseDelta = 0.5 -Architecture = 8086 -IgnorePkg = ignore -IgnorePkg = this -IgnorePkg = package -IgnoreGroup = ignore -IgnoreGroup = this -IgnoreGroup = group -NoUpgrade = noupgrade -NoExtract = noextract +DBPath = /var/lib/pacman/ +CacheDir = /var/cache/pacman/pkg/ +LogFile = /var/log/pacman.log +GPGDir = /etc/pacman.d/gnupg/ +HookDir = /etc/pacman.d/hooks/ +HoldPkg = pacman glibc +#XferCommand = /usr/bin/curl -L -C - -f -o %o %u +XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u +CleanMethod = KeepInstalled +Architecture = auto + +# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup +IgnorePkg = xorm +IgnoreGroup = yorm + +#NoUpgrade = +#NoExtract = +# Misc options +UseSyslog +Color +NoProgressBar CheckSpace -ILoveCandy VerbosePkgLists +ParallelDownloads = 5 + +# By default, pacman accepts packages signed by keys that its local keyring +# trusts (see pacman-key and its man page), as well as unsigned packages. +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional +RemoteFileSigLevel = Required + +# NOTE: You must run `pacman-key --init` before first using pacman; the local +# keyring can then be populated with the keys of all official Arch Linux +# packagers with `pacman-key --populate archlinux`. + +# +# REPOSITORIES +# - can be defined here or included from another file +# - pacman will search repositories in the order defined here +# - local/custom mirrors can be added here or in separate files +# - repositories listed first will take precedence when packages +# have identical names, regardless of version number +# - URLs will have $repo replaced by the name of the current repo +# - URLs will have $arch replaced by the name of the architecture +# +# Repository entries are of the format: +# [repo-name] +# Server = ServerName +# Include = IncludePath +# +# The header [repo-name] is crucial - it must be present and +# uncommented to enable the repo. +# + +# The testing repositories are disabled by default. To enable, uncomment the +# repo name header and Include lines. You can add preferred servers immediately +# after the header, and they will be used before the default mirrors. + +#[core-testing] +#Include = /etc/pacman.d/mirrorlist + +[core] +Server = Core + +#[extra-testing] +#Include = /etc/pacman.d/mirrorlist + +[extra] +Server = Extra + +# If you want to run 32 bit applications on your x86_64 system, +# enable the multilib repositories as required here. -[repo1] -Server = repo1 +#[multilib-testing] +#Include = /etc/pacman.d/mirrorlist -[repo2] -Server = repo2 +[multilib] +Server = repo3 +Server = multilib +# An example of a custom package repository. See the pacman manpage for +# tips on creating your own repositories. +#[custom] +#SigLevel = Optional TrustAll +#Server = file:///home/custompkgs