Library recipes: run a recipe's steps with a minimal environment, not the build container's
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- github-actions, python
- Ambito
- build-system, security
Direzione di ricerca
Start with build_env() and the subprocess.run call in build_libraries() in scripts/gap_wheels.py, then check scripts/container_build.sh for the image's PATH. Add a library_env(prefix) for recipe steps only, and leave Windows on the old path with a comment. Done when tests/test_gap_wheels.py shows that CFLAGS, MAKEFLAGS and LD_LIBRARY_PATH set in the test's os.environ never reach a recipe step, and the PyYAML pair still builds to the same sha256.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
A recipe's build steps are fixed argument lists, so that nothing outside the reviewed recipe decides how the library is built. But each step runs with the whole environment of the process that started it:
# scripts/gap_wheels.py
def build_env() -> dict[str, str]:
env = dict(os.environ, PIP_DISABLE_PIP_VERSION_CHECK="1", PIP_NO_INPUT="1", SOURCE_DATE_EPOCH="1700000000",
PYTHONHASHSEED="0")
...
# build_libraries()
done = subprocess.run(argv, cwd=src, check=False, env=build_env(), ...)
./configure and make read a lot from the environment: CC, CFLAGS, LDFLAGS, CPPFLAGS, MAKEFLAGS, PKG_CONFIG_PATH, LD_LIBRARY_PATH, LANG, TZ, HOME, USER. Whatever the image, the runner or the workflow sets for any of them goes into the library, and none of it is in the recipe's sha256 (digest() in scripts/library_recipes.py covers the recipe's own fields only). An image update that starts exporting CFLAGS=-g, or a workflow edit that sets MAKEFLAGS, changes the library while the recorded recipe digest stays the same. The two builds of a pair would still match each other, so nothing would notice.
The README promises more than that: "built with the recipe's steps, which are argument lists in this repo (no shell, nothing from the package or from a workflow input)".
Where
scripts/gap_wheels.py: build_env() and the subprocess.run in build_libraries(). The package's own build (run_build()) is a different question and out of scope here.
What to do
- Add
library_env(prefix)and use it for recipe steps only. Start from an empty dict and set a short fixed list:PATH: on Linux the image's standard one, written out (/usr/local/bin:/usr/bin:/bin, plus the manylinux toolchain's folder if the image's compiler lives outside those; checkscripts/container_build.shand the image);HOMEandTMPDIR: folders under the build's work folder;LANG=C.UTF-8,LC_ALL=C.UTF-8,TZ=UTC;SOURCE_DATE_EPOCH, asbuild_env()sets it.
- On Windows nothing has a recipe yet. MSVC needs its own variables (
INCLUDE,LIB,Pathfrom the developer environment), so for now keepbuild_env()there and say so in a comment, or pass through a named allowlist. Don't break the Windows path for a future recipe. - Record the environment's variable names and values in the recipe record or the build's tool provenance, so a change to the list is a visible change. If that touches
RECORD_KEYSor the manifest's shape, describe it in the PR first: verification compares these records between builds. - A recipe that needs a variable sets it in its own step arguments (
CFLAGS=-O2 -fPICis already an argument to./configurein the libyaml recipe), which is inside the digest.
Done when:
- A test in
tests/test_gap_wheels.pyrunsbuild_libraries()with a recipe whose one step prints its environment to a file under the prefix (the existingbuild_libraries()tests, aroundgap_wheels.build_libraries([recipe], tmp / "work", tmp / "root"), show how to give it a small recipe), withCFLAGS,MAKEFLAGSandLD_LIBRARY_PATHset in the test's ownos.environ, and shows none of them reach the step. - A test pins the exact set of variable names a Linux step gets.
- The PyYAML pair still builds twice to the same sha256 with the change: the PR links two
gap-wheel-build.ymlruns from your fork. - The README's "In the build" paragraph says the steps get a fixed environment.
uvx --python 3.14 [email protected]passes, offline.
- Lingua principale
- Python
- Stelle
- 0
- Fork
- 1
- Merge medio
- 5h 59m
- PR unite (30g)
- 19
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di wheelgap/wheels
-
documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
bug help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di wheelgap/wheels
Issue simili
-
bug game: 0100FF500E34A000 game: 0400FF500E34A001 mac packing
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
jxxghp/MoviePilot#7576 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
jbaruch/software-factory#266 ·
I maintainer di solito rispondono entro 1 giorno
-
cron: raise a distinct error when next_fire finds no match in its search bound (from #813 item 5)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno