Skip to content

Commit 9dfd4f3

Browse files
authored
Merge pull request #2318 from deitch/goodbye-packages-txt
replace packages.txt with calculated graph
2 parents 1c242d0 + ec80dda commit 9dfd4f3

File tree

15 files changed

+31
-46
lines changed

15 files changed

+31
-46
lines changed

.github/pull-request-template.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ addressed, and remove any items that are not relevant to this PR.
3232
- [ ] Alternatively, the PR is marked as related to a pre-existing package request bug, such as a dependency
3333
- [ ] REQUIRED - The package is available under an OSI-approved or FSF-approved license
3434
- [ ] REQUIRED - The version of the package is still receiving security updates
35-
- [ ] REQUIRED - The package is added to `packages.txt`
3635

3736
#### For security-related PRs
3837
<!-- remove if unrelated -->

.github/workflows/ci-build.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
branches:
88
- gh-readonly-queue/main/**
99

10+
env:
11+
WOLFICTL: "docker run -it --rm --entrypoint=wolfictl ghcr.io/wolfi-dev/sdk:latest@sha256:fd8c71214f6455c75ec44ae99eb9f7ffc85f260ccce69d4367eb2e5d568facd9 wolfictl"
1012
jobs:
1113
changes:
1214
name: Determine packages to test building
@@ -28,17 +30,13 @@ jobs:
2830
- name: Build package list
2931
id: package-list
3032
run: |
31-
# Ensure there is a newline at the end of packages.txt to avoid `read` from ignoring
32-
# the last entry.
33-
echo >> $GITHUB_WORKSPACE/packages.txt
34-
3533
printf "packages=" >> $GITHUB_OUTPUT
3634
37-
while read pkg; do
35+
make list | while read pkg; do
3836
for file in ${{ steps.changes.outputs.all_changed_files }}; do
3937
[ "${file%.yaml}" = "$pkg" ] && printf "%s " ${file%.yaml} >> $GITHUB_OUTPUT
4038
done
41-
done < $GITHUB_WORKSPACE/packages.txt
39+
done
4240
4341
printf "\n" >> $GITHUB_OUTPUT
4442
@@ -72,7 +70,7 @@ jobs:
7270
- name: 'Build Wolfi'
7371
run: |
7472
for package in ${{needs.changes.outputs.packages}}; do
75-
make MELANGE="melange" MELANGE_EXTRA_OPTS="--create-build-log" REPO="$GITHUB_WORKSPACE/packages" BUILDWORLD=no packages/$package -j1
73+
make MELANGE="melange" MELANGE_EXTRA_OPTS="--create-build-log" REPO="$GITHUB_WORKSPACE/packages" BUILDWORLD=no package/$package -j1
7674
done
7775
7876
- name: Check for file

.github/workflows/wolfictl-lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
uses: docker://ghcr.io/wolfi-dev/wolfictl:latest@sha256:5876ee08b32ee3e9ff0d4c83867d168bbefe6b1e6cc5bee1f07442e5493ca6e4
2323
with:
2424
entrypoint: wolfictl
25-
args: lint
25+
args: lint --skip-rule no-makefile-entry-for-package
2626
- name: Enforce YAML formatting
2727
id: lint-yaml
2828
uses: docker://ghcr.io/wolfi-dev/wolfictl:latest@sha256:5876ee08b32ee3e9ff0d4c83867d168bbefe6b1e6cc5bee1f07442e5493ca6e4

CONTRIBUTING.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ Wolfi packages are built using melange. If you want to learn how packages are bu
2626

2727
Start by cloning this repository and create a YAML file named `<your-package-name>.yaml` in its root directory. If you have any patches, create a folder with the same name and put them there.
2828

29-
Add a new entry for your package near the bottom of [`packages.txt`](packages.txt) like this:
30-
31-
```
32-
your-package-name
33-
```
34-
3529
Once you're done writing the new package configuration file, you can test it by triggering a build with `make packages/<your-package-name> BUILDWORLD=no USE_CACHE=no`.
3630

3731
note: `USE_CACHE=no` disables using a GCP cloud bucket for caching pipeline sources. This is mainly used for production setups and not needed for local development.

Makefile

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ endif
66
TARGETDIR = packages/${ARCH}
77

88
MELANGE ?= $(shell which melange)
9+
WOLFICTL ?= $(shell which wolfictl)
910
KEY ?= local-melange.rsa
1011
REPO ?= $(shell pwd)/packages
1112
CACHE_DIR ?= gs://wolfi-sources/
@@ -32,11 +33,8 @@ MELANGE_OPTS += -r ${WOLFI_PROD}
3233
endif
3334

3435
# The list of packages to be built. The order matters.
35-
# At some point, when ready, this should be replaced with `wolfictl text -t name .`
36-
# non-standard source directories are provided by adding them separated by a comma,
37-
# e.g.
38-
# postgres-11,postgres
39-
PKGLIST ?= $(shell cat packages.txt | grep -v '^\#' )
36+
# wolfictl determines the list and order
37+
PKGLIST ?= $(shell $(WOLFICTL) text --dir . --type name)
4038

4139
all: ${KEY} .build-packages
4240

@@ -48,31 +46,24 @@ clean:
4846

4947
.PHONY: list list-yaml
5048
list:
51-
$(info $(PKGNAMELIST))
49+
$(info $(PKGLIST))
5250
@printf ''
5351

5452
list-yaml:
55-
$(info $(addsuffix .yaml,$(PKGNAMELIST)))
53+
$(info $(addsuffix .yaml,$(PKGLIST)))
5654
@printf ''
5755

58-
.packagerules: Makefile .git/HEAD packages.txt
59-
@echo "Solving build order, please wait..."
60-
@grep -v '^\#' packages.txt | while read pkg; do \
61-
pkgname=`echo $$pkg | cut -d, -f1`; \
62-
pkgdir=`echo $$pkg | cut -d, -f2`; \
63-
[ -z "$$pkgdir" ] && pkgdir=$$pkgname; \
64-
pkgver=`${MELANGE} package-version $${pkgname}.yaml`; \
65-
pkgtarget="${TARGETDIR}/$${pkgver}.apk"; \
66-
echo "PKGNAMELIST += $$pkgname"; \
67-
echo ".build-packages: $$pkgtarget"; \
68-
echo "packages/$$pkgname: $$pkgtarget"; \
69-
echo "$$pkgtarget: $${pkgname}.yaml \$${KEY}"; \
70-
printf "\t%s\n" "@mkdir -p ./$${pkgdir}/"; \
71-
printf "\t%s" "SDE=\$${SOURCE_DATE_EPOCH}; [ -z \"\$$\$$SDE\" ] && SDE=\`git log -1 --pretty=%ct --follow $${pkgname}.yaml\`;"; \
72-
printf "\t%s\n\n" "SOURCE_DATE_EPOCH=\$$\$$SDE \$${MELANGE} build $${pkgname}.yaml \$${MELANGE_OPTS} --source-dir ./$${pkgdir}/ --log-policy builtin:stderr,\$${TARGETDIR}/buildlogs/$${pkgver}.log"; \
73-
done > .packagerules
56+
.build-packages: $(addprefix package/,${PKGLIST})
7457

75-
-include .packagerules
58+
package/%:
59+
$(eval yamlfile := $*.yaml)
60+
$(eval pkgver := $(shell $(MELANGE) package-version $(yamlfile)))
61+
$(MAKE) yamlfile=$(yamlfile) pkgname=$* packages/$(ARCH)/$(pkgver).apk
62+
63+
packages/$(ARCH)/%.apk: $(KEY)
64+
@mkdir -p ./$(pkgname)/
65+
$(eval SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct --follow $(yamlfile)))
66+
@SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) $(MELANGE) build $(yamlfile) $(MELANGE_OPTS) --source-dir ./$(pkgname)/ --log-policy builtin:stderr,$(TARGETDIR)/buildlogs/$*.log
7667

7768
dev-container:
78-
docker run --privileged --rm -it -v "${PWD}:${PWD}" -w "${PWD}" ghcr.io/wolfi-dev/sdk:latest@sha256:3ef78225a85ab45f46faac66603c9da2877489deb643174ba1e42d8cbf0e0644
69+
docker run --privileged --rm -it -v "${PWD}:${PWD}" -w "${PWD}" ghcr.io/wolfi-dev/sdk:latest@sha256:3ba6e392eff7f09493c62b8a6bff4b9378ecccc27e5dc4ba0fa9f2a0e95c666f

bazel-5

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bazel

bazel-6

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bazel

lint.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ makepkgs=$(make list-yaml)
66
for f in *.yaml; do
77
echo "---" $f
88

9-
# Check that every package is listed in packages.txt
10-
if ! echo "$makepkgs" | grep -wq "$f"; then
11-
echo "missing $f in packages.txt"
12-
exit 1
13-
fi
14-
159
# Don't specify packages.wolfi.dev/os as a repository, and remove it from the keyring.
1610
# Packages from the bootstrap repo should be allowed, but otherwise packages
1711
# should be fetched locally and the local repository should be appended at

mariadb-10.11

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mariadb

mariadb-10.6

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mariadb

0 commit comments

Comments
 (0)