3 # Ruby script for generating Amarok tarball releases from KDE SVN
5 # (C) 2006-2007 Harald Sitter <sitter.harald@gmail.com>
6 # (C) 2005 Mark Kretschmann <kretschmann@kde.org>
7 # Some parts of this code taken from cvs2dist
8 # License: GNU General Public License V2
13 useStableBranch = false
15 # Ask whether using branch or trunk
16 location = `kdialog --combobox "Select checkout's place:" "Trunk" "Stable" "Tag"`.chomp()
18 tag = `kdialog --inputbox "Enter tag name: "`.chomp()
19 elsif location == "Stable"
20 useStableBranch = true
23 # Ask user for targeted application version
24 if tag and not tag.empty?()
27 version = `kdialog --inputbox "Enter Amarok version: "`.chomp()
30 user = `kdialog --inputbox "Your SVN user:"`.chomp()
31 protocol = `kdialog --radiolist "Do you use https or svn+ssh?" https https 0 "svn+ssh" "svn+ssh" 1`.chomp()
34 folder = "amarok-#{version}"
38 # Prevent using unsermake
39 oldmake = ENV["UNSERMAKE"]
40 ENV["UNSERMAKE"] = "no"
43 # Remove old folder, if exists
44 FileUtils.rm_rf( folder )
45 FileUtils.rm_rf( "#{folder}.tar.bz2" )
53 branch = "branches/stable/"
54 `svn co -N #{protocol}://#{user}@svn.kde.org/home/kde/#{branch}/extragear/multimedia/`
55 Dir.chdir( "multimedia" )
56 elsif not tag.empty?()
57 l10n = `kdialog --combobox "Get translation from:" "Trunk" "Stable" "Not at all"`.chomp()
60 elsif l10n == "Stable"
61 l10n_branch = "branches/stable/"
65 `svn co -N #{protocol}://#{user}@svn.kde.org/home/kde/#{branch}/extragear/multimedia`
66 Dir.chdir( "multimedia" )
68 `svn co -N #{protocol}://#{user}@svn.kde.org/home/kde/trunk/extragear/multimedia`
69 Dir.chdir( "multimedia" )
75 `svn co #{protocol}://#{user}@svn.kde.org/home/kde/branches/KDE/3.5/kde-common/admin`
78 unless l10n_branch == nil
79 unless l10n_branch == true
86 i18nlangs = `svn cat #{protocol}://#{user}@svn.kde.org/home/kde/#{branch}/l10n/subdirs`
93 FileUtils.rm_rf( "../doc/#{lang}" )
94 FileUtils.rm_rf( name )
95 docdirname = "l10n/#{lang}/docs/extragear-multimedia/amarok"
96 `svn co -q #{protocol}://#{user}@svn.kde.org/home/kde/#{branch}/#{docdirname} > /dev/null 2>&1`
97 next unless FileTest.exists?( "amarok" )
98 print "Copying #{lang}'s #{name} documentation over.. "
99 `cp -R amarok/ ../doc/#{lang}`
101 # we don't want KDE_DOCS = AUTO, cause that makes the
102 # build system assume that the name of the app is the
103 # same as the name of the dir the Makefile.am is in.
104 # Instead, we explicitly pass the name..
105 makefile = File.new( "../doc/#{lang}/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
106 makefile << "KDE_LANG = #{lang}\n"
107 makefile << "KDE_DOCS = #{name}\n"
113 Dir.chdir( ".." ) # multimedia
119 for lang in i18nlangs
121 pofilename = "l10n/#{lang}/messages/extragear-multimedia/amarok.po"
122 `svn cat #{protocol}://#{user}@svn.kde.org/home/kde/#{branch}/#{pofilename} 2> /dev/null | tee l10n/amarok.po`
123 next if FileTest.size( "l10n/amarok.po" ) == 0
127 print "Copying #{lang}'s #{name}.po over .. "
128 FileUtils.mv( "l10n/amarok.po", dest )
131 makefile = File.new( "#{dest}/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
132 makefile << "KDE_LANG = #{lang}\n"
133 makefile << "SUBDIRS = $(AUTODIRS)\n"
134 makefile << "POFILES = AUTO\n"
141 makefile = File.new( "po/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
142 makefile << "SUBDIRS = $(AUTODIRS)\n"
145 FileUtils.rm_rf( "po/xx" )
147 FileUtils.rm_rf( "po" )
150 FileUtils.rm_rf( "l10n" )
156 # Remove SVN data folder
157 `find -name ".svn" | xargs rm -rf`
159 # TODO: what is this supposed to do, why did we include it, and does the script
160 # actually work without it?
162 # `svn co -N #{protocol}://#{user}@svn.kde.org/home/kde/trunk/extragear/multimedia`
163 # `mv multimedia/* .`
164 # FileUtils.rm_rf( "multimedia" )
167 Dir.chdir( "amarok" )
169 # Move some important files to the root folder
170 FileUtils.mv( "AUTHORS", ".." )
171 FileUtils.mv( "ChangeLog", ".." )
172 FileUtils.mv( "COPYING", ".." )
173 FileUtils.mv( "COPYING.LGPL", ".." )
174 FileUtils.mv( "COPYING-DOCS", ".." )
175 FileUtils.mv( "INSTALL", ".." )
176 FileUtils.mv( "README", ".." )
177 FileUtils.mv( "TODO", ".." )
179 # This stuff doesn't belong in the tarball
180 FileUtils.rm_rf( "release_scripts" )
181 FileUtils.rm_rf( "src/engine/gst10" ) #Removed for now
182 FileUtils.rm_rf( "supplementary_scripts" )
186 # Exchange APP_VERSION string with targeted version
187 file = File.new( "amarok.h", File::RDWR )
191 str.sub!( /APP_VERSION \".*\"/, "APP_VERSION \"#{version}\"" )
196 Dir.chdir( ".." ) # amarok
197 Dir.chdir( ".." ) # multimedia
201 puts "**** Generating Makefiles.. "
202 `make -f Makefile.cvs`
205 FileUtils.rm_rf( "autom4te.cache" )
206 FileUtils.rm_rf( "stamp-h.in" )
209 puts "**** Compressing.. "
211 Dir.chdir( ".." ) # Amarok-foo
212 FileUtils.rm_rf( "multimedia" )
213 Dir.chdir( ".." ) # root folder
214 `tar -cf #{folder}.tar #{folder}`
215 `bzip2 #{folder}.tar`
216 FileUtils.rm_rf( folder )
220 ENV["UNSERMAKE"] = oldmake
224 puts "====================================================="
225 puts "Congratulations :) Amarok #{version} tarball generated.\n"
226 puts "Now follow the steps in the RELEASE_HOWTO, from\n"
227 puts "SECTION 3 onwards.\n"
229 puts "Then drink a few pints and have some fun on #amarok\n"
231 puts "MD5 checksum: " + `md5sum #{folder}.tar.bz2`