Skip to content

Commit a65fd39

Browse files
Merge pull request #5832 from kolyshkin/makefile-cleanups
(not just) Makefile cleanups
2 parents 7870181 + 135431f commit a65fd39

File tree

10 files changed

+18
-59
lines changed

10 files changed

+18
-59
lines changed

.codespellrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[codespell]
2+
skip = ./vendor,./.git,./go.sum,./docs/*.1,./docker/AUTHORS,./CHANGELOG.md,./changelog.txt,./tests/tools/vendor,./tests/tools/go.mod,./tests/tools/go.sum
3+
ignore-words-list = fo,passt,secon,erro

Makefile

+2-34
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export GOPROXY=https://proxy.golang.org
22

33
APPARMORTAG := $(shell hack/apparmor_tag.sh)
4-
STORAGETAGS := exclude_graphdriver_devicemapper $(shell ./btrfs_tag.sh) $(shell ./btrfs_installed_tag.sh) $(shell ./hack/libsubid_tag.sh)
4+
STORAGETAGS := $(shell ./btrfs_tag.sh) $(shell ./btrfs_installed_tag.sh) $(shell ./hack/libsubid_tag.sh)
55
SECURITYTAGS ?= seccomp $(APPARMORTAG)
66
TAGS ?= $(SECURITYTAGS) $(STORAGETAGS) $(shell ./hack/systemd_tag.sh)
77
ifeq ($(shell uname -s),FreeBSD)
@@ -29,15 +29,12 @@ RACEFLAGS := $(shell $(GO_TEST) -race ./pkg/dummy > /dev/null 2>&1 && echo -race
2929
COMMIT_NO ?= $(shell git rev-parse HEAD 2> /dev/null || true)
3030
GIT_COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),${COMMIT_NO}-dirty,${COMMIT_NO})
3131
SOURCE_DATE_EPOCH ?= $(if $(shell date +%s),$(shell date +%s),$(error "date failed"))
32-
STATIC_STORAGETAGS = "containers_image_openpgp $(STORAGE_TAGS)"
3332

3433
# we get GNU make 3.x in MacOS build envs, which wants # to be escaped in
3534
# strings, while the 4.x we have on Linux doesn't. this is the documented
3635
# workaround
3736
COMMENT := \#
3837
CNI_COMMIT := $(shell sed -n 's;^$(COMMENT) github.com/containernetworking/cni \([^ \n]*\).*$$;\1;p' vendor/modules.txt)
39-
RUNC_COMMIT := $(shell sed -n 's;^$(COMMENT) github.com/opencontainers/runc \([^ \n]*\).*$$;\1;p' vendor/modules.txt)
40-
LIBSECCOMP_COMMIT := release-2.3
4138

4239
EXTRA_LDFLAGS ?=
4340
BUILDAH_LDFLAGS := $(GO_LDFLAGS) '-X main.GitCommit=$(GIT_COMMIT) -X main.buildInfo=$(SOURCE_DATE_EPOCH) -X main.cniVersion=$(CNI_COMMIT) $(EXTRA_LDFLAGS)'
@@ -122,14 +119,8 @@ clean:
122119
docs: install.tools ## build the docs on the host
123120
$(MAKE) -C docs
124121

125-
# For vendoring to work right, the checkout directory must be such that our top
126-
# level is at $GOPATH/src/github.com/containers/buildah.
127-
.PHONY: gopath
128-
gopath:
129-
test $(shell pwd) = $(shell cd ../../../../src/github.com/containers/buildah ; pwd)
130-
131122
codespell:
132-
codespell -S Makefile,buildah.spec.rpkg,AUTHORS,bin,vendor,.git,go.mod,go.sum,CHANGELOG.md,changelog.txt,seccomp.json,.cirrus.yml,"*.xz,*.gz,*.tar,*.tgz,*ico,*.png,*.1,*.5,*.orig,*.rej" -L secon,passt,bu,uint,iff,od,erro -w
123+
codespell -w
133124

134125
.PHONY: validate
135126
validate: install.tools
@@ -142,25 +133,6 @@ validate: install.tools
142133
install.tools:
143134
$(MAKE) -C tests/tools
144135

145-
.PHONY: runc
146-
runc: gopath
147-
rm -rf ../../opencontainers/runc
148-
git clone https://github.com/opencontainers/runc ../../opencontainers/runc
149-
cd ../../opencontainers/runc && git checkout $(RUNC_COMMIT) && $(GO) build -tags "$(STORAGETAGS) $(SECURITYTAGS)"
150-
ln -sf ../../opencontainers/runc/runc
151-
152-
.PHONY: install.libseccomp.sudo
153-
install.libseccomp.sudo: gopath
154-
rm -rf ../../seccomp/libseccomp
155-
git clone https://github.com/seccomp/libseccomp ../../seccomp/libseccomp
156-
cd ../../seccomp/libseccomp && git checkout $(LIBSECCOMP_COMMIT) && ./autogen.sh && ./configure --prefix=/usr && make all && sudo make install
157-
158-
.PHONY: install.cni.sudo
159-
install.cni.sudo: gopath
160-
rm -rf ../../containernetworking/plugins
161-
git clone https://github.com/containernetworking/plugins ../../containernetworking/plugins
162-
cd ../../containernetworking/plugins && ./build_linux.sh && sudo install -D -v -m755 -t /opt/cni/bin/ bin/*
163-
164136
.PHONY: install
165137
install:
166138
install -d -m 755 $(DESTDIR)/$(BINDIR)
@@ -178,10 +150,6 @@ install.completions:
178150
install -m 755 -d $(DESTDIR)/$(BASHINSTALLDIR)
179151
install -m 644 contrib/completions/bash/buildah $(DESTDIR)/$(BASHINSTALLDIR)/buildah
180152

181-
.PHONY: install.runc
182-
install.runc:
183-
install -m 755 ../../opencontainers/runc/runc $(DESTDIR)/$(BINDIR)/
184-
185153
.PHONY: test-conformance
186154
test-conformance:
187155
$(GO_TEST) -v -tags "$(STORAGETAGS) $(SECURITYTAGS)" -cover -timeout 60m ./tests/conformance

copier/syscall_unix.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ func sameDevice(a, b os.FileInfo) bool {
7777
if aSys == nil || bSys == nil {
7878
return true
7979
}
80-
au, aok := aSys.(*syscall.Stat_t)
81-
bu, bok := bSys.(*syscall.Stat_t)
82-
if !aok || !bok {
80+
uA, okA := aSys.(*syscall.Stat_t)
81+
uB, okB := bSys.(*syscall.Stat_t)
82+
if !okA || !okB {
8383
return true
8484
}
85-
return au.Dev == bu.Dev
85+
return uA.Dev == uB.Dev
8686
}
8787

8888
const (

docs/buildah-build.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ Pass secret information to be used in the Containerfile for building images
909909
in a safe way that will not end up stored in the final image, or be seen in other stages.
910910
The value of the secret will be read from an environment variable or file named
911911
by the "id" option, or named by the "src" option if it is specified, or from an
912-
environment variable specifed by the "env" option.
912+
environment variable specified by the "env" option.
913913
The secret will be mounted in the container at `/run/secrets/*id*` by default.
914914

915915
To later use the secret, use the --mount flag in a `RUN` instruction within a `Containerfile`:

install.md

+4-15
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,8 @@ In Fedora, you can use this command:
194194
Then to install Buildah on Fedora follow the steps in this example:
195195

196196
```
197-
mkdir ~/buildah
198-
cd ~/buildah
199-
export GOPATH=`pwd`
200-
git clone https://github.com/containers/buildah ./src/github.com/containers/buildah
201-
cd ./src/github.com/containers/buildah
197+
git clone https://github.com/containers/buildah
198+
cd buildah
202199
make
203200
sudo make install
204201
buildah --help
@@ -252,18 +249,10 @@ In Ubuntu 22.10 (Karmic) or Debian 12 (Bookworm) you can use these commands:
252249

253250
```
254251
sudo apt-get -y -qq update
255-
sudo apt-get -y install bats btrfs-progs git go-md2man golang libapparmor-dev libglib2.0-dev libgpgme11-dev libseccomp-dev libselinux1-dev make skopeo libbtrfs-dev
252+
sudo apt-get -y install bats btrfs-progs git go-md2man golang libapparmor-dev libglib2.0-dev libgpgme11-dev libseccomp-dev libselinux1-dev make runc skopeo libbtrfs-dev
256253
```
257254

258-
Then to install Buildah follow the steps in this example:
259-
260-
```
261-
git clone https://github.com/containers/buildah
262-
cd buildah
263-
make runc all SECURITYTAGS="apparmor seccomp"
264-
sudo make install install.runc
265-
buildah --help
266-
```
255+
The build steps for Buildah on Debian or Ubuntu are the same as for Fedora, above.
267256

268257
## Vendoring - Dependency Management
269258

nix/default-arm64.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ let
7070
export CFLAGS='-static -pthread'
7171
export LDFLAGS='-s -w -static-libgcc -static'
7272
export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"'
73-
export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux'
73+
export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs seccomp apparmor selinux'
7474
export CGO_ENABLED=1
7575
'';
7676
buildPhase = ''

nix/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ let
6868
export CFLAGS='-static -pthread'
6969
export LDFLAGS='-s -w -static-libgcc -static'
7070
export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"'
71-
export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux'
71+
export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs seccomp apparmor selinux'
7272
export CGO_ENABLED=1
7373
'';
7474
buildPhase = ''

pkg/parse/parse_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func TestParsePullPolicy(t *testing.T) {
205205
"newer": true,
206206
"false": true,
207207
"never": true,
208-
"trye": false,
208+
"try": false,
209209
"truth": false,
210210
}
211211
for value, result := range testCases {

rpm/buildah.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full"
124124
export CNI_VERSION=`grep '^# github.com/containernetworking/cni ' src/modules.txt | sed 's,.* ,,'`
125125
export LDFLAGS="-X main.buildInfo=`date +%s` -X main.cniVersion=${CNI_VERSION}"
126126

127-
export BUILDTAGS="seccomp exclude_graphdriver_devicemapper $(hack/systemd_tag.sh) $(hack/libsubid_tag.sh)"
127+
export BUILDTAGS="seccomp $(hack/systemd_tag.sh) $(hack/libsubid_tag.sh)"
128128
%if !%{defined build_with_btrfs}
129129
export BUILDTAGS+=" btrfs_noversion exclude_graphdriver_btrfs"
130130
%endif

tests/source.bats

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ load helpers
3939
# Inspect the config
4040
run jq -r .created $srcdir/blobs/sha256/$configDigest
4141
assert "$status" -eq 0 "status of jq .created on configDigest"
42-
creatd=$output
4342
run date --date="$output"
4443
assert "$status" -eq 0 "status of date (this should never ever fail)"
4544
run jq -r .author $srcdir/blobs/sha256/$configDigest

0 commit comments

Comments
 (0)