2015-11-06 83 views
12

我試圖讓安裝了Vagrant的edx Devstack,我在Windows機器上。我收到的錯誤似乎是由Windows不支持的符號鏈接導致的。Vagrant - 攤鋪機devstack錯誤:「[Errno 20]不是目錄」

根據Dealing with line endings and symlinks under Windows下的edx故障排除指南,我應該在cygwin中運行以下命令來處理符號鏈接。

git rm --cached -r . && git reset --hard 

git config --global alias.add-symlink '!__git_add_symlink(){ 
    dst=$(echo "$2")/../$(echo "$1"); 
    if [ -e "$dst" ]; then 
     hash=$(echo "$1" | git hash-object -w --stdin); 
     git update-index --add --cacheinfo 120000 "$hash" "$2"; 
     git checkout -- "$2"; 
    else 
     echo "ERROR: Target $dst does not exist!"; 
     echo "  Not creating invalid symlink."; 
    fi; 
    }; __git_add_symlink "$1" "$2"' 

git config --global alias.rm-symlink '!__git_rm_symlink(){ 
    git checkout -- "$1"; link=$(echo "$1"); 
    POS=$'\''/'\''; DOS=$'\''\\\\'\''; 
    doslink=${link//$POS/$DOS}; 
    dest=$(dirname "$link")/$(cat "$link"); 
    dosdest=${dest//$POS/$DOS}; 
    if [ -f "$dest" ]; then 
     rm -f "$link"; 
     cmd //C mklink //H "$doslink" "$dosdest"; 
    elif [ -d "$dest" ]; then 
     rm -f "$link"; 
     cmd //C mklink //J "$doslink" "$dosdest"; 
    else 
     echo "ERROR: Something went wrong when processing $1 . . ."; 
     echo "  $dest may not actually exist as a valid target."; 
    fi; 
    }; __git_rm_symlink "$1"' 

git config --global alias.rm-symlinks '!__git_rm_symlinks(){ 
    for symlink in `git ls-files -s | grep -E "^120000" | cut -f2`; 
    do 
     git rm-symlink "$symlink"; 
     git update-index --assume-unchanged "$symlink"; 
    done; 
    }; __git_rm_symlinks' 

git config --global alias.checkout-symlinks '!__git_checkout_symlinks(){ 
    POS=$'\''/'\''; DOS=$'\''\\\\'\''; 
    for symlink in `git ls-files -s | grep -E "^120000" | cut -f2`; 
    do 
     git update-index --no-assume-unchanged "$symlink"; 
     if [ -d "$symlink" ]; then 
      dossymlink=${symlink//$POS/$DOS}; 
      cmd //C rmdir //S //Q "$dossymlink"; 
     fi; 
     git checkout -- "$symlink"; 
     echo "Restored git symlink $symlink <<===>> `cat $symlink`"; 
    done; 
    }; __git_checkout_symlinks' 

git rm-symlinks 

我也嘗試過在SO的答案Git symlinks in Windows,這產生了相同的結果。

輸出:

運行上面的命令後,我得到的輸出是一個有點古怪,所以我不知道,如果劇本是成功的。

[email protected] /cygdrive/c/.../Local/devstack/edx-platform/edx-platform $./symlinks-fix.sh 
**Git checkout output** 
... 
Checking out files: 100% (6983/6983), done. 
HEAD is now at 222bdd9 Merge pull request #10411 from edx/mobile/course-blocks-api 

Microsoft Windows [Version 6.2.9200] 
(c) 2012 Microsoft Corporation. All rights reserved. 

C:\Users\...\Local\devstack\edx-platform\edx-platform> 

爲什麼它會在最後進入Windows風格的命令提示符?這是我不確定git命令是否正常工作的地方。

在流浪:

運行vagrant upvagrant ssh,運行paver devstack lms當我得到以下錯誤(類似於輸出paver devstack studio)後:

[email protected]:~$ sudo su edxapp 
[email protected]:~/edx-platform$ paver devstack lms 
... 
pip install -q --disable-pip-version-check --exists-action w -r requirements/edx/github.txt 
    Could not find a tag or branch '96e1922348bfe6d99201b9512a9ed946c87b7e0b', assuming commit. 
    .... 20 similar .... 
    Could not find a tag or branch 'e7a6c95c300e95c51e42bfd1eba70489c05a6527', assuming commit. 

pip install -q --disable-pip-version-check --exists-action w -r requirements/edx/local.txt 
pip install -q --disable-pip-version-check --exists-action w -r requirements/edx/base.txt 
    Requested meliae==0.4.0 (from -r requirements/edx/base.txt (line 47)), but installing version 0.4.0.final.0 
pip install -q --disable-pip-version-check --exists-action w -r requirements/edx/post.txt 
python manage.py cms --settings=devstack reindex_course --setup 
2015-11-06 01:37:40,353 WARNING 4797 [xblock.plugin] plugin.py:147 - Unable to load XBlock 'html' 
    Traceback... 
IOError: [Errno 20] Not a directory: '/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/js/common_static/js/vendor/draggabilly.pkgd.js' 
2015-11-06 01:37:40,660 WARNING 4797 [xblock.plugin] plugin.py:147 - Unable to load XBlock 'course_info' 
    Traceback... 
IOError: [Errno 20] Not a directory: '/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/js/common_static/js/vendor/draggabilly.pkgd.js' 
    Traceback... 
IOError: [Errno 20] Not a directory: '/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/js/common_static/js/vendor/draggabilly.pkgd.js' 
    Traceback ... 
IOError: [Errno 20] Not a directory: '/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/js/common_static/js/vendor/draggabilly.pkgd.js' 
    Traceback ... 
IOError: [Errno 20] Not a directory: '/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/js/common_static/js/vendor/draggabilly.pkgd.js' 

