rpms/koffice-kivio/devel config.ini, NONE, 1.1 create_tarball_kivio.rb, NONE, 1.1 koffice-kivio.spec, 1.1, 1.2

Kevin Kofler kkofler at fedoraproject.org
Tue May 18 21:45:42 UTC 2010


Author: kkofler

Update of /cvs/pkgs/rpms/koffice-kivio/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv7293/devel

Modified Files:
	koffice-kivio.spec 
Added Files:
	config.ini create_tarball_kivio.rb 
Log Message:
* Tue May 18 2010 Kevin Kofler <Kevin at tigcc.ticalc.org>
- 3:1.6.3-32.trinity.20100511
- document tarball origin as requested in the review
- Conflicts: koffice-langpack < 2:2.1.91-2, documentation files conflict


--- NEW FILE config.ini ---
[kivio]
mainmodule   = koffice
kde_release  = no
version      = translations-20100511
docs         = yes
translations = yes
custompo     = kivio,koffice,kofficefilters


--- NEW FILE create_tarball_kivio.rb ---
#!/usr/bin/ruby

#
# Ruby script for generating amaroK tarball releases from KDE SVN
#
# (c) 2005 Mark Kretschmann <markey at web.de>
# (c) 2006-2008 Tom Albers <tomalbers at kde.nl>
# (c) 2007 Angelo Naselli <anaselli at linux.it> (command line parameters) 
# Some parts of this code taken from cvs2dist
# License: GNU General Public License V2

require 'optparse'
require 'ostruct'
require 'find'

# check command line parameters
options = OpenStruct.new
options.help  = false
options.https = false
options.ask   = true

opts = OptionParser.new do |opts|
  opts.on("-u", "--user USERNAME", "svn account") do |u|
    options.username = u
  end
  opts.on("-w", "--https", "Using https instead of svn+ssh") do |w|
    options.https = w
  end
  opts.on("-n", "--noaccount", "Using svn://anonsvn.kde.org/ instead of svn+ssh") do |n|
    options.anonsvn = n
  end
  opts.on("-a", "--application APPL", "Application name (all for all, kde_release for apps that have kde_release=yes)") do |a|
    options.application = a
    options.ask = false
  end
  opts.on("-v", "--version VER", "Overwrite package version set in config.ini") do |v|
    options.ver = v
  end
  opts.on_tail("-h", "--help", "Show this usage statement") do |h|
    options.help = true
  end
end

begin
  opts.parse!(ARGV)
rescue Exception => e
  puts e, "", opts
  puts
  exit
end

if (options.username)
  username = options.username + "@"
end

if (options.application)
  apps = Array.new
  apps << options.application
end

if (options.https)
  if (username)
    svnbase    = "https://#{username}svn.kde.org/home/kde"
  else
    puts opts
    puts
    puts "Username is mandatory with https"
    exit
  end
else
  svnbase    = "svn+ssh://#{username}svn.kde.org/home/kde"
end

if (options.anonsvn)
  if (options.https)
     puts opts
     puts
     puts "https or anonsvn please, not both"
     exit
   end
   svnbase    = "svn://anonsvn.kde.org/home/kde"
end

if (options.help)
  puts opts
  exit
end

############# START #############

svnroot    = "#{svnbase}/branches/stable"
kde_version  = `svn ls svn://anonsvn.kde.org/home/kde/tags/KDE | sort | tail -n1 | cut -d "/" -f1`.chomp
#kde_version = '4.0.4'

#----------------------------------------------------------------
# initiate. 
#----------------------------------------------------------------

f = File.new("config.ini")
app = Array.new
begin
    while (line = f.readline)
        aline = line.chomp
        if aline[0,1] == "[" 
            app << aline[1,(aline.length-2)]
        end
    end
rescue EOFError
    f.close
end

puts "Last KDE version found: " + kde_version
if (options.ask)
    puts "Which apps (multiple sep by space, posibilities: all kde_release " + app.join(" ") + ")?"
    apps = gets.split(" ")
end

