#!/usr/bin/env ruby # # Copyright (C) 2008 Harald Sitter # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . require 'fileutils' def msg(lang,text) puts ".!!!~~~~>#{lang}: #{text}" end def exe(lang) Dir.chdir(@langDir) test = %x[apt-cache show #{lang}] if test == "" msg(lang,"MISSING") @missing += [lang] return end version = %x[apt-cache show #{lang}|grep Version].chomp() unless version.include?("4.1.2") msg(lang,"WRONG VERSION #{version}") @wversion += [lang] return end @isoLang = lang.split("-")[2] if lang.include?("ptbr") @isoLang = "pt" preciser = "/pt_BR" elsif lang.include?("engb") @isoLang = "en" preciser = "/en_GB" @wizardonly=false elsif lang.include?("zhcn") @isoLang = "zh" preciser = "/zh_CN" elsif lang.include?("zhtw") @isoLang = "zh" preciser = "/zh_TW" else preciser = @isoLang end @lp = "language-pack-kde-#{@isoLang}-base" unless @zhProcessed or lang.end_with?("-pt") FileUtils.rm_rf(@isoLang) Dir.mkdir(@isoLang) end Dir.chdir(@isoLang) system("apt-get source #{lang}") kdeDir = Dir.glob("#{lang}-*/debian")[0] poDirs = Dir.glob("#{lang}-*/messages/*") system("apt-get source #{@lp}") lcDir = Dir.glob("language-pack-kde-#{@isoLang}-base*/data/#{preciser}/LC_MESSAGES")[0] for poDir in poDirs next if poDir.include?("CMakeLists.txt") poFiles = Dir.glob("#{poDir}/*") for poFile in poFiles puts("\tcopying #{poFile} to #{lcDir}") FileUtils.copy(poFile, lcDir) end end lpDir = Dir.glob("language-pack-kde*/debian")[0] Dir.chdir(lpDir) Dir.chdir("..") if @zhProcessed or not @wizardonly and not lang.include?("ptbr") system("dch -v 1:8.10+#{Time.now.utc.strftime("%Y%m%d")} 'Copy po files from #{lang}'") system("debuild -S -sa") uversion = IO.readlines("debian/changelog")[0].split("(")[1].split(")")[0].split(":")[1] package = @lp + "_" + uversion orig = @lp + "_" + uversion + ".tar.gz" changes = package + "_source.changes" diff = package + ".diff.gz" dsc = package + ".dsc" Dir.chdir("..") upDir = @upDir + "/" + @isoLang Dir.mkdir(upDir) FileUtils.cp(dsc, upDir) # FileUtils.cp(diff, upDir) FileUtils.cp(changes, upDir) FileUtils.cp(orig, upDir) end if @isoLang == "zh" if @zhProcessed @zhProcessed = false else @zhProcessed = true end end end @langDir = Dir.pwd() + "/langs" FileUtils.rm_rf(@langDir) Dir.mkdir(@langDir) @upDir = Dir.pwd() + "/uploads" FileUtils.rm_rf(@upDir) Dir.mkdir(@upDir) langs = %x[apt-cache pkgnames kde-l10n-] langs = langs.split("\n") skipped = [] @missing = [] @wversion = [] @zhProcessed = false puts "PROCESSING SPECIALS" for lang in langs if lang.split("-")[2].count("a-z") <= 3 skipped += [lang] next end msg("NEXT",lang) @wizardonly=true exe(lang) end puts "PROCESSING NORMAL" for skip in skipped msg("NEXT",skip) @wizardonly=false exe(skip) end for missing in @missing msg(missing,"Oh noes #{missing} missing from the archives :(") end for wversion in @wversion msg(wversion,"Meh! #{wversion}'s version is not including 4.1.2, probably a bit, old? :P") end