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.
This commit is contained in:
Jan Tojnar 2020-09-20 01:15:58 +02:00
parent c1b05442ff
commit 0c5ddf3358
No known key found for this signature in database
GPG key ID: 7FAB2A15F7A607A4
2 changed files with 2 additions and 1 deletions

View file

@ -475,6 +475,7 @@ passthru.updateScript = writeScript "update-zoom-us" ''
<programlisting>
passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ];
</programlisting>
The script will be run with <variable>UPDATE_NIX_ATTR_PATH</variable> environment variable set to the attribute path it is supposed to update.
<note>
<para>
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 <command>git commit</command> or any other commands that cannot handle that.

View file

@ -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)