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.58 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..2a61890 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,17 @@ 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 ne ""} {
  22. + if {[file isdirectory $file]} {
  23. + xinstall -d -m 0755 ${destroot}${ruby.lib}/${file}
  24. + } else {
  25. + xinstall -m 0644 ${file} ${destroot}${ruby.lib}/${file}
  26. + }
  27. + }
  28. }
  29. }
  30. }
  31. @@ -272,14 +274,12 @@ proc ruby.setup {module vers {type "install.rb"} {docs {}} {source "custom"}} {
  32. }
  33.  
  34. destroot {
  35. - _cd ${worksrcpath}
  36. - system "${prefix}/bin/gem install --local --force --install-dir ${destroot}${prefix}/lib/ruby/gems/${ruby.version} ${distpath}/${distname}"
  37. + system "cd ${worksrcpath} && ${prefix}/bin/gem install --local --force --install-dir ${destroot}${prefix}/lib/ruby/gems/${ruby.version} ${distpath}/${distname}"
  38.  
  39. set binDir ${destroot}${prefix}/lib/ruby/gems/${ruby.version}/bin
  40. if {[file isdirectory $binDir]} {
  41. - _cd $binDir
  42. foreach file [readdir $binDir] {
  43. - file copy $file ${destroot}${prefix}/bin
  44. + file copy [file join $binDir $file] ${destroot}${prefix}/bin
  45. }
  46. }
  47. }
  48. @@ -291,18 +291,22 @@ proc ruby.setup {module vers {type "install.rb"} {docs {}} {source "custom"}} {
  49. }
  50.  
  51. post-destroot {
  52. - _cd ${worksrcpath}
  53. # Install documentation files (if specified)
  54. if {[llength ${ruby.docs}] > 0} {
  55. set docPath ${prefix}/share/doc/${name}
  56. xinstall -d -m 0755 ${destroot}${docPath}
  57. foreach docitem ${ruby.docs} {
  58. + set docitem [file join ${worksrcpath} ${docitem}]
  59. if {[file isdirectory ${docitem}]} {
  60. - foreach dir [exec find ${docitem} -type d] {
  61. - xinstall -d -m 0755 ${destroot}${docPath}/${dir}
  62. - }
  63. - foreach file [exec find ${docitem} -type f] {
  64. - xinstall -m 0644 ${file} ${destroot}${docPath}/${file}
  65. + fs-traverse $file $docitem {
  66. + set file [trimroot $root $file]
  67. + if {$file ne ""} {
  68. + if {[file isdirectory $file]} {
  69. + xinstall -d -m 0755 ${destroot}${docPath}/${file}
  70. + } else {
  71. + xinstall -m 0644 ${file} ${destroot}${docPath}/${file}
  72. + }
  73. + }
  74. }
  75. } else {
  76. xinstall -m 0644 ${docitem} ${destroot}${docPath}
  77. @@ -311,3 +315,25 @@ proc ruby.setup {module vers {type "install.rb"} {docs {}} {source "custom"}} {
  78. }
  79. }
  80. }
  81. +
  82. +proc trimroot {root path} {
  83. + set acc {}
  84. + set skiproot no
  85. + foreach rootf [file split $root] pathf [file split $path] {
  86. + if {$pathf eq ""} {
  87. + # we've hit the end of the path
  88. + break
  89. + } elseif {$skiproot eq "yes" || $rootf eq ""} {
  90. + lappend acc $pathf
  91. + } elseif {$rootf ne $pathf} {
  92. + # diverged from the root
  93. + lappend acc $pathf
  94. + set skiproot yes
  95. + }
  96. + }
  97. + if {[llength $acc] == 0} {
  98. + return ""
  99. + } else {
  100. + return [eval [subst -nobackslashes -nocommands {file join $acc}]]
  101. + }
  102. +}
Add Comment
Please, Sign In to add comment