From 9d4fbdfa16eb4909c685d2abfedc5b22f26ee6a3 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Sat, 19 Oct 2024 07:46:00 -0500 Subject: [PATCH 1/2] fix: remove old rerender code --- conda_forge_tick/container_cli.py | 99 ------------------------------- 1 file changed, 99 deletions(-) diff --git a/conda_forge_tick/container_cli.py b/conda_forge_tick/container_cli.py index cfb2eaca7..f49f04ca5 100644 --- a/conda_forge_tick/container_cli.py +++ b/conda_forge_tick/container_cli.py @@ -185,93 +185,6 @@ def _execute_git_cmds_and_report(*, cmds, cwd, msg): raise e -def _rerender_feedstock(*, timeout): - from conda_forge_feedstock_ops.os_utils import ( - chmod_plus_rwX, - get_user_execute_permissions, - reset_permissions_with_user_execute, - sync_dirs, - ) - - from conda_forge_tick.rerender_feedstock import rerender_feedstock_local - - logger = logging.getLogger("conda_forge_tick.container") - - with tempfile.TemporaryDirectory() as tmpdir: - input_fs_dir = glob.glob("/cf_feedstock_ops_dir/*-feedstock") - assert len(input_fs_dir) == 1, f"expected one feedstock, got {input_fs_dir}" - input_fs_dir = input_fs_dir[0] - logger.debug( - f"input container feedstock dir {input_fs_dir}: {os.listdir(input_fs_dir)}" - ) - input_permissions = os.path.join( - "/cf_feedstock_ops_dir", - f"permissions-{os.path.basename(input_fs_dir)}.json", - ) - with open(input_permissions) as f: - input_permissions = json.load(f) - - fs_dir = os.path.join(tmpdir, os.path.basename(input_fs_dir)) - sync_dirs(input_fs_dir, fs_dir, ignore_dot_git=True, update_git=False) - logger.debug(f"copied container feedstock dir {fs_dir}: {os.listdir(fs_dir)}") - - reset_permissions_with_user_execute(fs_dir, input_permissions) - - has_gitignore = os.path.exists(os.path.join(fs_dir, ".gitignore")) - if has_gitignore: - shutil.move( - os.path.join(fs_dir, ".gitignore"), - os.path.join(fs_dir, ".gitignore.bak"), - ) - - cmds = [ - ["git", "init", "-b", "main", "."], - ["git", "add", "."], - ["git", "commit", "-am", "initial commit"], - ] - if has_gitignore: - cmds += [ - ["git", "mv", ".gitignore.bak", ".gitignore"], - ["git", "commit", "-am", "put back gitignore"], - ] - _execute_git_cmds_and_report( - cmds=cmds, - cwd=fs_dir, - msg="git init failed for rerender", - ) - - if timeout is not None: - kwargs = {"timeout": timeout} - else: - kwargs = {} - msg = rerender_feedstock_local(fs_dir, **kwargs) - - if logger.getEffectiveLevel() <= logging.DEBUG: - cmds = [ - ["git", "status"], - ["git", "diff", "--name-only"], - ["git", "diff", "--name-only", "--staged"], - ["git", "--no-pager", "diff"], - ["git", "--no-pager", "diff", "--staged"], - ] - _execute_git_cmds_and_report( - cmds=cmds, - cwd=fs_dir, - msg="git status failed for rerender", - ) - - # if something changed, copy back the new feedstock - if msg is not None: - output_permissions = get_user_execute_permissions(fs_dir) - sync_dirs(fs_dir, input_fs_dir, ignore_dot_git=True, update_git=False) - else: - output_permissions = input_permissions - - chmod_plus_rwX(input_fs_dir, recursive=True, skip_on_error=True) - - return {"commit_message": msg, "permissions": output_permissions} - - def _migrate_feedstock(*, feedstock_name, default_branch, attrs, input_kwargs): from conda_forge_feedstock_ops.os_utils import ( chmod_plus_rwX, @@ -623,18 +536,6 @@ def get_latest_version(log_level, existing_feedstock_node_attrs, sources): ) -@cli.command(name="rerender-feedstock") -@log_level_option -@click.option("--timeout", default=None, type=int, help="The timeout for the rerender.") -def rerender_feedstock(log_level, timeout): - return _run_bot_task( - _rerender_feedstock, - log_level=log_level, - existing_feedstock_node_attrs=None, - timeout=timeout, - ) - - @cli.command(name="migrate-feedstock") @log_level_option @existing_feedstock_node_attrs_option From b6d3edaf67da72790ba8d606150641b209afdd03 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 19 Oct 2024 12:47:40 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- conda_forge_tick/container_cli.py | 1 - 1 file changed, 1 deletion(-) diff --git a/conda_forge_tick/container_cli.py b/conda_forge_tick/container_cli.py index f49f04ca5..6158a46d8 100644 --- a/conda_forge_tick/container_cli.py +++ b/conda_forge_tick/container_cli.py @@ -17,7 +17,6 @@ import json import logging import os -import shutil import subprocess import sys import tempfile