rodjek / librarian-puppet

http://librarian-puppet.com
MIT License
693 stars 209 forks source link

ref SHA ambiguous argument #307

Open jpmorris opened 9 years ago

jpmorris commented 9 years ago

With no Puppetfile.lock and a Puppetfile that contains:

mod 'puppetlabs/nodejs',
:git => 'git@github.com:puppet-community/puppet-nodejs.git',
:ref => 'e9065f3a22'

(Or with the full SHA.) I get the error:

[Librarian]     --- Exited with pid 19840 exit 128
[Librarian]     --> fatal: ambiguous argument 'e9065f3a22^{commit}': unknown revision or path not in the working tree.
[Librarian]     --> Use '--' to separate paths from revisions, like this:
[Librarian]     --> 'git <command> [<revision>...] -- [<file>...]'
Could not checkout git@github.com:puppet-community/puppet-nodejs.git: fatal: ambiguous     argument 'e9065f3a22^{commit}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
carlossg commented 9 years ago

I think that commit was removed from the tree

$ git clone git@github.com:puppet-community/puppet-nodejs.git
Cloning into 'puppet-nodejs'...
cd puremote: Counting objects: 701, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 701 (delta 0), reused 0 (delta 0), pack-reused 696
Receiving objects: 100% (701/701), 137.85 KiB | 0 bytes/s, done.
Resolving deltas: 100% (279/279), done.
    Checking connectivity... done.
$ cd puppet-nodejs/
$ git co e9065f3a22
error: pathspec 'e9065f3a22' did not match any file(s) known to git.
dennisgranath commented 9 years ago

I have the same problem. I also tried the example from the readme (slightly modified): mod 'puppetlabs-apt', :git => "https://github.com/puppetlabs/puppetlabs-apt.git", :ref => '0.0.3'

With following result: $ librarian-puppet install DL is deprecated, please use Fiddle Could not checkout https://github.com/puppetlabs/puppetlabs-apt.git: fatal: ambiguous argument '0.0.3^commit': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]'

Git version: 2.1.4 librarian-puppet version: 2.1.0 OS: Windows

carlossg commented 9 years ago

@jpmorris issue is the same as #309 trying to get an orphaned commit that is not pulled in a normal clone, may need --mirror as suggested there

@dennisgranath your example works fine here, I can't say what's wrong without more details

dennisgranath commented 9 years ago

Ok! Asked my colleauge to reproduce. Here is the output of that:

VERSIONS

$ ruby --version ruby 2.0.0p643 (2015-02-25) [i386-mingw32]

$ librarian-puppet version DL is deprecated, please use Fiddle librarian-puppet v2.1.0

$ gem list | grep puppet puppet (3.7.5 x86-mingw32)

Dist

Windows 7 Cygwin 2.0.4-1

Puppetfile

!/usr/bin/env ruby

^syntax detection

forge "https://forgeapi.puppetlabs.com"

mod 'puppetlabs-apt', :git => 'https://github.com/puppetlabs/puppetlabs-apt.git', :ref => '2.0.1'

LOG

