generic: build system cleanups

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2015-10-29 12:07:03 +02:00
parent 2ae20920a9
commit e9b375cec3
20 changed files with 19 additions and 1417 deletions

View file

@ -1,5 +1,3 @@
include( KDELibsDependencies ) # for KDE version
add_subdirectory( applets ) add_subdirectory( applets )
add_subdirectory( engines ) add_subdirectory( engines )
add_subdirectory( containments ) add_subdirectory( containments )

View file

@ -24,9 +24,6 @@ macro_log_feature(LCMS2_FOUND "LittleCMS" "Color management engine" "http://www.
find_package(LibKonq) find_package(LibKonq)
macro_log_feature(LIBKONQ_FOUND "libkonq" "Standard file management features" "http://www.kde.org" TRUE) macro_log_feature(LIBKONQ_FOUND "libkonq" "Standard file management features" "http://www.kde.org" TRUE)
find_package(Kdcraw 2.4.2)
macro_log_feature(KDCRAW_FOUND "libkdcraw" "KDE Dcraw library" "http://www.kde.org" TRUE "2.4.2")
## Global settings ## Global settings
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)

View file

@ -184,13 +184,13 @@ target_link_libraries(gwenviewlib
${KDE4_KFILE_LIBS} ${KDE4_KFILE_LIBS}
${KDE4_KIO_LIBS} ${KDE4_KIO_LIBS}
${KDE4_PHONON_LIBS} ${KDE4_PHONON_LIBS}
${KDE4_KDCRAW_LIBS}
${JPEG_LIBRARY} ${JPEG_LIBRARY}
${EXIV2_LIBRARIES} ${EXIV2_LIBRARIES}
${QT_QTOPENGL_LIBRARY} ${QT_QTOPENGL_LIBRARY}
${X11_X11_LIB} ${X11_X11_LIB}
${PNG_LIBRARIES} ${PNG_LIBRARIES}
${LCMS2_LIBRARIES} ${LCMS2_LIBRARIES}
${KDCRAW_LIBRARIES}
) )
install(TARGETS gwenviewlib ${INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS gwenviewlib ${INSTALL_TARGETS_DEFAULT_ARGS})

View file

@ -4,10 +4,10 @@ macro(gv_add_unit_test _test)
${KDE4_KIO_LIBS} ${KDE4_KIO_LIBS}
${KDE4_KDEUI_LIBS} ${KDE4_KDEUI_LIBS}
${KDE4_KDECORE_LIBS} ${KDE4_KDECORE_LIBS}
${KDE4_KDCRAW_LIBS}
${QT_QTTEST_LIBRARY} ${QT_QTTEST_LIBRARY}
${QT_QTCORE_LIBRARY} ${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY} ${QT_QTGUI_LIBRARY}
${KDCRAW_LIBRARIES}
gwenviewlib gwenviewlib
) )
endmacro(gv_add_unit_test) endmacro(gv_add_unit_test)

View file

@ -5,7 +5,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
find_package(KDE4 4.14.3 REQUIRED) find_package(KDE4 4.14.3 REQUIRED)
include (KDE4Defaults) include (KDE4Defaults)
include(MacroLibrary) include(MacroLibrary)
include(MacroOptionalDependPackage)
macro_optional_find_package(KDE4Workspace) macro_optional_find_package(KDE4Workspace)
macro_log_feature(KDE4WORKSPACE_FOUND "kdebase workspace" "KDE base workspace libraries" "http://www.kde.org" FALSE "" "Needed for building several Plasma plugins") macro_log_feature(KDE4WORKSPACE_FOUND "kdebase workspace" "KDE base workspace libraries" "http://www.kde.org" FALSE "" "Needed for building several Plasma plugins")

View file

@ -1,8 +1,5 @@
project(plasma-frame) project(plasma-frame)
macro_optional_find_package(Kexiv2)
macro_log_feature(KEXIV2_FOUND "libkexiv2" "Library to access EXIF information" "http://www.kde.org" FALSE "0.2.0" "RECOMMENDED: Enables automatic rotation for frame applet" )
set(frame_SRCS set(frame_SRCS
frame.cpp frame.cpp
slideshow.cpp slideshow.cpp
@ -14,18 +11,17 @@ set(frame_SRCS
appearanceSettings.ui appearanceSettings.ui
) )
macro_bool_to_01(KEXIV2_FOUND HAVE_KEXIV2)
kde4_add_plugin(plasma_applet_frame ${frame_SRCS}) kde4_add_plugin(plasma_applet_frame ${frame_SRCS})
if(HAVE_KEXIV2) include_directories( ${KEXIV2_INCLUDE_DIR} )
include_directories( ${KEXIV2_INCLUDE_DIR} ) set_source_files_properties(picture.cpp imageloader.cpp PROPERTIES
set_source_files_properties(picture.cpp imageloader.cpp PROPERTIES COMPILE_FLAGS -DHAVE_KEXIV2)
COMPILE_FLAGS -DHAVE_KEXIV2) target_link_libraries(plasma_applet_frame
target_link_libraries(plasma_applet_frame ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS} ${KEXIV2_LIBRARIES} ) ${KDE4_PLASMA_LIBS}
else (HAVE_KEXIV2) ${KDE4_KIO_LIBS}
target_link_libraries(plasma_applet_frame ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS} ) ${KDE4_KFILE_LIBS}
endif(HAVE_KEXIV2) ${KDE4_KEXIV2_LIBS}
)
install(TARGETS plasma_applet_frame DESTINATION ${PLUGIN_INSTALL_DIR}) install(TARGETS plasma_applet_frame DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-frame-default.desktop DESTINATION ${SERVICES_INSTALL_DIR}) install(FILES plasma-frame-default.desktop DESTINATION ${SERVICES_INSTALL_DIR})

