Revert previous commit, was incorrect
[amarok.git] / release_scripts / rework / lib / librelease.rb
blob4b4ee5c0689bed93761215c776d1a2f3bb577c5d
1 #!/usr/bin/env ruby
3 # Generic ruby library for KDE extragear/playground releases
5 # Copyright (C) 2007 Harald Sitter <harald@getamarok.com>
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 require './lib/libkdialog.rb'
21 require 'fileutils'
23 @dlg = KDialog.new("#{NAME} release script","cookie")
25 def InformationQuery()
26   def CheckoutLocation()
27     location = @dlg.combobox("Select checkout\\'s place:", "Trunk Stable Tag")
28     puts location #DEBUG
29     if location == "Stable"
30       @useStable = true
31     elsif location == "Tag"
32       @tag = @dlg.inputbox("Enter the tag name:")
33       puts @tag #DEBUG
34     end
35   end
37   def ReleaseVersion()
38     if @tag and not @tag.empty?()
39       @version = @tag
40     else
41       @version = @dlg.inputbox("Enter the release version:")
42     end
43     puts @version #DEBUG
44   end
46   def SvnProtcol()
47     @protocol = @dlg.radiolist("Do you use svn+ssh, https or anonsvn :",["svn+ssh","https","anonsvn"],1)
48     puts @protocol #DEBUG
49   end
51   def SvnUsername()
52     if @protocol == "anonsvn"
53       @protocol = "svn"
54       @user = "anonsvn"
55     else
56       @user = @dlg.inputbox("Your SVN user:")
57       @user += "@svn"
58     end
59     puts @user #DEBUG
60   end
62   @version  = "2.0.0" #DEBUG
63   @protocol = "anonsvn" #DEBUG
64   #   CheckoutLocation()
65   #   ReleaseVersion()
66   #   SvnProtcol()
67   SvnUsername()
68 end
71 def FetchSource()
72   bar  = @dlg.progressbar("fetching source code",1)
73   FileUtils.rm_rf( @folder )
74   FileUtils.rm_rf( "#{@folder}.tar.bz2" )
76   branch = "trunk"
78   if @useStable
79     branch = "branches/stable"
80   elsif @tag and not @tag.empty?()
81     branch = "tags/#{NAME}/#{@tag}"
82   end
84   @repo = "#{@protocol}://#{@user}.kde.org/home/kde/#{branch}"
85   puts @repo #DEBUG
87   puts "Fetching source from #{branch}...\n\n"
88   # TODO: ruby-svn
89   `svn co #{@repo}/#{COMPONENT}/#{SECTION}/#{NAME} #{@folder}`
91   bar.progress = 1
92   bar.close
93 end
96 def CreateTar()
97   bar  = @dlg.progressbar("creating tarball",4)
98   `find -name ".svn" | xargs rm -rf`
99   bar.progress = 1
100   `tar -cf #{@folder}.tar #{@folder}`
101   bar.progress = 2
102   `bzip2 #{@folder}.tar`
103   bar.progress = 3
104   FileUtils.rm_rf(@folder)
105   bar.close