rpms/alexandria/devel alexandria-0.6.6alpha-rake-prefix.patch, NONE, 1.1 alexandria.spec, 1.44, 1.45 alexandria-0.6.6alpha1-installprefix.patch, 1.1, NONE

Mamoru Tasaka mtasaka at fedoraproject.org
Thu Dec 17 15:58:40 UTC 2009


Author: mtasaka

Update of /cvs/extras/rpms/alexandria/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv32044

Modified Files:
	alexandria.spec 
Added Files:
	alexandria-0.6.6alpha-rake-prefix.patch 
Removed Files:
	alexandria-0.6.6alpha1-installprefix.patch 
Log Message:
* Fri Dec 18 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.6-0.2.alpha
- Use "rake install_package_staging" as explained by the upstream
  (in alexandria-Bugs-27578)
- Kill the creation of 64/128 icons as scalable svg is already installed


alexandria-0.6.6alpha-rake-prefix.patch:
 Rakefile                     |   70 ++++++++++++-------
 util/rake/fileinstall.rb     |  156 ++++++++++++++++++++++++++++++-------------
 util/rake/gettextgenerate.rb |    2 
 util/rake/omfgenerate.rb     |    2 
 4 files changed, 159 insertions(+), 71 deletions(-)

--- NEW FILE alexandria-0.6.6alpha-rake-prefix.patch ---
Index: Rakefile
===================================================================
--- Rakefile	(revision 1111)
+++ Rakefile	(revision 1116)
@@ -1,4 +1,28 @@
 # -*- ruby -*-
+#--
+# Copyright (C) 2009 Cathal Mc Ginley
+#
+# This file is part of the Alexandria build system.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#++
 
 begin
   require 'rake'
@@ -38,46 +62,44 @@
   o.generate_omf('data/omf/alexandria', 'data/omf/alexandria/*.in') 
 end
 
-debinstall = FileInstallTask.new(:debian_install, stage_dir, true) do |i|
+def install_common(install_task)
+  install_task.install_exe('bin', 'bin/*', "#{PREFIX}/bin")
+  install_task.install('lib', 'lib/**/*.rb', install_task.rubylib)
 
-  i.install_exe('bin', 'bin/*', "#{PREFIX}/bin")
-  i.install('lib', 'lib/**/*.rb', i.rubylib)
-
   share_files = ['data/alexandria/**/*', 'data/gnome/**/*.*',
                  'data/locale/**/*.mo', 'data/omf/**/*.omf', 
                  'data/sounds/**/*.wav'] #, 'data/menu/*']
-  i.install('data', share_files, SHARE)
+  install_task.install('data', share_files, SHARE)
 
   icon_files = ['data/app-icon/**/*.png', 'data/app-icon/scalable/*.svg']
-  i.install_icons(icon_files, "#{SHARE}/icons")
-  i.install('data/app-icon/32x32', 'data/app-icon/32x32/*.xpm', "#{SHARE}/pixmaps")
+  install_task.install_icons(icon_files, "#{SHARE}/icons")
+  install_task.install('data/app-icon/32x32', 'data/app-icon/32x32/*.xpm', "#{SHARE}/pixmaps")
 
-  i.install('','schemas/alexandria.schemas', "#{SHARE}/gconf")
-  i.install('', 'alexandria.desktop', "#{SHARE}/applications")
-  i.install('doc','doc/alexandria.1', "#{SHARE}/man/man1")
+  install_task.install('','schemas/alexandria.schemas', "#{SHARE}/gconf")
+  install_task.install('', 'alexandria.desktop', "#{SHARE}/applications")
+  install_task.install('doc','doc/alexandria.1', "#{SHARE}/man/man1")
 
+end
 
+debinstall = FileInstallTask.new(:package_staging, stage_dir, true) do |i|
+  install_common(i)
+
 end
 
-debinstall.similar(:install_files) do |j|
+task :debian_install => :install_package_staging
+
+packageinstall = FileInstallTask.new(:package) do |j|
+  install_common(j)
+
   docs = ['README', 'NEWS', 'INSTALL', 'COPYING', 'TODO']
   devel_docs = ['doc/AUTHORS', 'doc/BUGS', 'doc/FAQ', 
                 'doc/cuecat_support.rdoc']
   j.install('', docs, "#{SHARE}/doc/#{PROJECT}") 
   j.install('doc', devel_docs, "#{SHARE}/doc/#{PROJECT}")
 
