From 141cb709de87ca906a4d885d6c70d88d90ca2b4a Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 4 May 2019 17:48:19 +0800 Subject: [PATCH] homu: fixes --- .../homu/disable-ssh-host-keycheck.patch | 13 ++++++++++ .../homu/patch-cache-directory.patch | 26 +++++++++++++++++++ nixbld-etc-nixos/homu/pkg.nix | 6 +++-- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 nixbld-etc-nixos/homu/disable-ssh-host-keycheck.patch create mode 100644 nixbld-etc-nixos/homu/patch-cache-directory.patch diff --git a/nixbld-etc-nixos/homu/disable-ssh-host-keycheck.patch b/nixbld-etc-nixos/homu/disable-ssh-host-keycheck.patch new file mode 100644 index 0000000..ef39ad9 --- /dev/null +++ b/nixbld-etc-nixos/homu/disable-ssh-host-keycheck.patch @@ -0,0 +1,13 @@ +diff --git a/homu/git_helper.py b/homu/git_helper.py +index 0f70c69..f53fb57 100755 +--- a/homu/git_helper.py ++++ b/homu/git_helper.py +@@ -7,7 +7,7 @@ SSH_KEY_FILE = os.path.join(os.path.dirname(__file__), '../cache/key') + + + def main(): +- args = ['ssh', '-i', SSH_KEY_FILE, '-S', 'none'] + sys.argv[1:] ++ args = ['ssh', '-o', 'StrictHostKeyChecking=no', '-i', SSH_KEY_FILE, '-S', 'none'] + sys.argv[1:] + os.execvp('ssh', args) + + diff --git a/nixbld-etc-nixos/homu/patch-cache-directory.patch b/nixbld-etc-nixos/homu/patch-cache-directory.patch new file mode 100644 index 0000000..0cf2c90 --- /dev/null +++ b/nixbld-etc-nixos/homu/patch-cache-directory.patch @@ -0,0 +1,26 @@ +diff --git a/homu/git_helper.py b/homu/git_helper.py +index 0f70c69..732230c 100755 +--- a/homu/git_helper.py ++++ b/homu/git_helper.py +@@ -3,7 +3,7 @@ + import sys + import os + +-SSH_KEY_FILE = os.path.join(os.path.dirname(__file__), '../cache/key') ++SSH_KEY_FILE = os.path.expanduser("~/cache/key") + + + def main(): +diff --git a/homu/main.py b/homu/main.py +index 16b60a2..a2e109a 100644 +--- a/homu/main.py ++++ b/homu/main.py +@@ -649,7 +649,7 @@ def git_push(git_cmd, branch, state): + + + def init_local_git_cmds(repo_cfg, git_cfg): +- fpath = 'cache/{}/{}'.format(repo_cfg['owner'], repo_cfg['name']) ++ fpath = '{}/cache/{}/{}'.format(os.path.expanduser("~"), repo_cfg['owner'], repo_cfg['name']) + url = 'git@github.com:{}/{}.git'.format(repo_cfg['owner'], repo_cfg['name']) # noqa + + if not os.path.exists(SSH_KEY_FILE): diff --git a/nixbld-etc-nixos/homu/pkg.nix b/nixbld-etc-nixos/homu/pkg.nix index ee95db2..43cb2a0 100644 --- a/nixbld-etc-nixos/homu/pkg.nix +++ b/nixbld-etc-nixos/homu/pkg.nix @@ -1,4 +1,4 @@ -{ python3Packages, fetchFromGitHub }: +{ python3Packages, python3, fetchFromGitHub, git, openssh }: let uritemplate_0_2_0 = python3Packages.github3_py.overrideAttrs(oa: rec { @@ -27,6 +27,8 @@ in rev = "2ea53e76ebac3e5fa11bc39054b3cd4c42eff607"; sha256 = "1ih7s8zfbpq0qb9vqbxzr0r4s9ff52l4ipr916kwbck3ygliq3r9"; }; - propagatedBuildInputs = [ github3_py_0_9_6 ] ++ (with python3Packages; [ toml jinja2 requests bottle waitress retrying ]); + patches = [ ./patch-cache-directory.patch ./disable-ssh-host-keycheck.patch ]; + postInstall = "chmod 755 $out/${python3.sitePackages}/homu/git_helper.py"; + propagatedBuildInputs = [ github3_py_0_9_6 git openssh ] ++ (with python3Packages; [ toml jinja2 requests bottle waitress retrying ]); checkPhase = "python -m unittest discover tests -v"; }