mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 09:04:22 +01:00
reckless: fix git clone issue with removed dir
Reckless was failing to install multiple plugins due to git not appreciating the cwd being a now removed dir after the first plugin tmp files were cleaned up.
This commit is contained in:
committed by
Christian Decker
parent
a728b04243
commit
341d73fdc2
@@ -336,10 +336,10 @@ def _install_plugin(src: InstInfo) -> bool:
|
|||||||
if ('http' in src.repo[:4]) or ('github.com' in src.repo):
|
if ('http' in src.repo[:4]) or ('github.com' in src.repo):
|
||||||
# Ugly, but interactively handling stderr gets hairy.
|
# Ugly, but interactively handling stderr gets hairy.
|
||||||
if IS_VERBOSE:
|
if IS_VERBOSE:
|
||||||
git = Popen(['git', 'clone', src.repo, clone_path],
|
git = Popen(['git', 'clone', src.repo, str(clone_path)],
|
||||||
stdout=PIPE)
|
stdout=PIPE)
|
||||||
else:
|
else:
|
||||||
git = Popen(['git', 'clone', src.repo, clone_path],
|
git = Popen(['git', 'clone', src.repo, str(clone_path)],
|
||||||
stdout=PIPE, stderr=PIPE)
|
stdout=PIPE, stderr=PIPE)
|
||||||
git.wait()
|
git.wait()
|
||||||
if git.returncode != 0:
|
if git.returncode != 0:
|
||||||
@@ -353,6 +353,7 @@ def _install_plugin(src: InstInfo) -> bool:
|
|||||||
if src.subdir is not None:
|
if src.subdir is not None:
|
||||||
plugin_path = Path(clone_path).joinpath(src.subdir)
|
plugin_path = Path(clone_path).joinpath(src.subdir)
|
||||||
os.chdir(plugin_path)
|
os.chdir(plugin_path)
|
||||||
|
assert os.getcwd() == str(plugin_path)
|
||||||
if src.commit:
|
if src.commit:
|
||||||
verbose(f"Checking out commit {src.commit}")
|
verbose(f"Checking out commit {src.commit}")
|
||||||
checkout = Popen(['git', 'checkout', src.commit],
|
checkout = Popen(['git', 'checkout', src.commit],
|
||||||
@@ -400,6 +401,7 @@ def _install_plugin(src: InstInfo) -> bool:
|
|||||||
# Find this cute little plugin a forever home
|
# Find this cute little plugin a forever home
|
||||||
shutil.copytree(plugin_path, inst_path)
|
shutil.copytree(plugin_path, inst_path)
|
||||||
print(f'plugin installed: {inst_path}')
|
print(f'plugin installed: {inst_path}')
|
||||||
|
os.chdir(RECKLESS_CONFIG.reckless_dir)
|
||||||
remove_dir(clone_path)
|
remove_dir(clone_path)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -422,7 +424,7 @@ def install(plugin_name: str):
|
|||||||
def uninstall(plugin_name: str):
|
def uninstall(plugin_name: str):
|
||||||
"""disables plugin and deletes the plugin's reckless dir"""
|
"""disables plugin and deletes the plugin's reckless dir"""
|
||||||
assert isinstance(plugin_name, str)
|
assert isinstance(plugin_name, str)
|
||||||
print(f'Uninstalling plugin {plugin_name}')
|
verbose(f'Uninstalling plugin {plugin_name}')
|
||||||
disable(plugin_name)
|
disable(plugin_name)
|
||||||
plugin_dir = Path(RECKLESS_CONFIG.reckless_dir).joinpath(plugin_name)
|
plugin_dir = Path(RECKLESS_CONFIG.reckless_dir).joinpath(plugin_name)
|
||||||
verbose(f'looking for {plugin_dir}')
|
verbose(f'looking for {plugin_dir}')
|
||||||
@@ -604,8 +606,8 @@ def loadSources() -> list:
|
|||||||
sources_file = get_sources_file()
|
sources_file = get_sources_file()
|
||||||
# This would have been created if possible
|
# This would have been created if possible
|
||||||
if not Path(sources_file).exists():
|
if not Path(sources_file).exists():
|
||||||
print('Warning: Reckless requires write access')
|
verbose('Warning: Reckless requires write access')
|
||||||
Config(path=sources_file,
|
Config(path=str(sources_file),
|
||||||
default_text='https://github.com/lightningd/plugins')
|
default_text='https://github.com/lightningd/plugins')
|
||||||
return ['https://github.com/lightningd/plugins']
|
return ['https://github.com/lightningd/plugins']
|
||||||
return sources_from_file()
|
return sources_from_file()
|
||||||
|
|||||||
Reference in New Issue
Block a user