New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to include ssh user in lib_deps repository url #830

Closed
a2hill opened this Issue Nov 18, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@a2hill

a2hill commented Nov 18, 2016

Configuration

Operating system: macOS Seirra

PlatformIO Version: 3.1.0

Description of problem

When including a git+ssh repository URL with the ssh username included the library installer will throw an AssertionError due to a version mismatch.

Steps to Reproduce

  1. Add a lib_deps from a private repository (with username included):
    git+ssh://git@gitlab.my-private-repo.com/a2hill/my-private-project.git#3.1.8
  2. Build the project
  3. Receive error

Actual Results

File "/Users/a2hill/.atom/packages/platformio-ide/penv/lib/python2.7/site-packages/platformio/managers/package.py", line 211, in _install_from_url
    pkg_dir = self._install_from_tmp_dir(pkg_dir, requirements)
File "/Users/a2hill/.atom/packages/platformio-ide/penv/lib/python2.7/site-packages/platformio/managers/package.py", line 249, in _install_from_tmp_dir
    assert tmpmanifest['version'] == requirements, mismatch_error
AssertionError: Package version 3.1.8 doesn't satisfy requirements gitlab.my-private-repo.com/a2hill/my-private-project.git#3.1.8

Expected Results

Library should install correctly.

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:teensy31]
platform = teensy
board = teensy31
framework = arduino
lib_deps =
  git+ssh://git@gitlab.my-private-repo.com/a2hill/my-private-project.git#3.1.8

Source file to reproduce issue:

N/A

Additional info

This is important for privately hosted repository solutions (like GitLab) where a single 'git' user is used to control access to the repositories via public/private key authentication.

I know that URL's from lib_deps are sent directly to the platformio lib install utility. So after looking at the documentation I saw an option for platformio lib [STORAGE_OPTIONS] install <name>@<version>. To me it looks like the url parser is splitting on the '@' symbol and treating the second token as a version when in reality it is just the rest of the URL.

@sbrinkmann

This comment has been minimized.

Show comment
Hide comment
@sbrinkmann

sbrinkmann May 21, 2017

@ivankravets it seems to be that the issue returned with the latest version if pio core.

The path to the repo is: git+ssh://git@myrepo.io/mySensorNodes/BaseLibrary.git but when you look at the GIT executed command at the bottom, the GIT url is cut off at the @-sign. The issue appears with version 3.3.0 and 3.4.0b3

[Wed May 24 07:10:30 2017] Processing pro8MHzatmega328 (platform: atmelavr, lib_deps: git+https://github.com/mysensors/MySensors#2.1.0, git+ssh://git@myrepo.io/mySensorNodes/BaseLibrary.git, upload_port: /dev/cu.usbserial-A10442KK, board: pro8MHzatmega328, framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------
LibraryManager: Installing gogs @ brinkmann.io/mySensorNodes/BaseLibrary.git
git version 2.10.1 (Apple Git-78)
Cloning into '/Users/user/Projects/Arduino/PowerNode/.piolibdeps/_tmp_installing-2tPwyx-package'...
fatal: No path specified. See 'man git-pull' for valid url syntax
Error: Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/platformio/__main__.py", line 106, in main
    cli(None, None, None)
  File "/Library/Python/2.7/site-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/click/core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/decorators.py", line 16, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Library/Python/2.7/site-packages/platformio/commands/run.py", line 110, in cli
    results.append((envname, ep.process()))
  File "/Library/Python/2.7/site-packages/platformio/commands/run.py", line 174, in process
    result = self._run()
  File "/Library/Python/2.7/site-packages/platformio/commands/run.py", line 260, in _run
    ], self.verbose)
  File "/Library/Python/2.7/site-packages/platformio/commands/run.py", line 281, in _autoinstall_libdeps
    ctx.invoke(cmd_lib_install, libraries=[lib], silent=not verbose)
  File "/Library/Python/2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/platformio/commands/lib.py", line 97, in lib_install
    lm.install(library, silent=silent, interactive=interactive)
  File "/Library/Python/2.7/site-packages/platformio/managers/lib.py", line 252, in install
    trigger_event)
  File "/Library/Python/2.7/site-packages/platformio/managers/package.py", line 625, in install
    name, url, requirements, track=True)
  File "/Library/Python/2.7/site-packages/platformio/managers/package.py", line 368, in _install_from_url
    assert vcs.export()
  File "/Library/Python/2.7/site-packages/platformio/vcsclient.py", line 149, in export
    assert self.run_cmd(args)
  File "/Library/Python/2.7/site-packages/platformio/vcsclient.py", line 96, in run_cmd
    return check_call(args, **kwargs) == 0
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['git', 'clone', '--recursive', '--depth', '1', 'ssh://git', '/Users/user/Projects/Arduino/PowerNode/.piolibdeps/_tmp_installing-2tPwyx-package']' returned non-zero exit status 128

