justone / dfm

dotfiles manager
http://endot.org/projects/#dfm
Other
122 stars 18 forks source link

Use mklink on windows for symlinks #21

Closed rneatherway closed 9 years ago

rneatherway commented 10 years ago

I'm using Windows 7, with:

 perl 5, version 14, subversion 2 (v5.14.2) built for cygwin-thread-multi-64int

Note that I always use dfm from cygwin bash. However, the cygwin symlinks are not good enough for me, because native windows programs (eg emacs) do not understand them.

rneatherway commented 10 years ago

I haven't used any of the other commands that I can remember.

justone commented 10 years ago

Thanks for moving the PR.

I'll take a look at getting the test suite running in Cygwin to see if the other dfm functionality works. I don't have a windows 7 env, but I think I can get dev vm images from MS for just this sort of thing.

If you're up for it, you can give it a go. To run the tests it's just prove -v t. There are a couple of modules that the tests need above and beyond standard perl. Test::Trap and File::Slurp are two that come to mind, but there may be others.

rneatherway commented 10 years ago

I'll give it a run-through, no problem. I didn't realise you could get dev vm images for things like this -- very handy.

I should be able to install those modules using CPAN?

justone commented 10 years ago

Yes, they should both be available via CPAN.

rneatherway commented 10 years ago

It didn't go well sadly. All the tests failed, at least partially due to path issues. Here is the first:

t/00_compile.t .................. 
not ok 1 - use App::Dotfiles::Manager;
1..1

#   Failed test 'use App::Dotfiles::Manager;'
#   at t/00_compile.t line 4.
#     Tried to use 'App::Dotfiles::Manager'.
#     Error:  Can't locate App/Dotfiles/Manager.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.14/i686-cygwin-threads-64int /usr/lib/perl5/site_perl/5.14 /usr/lib/perl5/vendor_perl/5.14/i686-cygwin-threads-64int /usr/lib/perl5/vendor_perl/5.14 /usr/lib/perl5/5.14/i686-cygwin-threads-64int /usr/lib/perl5/5.14 /usr/lib/perl5/site_perl/5.10 /usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5/site_perl/5.8 .) at (eval 4) line 2.
# BEGIN failed--compilation aborted at (eval 4) line 2.
# Looks like you failed 1 test of 1.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests 
justone commented 10 years ago

Oops, I forgot the I switched it over to Module::Build a little while ago. Try this:

perl Build.PL
./Build test

That should at least fix the test above. I think that there will be other patching issues though.

rneatherway commented 10 years ago

Right, the first test passes now, thanks. After that there are some pathing issues as I am currently using MSysGit. I don't think this will be an easily supported configuration, and I intend to return to using Cygwin Git anyway so I will try again after reconfiguring my system. It'll be a few weeks until I can give this a proper run-through, probably should have saved the PR until then!

justone commented 10 years ago

No worries. Just add another comment when you get to it. I may have some time too, we'll see.

rneatherway commented 10 years ago

It turns out I needed to reinstall Cygwin Git for another reason, so here we go. I am using git version 1.8.5.5 compiled from source. The tests have to be run in bash started using "run as administrator" in order to use mklink. Some tests fail, but overall not too bad:

Test Summary Report
-------------------
t/01.simple.t                 (Wstat: 256 Tests: 16 Failed: 1)
  Failed test:  15
  Non-zero exit status: 1