kde_release = false;
if apps[0] == "all"
    apps = app
elsif apps[0] == "kde_release"
    apps = app
    kde_release = true;
end

puts "-> Considering " + apps.join(" & ")
if kde_release
    puts " -> Only applications which have kde_release = yes in config "
end
puts

#----------------------------------------------------------------
# retrieve apps. 
#----------------------------------------------------------------

apps.each do |app|
    puts
    puts "-> Processing " + app 

    found = false;
    appdata = Hash.new 
    f = File.new("config.ini")
    begin
        while (line = f.readline)
            aline = line.chomp
            if aline == "[" + app + "]"
                found = true; 
            elsif aline.length > 0 && found
                data = aline.split("=");
                temp = { data[0].strip => data[1].strip }
                appdata = appdata.merge(temp)
            else
                found = false
            end
        end
        rescue EOFError
        f.close
    end

    if (kde_release && appdata["kde_release"] != "yes")
      puts "  -> Skipping because kde_release is not set in the config.ini"
      next
    end

    if (options.ver)
      temp = { "version" => options.ver }
      appdata = appdata.merge(temp)
    else
      if !appdata["version"]
        temp = { "version" => kde_version }
        appdata = appdata.merge(temp)
      else
        if kde_release
           temp = { "version" => appdata["version"] + "-kde" + kde_version }
           appdata = appdata.merge(temp)
        end
      end
    end

    if !appdata["name"]
        temp = { "name" => app }
        appdata = appdata.merge(temp)
    end

    if appdata["folder"]
        app = appdata["folder"]
    end 

    if !appdata["folder"] || appdata["name"]
        temp = { "folder" => appdata["name"] + "-" + appdata["version"] }
    else
        temp = { "folder" => appdata["folder"] + "-" + appdata["version"] }
    end
    appdata = appdata.merge(temp)

    if appdata["addPo"] && appdata["addPo"].length > 0
        temp = { "addPo" =>  (appdata["addPo"]+" "+app).split(" ") }
    else
        temp = { "addPo" =>  app }
    end
    appdata = appdata.merge(temp)

    if appdata["addDocs"] && appdata["addDocs"].length > 0
        temp = { "addDocs" =>  (appdata["addDocs"]+" "+app).split(" ") }
    else
        temp = { "addDocs" =>  app }
    end
    appdata = appdata.merge(temp)

    if appdata["submodule"] && appdata["submodule"].length > 0
        temp = { "submodulepath" => appdata["submodule"] + "/", "l10nmodule" => appdata["mainmodule"] + "-" + appdata["submodule"] }
    else
        temp = { "submodulepath" => "", "l10nmodule" => appdata["mainmodule"] }
    end
    appdata = appdata.merge(temp)

    # Preparing
    puts "-> Fetching " + appdata["mainmodule"] + "/" + appdata["submodulepath"] + app + " into " + appdata["folder"] + "..."
    # Remove old folder, if exists
    `rm -rf #{appdata["folder"]} 2> /dev/null`
    `rm -rf #{appdata["folder"]}.tar.bz2 2> /dev/null`
    Dir.mkdir( appdata["folder"] )
    Dir.chdir( appdata["folder"] )

    # Do the main checkouts.
#    if appdata["wholeModule"]
#        `svn co #{svnroot}/#{appdata["mainmodule"]}/#{appdata["submodulepath"]} #{app}-tmp`
#    else
#        `svn co #{svnroot}/#{appdata["mainmodule"]}/#{appdata["submodulepath"]}#{app} #{app}-tmp`
#    end
    Dir.mkdir( app + "-tmp" )
    Dir.chdir( app + "-tmp" )