Build failed running pavelib.servers.devstack: Subprocess return code: 1 

據我瞭解,這是一個問題與符號鏈接(請參閱Google羣組上的this發佈)。

我是否正確運行上述符號鏈接腳本?如何檢查符號鏈接是否已成功處理?

其他嘗試:

繼谷歌組(以上鍊接)的建議,我也做了如下調整:

  • 使用Vagrantfile設置VAGRANT_USE_VBOXFS =真
  • 提供here
  • 設置環境變量OPENEDX_RELEASE =「named-release/cypress」
  • 從Vagrant實例安裝libxmlsec1。

後多vagrant destroyvagrant provision的,我仍然有同樣的問題IOError: [Error 20] Not a directory。任何幫助將非常感激!

版本:

  • Windows版本:8
  • 流浪版本:1.7.4
  • VirtualBox的版本:5.0。8
  • openEdx發佈:命名發佈/柏
+0

你們是不是在Windows中創建/使用符號鏈接,或者是你想創建的VirtualBox /使用符號連接(假設一個Linux VM)? – jperezov

+0

@Jonathan我試圖在我的Windows機器上存儲的文件中使用符號鏈接,並通過VirtualBox將它們共享到一個linux虛擬機......至少我認爲這就是流浪漢的工作原理。 – Evelyn

+0

第一個腳本中有一個錯誤,其中'hash = $(echo「$ 1」| git hash-object -w --stdin); '應該是'hash = $(echo -n「$ 1」| git hash-object -w --stdin); '(注意附加的「-n」) – venimus

回答

3

我認爲這個問題是由您cydrive路徑造成的錯誤。

嘗試在c:\cygwin\etc\fstab

none /cydrive cygdrive binary,posix=0,user 0 0

改變

none/cygdrive binary,posix=0,user 0 0

裁判:https://cygwin.com/cygwin-ug-net/using.html#cygdrive

UPDATE:

從CMD輸入「慶典」,然後複製/粘貼腳本的內容

如果你得到同樣的結果嘗試:

開放的.gitconfig(用記事本++或類似),如果加上這部分尚未現有

[alias] 
add-symlink = "!__git_add_symlink(){\n dst=$(echo \"$2\")/../$(echo \"$1\"); \n if [ -e \"$dst\" ]; then \n  hash=$(echo -n \"$1\" | git hash-object -w --stdin); \n  git update-index --add --cacheinfo 120000 \"$hash\" \"$2\"; \n  git checkout -- \"$2\"; \n else \n  echo \"ERROR: Target $dst does not exist!\"; \n  echo \"  Not creating invalid symlink.\"; \n fi; \n }; __git_add_symlink \"$1\" \"$2\"" 
rm-symlink = "!__git_rm_symlink(){\n git checkout -- \"$1\"; link=$(echo \"$1\"); \n POS=$'/'; DOS=$'\\\\\\\\'; \n doslink=${link//$POS/$DOS}; \n dest=$(dirname \"$link\")/$(cat \"$link\"); \n dosdest=${dest//$POS/$DOS}; \n if [ -f \"$dest\" ]; then \n  rm -f \"$link\"; \n  cmd //C mklink //H \"$doslink\" \"$dosdest\"; \n elif [ -d \"$dest\" ]; then \n  rm -f \"$link\"; \n  cmd //C mklink //J \"$doslink\" \"$dosdest\"; \n else \n  echo \"ERROR: Something went wrong when processing $1 . . .\"; \n  echo \"  $dest may not actually exist as a valid target.\"; \n fi; \n }; __git_rm_symlink \"$1\"" 
rm-symlinks = "!__git_rm_symlinks(){\n for symlink in `git ls-files -s | grep -E \"^120000\" | cut -f2`; \n do \n  git rm-symlink \"$symlink\"; \n  git update-index --assume-unchanged \"$symlink\"; \n done; \n }; __git_rm_symlinks" 
checkout-symlinks = "!__git_checkout_symlinks(){\n POS=$'/'; DOS=$'\\\\\\\\'; \n for symlink in `git ls-files -s | grep -E \"^120000\" | cut -f2`; \n do \n  git update-index --no-assume-unchanged \"$symlink\"; \n  if [ -d \"$symlink\" ]; then \n   dossymlink=${symlink//$POS/$DOS}; \n   cmd //C rmdir //S //Q \"$dossymlink\"; \n  fi; \n  git checkout -- \"$symlink\"; \n  echo \"Restored git symlink $symlink <<===>> `cat $symlink`\"; \n done; \n }; __git_checkout_symlinks" 

這將創建符號鏈接

一些Git命令

注:文件使用Unix行結尾,不使用Windows記事本編輯!

然後執行命令

git rm --cached -r . 
git reset --hard 
git rm-symlinks 

我在ENV測試,它的工作原理

+0

我編輯該文件後出現同樣的錯誤。在運行腳本之後,它仍然會轉到windows-style命令。我在管理員模式下使用cygwin,'mount'顯示以下內容(編輯fstab後):'/ cygwin/bin on/usr/bin type ntfs(binary,auto) C:/ cygwin/lib on/usr/lib type ntfs(binary,auto) C:/ cygwin on/type ntfs(binary,auto) C:on/c type ntfs(binary,posix = 0,user,noumount,auto) ' – Evelyn

+0

此選項「在fstab中是用於自動安裝的驅動器當你修改它時,它允許你有'/ cygdrive/c/windows'它會變成/ c/windows 似乎你需要在fstab中添加所有手動安裝的路徑,就像cygwin中描述的那樣手冊 – venimus

+0

我編輯答案添加一些其他的東西。我認爲你的'.sh'行可能關閉。他們應該是UNIX風格。 – venimus

相關問題