summaryrefslogtreecommitdiffstats
path: root/release_libkexiv2.rb
blob: 95d1cdebed3217690890b578afb2d650c5c9d77c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/usr/bin/env ruby
#
# Ruby script for generating libkexiv2 tarball releases from KDE SVN
#
# (c) 2005 Mark Kretschmann <markey@web.de>
# Some parts of this code taken from cvs2dist
# License: GNU General Public License V2


name       = "libkexiv2"
egmodule   = "libs"
version    = "0.1.7"
docs       = "no"
usesvnver  = "no"

#svnbase    = "svn+ssh://gkulzer@svn.kde.org/home/kde"
#svnbase    = "https://toma@svn.kde.org/home/kde"
#svnbase    = "svn+ssh://anaselli@svn.kde.org/home/kde"
svnbase    = "svn+ssh://vfuoglio@svn.kde.org/home/kde"
#svnbase    = "svn://anonsvn.kde.org/home/kde"
svnroot    = "#{svnbase}/trunk"
adminroot  = "#{svnbase}/branches/KDE/3.5"

addDocs    = []
addPo      = []

#----------------------------------------------------------------

if (usesvnver  != "yes")
	folder     = name + "-" + version
else
	t = Time.now
	folder     = name + "-" + version + "." + "0." + t.strftime("%Y%m%d")
end

addPo      = [name] + addPo
addDocs    = [name] + addDocs

# Prevent using unsermake
oldmake = ENV["UNSERMAKE"]
ENV["UNSERMAKE"] = "no"

puts "Fetching #{egmodule}/#{name}..."
# Remove old folder, if exists
`rm -rf #{folder} 2> /dev/null`
`rm -rf folder.tar.bz2 2> /dev/null`

# Dir.mkdir( folder )
Dir.mkdir( "#{folder}" )
Dir.chdir( folder )

`svn co -N #{svnroot}/extragear/#{egmodule}`
Dir.chdir( egmodule )
`svn up #{name}`

if ( docs != "no")
    `svn up -N doc`
    for dg in addDocs
        dg.chomp!
        `svn up doc/#{dg}`
    end
end

`svn co #{adminroot}/kde-common/admin`
puts "done\n"

puts "\n"
puts "Fetching l10n docs for #{egmodule}/#{name}...\n"
puts "\n"

i18nlangs = `svn cat #{svnroot}/l10n/subdirs`
i18nlangsCleaned = []
for lang in i18nlangs
  l = lang.chomp
  if (l != "xx")
    i18nlangsCleaned += [l];
  end
end
i18nlangs = i18nlangsCleaned

Dir.mkdir( "l10n" )
Dir.chdir( "l10n" )

# docs
for lang in i18nlangs
  lang.chomp!

  for dg in addDocs
    dg.chomp!
    `rm -rf #{dg}`
    docdirname = "l10n/#{lang}/docs/extragear-#{egmodule}/#{dg}"
    if ( docs != "no")
        `svn co -q #{svnroot}/#{docdirname} > /dev/null 2>&1`
    end
    next unless FileTest.exists?( dg )
    print "Copying #{lang}'s #{dg} documentation over...  "
    `cp -R #{dg}/ ../doc/#{lang}_#{dg}`

    # we don't want KDE_DOCS = AUTO, cause that makes the
    # build system assume that the name of the app is the
    # same as the name of the dir the Makefile.am is in.
    # Instead, we explicitly pass the name..
    makefile = File.new( "../doc/#{lang}_#{dg}/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
    makefile << "KDE_LANG = #{lang}\n"
    makefile << "KDE_DOCS = #{dg}\n"
    makefile.close()

    puts( "done.\n" )
  end
end

puts "\n"
puts "Fetching l10n po for #{egmodule}/#{name}...\n"
puts "\n"

Dir.chdir( ".." ) # in egmodule now

$subdirs = false
Dir.mkdir( "po" )

for lang in i18nlangs
  lang.chomp!
  dest = "po/#{lang}"

  for dg in addPo
    dg.chomp!
    pofilename = "l10n/#{lang}/messages/extragear-#{egmodule}/#{dg}.po"
    `svn cat #{svnroot}/#{pofilename} 2> /dev/null | tee l10n/#{dg}.po`
    next if FileTest.size( "l10n/#{dg}.po" ) == 0

    if !FileTest.exist?( dest )
      Dir.mkdir( dest )
    end

    print "Copying #{lang}'s #{dg}.po over ..  "
    `mv l10n/#{dg}.po #{dest}`
    puts( "done.\n" )

    makefile = File.new( "#{dest}/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
    makefile << "KDE_LANG = #{lang}\n"
    makefile << "SUBDIRS  = $(AUTODIRS)\n"
    makefile << "POFILES  = AUTO\n"
    makefile.close()

    $subdirs = true
  end
end

if $subdirs
  makefile = File.new( "po/Makefile.am", File::CREAT | File::RDWR | File::TRUNC )
  makefile << "SUBDIRS = $(AUTODIRS)\n"
  makefile.close()
else
  `rm -Rf po`
end

`rm -rf l10n`
puts "\n"

#add a release marker
`export LANGUAGE=en_US.UTF-8; export LC_ALL=en_US.UTF-8; svn info #{name} | egrep '^Last Changed (Rev|Date):' > RELEASE.rev`

# Remove SVN data folder
`find -name ".svn" | xargs rm -rf`

# Remove release_XXX.rb files 
`/bin/rm -rf release_kipiplugins.rb`  
`/bin/rm -rf release_libkexiv2.rb`
`/bin/rm -rf release_libkipi.rb`
`/bin/rm -rf release_libkdcraw.rb`
# Remove prepare_XXX.rb files 
`/bin/rm -rf prepare_kipiplugins.rb`  
`/bin/rm -rf prepare_libkexiv2.rb`
`/bin/rm -rf prepare_libkipi.rb`
`/bin/rm -rf prepare_libkdcraw.rb`
# Remove release_kipi-plugins_cl.sh
`/bin/rm -rf release_kipi_changelog.sh`

`/bin/mv * ..`
Dir.chdir( ".." ) # name-version
`rmdir #{egmodule}`

# Move some important files to the root folder
Dir.chdir( "#{name}" )
`/bin/mv -f #{name}.lsm ..`
`/bin/mv -f AUTHORS ..`
`/bin/mv -f ChangeLog ..`
`/bin/mv -f COPYING ..`
`/bin/mv -f INSTALL ..`
`/bin/mv -f NEWS ..`
`/bin/mv -f README ..`
`/bin/mv -f TODO ..`
Dir.chdir( ".." )


# Generate makefiles
`find | xargs touch`

puts "\n"
puts "Generating Makefiles..  "
`make -f Makefile.cvs`
puts "done.\n"

`rm -rf autom4te.cache`
`rm stamp-h.in`

puts "\n"
puts "Compressing..  "
Dir.chdir( ".." ) # root folder
`tar -jcf #{folder}.tar.bz2 #{folder}`
`rm -rf #{folder}`
puts "done.\n"


ENV["UNSERMAKE"] = oldmake