View file

@ -84,7 +84,6 @@ include_directories(${KDevelop_SOURCE_DIR} ${KDevelop_BINARY_DIR} ${KDE4_INCLUDE
# create config.h # create config.h
configure_file (config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) configure_file (config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
add_subdirectory(cmake)
add_subdirectory(pics) add_subdirectory(pics)
add_subdirectory(app) add_subdirectory(app)
add_subdirectory(formatters) add_subdirectory(formatters)

View file

@ -8,9 +8,6 @@ macro_log_feature(HAVE_POPPLER_0_12_1 "Poppler-Qt4" "A PDF rendering library" "h
macro_optional_find_package(LibSpectre) macro_optional_find_package(LibSpectre)
macro_log_feature(LIBSPECTRE_FOUND "libspectre" "A PostScript rendering library" "http://libspectre.freedesktop.org/wiki/" FALSE "${LIBSPECTRE_MINIMUM_VERSION}" "Support for PS files in okular.") macro_log_feature(LIBSPECTRE_FOUND "libspectre" "A PostScript rendering library" "http://libspectre.freedesktop.org/wiki/" FALSE "${LIBSPECTRE_MINIMUM_VERSION}" "Support for PS files in okular.")
macro_optional_find_package(Kexiv2)
macro_log_feature(KEXIV2_FOUND "LibKExiv2" "Wrapper around Exiv2 library" "http://www.digikam.org/sharedlibs" FALSE "" "Support for image files")
macro_optional_find_package(DjVuLibre) macro_optional_find_package(DjVuLibre)
macro_log_feature(DJVULIBRE_FOUND "DjVuLibre" "A library for dealing with DjVu formatted files" "http://djvulibre.djvuzone.org" FALSE "3.5.17" "Support for DjVu files in okular.") macro_log_feature(DJVULIBRE_FOUND "DjVuLibre" "A library for dealing with DjVu formatted files" "http://djvulibre.djvuzone.org" FALSE "3.5.17" "Support for DjVu files in okular.")
@ -41,9 +38,7 @@ if(LIBSPECTRE_FOUND)
add_subdirectory(spectre) add_subdirectory(spectre)
endif(LIBSPECTRE_FOUND) endif(LIBSPECTRE_FOUND)
if(KEXIV2_FOUND) add_subdirectory( kimgio )
add_subdirectory( kimgio )
endif(KEXIV2_FOUND)
if(DJVULIBRE_FOUND) if(DJVULIBRE_FOUND)
add_subdirectory(djvu) add_subdirectory(djvu)

View file

@ -12,7 +12,13 @@ set(okularGenerator_kimgio_PART_SRCS generator_kimgio.cpp )
kde4_add_plugin(okularGenerator_kimgio ${okularGenerator_kimgio_PART_SRCS}) kde4_add_plugin(okularGenerator_kimgio ${okularGenerator_kimgio_PART_SRCS})
target_link_libraries(okularGenerator_kimgio okularcore ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${QT_QTXML_LIBRARY} ${KEXIV2_LIBRARIES} ) target_link_libraries(okularGenerator_kimgio
okularcore
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
${KDE4_KEXIV2_LIBS}
${QT_QTXML_LIBRARY}
)
install(TARGETS okularGenerator_kimgio DESTINATION ${PLUGIN_INSTALL_DIR}) install(TARGETS okularGenerator_kimgio DESTINATION ${PLUGIN_INSTALL_DIR})
if(ENABLE_TESTING) if(ENABLE_TESTING)

View file

@ -31,7 +31,6 @@ add_definitions(-DVERSION="${VERSION}")
find_package(KDE4 4.14.3 REQUIRED) find_package(KDE4 4.14.3 REQUIRED)
find_package(MSGFMT REQUIRED)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(BLKID REQUIRED blkid) pkg_check_modules(BLKID REQUIRED blkid)
pkg_check_modules(LIBATASMART REQUIRED libatasmart) pkg_check_modules(LIBATASMART REQUIRED libatasmart)

View file

@ -1,39 +0,0 @@
=begin
***************************************************************************
* Copyright (C) 2008-2009 by Volker Lanz <vl@fidra.de> *
* *
* 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) any later version. *
* *
* 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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************
=end
require 'release/application.rb'
require 'fileutils'
class PartitionManagerApp < Application
def initialize(product, component, section, name)
super
end
def applyFixes(workingDir, outputDir)
puts 'applying fixes for partition manager'
Dir.chdir "#{workingDir}/#{outputDir}"
puts 'removing scripts subdir...'
FileUtils.rm_rf 'scripts'
end
end

View file

@ -1,30 +0,0 @@
#!/usr/bin/ruby
=begin
***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* *
* 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) any later version. *
* *
* 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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************
=end
require 'partitionmanagerapp.rb'
require 'release/releasecmd.rb'
app = PartitionManagerApp.new('Partition Manager', 'extragear', 'sysadmin', 'partitionmanager')
cmd = ReleaseCommand.new
cmd.readOptions
cmd.run(app) if cmd.validate

View file

@ -1,34 +0,0 @@
=begin
***************************************************************************
* Copyright (C) 2008-2009 by Volker Lanz <vl@fidra.de> *
* *
* 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) any later version. *
* *
* 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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************
=end
class Application
attr_reader :product, :component, :section, :name
def initialize(product, component, section, name)
@product = product
@component = component
@section = section
@name = name
end
def applyFixes(workingDir, outputDir)
puts 'applying fixes for base application class'
end
end

View file

@ -1,324 +0,0 @@
=begin
***************************************************************************
* Copyright (C) 2008,2009,2010 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2007-2008 by Harald Sitter <harald@getamarok.com> *
* *
* 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) any later version. *
* *
* 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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************
=end
require 'application.rb'
require 'tagger.rb'
require 'translationstatsbuilder.rb'
require 'fileutils'
require 'getoptlong'
class ReleaseBuilder
public
def initialize(checkoutFrom, checkoutTag, app, workingDir, protocol, user, version)
@checkoutFrom = checkoutFrom
@checkoutTag = checkoutTag
@app = app
@workingDir = workingDir
@protocol = protocol
@user = user
@version = version
@outputDir = "#{@app.name}-#{@version}"
FileUtils.rm_rf @outputDir
FileUtils.rm_rf "#{@outputDir}.tar.bz2"
FileUtils.rm_rf "#{@outputDir}.tar.gz"
FileUtils.rm_rf "#{@outputDir}-l10n-stats.html"
end
def run(createTarball, getTranslations, skipBelow, getDocs, createTag, applyFixes)
checkoutSource
translations = checkoutTranslations(skipBelow) if getTranslations
docs = checkoutDocumentation if getDocs
if createTag
Dir.chdir "#{@workingDir}/#{@outputDir}"
tagger = Tagger.new(@checkoutFrom, @checkoutTag, @app, @protocol, @user, @version)
tagger.tagSource
tagger.tagTranslations(translations) if getTranslations
tagger.tagDocumentation(docs) if getDocs
end
@app.applyFixes(@workingDir, @outputDir) if applyFixes
self.createTarball if createTarball
end
def checkoutSource
Dir.chdir @workingDir
repository = ReleaseBuilder.repositoryRoot(@protocol, @user) + ReleaseBuilder.repositoryPath('src', @app, @checkoutFrom, @checkoutTag)
`svn co #{repository} #{@outputDir}`
end
def createCmakeListsTranslations(lang)
File.open("po/#{lang}/CMakeLists.txt", File::CREAT | File::RDWR | File::TRUNC) do |f|
f.print <<END_OF_TEXT
file(GLOB _po_files *.po)
GETTEXT_PROCESS_PO_FILES(#{lang} ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} ${_po_files})
END_OF_TEXT
end
end
def checkTranslation(lang, translationDir, skipBelow)
if skipBelow > 0
fuzzy, untranslated, per = TranslationStatsBuilder.fileStats("#{translationDir}/#{@app.name}.po")
puts "Language #{lang} is #{per}% complete."
if per < skipBelow
FileUtils.rm_rf translationDir
return false
end
end
return true
end
def checkoutTranslations(skipBelow)
Dir.chdir "#{@workingDir}/#{@outputDir}"
FileUtils.rm_rf 'l10n'
FileUtils.rm_rf 'po'
repository = ReleaseBuilder.repositoryRoot(@protocol, @user) + ReleaseBuilder.repositoryPath('i18n', @app, @checkoutFrom, @checkoutTag)
translations = []
if @checkoutFrom == 'trunk'
Dir.mkdir 'po'
subdirs = `svn cat #{repository}/subdirs 2>/dev/null`.chomp!
subdirs.each do |lang|
lang.chomp!
next if lang == 'x-test'
FileUtils.rm_rf 'l10n'
`svn co #{repository}/#{lang}/messages/#{@app.component}-#{@app.section} l10n >/dev/null 2>&1`
next unless FileTest.exists? "l10n/#{@app.name}.po"
next unless checkTranslation(lang, "l10n", skipBelow)
puts "Adding translations for #{lang}..."
dest = "po/#{lang}"
Dir.mkdir dest
FileUtils.mv("l10n/#{@app.name}.po", dest)
FileUtils.mv('l10n/.svn', dest)
createCmakeListsTranslations(lang)
`svn add #{dest}/CMakeLists.txt >/dev/null 2>&1`
translations << lang
end
else
`svn co #{repository} >/dev/null 2>&1`
Dir.entries('po').sort.each do |lang|
next if lang == 'CMakeLists.txt' or lang == '.' or lang == '..' or lang == '.svn'
next unless checkTranslation(lang, "po/#{lang}", skipBelow)
createCmakeListsTranslations(lang)
translations << lang
end
end
if translations.length > 0
File.open('po/CMakeLists.txt', File::CREAT | File::RDWR | File::TRUNC) do |f|
f.print <<END_OF_TEXT
find_package(Gettext REQUIRED)
if (NOT GETTEXT_MSGMERGE_EXECUTABLE)
message(FATAL_ERROR "Please install the msgmerge program from the gettext package.")
endif (NOT GETTEXT_MSGMERGE_EXECUTABLE)
if (NOT GETTEXT_MSGFMT_EXECUTABLE)
message(FATAL_ERROR "Please install the msgfmt program from the gettext package.")
endif (NOT GETTEXT_MSGFMT_EXECUTABLE)
END_OF_TEXT
translations.each { |lang| f.print "add_subdirectory(#{lang})\n" }
end
File.open('CMakeLists.txt', File::APPEND | File::RDWR) do |f|
f.print <<END_OF_TEXT
include(MacroOptionalAddSubdirectory)
macro_optional_add_subdirectory(po)
END_OF_TEXT
end
TranslationStatsBuilder.new(@app.name, @version, @workingDir, @outputDir).run
else
FileUtils.rm_rf 'po'
end
FileUtils.rm_rf 'l10n'
return translations
end
def createCmakeListsDoc(lang)
File.open("doc/#{lang}/CMakeLists.txt", File::CREAT | File::RDWR | File::TRUNC) do |f|
f << "kde4_create_handbook(index.docbook INSTALL_DESTINATION \${HTML_INSTALL_DIR}/#{lang}/ SUBDIR #{@app.name})\n"
end
end
def checkoutDocumentation
Dir.chdir "#{@workingDir}/#{@outputDir}"
docs = [ ]
repository = ReleaseBuilder.repositoryRoot(@protocol, @user) + ReleaseBuilder.repositoryPath('doc', @app, @checkoutFrom, @checkoutTag)
if @checkoutFrom == 'trunk'
# the english docs are the super-extra-exception: they reside near, but not with, the code
usDocsRepo = ReleaseBuilder.repositoryRoot(@protocol, @user) + "trunk"
`svn co #{usDocsRepo}/#{@app.component}/#{@app.section}/doc/#{@app.name} doc/en_US >/dev/null 2>&1`
if not File.exists? 'doc/en_US/index.docbook'
FileUtils.rm_rf 'doc'
return nil
end
createCmakeListsDoc("en_US")
docs << 'en_US'
# now, the rest of the docs are localized, so reside somewhere else
subdirs = `svn cat #{repository}/subdirs 2>/dev/null`.chomp!
subdirs.each do |lang|
lang.chomp!
FileUtils.rm_rf 'l10n'
`svn co #{repository}/#{lang}/docs/#{@app.component}-#{@app.section}/#{@app.name} l10n >/dev/null 2>&1`
next unless FileTest.exists? 'l10n/index.docbook'
puts "Adding documentation for #{lang}..."
dest = "doc/#{lang}"
FileUtils.mv('l10n', dest)
createCmakeListsDoc(lang)
`svn add doc/#{lang}/CMakeLists.txt >/dev/null 2>&1`
docs << lang
end
else
`svn co #{repository} >/dev/null 2>&1`
return nil if not FileTest.exists? 'doc'
Dir.entries('doc').sort.each do |lang|
next if lang == 'CMakeLists.txt' or lang == '.' or lang == '..' or lang == '.svn'
createCmakeListsDoc(lang)
docs << lang
end
end
File.open('doc/CMakeLists.txt', File::CREAT | File::RDWR | File::TRUNC) do |f|
docs.each { |lang| f << "add_subdirectory(#{lang})\n" }
end
File.open('CMakeLists.txt', File::APPEND | File::RDWR) do |f|
f << "include(MacroOptionalAddSubdirectory)\n" unless File.exists? 'po'
f << "macro_optional_add_subdirectory(doc)\n"
end
FileUtils.rm_rf 'l10n'
return docs
end
def createTarball
Dir.chdir @workingDir
tarBzFileName = "#{@outputDir}.tar.bz2"
tarGzFileName = "#{@outputDir}.tar.gz"
`find #{@outputDir} -name .svn | xargs rm -rf`
`tar cfj #{tarBzFileName} #{@outputDir}`
`tar cfz #{tarGzFileName} #{@outputDir}`
`rm -rf #{@outputDir}`
puts "bz2 MD5: " + `md5sum #{tarBzFileName}`.split[0]
puts "bz2 SHA1: " + `sha1sum #{tarBzFileName}`.split[0]
puts "gz MD5: " + `md5sum #{tarGzFileName}`.split[0]
puts "gz SHA1: " + `sha1sum #{tarGzFileName}`.split[0]
end
def self.repositoryRoot(protocol, user)
if protocol == 'anonsvn'
protocol = 'svn'
user = 'anon'
else
user += "@"
end
return "#{protocol}://#{user}svn.kde.org/home/kde/"
end
def self.repositoryPath(type, app, checkoutFrom, tag)
if type == 'src'
rval = case checkoutFrom
when 'trunk' then "trunk/#{app.component}/#{app.section}/#{app.name}"
when 'branches' then "branches/#{app.name}/#{tag}/#{app.name}"
when 'tags' then "tags/#{app.name}/#{tag}/#{app.name}"
else "### invalid checkout source: #{checkoutFrom} ###"
end
elsif type == 'i18n'
rval = case checkoutFrom
when 'trunk' then "trunk/l10n-kde4/" # followed by $lang/messages/#{app.component}-#{app.section}/#{app.name}.po, but the code has to deal with that
when 'branches' then "branches/#{app.name}/#{tag}/po"
when 'tags' then "tags/#{app.name}/#{tag}/po"
else "### invalid checkout source: #{checkoutFrom} ###"
end
elsif type == 'doc'
rval = case checkoutFrom
when 'trunk' then "trunk/l10n-kde4/" # see above
when 'branches' then "branches/#{app.name}/#{tag}/doc"
when 'tags' then "tags/#{app.name}/#{tag}/doc"
else "### invalid checkout source: #{checkoutFrom} ###"
end
else
# this is to get the root directory for tags and branches. it doesn't make any
# sense for trunk.
rval = case checkoutFrom
when 'trunk' then "### invalid checkout type / source combo: #{type} - #{checkoutFrom} ###"
when 'branches' then "branches/#{app.name}/#{tag}"
when 'tags' then "tags/#{app.name}/#{tag}"
else "### invalid checkout source: #{checkoutFrom} ###"
end
end
return rval
end
end

View file

@ -1,130 +0,0 @@
=begin
***************************************************************************
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* 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) any later version. *
* *
* 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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************
=end
require 'releasebuilder.rb'
class ReleaseCommand
def initialize
@version = nil
@checkoutFrom = 'trunk'
@tag = ''
@protocol = 'anonsvn'
@user = ''
@getDocs = true
@getTranslations = true
@skipBelow = 0
@createTag = false
@applyFixes = true
@createTarball = true
end
def self.usage
puts <<END_OF_TEXT
#{$0} [options]
where options are:
--version (-v): mandatory
--checkout-from (-c): trunk (default), branches, tags
--tag (-t): name of tag
--svn-access (-s): https, svn+ssh, anonsvn (default)
--svn-user (-u): svn username (for svn+ssh)
--get-docs (-d): also get documentation (default)
--no-get-docs (-D): do not get documentation
--get-translations (-r): also get translations (default)
--no-get-translations (-R): do not get translations
--skip-incomplete (-k): skip translations below a given percentage of completeness
--create-tag (-e): create a new tag
--no-create-tag (-E): do not create a new tag (default)
--apply-fixes (-f): apply application-specific fixes to the source (default)
--no-apply-fixes (-F): do not apply application-specific fixes to the source
--create-tarball (-b): create a tarball (default)
--no-create-tarball (-B): do not create a tarball
--help (-h): show this usage
END_OF_TEXT
end
def readOptions
opts = GetoptLong.new(
[ '--version', '-v', GetoptLong::REQUIRED_ARGUMENT ],
[ '--checkout-from', '-c', GetoptLong::REQUIRED_ARGUMENT ],
[ '--tag', '-t', GetoptLong::REQUIRED_ARGUMENT ],
[ '--svn-access', '-s', GetoptLong::REQUIRED_ARGUMENT ],
[ '--svn-user', '-u', GetoptLong::REQUIRED_ARGUMENT ],
[ '--get-docs', '-d', GetoptLong::NO_ARGUMENT ],
[ '--no-get-docs', '-D', GetoptLong::NO_ARGUMENT ],
[ '--get-translations', '-r', GetoptLong::NO_ARGUMENT ],
[ '--no-get-translations', '-R', GetoptLong::NO_ARGUMENT ],
[ '--skip-incomplete', '-k', GetoptLong::REQUIRED_ARGUMENT ],
[ '--create-tag', '-e', GetoptLong::NO_ARGUMENT ],
[ '--no-create-tag', '-E', GetoptLong::NO_ARGUMENT ],
[ '--apply-fixes', '-f', GetoptLong::NO_ARGUMENT ],
[ '--no-apply-fixes', '-F', GetoptLong::NO_ARGUMENT ],
[ '--create-tarball', '-b', GetoptLong::NO_ARGUMENT ],
[ '--no-create-tarball', '-B', GetoptLong::NO_ARGUMENT ],
[ '--help', '-h', GetoptLong::NO_ARGUMENT ]
)
opts.each do |opt, arg|
case opt
when '--version' then @version = arg
when '--checkout-from' then @checkoutFrom = arg
when '--tag' then @tag = arg
when '--svn-access' then @protocol = arg
when '--svn-user' then @user = arg
when '--get-docs' then @getDocs = true
when '--no-get-docs' then @getDocs = false
when '--get-translations' then @getTranslations = true
when '--no-get-translations' then @getTranslations = false
when '--skip-incomplete' then @skipBelow = arg.to_i
when '--create-tag' then @createTag = true
when '--no-create-tag' then @createTag = false
when '--apply-fixes' then @applyFixes = true
when '--no-apply-fixes' then @applyFixes = false
when '--create-tarball' then @createTarball = true
when '--no-create-tarball' then @createTarball = false
when '--help' then ReleaseCommand.usage; exit
end
end
end
def validate
if not @version
puts 'Version can not be empty.'
return false
end
if @protocol != 'anonsvn' and @user.empty?
puts "The SVN protocol '#{@protocol}' requires a user name."
return false
end
if @checkoutFrom == 'tags' and @tag.empty?
puts 'Cannot check out from tag dir if tag is empty.'
return false
end
return true
end
def run(app)
releaseBuilder = ReleaseBuilder.new(@checkoutFrom, @tag, app, Dir.getwd, @protocol, @user, @version)
releaseBuilder.run(@createTarball, @getTranslations, @skipBelow, @getDocs, @createTag, @applyFixes)
end
end

