From 0c5ddf335836c521215ecc9bfbb07ba45256a7df Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sun, 20 Sep 2020 01:15:58 +0200 Subject: [PATCH] maintainers/scripts/update.nix: run update script with UPDATE_NIX_ATTR_PATH The environment variable will contain the attribute path the script is supposed to update. --- doc/stdenv/stdenv.xml | 1 + maintainers/scripts/update.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/stdenv/stdenv.xml b/doc/stdenv/stdenv.xml index d33ee382d0b5..6b74e96aad55 100644 --- a/doc/stdenv/stdenv.xml +++ b/doc/stdenv/stdenv.xml @@ -475,6 +475,7 @@ passthru.updateScript = writeScript "update-zoom-us" '' passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]; + The script will be run with UPDATE_NIX_ATTR_PATH environment variable set to the attribute path it is supposed to update. The script will be usually run from the root of the Nixpkgs repository but you should not rely on that. Also note that the update scripts will be run in parallel by default; you should avoid running git commit or any other commands that cannot handle that. diff --git a/maintainers/scripts/update.py b/maintainers/scripts/update.py index 61387ee8cb33..74e36eaf80c6 100644 --- a/maintainers/scripts/update.py +++ b/maintainers/scripts/update.py @@ -39,7 +39,7 @@ async def run_update_script(merge_lock: asyncio.Lock, temp_dir: Optional[Tuple[s eprint(f" - {package['name']}: UPDATING ...") try: - update_process = await check_subprocess(*package['updateScript'], stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, cwd=worktree) + update_process = await check_subprocess('env', f"UPDATE_NIX_ATTR_PATH={package['attrPath']}", *package['updateScript'], stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, cwd=worktree) update_info = await update_process.stdout.read() await merge_changes(merge_lock, package, update_info, temp_dir)