TDE educational programs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

239 lines
5.7 KiB

  1. #!/usr/bin/env ruby
  2. #
  3. # Ruby script for generating tarball releases from SVN
  4. #
  5. # (c) 2005 Mark Kretschmann <markey@web.de>
  6. # modified by Carsten Niehaus
  7. # Some parts of this code taken from cvs2dist
  8. # License: GPL V2
  9. require 'getoptlong'
  10. opts = GetoptLong.new(
  11. [ "--noi18n", "-i", GetoptLong::NO_ARGUMENT ],
  12. [ "--nogpg", "-g", GetoptLong::NO_ARGUMENT ],
  13. [ "--libtdeedu", "-l", GetoptLong::NO_ARGUMENT ],
  14. [ "--widgets", "-w", GetoptLong::NO_ARGUMENT ],
  15. [ "--appname", "-a", GetoptLong::REQUIRED_ARGUMENT ],
  16. [ "--help", "-h", GetoptLong::NO_ARGUMENT ]
  17. )
  18. doi18n = "yes"
  19. dogpg = "yes"
  20. packlibtdeedu = "no"
  21. packwidgets = "no"
  22. name = ""
  23. #check if there are arguments
  24. opts.each do |opt, arg|
  25. if opt == "--noi18n"
  26. doi18n = "no"
  27. elsif opt == "--nogpg"
  28. dogpg = "no"
  29. elsif opt == "--libtdeedu"
  30. packlibtdeedu = "yes"
  31. elsif opt == "--widgets"
  32. packwidgets = "yes"
  33. elsif opt == "--appname"
  34. name = arg
  35. elsif opt == "--help"
  36. puts "Usage:\n
  37. Optional:\n
  38. --noi18n to disable the packaging of translations and documentation\n
  39. --nogpg to disable signing with GnuPG\n
  40. --libtdeedu to enable packing libtdeedu\n
  41. --widgets to enable packing the KDEEDU-Widgets"
  42. exit()
  43. end
  44. end
  45. if name.empty?
  46. name = `kdialog --combobox "Select an application:" Kalzium KBruch KHangMan Kig Kiten KPercentage KMessedWords KmPlot KStars KTouch KTurtle KVerbos KVoctrain KWordQuiz`.chomp!.downcase
  47. end
  48. if name.empty?
  49. exit()
  50. end
  51. version = `kdialog --title "Version number" --inputbox "Enter the version number"`.chomp!
  52. if version.empty?
  53. version = "preview"
  54. end
  55. puts "Start packing #{name}".center(40, " - ")
  56. folder = "#{name}-#{version}"
  57. # Some helper methods
  58. def svn( command, dir )
  59. `svn #{command} svn://anonsvn.kde.org/home/kde/#{dir}`
  60. end
  61. # Prevent using unsermake
  62. oldmake = ENV["UNSERMAKE"]
  63. ENV["UNSERMAKE"] = "no"
  64. # Remove old folder, if exists
  65. `rm -rf #{folder} 2> /dev/null`
  66. `rm -rf folder.tar.bz2 2> /dev/null`
  67. Dir.mkdir( folder )
  68. Dir.chdir( folder )
  69. if packlibtdeedu == "yes"
  70. svn( "co -N", "/trunk/KDE/tdeedu/" )
  71. Dir.chdir( "tdeedu")
  72. puts "Checking out libtdeedu".center(40, " - ")
  73. `svn up libtdeedu`
  74. end
  75. if packwidgets == "yes"
  76. svn( "co -N", "/trunk/playground/edu/" )
  77. Dir.chdir( "playground/edu")
  78. puts "Checking out the tdeedu-widgets".center(40, " - ")
  79. svn( "co", "/trunk/playground/edu/widgets/")
  80. end
  81. puts "Checking out #{name}".center(40," - ")
  82. `svn up #{name}`
  83. puts "Checking out kde-commons/admin".center(40, " - ")
  84. svn( "co", "/trunk/KDE/kde-common/admin")
  85. # we check out kde-l10n...
  86. if doi18n == "yes"
  87. puts "\n"
  88. puts "l10n".center(40, " - ")
  89. puts "\n"
  90. Dir.mkdir( "doc" )
  91. i18nlangs = `svn cat https://svn.kde.org/home/kde/trunk/l10n/subdirs`
  92. Dir.mkdir( "l10n" )
  93. Dir.chdir( "l10n" )
  94. # docs
  95. for lang in i18nlangs
  96. lang.chomp!
  97. `rm -rf ../doc/#{lang}`
  98. `rm -rf #{name}`
  99. docdirname = "l10n/#{lang}/docs/tdeedu/#{name}"
  100. `svn co -q https://svn.kde.org/home/kde/trunk/#{docdirname} > /dev/null 2>&1`
  101. next unless FileTest.exists?( "#{name}" )
  102. `cp -R #{name}/ ../doc/#{lang}`
  103. # we don't want KDE_DOCS = AUTO, cause that makes the
  104. # build system assume that the name of the app is the
  105. # same as the name of the dir the Makefile.am is in.
  106. # Instead, we explicitly pass the name..
  107. makefile = File.new( "../doc/#{lang}/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
  108. makefile << "KDE_LANG = #{lang}\n"
  109. makefile << "KDE_DOCS = #{name}\n"
  110. makefile.close()
  111. puts( "#{lang} done.\n" )
  112. end
  113. #now create the Makefile.am so that the docs will be build
  114. makefile = File.new( "../doc/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
  115. makefile << "KDE_LANG = en\n"
  116. makefile << "KDE_DOCS = AUTO\n"
  117. makefile << "SUBDIRS = $(AUTODIRS)\n"
  118. makefile.close()
  119. Dir.chdir( ".." ) # multimedia
  120. puts "\n"
  121. $subdirs = false
  122. Dir.mkdir( "po" )
  123. for lang in i18nlangs
  124. lang.chomp!
  125. pofilename = "l10n/#{lang}/messages/tdeedu/#{name}.po"
  126. `svn cat https://svn.kde.org/home/kde/trunk/#{pofilename} 2> /dev/null | tee l10n/#{name}.po`
  127. next if FileTest.size( "l10n/#{name}.po" ) == 0
  128. dest = "po/#{lang}"
  129. Dir.mkdir( dest )
  130. print "Copying #{lang}'s #{name}.po over .. "
  131. `mv l10n/#{name}.po #{dest}`
  132. puts( "done.\n" )
  133. makefile = File.new( "#{dest}/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
  134. makefile << "KDE_LANG = #{lang}\n"
  135. makefile << "SUBDIRS = $(AUTODIRS)\n"
  136. makefile << "POFILES = AUTO\n"
  137. makefile.close()
  138. $subdirs = true
  139. end
  140. if $subdirs
  141. makefile = File.new( "po/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
  142. makefile << "SUBDIRS = $(AUTODIRS)\n"
  143. makefile.close()
  144. else
  145. puts "Removing po-subdirectory"
  146. `rm -Rf po`
  147. end
  148. `rm -rf l10n`
  149. end
  150. puts "\n"
  151. puts "Removing svn-history files"
  152. `find -name ".svn" | xargs rm -rf`
  153. Dir.chdir( "#{name}" )
  154. `rm -rf debian`
  155. Dir.chdir( ".." ) # tdeedu
  156. puts( "\n" )
  157. `find | xargs touch`
  158. puts "Generating Makefiles".center(40, " - ")
  159. `make -f Makefile.cvs`
  160. puts "done.\n"
  161. `rm -rf autom4te.cache`
  162. `rm stamp-h.in`
  163. puts "Compressing".center(40, " - ")
  164. `mv * ..`
  165. Dir.chdir( ".." )
  166. `rm -rf kde-common`
  167. `rm -rf tdeedu` # after the moving of the directory this is empty
  168. Dir.chdir( ".." ) # root folder
  169. `tar -cf #{folder}.tar #{folder}`
  170. `bzip2 #{folder}.tar`
  171. `rm -rf #{folder}`
  172. puts "done.\n"
  173. ENV["UNSERMAKE"] = oldmake
  174. if dogpg == "yes"
  175. puts "Signing with your GnuPG-key".center(40, " - ")
  176. `gpg --detach-sign #{folder}.tar.bz2`
  177. end
  178. puts "\n"
  179. puts "====================================================="
  180. puts "Congratulations :) #{name} #{version} tarball generated.\n"
  181. puts "\n"
  182. puts "MD5 checksum: " + `md5sum #{folder}.tar.bz2`
  183. if dogpg == "yes"
  184. puts "The user can verify this package with "
  185. puts "\n"
  186. puts "gpg --verify #{folder}.tar.bz2.sig #{folder}.tar.bz2"
  187. end
  188. puts "\n"
  189. puts "\n"