File: Makefile

package info (click to toggle)
golang-github-theupdateframework-go-tuf 2.0.2%2B0.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,908 kB
  • sloc: python: 164; makefile: 89; sh: 37
file content (126 lines) | stat: -rw-r--r-- 3,739 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#
# Copyright 2024 The Update Framework Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
#
# SPDX-License-Identifier: Apache-2.0

# We want to use bash
SHELL:=/bin/bash

# Set environment variables
CLIS:=tuf-client # tuf

# Default target
.PHONY: default
default: build

#####################
# build section
#####################

# Build
.PHONY: build
build: $(addprefix build-, $(CLIS))

# Target for building a Go binary
.PHONY: build-%
build-%:
	@echo "Building $*"
	@go build -o $* examples/cli/$*/main.go

#####################
# test section
#####################

# Test target
.PHONY: test
test:
	go test -race -covermode atomic ./...

#####################
# lint section
#####################

.PHONY: lint
lint:
	golangci-lint run

.PHONY: fmt
fmt:
	go fmt ./...

#####################
# examples section
#####################

# Target for running all examples
.PHONY: example-all
example-all: example-client example-repository example-multirepo example-tuf-client-cli example-root-signing

# Target for demoing the examples/client/client_example.go
.PHONY: example-client
example-client:
	@echo "Executing the following example - client/client_example.go"
	@cd examples/client/ && go run .

# Target for demoing the examples/repository/basic_repository.go
.PHONY: example-repository
example-repository:
	@echo "Executing the following example - repository/basic_repository.go"
	@cd examples/repository/ && go run .

# Target for demoing the examples/multirepo/client/client_example.go
.PHONY: example-multirepo
example-multirepo:
	@echo "Executing the following example - multirepo/client/client_example.go"
	@cd examples/multirepo/client/ && go run .

# Target for demoing the tuf-client cli
.PHONY: example-tuf-client-cli
example-tuf-client-cli: build-tuf-client
	@echo "Clearing any leftover artifacts..."
	./tuf-client reset --force
	@echo "Initializing the following https://jku.github.io/tuf-demo/ TUF repository"
	@sleep 2
	./tuf-client init --url https://jku.github.io/tuf-demo/metadata
	@echo "Downloading the following target file - rdimitrov/artifact-example.md"
	@sleep 2
	./tuf-client get --url https://jku.github.io/tuf-demo/metadata --turl https://jku.github.io/tuf-demo/targets rdimitrov/artifact-example.md

# Target for demoing the tuf-client cli with root-signing repo
.PHONY: example-root-signing
example-root-signing: build-tuf-client
	@echo "Clearing any leftover artifacts..."
	./tuf-client reset --force
	@echo "Downloading the initial root of trust"
	@curl -L "https://tuf-repo-cdn.sigstore.dev/5.root.json" > root.json
	@echo "Initializing the following https://tuf-repo-cdn.sigstore.dev TUF repository"
	@sleep 2
	./tuf-client init --url https://tuf-repo-cdn.sigstore.dev --file root.json
	@echo "Downloading the following target file - rekor.pub"
	@sleep 2
	./tuf-client get --url https://tuf-repo-cdn.sigstore.dev --turl https://tuf-repo-cdn.sigstore.dev/targets rekor.pub

# Clean target
.PHONY: clean
clean:
	@rm -rf examples/multirepo/client/bootstrap/
	@rm -rf examples/multirepo/client/download/
	@rm -rf examples/multirepo/client/metadata/
	@rm -rf examples/repository/tmp*
	@rm -rf examples/client/tmp*
	@rm -rf tuf_download
	@rm -rf tuf_metadata
	@rm -f tuf-client
	@rm -f root.json