t/03.uninstall.t              (Wstat: 512 Tests: 2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/05.import.t                 (Wstat: 1024 Tests: 17 Failed: 4)
  Failed tests:  2, 6-7, 10
  Non-zero exit status: 4
Files=6, Tests=48, 96 wallclock secs ( 0.05 usr  0.14 sys + 22.96 cusr 63.59 csys = 86.74 CPU)
Result: FAIL
Failed 3/6 test programs. 6/48 subtests failed.

The failures seem to be a mixture of symlinks pointing to the wrong place and full paths being returned instead of relative:

t/00_compile.t .................. ok   
t/01.simple.t ................... 1/? Cloning into bare repository '/home/robnea/dev/dfm/t/simple_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/simple/.dotfiles'...
Cloning into '/home/robnea/dev/dfm/t/simple2/.dotfiles'...
t/01.simple.t ................... 2/? Cloning into bare repository '/home/robnea/dev/dfm/t/dangling_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/dangling/.dotfiles'...
t/01.simple.t ................... 3/? Cloning into bare repository '/home/robnea/dev/dfm/t/ssh_no_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/ssh_no/.dotfiles'...
t/01.simple.t ................... 4/? Cloning into bare repository '/home/robnea/dev/dfm/t/ssh_with_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/ssh_with/.dotfiles'...
t/01.simple.t ................... 5/? Cloning into bare repository '/home/robnea/dev/dfm/t/bin_recurse_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/bin_recurse/.dotfiles'...
t/01.simple.t ................... 6/? Cloning into bare repository '/home/robnea/dev/dfm/t/deprecated_recurse_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/deprecated_recurse/.dotfiles'...
Cloning into bare repository '/home/robnea/dev/dfm/t/deprecated_recurse_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/deprecated_recurse/.dotfiles'...
t/01.simple.t ................... 7/? Cloning into bare repository '/home/robnea/dev/dfm/t/switch_recurse_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/switch_recurse/.dotfiles'...
t/01.simple.t ................... 8/? Cloning into bare repository '/home/robnea/dev/dfm/t/parallel_recursions_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/parallel_recursions/.dotfiles'...
t/01.simple.t ................... 9/? Cloning into bare repository '/home/robnea/dev/dfm/t/exec option_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/exec option/.dotfiles'...
t/01.simple.t ................... 10/? Cloning into bare repository '/home/robnea/dev/dfm/t/switch_to_skip_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/switch_to_skip/.dotfiles'...
t/01.simple.t ................... 11/? Cloning into bare repository '/home/robnea/dev/dfm/t/user name_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/user name/.dotfiles'...
t/01.simple.t ................... 12/? Cloning into bare repository '/home/robnea/dev/dfm/t/chmod_option_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/chmod_option/.dotfiles'...
t/01.simple.t ................... 13/? Cloning into bare repository '/home/robnea/dev/dfm/t/first_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/first/.dotfiles'...
t/01.simple.t ................... 14/? Cloning into bare repository '/home/robnea/dev/dfm/t/first_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/first/.dotfiles'...
    # /home/robnea/dev/dfm/t/first/.dotfiles

    #   Failed test 'bin points into repo'
    #   at t/01.simple.t line 344.
    #          got: '/home/robnea/dev/dfm/t/rep/bin'
    #     expected: '../rep/bin'
t/01.simple.t ................... 15/?     # Looks like you failed 1 test of 9.

#   Failed test 'repo dir env override not in home'
#   at t/01.simple.t line 355.
Cloning into bare repository '/home/robnea/dev/dfm/t/simple_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/simple/.dotfiles'...
t/01.simple.t ................... 16/? # Looks like you failed 1 test of 16.
t/01.simple.t ................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/16 subtests 
t/02.updates_mergeandinstall.t .. 1/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
Cloning into '/home/robnea/dev/dfm/t/host2/.dotfiles'...
t/02.updates_mergeandinstall.t .. 2/? Cloning into bare repository '/home/robnea/dev/dfm/t/host one_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host one/.dotfiles'...
Cloning into '/home/robnea/dev/dfm/t/host two/.dotfiles'...
t/02.updates_mergeandinstall.t .. 3/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_rebase_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1_rebase/.dotfiles'...
Cloning into '/home/robnea/dev/dfm/t/host2_rebase/.dotfiles'...
t/02.updates_mergeandinstall.t .. 4/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_merge_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1_merge/.dotfiles'...
Cloning into '/home/robnea/dev/dfm/t/host2_merge/.dotfiles'...
t/02.updates_mergeandinstall.t .. 5/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
Cloning into '/home/robnea/dev/dfm/t/host2/.dotfiles'...
t/02.updates_mergeandinstall.t .. 6/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
Cloning into bare repository '/home/robnea/dev/dfm/t/host2_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host2/.dotfiles'...
t/02.updates_mergeandinstall.t .. 7/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
Cloning into bare repository '/home/robnea/dev/dfm/t/host2_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host2/.dotfiles'...
t/02.updates_mergeandinstall.t .. 8/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/02.updates_mergeandinstall.t .. ok   
t/03.uninstall.t ................ 1/? Cloning into bare repository '/home/robnea/dev/dfm/t/uninstall_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/uninstall/.dotfiles'...
t/03.uninstall.t ................ 2/? read_file '/home/robnea/dev/dfm/t/uninstall/.bashrc' - sysopen: No such file or directory at t/03.uninstall.t line 38
    # Child (uninstall dotfiles) exited without calling finalize()

#   Failed test 'uninstall dotfiles'
#   at /usr/lib/perl5/5.14/Test/Builder.pm line 252.
# Tests were run but no plan was declared and done_testing() was not seen.
t/03.uninstall.t ................ Dubious, test returned 2 (wstat 512, 0x200)
Failed 1/2 subtests 
t/04.misc.t ..................... 1/? Cloning into bare repository '/home/robnea/dev/dfm/t/help_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/help/.dotfiles'...
t/04.misc.t ..................... 2/? Cloning into bare repository '/home/robnea/dev/dfm/t/version_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/version/.dotfiles'...
t/04.misc.t ..................... ok   
t/05.import.t ................... 1/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...

        #   Failed test 'symlink points to correct location'
        #   at t/05.import.t line 462.
        #          got: '/tmp'
        #     expected: '.dotfiles/newlink'
t/05.import.t ................... 2/?         # Looks like you failed 1 test of 6.

    #   Failed test 'symlink'
    #   at t/05.import.t line 75.
    # Looks like you failed 1 test of 9.

#   Failed test 'single file or directory'
#   at t/05.import.t line 76.
Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/05.import.t ................... 3/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/05.import.t ................... 4/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/05.import.t ................... 5/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...

    #   Failed test 'symlink points to correct location'
    #   at t/05.import.t line 462.
    #          got: '/tmp'
    #     expected: '.dotfiles/newlink'

    #   Failed test 'symlink points to correct location'
    #   at t/05.import.t line 462.
    #          got: '/usr'
    #     expected: '.dotfiles/newlink2'
t/05.import.t ................... 6/?     # Looks like you failed 2 tests of 19.

#   Failed test 'full or relative paths to files'
#   at t/05.import.t line 193.
Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...

    #   Failed test 'symlink points to correct location'
    #   at t/05.import.t line 462.
    #          got: '/home/robnea/dev/dfm/t/host1/.dotfiles/.ssh/newfile'
    #     expected: '../.dotfiles/.ssh/newfile'
t/05.import.t ................... 7/?     # Looks like you failed 1 test of 7.

#   Failed test 'file in recursed directory'
#   at t/05.import.t line 214.
Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/05.import.t ................... 8/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/05.import.t ................... 9/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...

        #   Failed test 'symlink points to correct location'
        #   at t/05.import.t line 462.
        #          got: '/home/robnea/dev/dfm/t/host1/.dotfiles/.ssh/newfile'
        #     expected: '../.dotfiles/.ssh/newfile'
        # Looks like you failed 1 test of 5.

    #   Failed test 'recursed file'
    #   at t/05.import.t line 282.
    # Looks like you failed 1 test of 5.
t/05.import.t ................... 10/? 
#   Failed test 'fail on file that is already tracked'
#   at t/05.import.t line 283.
Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/05.import.t ................... 11/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/05.import.t ................... 12/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/05.import.t ................... 13/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/05.import.t ................... 14/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/05.import.t ................... 15/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/05.import.t ................... 16/? Cloning into bare repository '/home/robnea/dev/dfm/t/host1_repo.git'...
done.
Cloning into '/home/robnea/dev/dfm/t/host1/.dotfiles'...
t/05.import.t ................... 17/? # Looks like you failed 4 tests of 17.
t/05.import.t ................... Dubious, test returned 4 (wstat 1024, 0x400)
Failed 4/17 subtests 
justone commented 9 years ago

Sorry that merging this took so long. Thank you for the code.