-  j.uninstall_empty_dirs(["#{SHARE}/**/#{PROJECT}",
-                          "#{j.rubylib}/#{PROJECT}"
+  j.uninstall_empty_dirs(["#{SHARE}/**/#{PROJECT}/",
+                          "#{j.rubylib}/#{PROJECT}/"
                          ])
-=begin
-  j.uninstall_empty_dirs(["#{SHARE}/sounds/#{PROJECT}",
-                          "#{SHARE}/gnome/help/#{PROJECT}",
-                          "#{SHARE}/omf/#{PROJECT}",
-                          "#{SHARE}/doc/#{PROJECT}",
-                          "#{SHARE}/#{PROJECT}",
-                          "#{j.rubylib}/#{PROJECT}"
-                         ])
-=end
 end
 
 
@@ -296,7 +318,7 @@
 task :post_install => [:scrollkeeper, :gconf, :update_icon_cache]
 
 desc "Install Alexandria"
-task :install => [:pre_install, :install_files, :post_install]
+task :install => [:pre_install, :install_package, :post_install]
 
 desc "Uninstall Alexandria"
-task :uninstall => [:un_install_files, :un_install_files_empty_dirs]
+task :uninstall => [:uninstall_package] # TODO gconf etc...
Index: util/rake/gettextgenerate.rb
===================================================================
--- util/rake/gettextgenerate.rb	(revision 1111)
+++ util/rake/gettextgenerate.rb	(revision 1116)
@@ -2,7 +2,7 @@
 #--
 # Copyright (C) 2009 Cathal Mc Ginley
 #
-# This file is part of the Palatina build system.
+# This file is part of the Alexandria build system.
 #
 # Permission is hereby granted, free of charge, to any person obtaining
 # a copy of this software and associated documentation files (the
Index: util/rake/fileinstall.rb
===================================================================
--- util/rake/fileinstall.rb	(revision 1111)
+++ util/rake/fileinstall.rb	(revision 1116)
@@ -2,7 +2,7 @@
 #--
 # Copyright (C) 2009 Cathal Mc Ginley
 #
-# This file is part of the Palatina build system.
+# This file is part of the Alexandria build system.
 #
 # Permission is hereby granted, free of charge, to any person obtaining
 # a copy of this software and associated documentation files (the
@@ -58,21 +58,17 @@
   # Debian, set +dirname+ to 'debian/packagename' and
   # +install_to_rubylibdir+ to true so that files are stage-installed
   # to 'debian/packagename/usr/lib/ruby/1.8'
-  def initialize(taskname=nil, dirname=nil, install_to_rubylibdir=false)
+  def initialize(taskname, dirname=nil, install_to_rubylibdir=false)
     @taskname = taskname
     @install_to_rubylibdir = install_to_rubylibdir
     calculate_ruby_dir
     @stage_dir = dirname # || @prefix
     @file_groups = []
+    @dirs_to_remove_globs
     if block_given?
       yield self
     end
-    if taskname
-      # taskname will be nil for newly cloned tasked (c.f. #similar)
-      # so we don't make the new task yet...
-      make_tasks
-    end
-
+    make_tasks
   end
 
   protected
@@ -80,47 +76,71 @@
   # Creates the install and uninstall tasks based on the contents
   # of the @file_groups list
   def make_tasks
+    tasknames = {}
+    tasknames[:install] = "install_#{@taskname}".intern
+    tasknames[:uninstall] = "uninstall_#{@taskname}".intern
+    tasknames[:uninstall_files] = "uninstall_#{@taskname}_files".intern
+    tasknames[:uninstall_dirs] = "uninstall_#{@taskname}_dirs".intern
+
+    # INSTALL TASK
+
     description = "Install package files"
     if @stage_dir
       description += " to staging directory"
     end
     desc description
-    task @taskname do
+    task tasknames[:install] do
       @file_groups.each {|g| g.install(@stage_dir) }
     end    
 
+    # UNINSTALL TASKS
+
+    task tasknames[:uninstall_files] do
+      @file_groups.each {|g| g.uninstall(@stage_dir) }
+    end    
+
+    task tasknames[:uninstall_dirs] => tasknames[:uninstall_files] do
+      all_dirs = Set.new
+      @file_groups.each {|g| g.get_installation_dirs(@stage_dir, all_dirs) }
+      
+
+      #all_dirs.sort.each {|dir| puts dir }
+      to_delete = Set.new
+      @dirs_to_remove_globs.each do |glob|
+        regex = glob2regex(glob)
+        all_dirs.each do |dir|
+          unless dir =~ /\/$/
+            dir += '/'
+          end
+          if regex =~ dir            
+            #puts "SHOULD DELETE #{dir} #{$1} ; "             
+            to_delete << $1
+          end
+        end
+      end
+      to_delete.each do |dirname|
+        dir = dirname
+        if @stage_dir
+          dir = File.join(@stage_dir, dirname)
+        end
+        delete_empty(dir)
+      end
+    end
+
     uninstall_description = "Uninstall package files"
     if @stage_dir
-      description += " from staging directory"
-    end
-    
-    #desc uninstall_description
-    task "un_#{@taskname}".intern do
-      @dirs = Set.new
-      @file_groups.each {|g| g.uninstall(@stage_dir, @dirs) }
-    end    
+      uninstall_description += " from staging directory"
+    end   
+    desc uninstall_description
+    task tasknames[:uninstall] => [tasknames[:uninstall_files], 
+                                   tasknames[:uninstall_dirs]]
+
   end
+  
 
-  attr_accessor :file_groups, :stage_dir, :taskname
 
   public
 
-
-  # Makes a copy of this install task, with the same file groups
-  # already set, but to which more file groups can be added without
-  # interference.
-  def similar(taskname, dirname=nil, install_to_rubylibdir=false)
-    newtask = self.dup
-    newtask.taskname = taskname
-    newtask.stage_dir = dirname
-    if block_given?
-      yield newtask 
-    end   
-    newtask.make_tasks
-    newtask
-  end
-    
-  
   # Include the files specified in the +file_glob+ to be installed in
   # +dest_dir+, but noting that the prefix +src_dir+ is to be
   # disregarded in the installation.
@@ -151,7 +171,9 @@
         icon_dir = icon_file.dirname
         icon_size = Pathname.new(icon_dir).basename
         icon_dest_dir = "#{dest_dir}/#{theme}/#{icon_size}/#{icon_type}"
-        @file_groups << FileGroup.new(icon_dir, f, icon_dest_dir)
+        group = FileGroup.new(icon_dir, f, icon_dest_dir)
+        group.description = "icons"
+        @file_groups << group
       end
     end
   end
@@ -159,12 +181,7 @@
   # Specify which directories should be deleted by the uninstall task
   # if they are empty (or only contain more empty directories).
   def uninstall_empty_dirs(dir_globs)
-    task "un_#{@taskname}_empty_dirs".intern => "un_#{@taskname}".intern do
-      puts "TODO implement uninstall_empty_dirs"
-      #FileList.new(dir_globs).each do |f|
-      #  puts f
-      #end
-    end
+    @dirs_to_remove_globs = dir_globs
   end
 
   private
@@ -190,14 +207,53 @@
     end
   end
 
+  def glob2regex(pathglob)
+    if pathglob =~ /\*\*$/
+      pathglob += "/"
+    end
+    real_parts = pathglob.split("**/")
+    real_parts.each do |part|
+      part.gsub!(".", "\\.")
+      part.gsub!("*", "[^\\/]*")
+      part.gsub!("?", "[^\\/]")
+      #puts part
+    end
+    pattern = real_parts.join("([^\/]+\/)*")
+    return /(#{pattern})/
+  end
 
+  # For each of the directories named in the list +dirs+, delete the
+  # tree if is empty except for further empty directories.
+  def delete_empty(dirs)
+    dirs.each do |d|
+      p = Pathname.new(d)
+      if p.exist?
+        delete_if_empty(p.realpath)
+      end
+    end
+  end
+
+  
+  # Delete the directory at the given Pathname +p+ if all its children
+  # can be similarly deleted, and if it is then empty.
+  def delete_if_empty(p)
+    p.children.each do |c|
+      delete_if_empty(c)
+    end
+    if p.children.empty?
+      p.delete # TODO optional verbose output here
+    end
+  end
+
   class FileGroup
     attr_reader :mode
+    attr_accessor :description
     def initialize(src_dir, file_glob, dest_dir, mode=0644)
       @src_dir = src_dir
       @file_glob = file_glob
       @dest_dir = dest_dir
       @mode = mode
+      @description = "files"
     end
     def to_s
       "FileGroup[#{@src_dir}]"
@@ -224,27 +280,37 @@
     end
 
     def install(base_dir)
+      puts "Installing #{@description} to #{@dest_dir}"
       files.each do |f|
         dest = self.dest_dir(f, base_dir)
         FileUtils.mkdir_p(dest) unless test(?d, dest)
         if test(?f, f)
-          FileUtils::Verbose.install(f, dest, :mode => self.mode)
+          FileUtils.install(f, dest, :mode => self.mode)
         end
       end
     end
 
-    def uninstall(base_dir, dirs)
+    def uninstall(base_dir)
       files.each do |f|
         dest = self.dest_dir(f, base_dir)
         filename = File.basename(f)
         file = File.join(dest, filename)
         if test(?f, file)
-          FileUtils::Verbose.rm_f(file) #, :noop => true)
-          dirs << File.dirname(file)
+          FileUtils.rm_f(file) #, :noop => true)
         end
       end
     end
 
+    def get_installation_dirs(base_dir, all_dirs_set)
+      files.each do |f|
+        dest = self.dest_dir(f, base_dir)
+        filename = File.basename(f)
+        file = File.join(dest, filename)
+        all_dirs_set << File.dirname(file)
+      end
+    end
+      
+
   end # class FileGroup
 
 end # class FileInstallTask
Index: util/rake/omfgenerate.rb
===================================================================
--- util/rake/omfgenerate.rb	(revision 1111)
+++ util/rake/omfgenerate.rb	(revision 1116)
@@ -2,7 +2,7 @@
 #--
 # Copyright (C) 2009 Cathal Mc Ginley
 #
-# This file is part of the Palatina build system.
+# This file is part of the Alexandria build system.
 #
 # Permission is hereby granted, free of charge, to any person obtaining
 # a copy of this software and associated documentation files (the


Index: alexandria.spec
===================================================================
RCS file: /cvs/extras/rpms/alexandria/devel/alexandria.spec,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -p -r1.44 -r1.45
--- alexandria.spec	16 Dec 2009 18:58:41 -0000	1.44
+++ alexandria.spec	17 Dec 2009 15:58:40 -0000	1.45
@@ -6,7 +6,7 @@
 %define		majorver	0.6.6
 %define		minorver	alpha
 
-%define		fedorarel	1
+%define		fedorarel	2
 %define		rel		%{?minorver:0.}%{fedorarel}%{?minorver:.%minorver}
 
 
@@ -24,9 +24,8 @@ Source0:	https://launchpad.net/~alexandr
 # Trial fix for hang up when importing list containing invalid isdn
 # ref: alexandria-Bugs-25348
 Patch2:		alexandria-0.6.4.1-hang-importing-invalid-isdn.patch
-# Add install_prefix
-# Will ask upstream
-Patch10:	alexandria-0.6.6alpha1-installprefix.patch
+# ref: aleandria-Bugs-27578
+Patch10:	alexandria-0.6.6alpha-rake-prefix.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:	noarch
@@ -37,8 +36,6 @@ BuildRequires:	gettext
 BuildRequires:	intltool
 BuildRequires:	scrollkeeper
 
-BuildRequires:	ImageMagick
-
 Requires:	ruby
 Requires:	ruby(abi) = %{rubyabi}
 
@@ -78,7 +75,7 @@ Alexandria is a GNOME application to hel
 #%%setup -q -n %{name}-%{majorver}%{?minorver}
 %setup -q -n %{name}-%{prevver}+%{majorver}%{?minorver}
 %patch2 -p0 -b .up25348
-%patch10 -p1 -b .prefix
+%patch10 -p0 -b .prefix
 
 # Embed Fedora EVR
 %{__sed} -i.evr \
@@ -91,44 +88,22 @@ rake build
 %install
 %{__rm} -rf $RPM_BUILD_ROOT
 
-# disable scrollkeeper
-%{__rm} -rf tmpbin
-%{__mkdir} tmpbin
-%{__ln_s} -f /bin/true tmpbin/scrollkeeper-update
-%{__ln_s} -f /bin/true tmpbin/gconftool-2
-%{__ln_s} -f /bin/true tmpbin/gtk-update-icon-cache
-
-export PATH="$(pwd)/tmpbin:$PATH"
-export RUBYLIBDIR=%{ruby_sitelib}
-#export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
-
-rake install \
-	install_prefix=$RPM_BUILD_ROOT
+rake install_package_staging \
+	DESTDIR=$RPM_BUILD_ROOT \
+	RUBYLIBDIR=%{ruby_sitelib}
 
-%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/applications/
 desktop-file-install \
 	--vendor fedora \
 	--dir $RPM_BUILD_ROOT%{_datadir}/applications/ \
 	--delete-original \
 	$RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop
 
-# create 64x64, 128x128 icon
-for s in 64 128 ; do
-	%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${s}x${s}/apps/
-	convert -scale ${s}x${s} \
-		data/alexandria/icons/%{name}.png \
-		$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${s}x${s}/apps/%{name}.png
-done
-
 # Move gconf files to where Fedora uses
 %{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}
 %{__mv} \
 	$RPM_BUILD_ROOT%{_datadir}/gconf/ \
 	$RPM_BUILD_ROOT%{_sysconfdir}/
 
-# Clean up documents
-%{__rm} -rf $RPM_BUILD_ROOT%{_defaultdocdir}
-
 # %%{_datadir}/menu seems to be used for debian
 # Removing for Fedora
 %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/menu/
@@ -207,6 +182,11 @@ exit 0
 %{_datadir}/icons/hicolor/*/apps/%{name}.*
 
 %changelog
+* Fri Dec 18 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.6-0.2.alpha
+- Use "rake install_package_staging" as explained by the upstream
+  (in alexandria-Bugs-27578)
+- Kill the creation of 64/128 icons as scalable svg is already installed
+
 * Thu Dec 17 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.6-0.1.alpha
 - Try 0.6.6 alpha
 


--- alexandria-0.6.6alpha1-installprefix.patch DELETED ---




More information about the fedora-extras-commits mailing list