diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 6692ff564..002352d26 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -17,6 +17,8 @@ jobs: restore-keys: | ${{ runner.os }}-go- - name: Lint + env: + GOFLAGS: -buildvcs=false run: /app/bin/golangci-lint run ./... - name: Run Build and Tests run: make test diff --git a/ci.Dockerfile b/ci.Dockerfile index 2b0e47633..75a53e8a0 100644 --- a/ci.Dockerfile +++ b/ci.Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/jguer/yay-builder:latest +FROM docker.io/menci/archlinuxarm:base-devel LABEL maintainer="Jguer,docker@jguer.space" ENV GO111MODULE=on @@ -9,5 +9,5 @@ COPY go.mod . RUN pacman-key --init && pacman -Sy && pacman -S --overwrite=* --noconfirm archlinux-keyring && \ pacman -Su --overwrite=* --needed --noconfirm doxygen meson asciidoc go git gcc make sudo base-devel && \ rm -rfv /var/cache/pacman/* /var/lib/pacman/sync/* && \ - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.53.3 && \ + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.54.2 && \ go mod download diff --git a/pkg/download/unified_integration_test.go b/pkg/download/unified_integration_test.go index 8e5be725c..1d62731a4 100644 --- a/pkg/download/unified_integration_test.go +++ b/pkg/download/unified_integration_test.go @@ -42,7 +42,7 @@ func TestIntegrationPKGBUILDReposDefinedDBClone(t *testing.T) { absPackagesDB: map[string]string{"linux": "core"}, } cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient, - cmdBuilder, + cmdBuilder, testLogger.Child("test"), targets, parser.ModeAny, "https://aur.archlinux.org", dir, false) assert.NoError(t, err) @@ -71,7 +71,7 @@ func TestIntegrationPKGBUILDReposNotExist(t *testing.T) { absPackagesDB: map[string]string{"yay": "core"}, } cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient, - cmdBuilder, + cmdBuilder, testLogger.Child("test"), targets, parser.ModeAny, "https://aur.archlinux.org", dir, false) assert.Error(t, err) @@ -88,12 +88,13 @@ func TestIntegrationPKGBUILDFull(t *testing.T) { }, } + testLogger := text.NewLogger(os.Stdout, os.Stderr, strings.NewReader(""), true, "test") targets := []string{"core/linux", "aur/yay-bin", "yay-git"} searcher := &testDBSearcher{ absPackagesDB: map[string]string{"linux": "core"}, } - fetched, err := PKGBUILDs(searcher, mockClient, &http.Client{}, + fetched, err := PKGBUILDs(searcher, mockClient, &http.Client{}, testLogger.Child("test"), targets, "https://aur.archlinux.org", parser.ModeAny) assert.NoError(t, err) 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