View file

@ -1,107 +0,0 @@
#!/usr/bin/ruby
=begin
***************************************************************************
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* 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) any later version. *
* *
* 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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************
=end
require 'Qt4'
# generate with:
# $ rbuic4 releasedialog.ui > ui_releasedialog.rb
require 'ui_releasedialog.rb'
require 'releasebuilder.rb'
class ReleaseDialog < Qt::Dialog
slots 'on_comboAccess_currentIndexChanged(int)',
'on_comboCheckout_currentIndexChanged(int)',
'on_checkTranslations_toggled(bool)'
def initialize(app)
super()
@app = app
@ui = Ui_ReleaseDialog.new()
@ui.setupUi(self)
@ui.labelName.setText(@app.product)
end
def validate
if @ui.editVersion.text.empty?
Qt::MessageBox.information(self, tr('Missing Information'), tr('The application\'s version can not be empty.'))
return false
end
if @ui.comboAccess.currentIndex != 0 and @ui.editUser.text.empty?
Qt::MessageBox.information(self, tr('Missing Information'), tr('Please provide a user name for the selected SVN access method.'))
return false
end
return true
end
def accept
return if not validate
skipBelow = @ui.checkSkipTrans.isChecked ? @ui.spinSkipTrans.value : 0
hide
releaseBuilder = ReleaseBuilder.new(@ui.comboCheckout.currentText, @ui.comboTag.currentText, @app, Dir.getwd, @ui.comboAccess.currentText, @ui.editUser.text, @ui.editVersion.text)
releaseBuilder.run(@ui.checkTarball.isChecked, @ui.checkTranslations.isChecked, skipBelow, @ui.checkDocs.isChecked, @ui.checkTag.isChecked, @ui.checkFixes.isChecked)
super
end
private
def on_comboAccess_currentIndexChanged(index)
@ui.editUser.setEnabled(index > 0)
end
def on_comboCheckout_currentIndexChanged(index)
@ui.comboTag.clear
@ui.comboTag.setEnabled(index == 1 && updateBranches || index == 2 && updateTags)
end
def on_checkTranslations_toggled(state)
@ui.checkSkipTrans.setEnabled(state)
@ui.sliderSkipTrans.setEnabled(state && @ui.checkSkipTrans.isChecked)
@ui.spinSkipTrans.setEnabled(state && @ui.checkSkipTrans.isChecked)
end
def updateTags
tags = `svn ls svn://anonsvn.kde.org/home/kde/tags/#{@app.name}`.chomp!
return false if not tags or tags.length == 0
tags.sort.each { |t| @ui.comboTag.addItem(t.delete("/\n\r")) }
return true
end
def updateBranches
branches = `svn ls svn://anonsvn.kde.org/home/kde/branches/#{@app.name}`.chomp!
return false if not branches or branches.length == 0
branches.sort.each { |t| @ui.comboTag.addItem(t.delete("/\n\r")) }
return true
end
end