sbrinkmann commented May 21, 2017

@ivankravets it seems to be that the issue returned with the latest version if pio core.

The path to the repo is: git+ssh://git@myrepo.io/mySensorNodes/BaseLibrary.git but when you look at the GIT executed command at the bottom, the GIT url is cut off at the @-sign. The issue appears with version 3.3.0 and 3.4.0b3

[Wed May 24 07:10:30 2017] Processing pro8MHzatmega328 (platform: atmelavr, lib_deps: git+https://github.com/mysensors/MySensors#2.1.0, git+ssh://git@myrepo.io/mySensorNodes/BaseLibrary.git, upload_port: /dev/cu.usbserial-A10442KK, board: pro8MHzatmega328, framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------
LibraryManager: Installing gogs @ brinkmann.io/mySensorNodes/BaseLibrary.git
git version 2.10.1 (Apple Git-78)
Cloning into '/Users/user/Projects/Arduino/PowerNode/.piolibdeps/_tmp_installing-2tPwyx-package'...
fatal: No path specified. See 'man git-pull' for valid url syntax
Error: Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/platformio/__main__.py", line 106, in main
    cli(None, None, None)
  File "/Library/Python/2.7/site-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/click/core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/decorators.py", line 16, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Library/Python/2.7/site-packages/platformio/commands/run.py", line 110, in cli
    results.append((envname, ep.process()))
  File "/Library/Python/2.7/site-packages/platformio/commands/run.py", line 174, in process
    result = self._run()
  File "/Library/Python/2.7/site-packages/platformio/commands/run.py", line 260, in _run
    ], self.verbose)
  File "/Library/Python/2.7/site-packages/platformio/commands/run.py", line 281, in _autoinstall_libdeps
    ctx.invoke(cmd_lib_install, libraries=[lib], silent=not verbose)
  File "/Library/Python/2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/platformio/commands/lib.py", line 97, in lib_install
    lm.install(library, silent=silent, interactive=interactive)
  File "/Library/Python/2.7/site-packages/platformio/managers/lib.py", line 252, in install
    trigger_event)
  File "/Library/Python/2.7/site-packages/platformio/managers/package.py", line 625, in install
    name, url, requirements, track=True)
  File "/Library/Python/2.7/site-packages/platformio/managers/package.py", line 368, in _install_from_url
    assert vcs.export()
  File "/Library/Python/2.7/site-packages/platformio/vcsclient.py", line 149, in export
    assert self.run_cmd(args)
  File "/Library/Python/2.7/site-packages/platformio/vcsclient.py", line 96, in run_cmd
    return check_call(args, **kwargs) == 0
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['git', 'clone', '--recursive', '--depth', '1', 'ssh://git', '/Users/user/Projects/Arduino/PowerNode/.piolibdeps/_tmp_installing-2tPwyx-package']' returned non-zero exit status 128

@ivankravets ivankravets reopened this May 25, 2017

@ivankravets ivankravets modified the milestones: 3.4.0, 3.2.0 May 25, 2017

@ivankravets

This comment has been minimized.

Show comment
Hide comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment