Fix image recursive build (#2280)

* fix image recursive build

* add test fixes

* disable buildvcs

* fix integration
This commit is contained in:
Jo 2023-09-15 11:17:18 +02:00 committed by GitHub
parent b6c72ce7a2
commit e60ccdf8b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 123 additions and 50 deletions

View File

@ -17,6 +17,8 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-go- ${{ runner.os }}-go-
- name: Lint - name: Lint
env:
GOFLAGS: -buildvcs=false
run: /app/bin/golangci-lint run ./... run: /app/bin/golangci-lint run ./...
- name: Run Build and Tests - name: Run Build and Tests
run: make test run: make test

View File

@ -1,4 +1,4 @@
FROM docker.io/jguer/yay-builder:latest FROM docker.io/menci/archlinuxarm:base-devel
LABEL maintainer="Jguer,docker@jguer.space" LABEL maintainer="Jguer,docker@jguer.space"
ENV GO111MODULE=on ENV GO111MODULE=on
@ -9,5 +9,5 @@ COPY go.mod .
RUN pacman-key --init && pacman -Sy && pacman -S --overwrite=* --noconfirm archlinux-keyring && \ 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 && \ pacman -Su --overwrite=* --needed --noconfirm doxygen meson asciidoc go git gcc make sudo base-devel && \
rm -rfv /var/cache/pacman/* /var/lib/pacman/sync/* && \ 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 go mod download

View File

@ -42,7 +42,7 @@ func TestIntegrationPKGBUILDReposDefinedDBClone(t *testing.T) {
absPackagesDB: map[string]string{"linux": "core"}, absPackagesDB: map[string]string{"linux": "core"},
} }
cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient, cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient,
cmdBuilder, cmdBuilder, testLogger.Child("test"),
targets, parser.ModeAny, "https://aur.archlinux.org", dir, false) targets, parser.ModeAny, "https://aur.archlinux.org", dir, false)
assert.NoError(t, err) assert.NoError(t, err)
@ -71,7 +71,7 @@ func TestIntegrationPKGBUILDReposNotExist(t *testing.T) {
absPackagesDB: map[string]string{"yay": "core"}, absPackagesDB: map[string]string{"yay": "core"},
} }
cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient, cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient,
cmdBuilder, cmdBuilder, testLogger.Child("test"),
targets, parser.ModeAny, "https://aur.archlinux.org", dir, false) targets, parser.ModeAny, "https://aur.archlinux.org", dir, false)
assert.Error(t, err) 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"} targets := []string{"core/linux", "aur/yay-bin", "yay-git"}
searcher := &testDBSearcher{ searcher := &testDBSearcher{
absPackagesDB: map[string]string{"linux": "core"}, 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) targets, "https://aur.archlinux.org", parser.ModeAny)
assert.NoError(t, err) assert.NoError(t, err)

View File

@ -16,33 +16,32 @@ func TestPacmanConf(t *testing.T) {
t.Parallel() t.Parallel()
expectedPacmanConf := &pacmanconf.Config{ expectedPacmanConf := &pacmanconf.Config{
RootDir: "/", RootDir: "/", DBPath: "/var/lib/pacman/",
DBPath: "//var/lib/pacman/", CacheDir: []string{"/var/cache/pacman/pkg/"},
CacheDir: []string{"/cachedir/", "/another/"}, HookDir: []string{"/etc/pacman.d/hooks/"},
HookDir: []string{"/hookdir/"}, GPGDir: "/etc/pacman.d/gnupg/", LogFile: "/var/log/pacman.log",
GPGDir: "/gpgdir/", HoldPkg: []string{"pacman", "glibc"}, IgnorePkg: []string{"xorm"},
LogFile: "/logfile", IgnoreGroup: []string{"yorm"}, Architecture: []string{"x86_64"},
HoldPkg: []string(nil), XferCommand: "/usr/bin/wget --passive-ftp -c -O %o %u",
IgnorePkg: []string{"ignore", "this", "package"}, NoUpgrade: []string(nil), NoExtract: []string(nil), CleanMethod: []string{"KeepInstalled"},
IgnoreGroup: []string{"ignore", "this", "group"}, SigLevel: []string{"PackageRequired", "PackageTrustedOnly", "DatabaseOptional", "DatabaseTrustedOnly"},
Architecture: []string{"8086"}, LocalFileSigLevel: []string{"PackageOptional", "PackageTrustedOnly"},
XferCommand: "", RemoteFileSigLevel: []string{"PackageRequired", "PackageTrustedOnly"}, UseSyslog: true,
NoUpgrade: []string{"noupgrade"}, Color: true, UseDelta: 0, TotalDownload: false, CheckSpace: true,
NoExtract: []string{"noextract"}, VerbosePkgLists: true, DisableDownloadTimeout: false,
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,
Repos: []pacmanconf.Repository{ 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"},
},
}, },
} }

109
testdata/pacman.conf vendored
View File

@ -1,26 +1,97 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[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 = / RootDir = /
CacheDir = /cachedir/ /another/ DBPath = /var/lib/pacman/
LogFile = /logfile CacheDir = /var/cache/pacman/pkg/
GPGDir = /gpgdir/ LogFile = /var/log/pacman.log
HookDir = /hookdir/ GPGDir = /etc/pacman.d/gnupg/
UseDelta = 0.5 HookDir = /etc/pacman.d/hooks/
Architecture = 8086 HoldPkg = pacman glibc
IgnorePkg = ignore #XferCommand = /usr/bin/curl -L -C - -f -o %o %u
IgnorePkg = this XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
IgnorePkg = package CleanMethod = KeepInstalled
IgnoreGroup = ignore Architecture = auto
IgnoreGroup = this
IgnoreGroup = group
NoUpgrade = noupgrade
NoExtract = noextract
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
IgnorePkg = xorm
IgnoreGroup = yorm
#NoUpgrade =
#NoExtract =
# Misc options
UseSyslog
Color
NoProgressBar
CheckSpace CheckSpace
ILoveCandy
VerbosePkgLists VerbosePkgLists
ParallelDownloads = 5
[repo1] # By default, pacman accepts packages signed by keys that its local keyring
Server = repo1 # trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
RemoteFileSigLevel = Required
[repo2] # NOTE: You must run `pacman-key --init` before first using pacman; the local
Server = repo2 # 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.
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist
[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