View file

@ -1,469 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ReleaseDialog</class>
<widget class="QDialog" name="ReleaseDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>405</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>500</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>KDE Release Builder</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="goupApplication">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Application</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Name:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>&amp;Version:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>editVersion</cstring>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="editVersion">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelName">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>2</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Repository and Revision</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&amp;Checkout From:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>comboCheckout</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboCheckout">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>trunk</string>
</property>
</item>
<item>
<property name="text">
<string>branches</string>
</property>
</item>
<item>
<property name="text">
<string>tags</string>
</property>
</item>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Ta&amp;g/Branch:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>comboCheckout</cstring>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="comboTag">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&amp;SVN Access:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>comboAccess</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboAccess">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>anonsvn</string>
</property>
</item>
<item>
<property name="text">
<string>https</string>
</property>
</item>
<item>
<property name="text">
<string>svn+ssh</string>
</property>
</item>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>&amp;User:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>editUser</cstring>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="editUser">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupOptions">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>2</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="checkDocs">
<property name="text">
<string>Get &amp;Documentation</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkTranslations">
<property name="text">
<string>Get &amp;Translations</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkTag">
<property name="text">
<string>C&amp;reate Tag</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="checkSkipTrans">
<property name="text">
<string>S&amp;kip translations below completion:</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="sliderSkipTrans">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinSkipTrans">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkTarball">
<property name="text">
<string>Create Tar&amp;ball</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkFixes">
<property name="text">
<string>Apply &amp;fixes</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>editVersion</tabstop>
<tabstop>comboCheckout</tabstop>
<tabstop>comboTag</tabstop>
<tabstop>comboAccess</tabstop>
<tabstop>editUser</tabstop>
<tabstop>checkDocs</tabstop>
<tabstop>checkTranslations</tabstop>
<tabstop>checkTag</tabstop>
<tabstop>checkSkipTrans</tabstop>
<tabstop>sliderSkipTrans</tabstop>
<tabstop>spinSkipTrans</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>ReleaseDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>226</x>
<y>447</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ReleaseDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>294</x>
<y>447</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>sliderSkipTrans</sender>
<signal>valueChanged(int)</signal>
<receiver>spinSkipTrans</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>354</x>
<y>378</y>
</hint>
<hint type="destinationlabel">
<x>489</x>
<y>383</y>
</hint>
</hints>
</connection>
<connection>
<sender>spinSkipTrans</sender>
<signal>valueChanged(int)</signal>
<receiver>sliderSkipTrans</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>492</x>
<y>397</y>
</hint>
<hint type="destinationlabel">
<x>342</x>
<y>384</y>
</hint>
</hints>
</connection>
<connection>
<sender>checkSkipTrans</sender>
<signal>toggled(bool)</signal>
<receiver>sliderSkipTrans</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>123</x>
<y>387</y>
</hint>
<hint type="destinationlabel">
<x>288</x>
<y>396</y>
</hint>
</hints>
</connection>
<connection>
<sender>checkSkipTrans</sender>
<signal>toggled(bool)</signal>
<receiver>spinSkipTrans</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>87</x>
<y>388</y>
</hint>
<hint type="destinationlabel">
<x>486</x>
<y>391</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -1,94 +0,0 @@
=begin
***************************************************************************
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2007-2008 by Harald Sitter <harald@getamarok.com> *
* *
* 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) any later version. *
* *
* 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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************
=end
require 'fileutils'
require 'application.rb'
class Tagger
def initialize(checkoutFrom, checkoutTag, app, protocol, user, version)
@checkoutFrom = checkoutFrom
@checkoutTag = checkoutTag
@app = app
@protocol = protocol
@user = user
@version = version
@tmpDirName = 'tagging_dir'
end
def tagSource
puts "Tagging source files..."
repositorySource = ReleaseBuilder.repositoryRoot(@protocol, @user) + ReleaseBuilder.repositoryPath('src', @app, @checkoutFrom, @checkoutTag)
repositoryTagRoot = ReleaseBuilder.repositoryRoot(@protocol, @user) + ReleaseBuilder.repositoryPath(nil, @app, 'tags', @version)
`svn mkdir --parents -m 'Directory for tag #{@version}' #{repositoryTagRoot} >/dev/null 2>&1`
`svn cp -m 'Tag #{@version}' #{repositorySource} #{repositoryTagRoot} >/dev/null 2>&1`
puts "Done tagging source files."
end
def tagTranslations(translations)
return if translations == nil or translations.length == 0
repositoryTagRoot = ReleaseBuilder.repositoryRoot(@protocol, @user) + ReleaseBuilder.repositoryPath(nil, @app, 'tags', @version)
puts "Tagging translations..."
`svn co --depth immediates #{repositoryTagRoot} #{@tmpDirName} >/dev/null 2>&1`
`svn mkdir --parents -m 'Translations for #{@version}' #{repositoryTagRoot}/po >/dev/null 2>&1`
`svn up #{@tmpDirName}/po >/dev/null 2>&1`
translations.each do |trans|
`svn mkdir #{@tmpDirName}/po/#{trans} >/dev/null 2>&1`
`svn cp po/#{trans} #{@tmpDirName}/po >/dev/null 2>&1`
end
`svn commit -m 'Tag translations for #{@version}' #{@tmpDirName}/po >/dev/null 2>&1`
FileUtils.rm_rf @tmpDirName
puts "Done tagging translations."
end
def tagDocumentation(docs)
return if docs == nil or docs.length == 0
repositoryTagRoot = ReleaseBuilder.repositoryRoot(@protocol, @user) + ReleaseBuilder.repositoryPath(nil, @app, 'tags', @version)
puts "Tagging documentation..."
`svn co --depth immediates #{repositoryTagRoot} #{@tmpDirName} >/dev/null 2>&1`
`svn mkdir --parents -m 'Documentation for #{@version}' #{repositoryTagRoot}/doc >/dev/null 2>&1`
`svn up #{@tmpDirName}/doc >/dev/null 2>&1`
docs.each do |doc|
`svn cp doc/#{doc} #{@tmpDirName}/doc/ >/dev/null 2>&1`
end
`svn commit -m 'Tag documentation for #{@version}' #{@tmpDirName}/doc >/dev/null 2>&1`
FileUtils.rm_rf @tmpDirName
puts "Done tagging documentation."
end
end