~/src/lib-pup-bug$ librarian-puppet --verbose install DL is deprecated, please use Fiddle Could not find command "__verbose". ~/src/lib-pup-bug$ librarian-puppet install --verbose DL is deprecated, please use Fiddle [Librarian] Ruby Version: 2.0.0 [Librarian] Ruby Platform: i386-mingw32 [Librarian] Rubygems Version: 2.0.14 [Librarian] Librarian Version: 0.6.2 [Librarian] Librarian Adapter: puppet [Librarian] Librarian Adapter Version: 2.1.0 [Librarian] Project: C:/cygwin64/home/marcus.philip/src/lib-pup-bug [Librarian] Specfile: Puppetfile [Librarian] Lockfile: Puppetfile.lock [Librarian] Git: C:/cygwin64/bin/git.EXE [Librarian] Git Version: 2.1.4 [Librarian] Git Environment Variables: [Librarian] GIT_PS1_SHOWCOLORHINTS=true [Librarian] GIT_PS1_SHOWDIRTYSTATE=1 [Librarian] GIT_PS1_SHOWSTASHSTATE=1 [Librarian] GIT_PS1_SHOWUNTRACKEDFILES=1 [Librarian] GIT_PS1_SHOWUPSTREAM=verbose [Librarian] Pre-Cached Sources: [Librarian] Post-Cached Sources: [Librarian] [:forge, "https://forgeapi.puppetlabs.com", {}] [Librarian] [:git, "https://github.com/puppetlabs/puppetlabs-apt.git", {:ref=>"2.0.1"}] [Librarian] Resolving puppetlabs-apt (>= 0) https://github.com/puppetlabs/puppetlabs-apt.git#2.0.1 [Librarian] Checking manifests [Librarian] --- No output [Librarian] --- No output [Librarian] --- No output [Librarian] --- No output [Librarian] --> origin [Librarian] --> origin/1.4.x [Librarian] --> origin/1.5.x [Librarian] --> origin/1.6.x [Librarian] --> origin/1.7.x [Librarian] --> origin/1.8.x [Librarian] --> origin/2.0.x [Librarian] --> origin/2.1.x [Librarian] --> origin/HEAD -> origin/master [Librarian] --> origin/master [Librarian] --- Exited with pid 14340 exit 128 [Librarian] --> fatal: ambiguous argument '2.0.1^commit': unknown revision or path not in the working tree. [Librarian] --> Use '--' to separate paths from revisions, like this: [Librarian] --> 'git [...] -- [...]' Could not checkout https://github.com/puppetlabs/puppetlabs-apt.git: fatal: ambiguous argument '2.0.1^commit': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarian-puppet-2.1.0/lib/librarian/puppet/source/git.rb:37:in rescue in cache!' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarian-puppet-2.1.0/lib/librarian/puppet/source/git.rb:34:incache!' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarian-puppet-2.1.0/lib/librarian/puppet/source/local.rb:32:in fetch_version' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/manifest.rb:93:infetch_version!' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/manifest.rb:85:in fetched_version' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/manifest.rb:24:inversion' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/manifest.rb:20:in to_s' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:191:inblock in scope_checking_manifest' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:236:in block in debug' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/logger.rb:37:inblock in debug' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/ui.rb:32:in debug' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/logger.rb:37:indebug' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:236:in debug' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:191:inscope_checking_manifest' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:160:in block (2 levels) in resolving_dependency_map_find_manifests' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:218:inblock in map_find' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:217:in each' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:217:inmap_find' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:159:in block in resolving_dependency_map_find_manifests' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:172:inblock (2 levels) in scope_resolving_dependency' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:186:in block in scope_checking_manifests' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:230:inscope' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:185:in scope_checking_manifests' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:171:inblock in scope_resolving_dependency' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:230:in scope' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:170:inscope_resolving_dependency' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:158:in resolving_dependency_map_find_manifests' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:65:indo_resolve' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver/implementation.rb:50:in resolve' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/resolver.rb:23:inresolve' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/action/resolve.rb:31:in run' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarian-puppet-2.1.0/lib/librarian/puppet/action/resolve.rb:8:inrun' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarian-puppet-2.1.0/lib/librarian/puppet/cli.rb:104:in resolve!' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarian-puppet-2.1.0/lib/librarian/puppet/cli.rb:68:ininstall' C:/Ruby200/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in run' C:/Ruby200/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:ininvoke_command' C:/Ruby200/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in dispatch' C:/Ruby200/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:instart' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/cli.rb:26:in block (2 levels) in bin!' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/cli.rb:31:inreturning_status' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/cli.rb:26:in block in bin!' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/cli.rb:47:inwith_environment' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarianp-0.6.2/lib/librarian/cli.rb:26:in bin!' C:/Ruby200/lib/ruby/gems/2.0.0/gems/librarian-puppet-2.1.0/bin/librarian-puppet:7:in<top (required)>' C:/Ruby200/bin/librarian-puppet:23:in load' C:/Ruby200/bin/librarian-puppet:23:in

'

carlossg commented 9 years ago

Have you deleted the .tmp dir before running install? maybe the clone got corrupt

If you did, go into .tmp/librarian/cache/source/git/<some sha here> and paste the output of

git rev-parse 2.0.1^{commit}
git rev-parse 2.0.1
git tag | grep 2.0.1
dennisgranath commented 9 years ago

Everything looks fine when running; git rev-parse 2.0.1^{commit} git rev-parse 2.0.1 git tag | grep 2.0.1

But librarian-puppet output I see: Could not checkout https://github.com/puppetlabs/puppetlabs-apt.git: fatal: ambiguous argument '2.0.1^commit': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this:

So I tried this: git rev-parse 2.0.1^commit And I get the same fault which I guess is pretty much expected.

So I started to suspect that something was wrong with my git installation (which I installed using cygwins package manager). I uninstalled it and re-installed "windows way" and that seems to work:) Thanks for your help!

carlossg commented 9 years ago

I guess there is some issue with windows shell execution that removes the curly brackets around {commit}

pecigonzalo commented 8 years ago

Im having the same issue and it does the same thing even when i execute under the bash(mingw) shell. Im running MSYS2/MinGW64

rndmh3ro commented 8 years ago

Workaround for me is to double escape the curly braces: In lib/librarian/puppet/source/git.rb:L14:

          command = %W(rev-parse #{reference}^\\{commit\\} --quiet)

Obviously this could break linux-builds and is probably required elsethere, too.