Guest User

Untitled

a guest
Apr 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. diff --git a/base/src/port1.0/resources/group/ruby-1.0.tcl b/base/src/port1.0/resources/group/ruby-1.0.tcl
  2. index 7c06869..f3ed6bc 100644
  3. --- a/base/src/port1.0/resources/group/ruby-1.0.tcl
  4. +++ b/base/src/port1.0/resources/group/ruby-1.0.tcl
  5. @@ -180,15 +180,15 @@ proc ruby.setup {module vers {type "install.rb"} {docs {}} {source "custom"}} {
  6. build {}
  7.  
  8. destroot {
  9. - _cd ${worksrcpath}/${ruby.srcdir}
  10. + set root ${worksrcpath}/${ruby.srcdir}
  11. xinstall -d -m 0755 ${destroot}${ruby.lib}
  12. - foreach dir [exec find . -type d] {
  13. - set dir [strsed ${dir} {s|^[.]/||}]
  14. - xinstall -d -m 0755 ${destroot}${ruby.lib}/${dir}
  15. - }
  16. - foreach file [exec find . -type f] {
  17. - set file [strsed ${file} {s|^[.]/||}]
  18. - xinstall -m 0644 ${file} ${destroot}${ruby.lib}/${file}
  19. + fs-traverse file $root {
  20. + set file [trimroot $root $file]
  21. + if {[file isdirectory $file]} {
  22. + xinstall -d -m 0755 ${destroot}${ruby.lib}/${file}
  23. + } else {
  24. + xinstall -m 0644 ${file} ${destroot}${ruby.lib}/${file}
  25. + }
  26. }
  27. }
  28. }
  29. @@ -272,14 +272,12 @@ proc ruby.setup {module vers {type "install.rb"} {docs {}} {source "custom"}} {
  30. }
  31.  
  32. destroot {
  33. - _cd ${worksrcpath}
  34. - system "${prefix}/bin/gem install --local --force --install-dir ${destroot}${prefix}/lib/ruby/gems/${ruby.version} ${distpath}/${distname}"
  35. + system "cd ${worksrcpath} && ${prefix}/bin/gem install --local --force --install-dir ${destroot}${prefix}/lib/ruby/gems/${ruby.version} ${distpath}/${distname}"
  36.  
  37. set binDir ${destroot}${prefix}/lib/ruby/gems/${ruby.version}/bin
  38. if {[file isdirectory $binDir]} {
  39. - _cd $binDir
  40. foreach file [readdir $binDir] {
  41. - file copy $file ${destroot}${prefix}/bin
  42. + file copy [file join $binDir $file] ${destroot}${prefix}/bin
  43. }
  44. }
  45. }
  46. @@ -291,18 +289,20 @@ proc ruby.setup {module vers {type "install.rb"} {docs {}} {source "custom"}} {
  47. }
  48.  
  49. post-destroot {
  50. - _cd ${worksrcpath}
  51. # Install documentation files (if specified)
  52. if {[llength ${ruby.docs}] > 0} {
  53. set docPath ${prefix}/share/doc/${name}
  54. xinstall -d -m 0755 ${destroot}${docPath}
  55. foreach docitem ${ruby.docs} {
  56. + set docitem [file join ${worksrcpath} ${docitem}]
  57. if {[file isdirectory ${docitem}]} {
  58. - foreach dir [exec find ${docitem} -type d] {
  59. - xinstall -d -m 0755 ${destroot}${docPath}/${dir}
  60. - }
  61. - foreach file [exec find ${docitem} -type f] {
  62. - xinstall -m 0644 ${file} ${destroot}${docPath}/${file}
  63. + fs-traverse $file $docitem {
  64. + set file [trimroot $root $file]
  65. + if {[file isdirectory $file]} {
  66. + xinstall -d -m 0755 ${destroot}${docPath}/${file}
  67. + } else {
  68. + xinstall -m 0644 ${file} ${destroot}${docPath}/${file}
  69. + }
  70. }
  71. } else {
  72. xinstall -m 0644 ${docitem} ${destroot}${docPath}
  73. @@ -311,3 +311,25 @@ proc ruby.setup {module vers {type "install.rb"} {docs {}} {source "custom"}} {
  74. }
  75. }
  76. }
  77. +
  78. +proc trimroot {root path} {
  79. + set acc {}
  80. + set skiproot no
  81. + foreach rootf [file split $root] pathf [file split $path] {
  82. + if {$pathf eq ""} {
  83. + # we've hit the end of the path
  84. + break
  85. + } elseif {$skiproot eq "yes" || $rootf eq ""} {
  86. + lappend acc $pathf
  87. + } elseif {$rootf ne $pathf} {
  88. + # diverged from the root
  89. + lappend acc $pathf
  90. + set skiproot yes
  91. + }
  92. + }
  93. + if {[llength $acc] == 0} {
  94. + return ""
  95. + } else {
  96. + return [eval [subst -nobackslashes -nocommands {file join $acc}]]
  97. + }
  98. +}
Add Comment
Please, Sign In to add comment