View file

@ -1,128 +0,0 @@
=begin
***************************************************************************
* Copyright (C) 2008-2009 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2007-2008 by Harald Sitter <harald@getamarok.com> *
* *
* 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) any later version. *
* *
* 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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************
=end
class TranslationStatsBuilder
def initialize(appName, version, workingDir, outputDir)
@appName = appName
@version = version
@workingDir = workingDir
@outputDir = outputDir
end
def run
Dir.chdir "#{@workingDir}/#{@outputDir}"
file = File.new("../#{@appName}-#{@version}-l10n-stats.html", File::CREAT | File::RDWR | File::TRUNC)
statsHeader(file)
numLanguages = 0
translatedPercent = 0
Dir.entries('po').sort.each do |lang|
next if lang == '.' or lang == '..' or lang == 'CMakeLists.txt'
numLanguages, translatedPercent = statsLine(file, lang, numLanguages, translatedPercent)
end
statsFooter(file, numLanguages, translatedPercent)
file.close
end
private
def statsHeader(file)
file.print <<END_OF_TEXT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>#{@appName} #{@version} Translation Statistics</title>
<style>
.th { color: #196aff; font-weight: bold; height: 12px; }
</style>
</head>
<body>
<h1>#{@appName} #{@version} Translation Statistics</h1>
<br>
<table border="1" cellspacing="0">
<tr>
<th>Language</th>
<th>Fuzzy</th>
<th>Untranslated</th>
<th>Total Missing</th>
<th>Complete</th>
</tr>
END_OF_TEXT
end
def statsFooter(file, numLanguages, translatedPercent)
file.print <<END_OF_TEXT
<tr>
<th>#{numLanguages}</th>
<th></th>
<th></th>
<th></th>
<th>#{translatedPercent.to_s + " %"}</th>
</tr>
</table>
</body>
</html>
END_OF_TEXT
end
def self.fileStats(filename)
values = `msgfmt --statistics #{filename} -o /dev/null 2>&1`.scan /[\d]+/
fuzzy = values[1].to_i
untranslated = values[2].to_i
total = values[0].to_i + values[1].to_i + values[2].to_i
percentage = (total - fuzzy - untranslated) * 100 / total
return fuzzy, untranslated, percentage
end
def statsLine(file, langName, numLanguages, translatedPercent)
return 0, 0 if not File.exists?("po/#{langName}/#{@appName}.po")
fuzzy, untranslated, percentage = TranslationStatsBuilder.fileStats("po/#{langName}/#{@appName}.po")
textColor = case percentage
when 0...70 then 'red'
when 70...100 then 'orange'
else 'green'
end
file.print <<END_OF_TEXT
<tr>
<td style="text-align: left; color: #{textColor}">#{langName}</td>
<td style="text-align: center; color: #{textColor}">#{fuzzy}</td>
<td style="text-align: center; color: #{textColor}">#{untranslated}</td>
<td style="text-align: center; color: #{textColor}">#{fuzzy + untranslated}</td>
<td style="text-align: center; color: #{textColor}">#{percentage.to_s + " %"}</td>
</tr>
END_OF_TEXT
numLanguages += 1
translatedPercent = translatedPercent.to_i != 0 ? (translatedPercent + percentage) / 2 : percentage
return numLanguages, translatedPercent
end
end

View file

@ -1,32 +0,0 @@
#!/usr/bin/ruby
=begin
***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* *
* 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) any later version. *
* *
* 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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************
=end
require 'partitionmanagerapp.rb'
require 'release/releasedialog.rb'
require 'Qt4'
app = PartitionManagerApp.new('Partition Manager', 'extragear', 'sysadmin', 'partitionmanager')
qtApp = Qt::Application.new(ARGV)
window = ReleaseDialog.new(app)
window.show
qtApp.exec