#    if appdata["docs"] != "no"
#        `svn co #{svnroot}/#{appdata["mainmodule"]}/#{appdata["submodulepath"]}doc/#{app} doc`
#    end

    # Move them to the toplevel
    `/bin/mv * ..`
    Dir.chdir( ".." )

    `find -name ".svn" | xargs rm -rf`
    `rm -rf #{app}-tmp`

    if appdata["translations"] != "no"
        puts "-> Fetching l10n docs for #{appdata["submodulepath"]}#{app}..."

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

        Dir.mkdir( "doc-translations" )
        topmakefile = File.new( "doc-translations/CMakeLists.txt", File::CREAT | File::RDWR | File::TRUNC )

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

        # docs
        for lang in i18nlangs
            lang.chomp!

            for dg in appdata["addDocs"].split
                dg.chomp!
                `rm -rf #{dg}`
                docdirname = "l10n/#{lang}/docs/#{appdata["l10nmodule"]}/#{dg}"
                if ( appdata["docs"] != "no" )
                    puts "  -> Checking if #{lang} has translated documentation...\n"
                    `svn co -q #{svnroot}/#{docdirname} > /dev/null 2>&1`
                end
                next unless FileTest.exists?( dg + '/index.docbook' )

                print "    -> Copying #{lang}'s #{dg} documentation over...  "
                Dir.mkdir( "../doc-translations/#{lang}_#{dg}/" )
                `cp -R #{dg}/ ../doc-translations/#{lang}_#{dg}/#{dg}`
                topmakefile << "add_subdirectory( #{lang}_#{dg}/#{dg} )\n"

                makefile = File.new( "../doc-translations/#{lang}_#{dg}/#{dg}/CMakeLists.txt", File::CREAT | File::RDWR | File::TRUNC )
                makefile << "kde4_create_handbook( index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/#{lang}/)\n"
                Dir.chdir( "../doc-translations/#{lang}_#{dg}/#{dg}")
                `find -name ".svn" | xargs rm -rf`
                Find.find( "." ) do |path|
                    if File.basename(path)[0] == ?.
                        # skip this one...
                    else
                        if FileTest.directory?(path)
                            makefile << "add_subdirectory( " + File.basename(path) + " )\n"
                            submakefile = File.new(  File.basename(path) + "/CMakeLists.txt", File::CREAT | File::RDWR | File::TRUNC )
                            submakefile << "kde4_create_handbook( index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/#{lang}/#{dg}/)\n"
                            submakefile.close()
                            Find.prune
                        end
                    end
                end
                Dir.chdir( "../../../l10n")
                makefile.close()

                puts( "done.\n" )
            end
        end
        topmakefile.close()

        # app translations
        puts "-> Fetching l10n po for #{appdata["submodulepath"]}#{app}...\n"

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

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

        topmakefile = File.new( "po/CMakeLists.txt", File::CREAT | File::RDWR | File::TRUNC )
        for lang in i18nlangs
            lang.chomp!
            dest = "po/#{lang}"

            for dg in appdata["addPo"].split
                dg.chomp!
                if appdata["wholeModule"]
                    print "  -> Copying #{lang}'s over ..\n"
                    pofolder = "l10n/#{lang}/messages/#{appdata["l10nmodule"]}"
                    `svn co #{svnroot}/#{pofolder} #{dest}`
                    if FileTest.exist?( dest )
                      topmakefile << "add_subdirectory( #{lang} )\n"
                    end
                    next if !FileTest.exist?( dest )
				
                elsif appdata["custompo"]
		                valid = false
                    for sp in appdata["custompo"].split(/,/)
		    	              pofilename = "l10n/#{lang}/messages/#{appdata["l10nmodule"]}/#{sp}.po"
                    	  `svn cat #{svnroot}/#{pofilename} 2> /dev/null | tee l10n/#{sp}.po`
                    	  if not FileTest.size( "l10n/#{sp}.po" ) == 0
	   		                valid=true
                    	  if !FileTest.exist?( dest )
                            Dir.mkdir( dest )
                            topmakefile << "add_subdirectory( #{lang} )\n"
                    	  end
                    	  print "\n  -> Copying #{lang}'s #{sp}.po over ..  "
                    	  `mv l10n/#{sp}.po #{dest}`
			              end
                end
		            next if not valid
                else
                    pofilename = "l10n/#{lang}/messages/#{appdata["l10nmodule"]}/#{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 )
                        topmakefile << "add_subdirectory( #{lang} )\n"
                    end

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

                makefile = File.new( "#{dest}/CMakeLists.txt", File::CREAT | File::RDWR | File::TRUNC )
                makefile << "file(GLOB _po_files *.po)\n"
                makefile << "GETTEXT_PROCESS_PO_FILES( #{lang} ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} ${_po_files} )\n"
                makefile.close()
            end
        end
        topmakefile.close()

        `rm -rf l10n`

        # add l10n to compilation.
        `echo "find_package(Msgfmt REQUIRED)" >> CMakeLists.txt`
        `echo "find_package(Gettext REQUIRED)" >> CMakeLists.txt`
        `echo "add_subdirectory( po )" >> CMakeLists.txt`
        `echo "add_subdirectory( doc-translations )" >> CMakeLists.txt`
        if FileTest.exist?( "doc" )
            `echo "add_subdirectory( doc )" >> CMakeLists.txt`
        end
    end

    # Remove cruft 
    `find -name ".svn" | xargs rm -rf`
    if ( appdata["remove"] != "")
        `/bin/rm -rf #{appdata["remove"]}`
    end

    print "-> Compressing ..  "
    Dir.chdir( ".." ) # root folder
    `tar -jcf #{appdata["folder"]}.tar.bz2 #{appdata["folder"]}`
    #`rm -rf #{appdata["folder"]}`
    puts " done."
