From 87b9c8fd0c728c35886b9d6bfd649627e0bd8c48 Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Mon, 17 Oct 2016 21:51:38 -0400 Subject: [PATCH 1/5] Add executable permissions on `run_docker_build.sh` for everyone. --- conda_smithy/configure_feedstock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 2dc47ec49..17ccb54ab 100755 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -94,7 +94,7 @@ def render_run_docker_build(jinja_env, forge_config, forge_dir): with open(target_fname, 'w') as fh: fh.write(template.render(**forge_config)) st = os.stat(target_fname) - os.chmod(target_fname, st.st_mode | stat.S_IEXEC) + os.chmod(target_fname, st.st_mode | stat.S_IXOTH | stat.S_IXGRP | stat.S_IXUSR) def render_circle(jinja_env, forge_config, forge_dir): From 8671d0777d4ecdf8d5952ae5a917816114647559 Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Mon, 17 Oct 2016 23:29:07 -0400 Subject: [PATCH 2/5] Add executable permissions on `checkout_merge_commit.sh` too. --- conda_smithy/configure_feedstock.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 17ccb54ab..9633279a5 100755 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -93,8 +93,19 @@ def render_run_docker_build(jinja_env, forge_config, forge_dir): target_fname = os.path.join(forge_dir, 'ci_support', 'run_docker_build.sh') with open(target_fname, 'w') as fh: fh.write(template.render(**forge_config)) - st = os.stat(target_fname) - os.chmod(target_fname, st.st_mode | stat.S_IXOTH | stat.S_IXGRP | stat.S_IXUSR) + + # Fix permissions. + target_fnames = [ + os.path.join(forge_dir, 'ci_support', 'run_docker_build.sh'), + os.path.join(forge_dir, 'ci_support', 'checkout_merge_commit.sh'), + ] + for each_target_fname in target_fnames: + if os.path.exists(each_target_fname): + st = os.stat(each_target_fname) + os.chmod( + each_target_fname, + st.st_mode | stat.S_IXOTH | stat.S_IXGRP | stat.S_IXUSR + ) def render_circle(jinja_env, forge_config, forge_dir): From 115b1276d7a9286280bff9aab37fc7b9a477ae6d Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Mon, 17 Oct 2016 17:31:30 -0400 Subject: [PATCH 3/5] cli: Ensure `ci_support/checkout_merge_commit.sh` is an executable. --- conda_smithy/cli.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/conda_smithy/cli.py b/conda_smithy/cli.py index d3000799e..2a1caf1ac 100755 --- a/conda_smithy/cli.py +++ b/conda_smithy/cli.py @@ -42,9 +42,8 @@ def create_git_repo(target, msg): init_git_repo(target) subprocess.check_call(['git', 'add', '*'], cwd=target) if sys.platform == "win32": - # prevent this: - # bash: line 1: ./ci_support/run_docker_build.sh: Permission denied - # ./ci_support/run_docker_build.sh returned exit code 126 + # Ensure shell scripts have executable permissions. + subprocess.check_call(['git', 'update-index', '--chmod=+x', 'ci_support/checkout_merge_commit.sh'], cwd=target) subprocess.check_call(['git', 'update-index', '--chmod=+x', 'ci_support/run_docker_build.sh'], cwd=target) subprocess.check_call(['git', 'commit', '-m', msg], cwd=target) From cbfb658195ac1fbd147bbcb4c3572de722f0df50 Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Mon, 17 Oct 2016 17:33:50 -0400 Subject: [PATCH 4/5] cli: Use `git add -A` to add all files to the index. --- conda_smithy/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda_smithy/cli.py b/conda_smithy/cli.py index 2a1caf1ac..82461f125 100755 --- a/conda_smithy/cli.py +++ b/conda_smithy/cli.py @@ -40,7 +40,7 @@ def init_git_repo(target): def create_git_repo(target, msg): init_git_repo(target) - subprocess.check_call(['git', 'add', '*'], cwd=target) + subprocess.check_call(['git', 'add', '-A'], cwd=target) if sys.platform == "win32": # Ensure shell scripts have executable permissions. subprocess.check_call(['git', 'update-index', '--chmod=+x', 'ci_support/checkout_merge_commit.sh'], cwd=target) From 6663329652978a48a142a2fba6c97fb5e1808e0d Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Mon, 17 Oct 2016 18:40:40 -0400 Subject: [PATCH 5/5] cli: Always ensure executables have the right permissions in the index. --- conda_smithy/cli.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/conda_smithy/cli.py b/conda_smithy/cli.py index 82461f125..ffce6220a 100755 --- a/conda_smithy/cli.py +++ b/conda_smithy/cli.py @@ -41,10 +41,24 @@ def init_git_repo(target): def create_git_repo(target, msg): init_git_repo(target) subprocess.check_call(['git', 'add', '-A'], cwd=target) - if sys.platform == "win32": - # Ensure shell scripts have executable permissions. - subprocess.check_call(['git', 'update-index', '--chmod=+x', 'ci_support/checkout_merge_commit.sh'], cwd=target) - subprocess.check_call(['git', 'update-index', '--chmod=+x', 'ci_support/run_docker_build.sh'], cwd=target) + + # Ensure shell scripts have executable permissions. + executable_files = [ + "ci_support/checkout_merge_commit.sh", + "ci_support/run_docker_build.sh", + ] + for each_executable_file in executable_files: + if os.path.exists(os.path.join(target, each_executable_file)): + subprocess.check_call( + [ + 'git', + 'update-index', + '--chmod=+x', + each_executable_file + ], + cwd=target + ) + subprocess.check_call(['git', 'commit', '-m', msg], cwd=target)