3 # Ruby script for generating tarball releases from SVN
5 # (c) 2005 Mark Kretschmann <markey@web.de>
6 # modified by Carsten Niehaus
7 # Some parts of this code taken from cvs2dist
12 opts = GetoptLong.new(
13 [ "--noi18n", "-i", GetoptLong::NO_ARGUMENT ],
14 [ "--nogpg", "-g", GetoptLong::NO_ARGUMENT ],
15 [ "--libkdeedu", "-l", GetoptLong::NO_ARGUMENT ],
16 [ "--widgets", "-w", GetoptLong::NO_ARGUMENT ],
17 [ "--appname", "-a", GetoptLong::REQUIRED_ARGUMENT ],
18 [ "--help", "-h", GetoptLong::NO_ARGUMENT ]
27 #check if there are arguments
28 opts.each do |opt, arg|
31 elsif opt == "--nogpg"
33 elsif opt == "--libkdeedu"
35 elsif opt == "--widgets"
37 elsif opt == "--appname"
42 --noi18n to disable the packaging of translations and documentation\n
43 --nogpg to disable signing with GnuPG\n
44 --libkdeedu to enable packing libkdeedu\n
45 --widgets to enable packing the KDEEDU-Widgets"
51 name = `kdialog --combobox "Select an application:" Kalzium KBruch KHangMan Kig Kiten KPercentage KmPlot KStars KTouch KTurtle KVerbos KVoctrain KWordQuiz`.chomp!.downcase
58 version = `kdialog --title "Version number" --inputbox "Enter the version number"`.chomp!
63 puts "Start packing #{name}".center(40, " - ")
65 folder = "#{name}-#{version}"
68 def svn( command, dir )
69 `svn #{command} svn://anonsvn.kde.org/home/kde/#{dir}`
72 # Prevent using unsermake
73 oldmake = ENV["UNSERMAKE"]
74 ENV["UNSERMAKE"] = "no"
76 # Remove old folder, if exists
77 `rm -rf #{folder} 2> /dev/null`
78 `rm -rf folder.tar.bz2 2> /dev/null`
83 if packlibkdeedu == "yes"
84 svn( "co -N", "/trunk/KDE/kdeedu/" )
86 puts "Checking out libkdeedu".center(40, " - ")
89 if packwidgets == "yes"
90 svn( "co -N", "/trunk/playground/edu/" )
91 Dir.chdir( "playground/edu")
92 puts "Checking out the kdeedu-widgets".center(40, " - ")
93 svn( "co", "/trunk/playground/edu/widgets/")
96 puts "Checking out #{name}".center(40," - ")
99 puts "Checking out kde-commons/admin".center(40, " - ")
100 svn( "co", "/trunk/KDE/kde-common/admin")
102 # we check out kde-l10n...
105 puts "l10n".center(40, " - ")
110 i18nlangs = `svn cat https://svn.kde.org/home/kde/trunk/l10n/subdirs`
115 for lang in i18nlangs
117 `rm -rf ../doc/#{lang}`
119 docdirname = "l10n/#{lang}/docs/kdeedu/#{name}"
120 `svn co -q https://svn.kde.org/home/kde/trunk/#{docdirname} > /dev/null 2>&1`
121 next unless FileTest.exists?( "#{name}" )
122 `cp -R #{name}/ ../doc/#{lang}`
124 # we don't want KDE_DOCS = AUTO, cause that makes the
125 # build system assume that the name of the app is the
126 # same as the name of the dir the Makefile.am is in.
127 # Instead, we explicitly pass the name..
128 makefile = File.new( "../doc/#{lang}/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
129 makefile << "KDE_LANG = #{lang}\n"
130 makefile << "KDE_DOCS = #{name}\n"
133 puts( "#{lang} done.\n" )
136 #now create the Makefile.am so that the docs will be build
137 makefile = File.new( "../doc/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
138 makefile << "KDE_LANG = en\n"
139 makefile << "KDE_DOCS = AUTO\n"
140 makefile << "SUBDIRS = $(AUTODIRS)\n"
143 Dir.chdir( ".." ) # multimedia
149 for lang in i18nlangs
151 pofilename = "l10n/#{lang}/messages/kdeedu/#{name}.po"
152 `svn cat https://svn.kde.org/home/kde/trunk/#{pofilename} 2> /dev/null | tee l10n/#{name}.po`
153 next if FileTest.size( "l10n/#{name}.po" ) == 0
157 print "Copying #{lang}'s #{name}.po over .. "
158 `mv l10n/#{name}.po #{dest}`
161 makefile = File.new( "#{dest}/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
162 makefile << "KDE_LANG = #{lang}\n"
163 makefile << "SUBDIRS = $(AUTODIRS)\n"
164 makefile << "POFILES = AUTO\n"
171 makefile = File.new( "po/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
172 makefile << "SUBDIRS = $(AUTODIRS)\n"
175 puts "Removing po-subdirectory"
184 puts "Removing svn-history files"
185 `find -name ".svn" | xargs rm -rf`
187 Dir.chdir( "#{name}" )
191 Dir.chdir( ".." ) # kdeedu
197 puts "Generating Makefiles".center(40, " - ")
198 `make -f Makefile.cvs`
201 `rm -rf autom4te.cache`
205 puts "Compressing".center(40, " - ")
209 `rm -rf kdeedu` # after the moving of the directory this is empty
210 Dir.chdir( ".." ) # root folder
211 `tar -cf #{folder}.tar #{folder}`
212 `bzip2 #{folder}.tar`
217 ENV["UNSERMAKE"] = oldmake
220 puts "Signing with your GnuPG-key".center(40, " - ")
221 `gpg --detach-sign #{folder}.tar.bz2`
226 puts "====================================================="
227 puts "Congratulations :) #{name} #{version} tarball generated.\n"
229 puts "MD5 checksum: " + `md5sum #{folder}.tar.bz2`
231 puts "The user can verify this package with "
233 puts "gpg --verify #{folder}.tar.bz2.sig #{folder}.tar.bz2"