end 



Index: koffice-kivio.spec
===================================================================
RCS file: /cvs/pkgs/rpms/koffice-kivio/devel/koffice-kivio.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- koffice-kivio.spec	18 May 2010 21:33:16 -0000	1.1
+++ koffice-kivio.spec	18 May 2010 21:45:42 -0000	1.2
@@ -5,16 +5,26 @@
 Name:           koffice-kivio
 Epoch:          3
 Version:        1.6.3
-Release:        31.trinity.%{svn}svn%{?dist}
+Release:        32.trinity.%{svn}svn%{?dist}
 Summary:        A flowcharting application
 
 Group:          Applications/Productivity
 License:        GPLv2+
 URL:            http://www.koffice.org/
 # svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice/
+# SVNDATE=20100511
+# svn export \
+# svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice/ \
+# koffice-trinity-${SVNDATE}
+# tar cjf koffice-trinity-${SVNDATE}.tar.bz2 koffice-trinity-${SVNDATE}
 Source0:        koffice-trinity-%{svn}.tar.bz2
 # collected from svn://anonsvn.kde.org/home/kde/branches/stable/l10n/
+# ./create_tarball_kivio.rb -n -a kivio
 Source1:        %{translations}.tar.bz2
+# script used to fetch translations (patched extragear-tarball script)
+Source100:      create_tarball_kivio.rb
+# config file for the above script
+Source101:      config.ini
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 # disable some nested subdirectories which are not needed for Kivio
@@ -58,6 +68,10 @@ Requires:       %{name}-libs = %{version
 
 Conflicts:      koffice-core < 3:1.7
 
+# koffice-langpack-2:2.1.91-1 included translated Kivio documentation, so force
+# upgrading to 2:2.1.91-2 which fixes that to prevent file conflicts
+Conflicts:      koffice-langpack < 2:2.1.91-2
+
 %description
 %{summary}.
 
@@ -220,6 +234,11 @@ update-desktop-database -q &> /dev/null 
 
 
 %changelog
+* Tue May 18 2010 Kevin Kofler <Kevin at tigcc.ticalc.org>
+- 3:1.6.3-32.trinity.20100511
+- document tarball origin as requested in the review
+- Conflicts: koffice-langpack < 2:2.1.91-2, documentation files conflict
+
 * Sat May 15 2010 Kevin Kofler <Kevin at tigcc.ticalc.org>
 - 3:1.6.3-31.trinity.20100511
 - ship /usr/share/apps/koffice/koffice_shell.rc, Kivio needs it



More information about the scm-commits mailing list