[Mageia-sysadm] [231] import rpm-setup version cleaned by blino

root at mageia.org root at mageia.org
Thu Jan 6 18:30:06 CET 2011


Revision: 231
Author:   boklm
Date:     2011-01-06 18:30:05 +0100 (Thu, 06 Jan 2011)
Log Message:
-----------
import rpm-setup version cleaned by blino

Added Paths:
-----------
    rpm/
    rpm/rpm-setup/
    rpm/rpm-setup/trunk/
    rpm/rpm-setup/trunk/.perl_checker
    rpm/rpm-setup/trunk/AUTHORS
    rpm/rpm-setup/trunk/COPYING
    rpm/rpm-setup/trunk/INSTALL
    rpm/rpm-setup/trunk/Makefile.am
    rpm/rpm-setup/trunk/NEWS
    rpm/rpm-setup/trunk/README
    rpm/rpm-setup/trunk/TODO
    rpm/rpm-setup/trunk/autogen.sh
    rpm/rpm-setup/trunk/brp-compress
    rpm/rpm-setup/trunk/brp-strip
    rpm/rpm-setup/trunk/brp-strip-comment-note
    rpm/rpm-setup/trunk/brp-strip-static-archive
    rpm/rpm-setup/trunk/build.macros.in
    rpm/rpm-setup/trunk/configure.ac
    rpm/rpm-setup/trunk/filter.sh
    rpm/rpm-setup/trunk/find-debuginfo.sh
    rpm/rpm-setup/trunk/find-lang.pl
    rpm/rpm-setup/trunk/find-provides.in
    rpm/rpm-setup/trunk/find-provides.perl.in
    rpm/rpm-setup/trunk/find-requires.in
    rpm/rpm-setup/trunk/gem_helper.rb
    rpm/rpm-setup/trunk/git-repository--after-tarball
    rpm/rpm-setup/trunk/git-repository--apply-patch
    rpm/rpm-setup/trunk/http.req
    rpm/rpm-setup/trunk/kmod.prov
    rpm/rpm-setup/trunk/macros-perarch.in
    rpm/rpm-setup/trunk/macros.in
    rpm/rpm-setup/trunk/magic.prov
    rpm/rpm-setup/trunk/magic.req
    rpm/rpm-setup/trunk/make_arch_macrosfiles.sh.in
    rpm/rpm-setup/trunk/perl.prov
    rpm/rpm-setup/trunk/perl.req
    rpm/rpm-setup/trunk/perl.req-from-meta
    rpm/rpm-setup/trunk/php.prov
    rpm/rpm-setup/trunk/php.req
    rpm/rpm-setup/trunk/pkgconfigdeps.sh
    rpm/rpm-setup/trunk/pythoneggs.py
    rpm/rpm-setup/trunk/rpm-spec-mode.el
    rpm/rpm-setup/trunk/rpmeval.c
    rpm/rpm-setup/trunk/rpmgenplatform.in
    rpm/rpm-setup/trunk/rpmrc.in
    rpm/rpm-setup/trunk/rubygems.rb
    rpm/rpm-setup/trunk/tests/
    rpm/rpm-setup/trunk/tests/findlang.pl
    rpm/rpm-setup/trunk/tests/findlang.sh
    rpm/rpm-setup/trunk/tests/macros.sh
    rpm/rpm-setup/trunk/tests.sh

Added: rpm/rpm-setup/trunk/.perl_checker
===================================================================
--- rpm/rpm-setup/trunk/.perl_checker	                        (rev 0)
+++ rpm/rpm-setup/trunk/.perl_checker	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,2 @@
+File::Find
+Pod::Usage

Added: rpm/rpm-setup/trunk/AUTHORS
===================================================================
Added: rpm/rpm-setup/trunk/COPYING
===================================================================
Added: rpm/rpm-setup/trunk/INSTALL
===================================================================
--- rpm/rpm-setup/trunk/INSTALL	                        (rev 0)
+++ rpm/rpm-setup/trunk/INSTALL	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,6 @@
+Basic instructions to build :
+    aclocal
+    libtoolize
+    automake -a
+    autoconf
+    ./configure

Added: rpm/rpm-setup/trunk/Makefile.am
===================================================================
--- rpm/rpm-setup/trunk/Makefile.am	                        (rev 0)
+++ rpm/rpm-setup/trunk/Makefile.am	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,155 @@
+# $Id: Makefile.am 271263 2010-11-01 23:20:42Z peroyvind $
+
+arch_macrosfiles = $(RPMALLARCH:=.macros)
+
+pkg_data = 
+
+pkg_gdata = \
+		   macros
+
+pkg_sysconf_macros_tmp = \
+		   build.macros
+
+pkg_data_in = $(pkg_gdata:=.in)
+
+pkg_sysconf_macros_in = $(pkg_sysconf_macros_tmp:=.in)
+
+pkg_sysconf_macros = $(pkg_sysconf_macros_tmp)
+
+pkg_gconfig = \
+		   platform \
+		   $(if $(CANONTARGETCPU32), platform32, )
+
+pkg_scripts = \
+		   brp-compress \
+	       brp-strip \
+	       brp-strip-comment-note \
+		   brp-strip-static-archive \
+           filter.sh \
+	       find-lang.pl \
+	       find-debuginfo.sh \
+	       gem_helper.rb \
+	        git-repository--after-tarball \
+	        git-repository--apply-patch \
+		   http.req \
+		   magic.prov \
+		   magic.req \
+		   kmod.prov \
+		   perl.prov \
+		   perl.req \
+		   perl.req-from-meta \
+		   php.prov \
+		   php.req \
+		   pkgconfigdeps.sh \
+		   pythoneggs.py \
+		   rubygems.rb
+
+pkg_gscripts = \
+		   find-provides \
+		   find-requires \
+		   find-provides.perl
+
+pkg_scripts_in = $(pkg_gscripts:=.in)
+
+BUILT_SOURCES = macros-perarch make_arch_macrosfiles.sh rpmgenplatform
+
+pkglibdir = @RPMVENDORDIR@
+
+noinst_PROGRAMS = rpmeval
+
+rpmeval_SOURCES = rpmeval.c
+
+rpmeval_LDFLAGS = -lrpm
+
+noinst_DATA = $(pkg_gconfig)
+
+pkglib_DATA = \
+	$(pkg_data) \
+	$(pkg_gdata)
+	$(pkg_gconfig)
+
+pkglib_SCRIPTS = \
+	$(pkg_scripts) \
+	$(pkg_gscripts)
+
+EXTRA_DIST = \
+	$(pkg_data) \
+	$(pkg_data_in) \
+	$(pkg_sysconf_macros_in) \
+	$(pkg_scripts) \
+	$(pkg_scripts_in) \
+	macros-perarch.in make_arch_macrosfiles.sh.in \
+	rpmgenplatform.in rpmrc.in \
+	rpm-spec-mode.el \
+	tests.sh tests/macros.sh \
+	tests/findlang.pl tests/findlang.sh
+
+edit = sed \
+	-e 's, at RPMVENDOR\@,$(RPMVENDOR),g' \
+	-e 's, at RPMVENDORDIR\@,$(RPMVENDORDIR),g' \
+	-e 's, at RPMCANONVENDOR\@,$(RPMCANONVENDOR),g' \
+	-e 's, at RPMLIBDIR\@,$(RPMLIBDIR),g' \
+	-e 's, at RPMSYSCONFDIR\@,$(RPMSYSCONFDIR),g'\
+	-e 's, at RPMOS\@,$(RPMOS),g' \
+	-e 's, at CANONTARGETCPU\@,$(CANONTARGETCPU),g' \
+	-e 's, at CANONTARGETGNU\@,$(CANONTARGETGNU),g' \
+	-e 's, at RPMALLARCH\@,$(RPMALLARCH),g'
+
+%: %.in Makefile
+	$(edit) $< > $@
+
+$(arch_macrosfiles): rpmrc macros-perarch make_arch_macrosfiles.sh
+	arch=`echo $@ | sed 's,\\.macros,,'`; \
+	sh ./make_arch_macrosfiles.sh macros-perarch $$arch > $@
+
+platform: rpmgenplatform Makefile
+	perl rpmgenplatform $(CANONTARGETCPU) > $@
+
+platform32: rpmgenplatform Makefile
+	perl rpmgenplatform $(CANONTARGETCPU32) > $@
+
+install-data-local: $(arch_macrosfiles) $(pkg_gconfig) $(pkg_sysconf_macros_tmp)
+if ONLY_RPMRC
+	echo "not installing per-arch macros which are already in rpmrc and standard rpm per-arch macros"
+else
+	for i in $(RPMALLARCH); do \
+	  $(mkinstalldirs) $(DESTDIR)$(RPMVENDORDIR)/platform/$${i}-$(RPMOS); \
+	  $(install_sh_DATA) $${i}.macros $(DESTDIR)$(RPMVENDORDIR)/platform/$${i}-$(RPMOS)/macros; \
+	done
+endif
+	[ -d $(DESTDIR)$(RPMSYSCONFDIR)/macros.d ] || $(mkinstalldirs) $(DESTDIR)$(RPMSYSCONFDIR)/macros.d
+	for i in $(pkg_sysconf_macros); do \
+		$(install_sh_DATA) $${i} $(DESTDIR)$(RPMSYSCONFDIR)/macros.d/$${i}; \
+	done
+if RPMPLATFORM
+	for i in $(pkg_gconfig); do \
+		$(install_sh_DATA) $${i} $(DESTDIR)$(RPMSYSCONFDIR)/$${i}; \
+	done
+	$(install_sh_SCRIPT) rpmgenplatform $(DESTDIR)$(bindir)/rpmgenplatform
+endif
+
+.PHONY: ChangeLog test
+
+ChangeLog:
+	@if [ -e ".svn" ]; then \
+	    $(MAKE) ChangeLog-svn; \
+	elif [ -e ".git" ]; then \
+	    $(MAKE) ChangeLog-git; \
+	else \
+	    echo "Unknown SCM (not SVN nor GIT)";\
+	    exit 1; \
+	fi;
+
+ChangeLog-svn:
+	LC_ALL=C svn2cl
+	rm -f *.bak
+
+ChangeLog-git:
+	@git2cl >ChangeLog
+
+test: $(pkg_gdata) $(pkg_gscripts) $(arch_macrosfiles) $(pkg_gconfig)
+	sh tests.sh
+
+CLEANFILES = $(pkg_gdata) $(pkg_gscripts) $(arch_macrosfiles) $(pkg_gconfig)\
+			 rpmrc macros-perarch $(pkg_sysconf_macros_tmp) \
+			 make_arch_macrosfiles.sh

Added: rpm/rpm-setup/trunk/NEWS
===================================================================
--- rpm/rpm-setup/trunk/NEWS	                        (rev 0)
+++ rpm/rpm-setup/trunk/NEWS	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,113 @@
+Version 1.113 - 2 November 2010, by Funda Wang
+- find gstreamer provides
+
+Version 1.112 - 1 November 2010, by Per Øyvind Karlsen
+- enable python egg provides/requires.
+
+Version 1.111 - 30 October 2010, by Anssi Hannula
+- generate requires on "python(abi) = x.y" instead of "python >= x.y" for
+  python modules to properly handle the strict dependency
+- remove runtime dependencies from %py_requires as they are now handled
+  automatically
+
+Version 1.110 - 18 October 2010, by Per Øyvind Karlsen
+- fix warning from rubygems.rb
+- drop %gem_unpack, equivalent behaviour has been implemented in %setup now
+ 
+Version 1.109 - 16 October 2010, by Per Øyvind Karlsen
+- don't install dependencies for gems when using %gem_install
+- fix build with rpm 5.3
+
+Version 1.108 - 16 October 2010, by Per Øyvind Karlsen
+- add gem_helper.rb and it's corresponding macros %gem_unpack, %gem_build &
+  gem_install for simplifying & streamlining ruby gem packaging.
+ 
+Version 1.107 -  9 September 2010, by Per Øyvind Karlsen
+- enable automatic dependency extraction for ruby gems
+
+Version 1.106 - 16 July 2010, by Jerome Quelin
+- extract perl module version when $Full::Package::VERSION is set
+
+Version 1.105 - 14 July 2010, by Jerome Quelin
+- support to extract perl runtime requires from meta spec 2
+
+Version 1.104 - 27 April 2010, by Christophe Fergeau
+- revert previous '-g' addition when stripping shared libraries since it 
+  increases shared library sizes by 10 to 20% for no good reason
+
+Version 1.103 - 16 April 2010, by Per Øyvind Karlsen
+- strip shared libraries with the '-g' option
+
+Version 1.102 -  8 April 2010, by Michael Scherer
+- do not requires python 2.X branch rpm for python 3.X modules, 
+  requires instead python 3.X interpreter
+
+Version 1.101 - 26 March 2010, by Jerome Quelin
+- fix find-requires to call perl.req-from-meta with the correct meta
+  file when there are multiple meta file in the package
+
+Version 1.100 - 14 March 2010, by Jerome Quelin
+- fix find-requires to look for correct meta.yml before calling
+  perl.req-from-meta
+- make perl.prov skip comment lines
+
+Version 1.99 -  9 March 2010, by Per Øyvind Karlsen
+- allow for for only stripping files without creating debug package contents by
+  setting DISABLE_DEBUG environment variable.
+
+Version 1.98 -  5 March 2010, by Per Øyvind Karlsen
+- Update find-debuginfo.sh from upstream
+- new script: perl.req-from-meta (jquelin)
+
+Version 1.97 - 12 December 2009, by Anssi Hannula
+- fix package build when the debug package is empty (regression introduded in
+  1.96)
+
+Version 1.96 - 10 December 2009, by Anssi Hannula
+- fix perl.prov to assign versions to provides when the version is declared
+  with 'our' or 'my' keyword, or when it is prepended with code
+  (Jérôme Quelin)
+- replace %sunsparc with %sparc & %sparcx (from rpm5.org, Per Øyvind Karlsen)
+- support ELF executables only as a.out has been deprecated since ages
+  ago (fixes objdump 'File format not recognized' errors) (Per Øyvind Karlsen)
+- don't try finding debug files in buildroot when there's none
+  (Per Øyvind Karlsen)
+
+Version 1.95 - 25 September 2009, by Olivier Blin
+- MIPS and ARM support (from Arnaud Patard):
+  o add mipsel support
+  o introduce CANONTARGETGNU, to be able to use -gnueabi for ARM
+  o add arm support and use -gnueabi instead of -gnu
+
+Version 1.94 - 8 August 2009, by Anssi Hannula
+- update perl_convert_version to keep alphabetic tail in version number
+  (Luca Berra)
+
+Version 1.93 - 28 July 2009, by Christophe Fergeau
+- update perl_convert_version macro (Jérôme Quelin)
+
+Version 1.92 - 9 July 2009, by Christophe Fergeau 
+- making sure automatic provides & requires for perl package are using the
+  new macro %perl_convert_version (jquelin)
+- rpm5 fixes (peroyvind)
+
+Version 1.91 - 3 February 2009, by Christophe Fergeau
+- build.macros.in
+  o add new perl_convert_version macro to convert cpan version to rpm version
+- git-repository--after-tarball:
+  o commit the tarball with user "unknown author <cooker at mandrivalinux.org>"
+  o commit the tarball using the tarball's modification time
+
+Version 1.90 - 29 January 2009, by Pixel
+
+- call patch with -U (aka --unified-reject-files)
+
+Version 1.89 - 29 January 2009, by Pixel
+
+- when %_with_git_repository is set, define %_after_setup and %_patch to use
+  the new scripts git-repository--after-tarball and git-repository--apply-patch
+
+Version 1.88 - 7 January 2009, by Christophe Fergeau
+
+- fix ugly warning during invocation of php.req
+- RPM5 fixes 

Added: rpm/rpm-setup/trunk/README
===================================================================
--- rpm/rpm-setup/trunk/README	                        (rev 0)
+++ rpm/rpm-setup/trunk/README	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,37 @@
+rpm-mageia-setup
+$Id: README 22754 2007-02-22 13:03:02Z nanardon $
+
+This package contains configuration and script for the Mageia rpm.
+
+Some file come from .in, this allow to transform path for testing purpose.
+If your file or script contains path, you should make a .in files.
+
+* About macros:
+Only redefine macros in this package if the rpm one does not please to you.
+
+All macros having same body should go into macros.in.
+If the macros body change:
+- add a symbolic value into macros-perarch.in (@foo@)
+- add the value into make_macrosfiles.sh.in
+
+Example:
+%_libdir /use/%_lib => macros.in
+%_lib lib|lib64 => macros-perarch.in
+
+* Testing the monster
+
+o First and easy way:
+$ make test
+
+o Live tests:
+
+$ ./configure --with-rpmconfdir=$fakeroot --with-rpmlibdir=/usr/lib/rpm --with-rpmsysconfdir=/etc
+
+This will configure the package for an installation into fakeroot, using rpm files in /usr/lib/rpm.
+$ make
+$ make install
+
+Now we can say to rpm to use fake config:
+rpm --rcfile $fakeroot/mageia/rpmrc other command...
+
+Happy Hacking

Added: rpm/rpm-setup/trunk/TODO
===================================================================
--- rpm/rpm-setup/trunk/TODO	                        (rev 0)
+++ rpm/rpm-setup/trunk/TODO	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,3 @@
+- add tests, tests, and tests !
+- rewrite kmod.prov in perl, would make the script clearer
+

Added: rpm/rpm-setup/trunk/autogen.sh
===================================================================
--- rpm/rpm-setup/trunk/autogen.sh	                        (rev 0)
+++ rpm/rpm-setup/trunk/autogen.sh	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,5 @@
+#!/bin/sh
+libtoolize --force --copy
+aclocal
+autoconf
+automake -a -c


Property changes on: rpm/rpm-setup/trunk/autogen.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:eol-style
   + native

Added: rpm/rpm-setup/trunk/brp-compress
===================================================================
--- rpm/rpm-setup/trunk/brp-compress	                        (rev 0)
+++ rpm/rpm-setup/trunk/brp-compress	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# $Id: brp-compress 11488 2005-04-29 03:14:31Z othauvin $
+
+# If using normal root, avoid changing anything.
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+	exit 0
+fi
+
+cd $RPM_BUILD_ROOT
+
+# Compress man pages
+COMPRESS="bzip2 -9"
+COMPRESS_EXT=.bz2
+
+for d in ./usr/man/man* ./usr/man/*/man* ./usr/info \
+	./usr/share/man/man* ./usr/share/man/*/man* ./usr/share/info \
+	./usr/kerberos/man ./usr/X11R6/man/man* ./usr/lib/perl5/man/man* \
+	./usr/share/doc/*/man/man* ./usr/lib/*/man/man*
+do
+    [ -d $d ] || continue
+    for f in `find $d -type f`
+    do
+        [ -f "$f" ] || continue
+	[ "`basename $f`" = "dir" ] && continue
+
+	case "$f" in
+	 *.Z) gunzip $f; b=`echo $f | sed -e 's/\.Z$//'`;;
+	 *.gz) gunzip $f; b=`echo $f | sed -e 's/\.gz$//'`;;
+	 *.bz2) bunzip2 $f; b=`echo $f | sed -e 's/\.bz2$//'`;;
+	 *) b=$f;;
+	esac
+
+	$COMPRESS $b </dev/null 2>/dev/null || {
+	    inode=`ls -i $b | awk '{ print $1 }'`
+	    others=`find $d -type f -inum $inode`
+	    if [ -n "$others" ]; then
+		for afile in $others ; do
+		    [ "$afile" != "$b" ] && rm -f $afile
+		done
+		$COMPRESS -f $b
+		for afile in $others ; do
+		    [ "$afile" != "$b" ] && ln $b$COMPRESS_EXT $afile$COMPRESS_EXT
+		done
+	    else
+		$COMPRESS -f $b
+	    fi
+	}
+    done
+
+    for f in `find $d -type l`
+    do
+	l=`ls -l $f | sed -e 's/.* -> //' -e 's/\.gz$//' -e 's/\.bz2$//' -e 's/\.Z$//'`
+	rm -f $f
+	b=`echo $f | sed -e 's/\.gz$//' -e 's/\.bz2$//' -e 's/\.Z$//'`
+	ln -sf $l$COMPRESS_EXT $b$COMPRESS_EXT
+    done
+done


Property changes on: rpm/rpm-setup/trunk/brp-compress
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/brp-strip
===================================================================
--- rpm/rpm-setup/trunk/brp-strip	                        (rev 0)
+++ rpm/rpm-setup/trunk/brp-strip	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,13 @@
+#!/bin/sh
+# If using normal root, avoid changing anything.
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+	exit 0
+fi
+
+# Strip ELF binaries
+for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
+        grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug"  | \
+	grep -v ' shared object,' | \
+	sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped/\1/p'`; do
+	strip -g $f || :
+done


Property changes on: rpm/rpm-setup/trunk/brp-strip
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/brp-strip-comment-note
===================================================================
--- rpm/rpm-setup/trunk/brp-strip-comment-note	                        (rev 0)
+++ rpm/rpm-setup/trunk/brp-strip-comment-note	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,18 @@
+#!/bin/sh
+# If using normal root, avoid changing anything.
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+	exit 0
+fi
+
+# Strip .comment and .note sections (the latter only if it is not allocated)
+# for already stripped elf files in the build root
+for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
+        grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug"  | \
+	sed -n -e 's/^\(.*\):[ 	]*ELF.*, stripped/\1/p'`; do
+	note="-R .note"
+	if objdump -h $f 2>/dev/null | grep '^[ 	]*[0-9]*[ 	]*.note[ 	]' -A 1 | \
+		grep ALLOC >/dev/null; then
+		note=
+	fi
+	strip -R .comment $note $f || :
+done


Property changes on: rpm/rpm-setup/trunk/brp-strip-comment-note
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/brp-strip-static-archive
===================================================================
--- rpm/rpm-setup/trunk/brp-strip-static-archive	                        (rev 0)
+++ rpm/rpm-setup/trunk/brp-strip-static-archive	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+	exit 0
+fi
+
+# Strip static libraries.
+for f in `find $RPM_BUILD_ROOT -type f -a -exec file {} \; | \
+        grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug"  | \
+	grep 'current ar archive' | \
+	sed -n -e 's/^\(.*\):[ 	]*current ar archive/\1/p'`; do
+	strip -g $f
+done


Property changes on: rpm/rpm-setup/trunk/brp-strip-static-archive
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/build.macros.in
===================================================================
--- rpm/rpm-setup/trunk/build.macros.in	                        (rev 0)
+++ rpm/rpm-setup/trunk/build.macros.in	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,349 @@
+
+%__gzip			/usr/bin/gzip
+
+%_sys_macros_dir @RPMSYSCONFDIR@/macros.d
+%build_sysmacrospath() %{_sys_macros_dir}/%{?1:%{1}}%{?!1:%{name}}.macros
+
+# [Pixel, Dec 2008] deprecated, to remove as soon as rpm 4.6.0 dust settles down
+%defaultbuildroot  %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+
+
+# when %_with_git_repository is set, these macros modify the behaviour of "%prep" step:
+%_after_setup %{?_with_git_repository:GIT_URL="%{?git_url}" GIT_REPOSITORY_CACHE=%{?git_repository_cache} @RPMVENDORDIR@/git-repository--after-tarball}
+%_patch %{?_with_git_repository:PKG_NAME=%{name} @RPMVENDORDIR@/git-repository--apply-patch}%{?!_with_git_repository:%__patch -U}
+
+# used by "git-repository--after-tarball":
+%git_repository_cache %_topdir/%{name}.git
+
+
+# Various programs used in rpm scripts
+%_update_desktop_database_bin %{_bindir}/update-desktop-database
+%_update_mime_database_bin %{_bindir}/update-mime-database
+%_update_icon_cache_bin %{_bindir}/gtk-update-icon-cache
+%_gconftool_bin %{_bindir}/gconftool-2
+%_scrollkeeper_bin %{_bindir}/scrollkeeper-update
+
+%__service          /sbin/service
+%__chkconfig        /sbin/chkconfig
+
+#==============================================================================
+# ---- Required rpmrc macros.
+#	Macros that used to be initialized as a side effect of rpmrc parsing.
+#	These are the default values that can be overridden by other
+#	(e.g. per-platform, per-system, per-packager, per-package) macros.
+#
+
+%debug_package_and_restore %{debug_package} \
+%package __restore__\
+Summary: %{summary}\
+Group: %{group}\
+%description __restore__
+
+%ix86 i386 i486 i586 i686 pentium3 pentium4 athlon k6
+
+%sparc sun4 sun4m sun4c sun4d sun4u sparcv9b sparcv9v2 %{sparcx}
+%sparcx sparc sparcv8 sparcv9 sparcv9v sparc64 sparc64v
+
+#	Multilibs
+%_multilibpatt		(/%{_lib}|/usr/%{_lib}(|/gconv)|/usr/local/%{_lib}|/usr/X11R6/%{_lib}|/opt/%{_lib})/[^/]*\\.([oa]|la|so[0-9.]*)$
+
+%_arch_tag_suffix (%_lib)
+%arch_tagged() %{1}%{_arch_tag_suffix} %{?2:%{2} %{3}%{?!3:%{error:undefined 3rd argument in arch_tagged}}}
+
+# Games macros
+%_gamesdir	games
+%_gamesbindir   %{_prefix}/%{_gamesdir}
+%_gamesdatadir  %{_datadir}/%{_gamesdir}
+
+# Menu directories
+%_menudir %{_prefix}/lib/menu
+%_iconsdir %{_datadir}/icons
+%_miconsdir %{_datadir}/icons/mini
+%_liconsdir %{_datadir}/icons/large
+
+%_xfontdir %_datadir/fonts
+
+%_webconfdir %{_sysconfdir}/httpd/conf
+%_webappconfdir %_webconfdir/webapps.d
+# compatibility
+%webappconfdir %_webappconfdir
+
+#==============================================================================
+# ---- Build configuration macros.
+#
+# Package version macro.
+#	The type of package to produce, for compatibility with legacy
+#	versions of rpm.
+#
+# Script gets packaged file list on input.
+# Returns list of multiarch files that are not marked as such,
+# i.e. files in $RPM_BUILD_ROOT that have arch-dependent values
+#
+# Note: Disable (by commenting out) for legacy compatibility.
+#%__check_multiarch_files @RPMLIBDIR@/check-multiarch-files %{buildroot}
+
+# Use internal dependency generator rather than external helpers?
+%_use_internal_dependency_generator	0
+
+%__find_provides	@RPMVENDORDIR@/filter.sh '%{?_provides_exceptions:%{_provides_exceptions}}%{!?_provides_exceptions: }' '%{?_exclude_files_from_autoprov:%{_exclude_files_from_autoprov}}%{!?_exclude_files_from_autoprov: }' '%{buildroot}' @RPMVENDORDIR@/find-provides
+%__find_requires	@RPMVENDORDIR@/filter.sh '%{?_requires_exceptions:%{_requires_exceptions}}%{!?_requires_exceptions: }' '%{?_exclude_files_from_autoreq:%{_exclude_files_from_autoreq}}%{!?_exclude_files_from_autoreq: }' '%{buildroot}' @RPMVENDORDIR@/find-requires %{?buildroot:%{buildroot}} %{?_target_cpu:%{_target_cpu}}
+
+%find_lang  @RPMVENDORDIR@/find-lang.pl %{buildroot}
+
+# stuff below has been deprecated by rpm filetriggers [June 2008]
+%update_menus %{nil}
+%clean_menus %{nil}
+%update_desktop_database %{nil}
+%clean_desktop_database %{nil}
+%update_mime_database %{nil}
+%clean_mime_database %{nil}
+%update_scrollkeeper %{nil}
+%clean_scrollkeeper %{nil}
+
+# Update Menu
+%_update_menus_bin %{_bindir}/update-menus
+
+# Update Window Managers session.
+%_fndsession_bin %{_sbindir}/fndSession
+%make_session %{nil}
+%make_dm_session if [ -x %{_fndsession_bin} ]; then %{_fndsession_bin} || true ; fi \
+%{nil}
+
+# For rebuilding gcj-db
+%_rebuildgcjdb_bin %{_bindir}/rebuild-gcj-db
+%update_gcjdb if [ -x %{_rebuildgcjdb_bin} ]; then %{_rebuildgcjdb_bin} || true ; fi \
+%{nil}
+
+%clean_gcjdb if [ -x %{_rebuildgcjdb_bin} ]; then %{_rebuildgcjdb_bin} || true ; fi \
+%{nil}
+
+# Rebuild icon cache
+#
+# following themes are handled through filetriggers:
+%icon_cache_through_filetrigger_hicolor 1
+%icon_cache_through_filetrigger_gnome 1
+%icon_cache_through_filetrigger_oxygen 1
+
+%update_icon_cache() %{expand: %%{!?icon_cache_through_filetrigger_%1:if [ -x %%{_update_icon_cache_bin} ]; then \
+%%{_update_icon_cache_bin} --force --quiet %%{_iconsdir}/%%{1} || true; fi \
+%%{nil}}}
+
+%clean_icon_cache() %{expand: %%{!?icon_cache_through_filetrigger_%1:if [ -x %%{_update_icon_cache_bin} -a -r %%{_iconsdir}/%%{1}/index.theme ]; then \
+%%{_update_icon_cache_bin} --force --quiet %%{_iconsdir}/%%{1} || true ; fi \
+%%{nil}}}
+
+# GConf schemas:
+# installation is handled by filetriggers
+%post_install_gconf_schemas() %{nil}
+# but uninstall still need to be done in %preun:
+%preun_uninstall_gconf_schemas() if [ "$1" = "0" -a -x %{_gconftool_bin} ]; then \
+SCHEMAS="" \
+for SCHEMA in %{*} ; do \
+  SCHEMAS="$SCHEMAS %{_sysconfdir}/gconf/schemas/$SCHEMA.schemas" \
+done \
+GCONF_CONFIG_SOURCE=`%{_gconftool_bin} --get-default-source` %{_gconftool_bin} --makefile-uninstall-rule  $SCHEMAS > /dev/null || true ; fi \
+%{nil}
+
+# Mageia Linux version
+# - "9.1"    =>  910
+# - "10.2.2" => 1022
+# (user may copy the following line in specfile)
+%mgaversion		%(perl -pe '/(\\d+)\\.(\\d)\\.?(\\d)?/; $_="$1$2".($3||0)' /etc/release)
+
+%distsuffix mga
+
+%mkrel(c:) %{-c: 0.%{-c*}.}%{1}%{?subrel:.%subrel}%{?distsuffix:%distsuffix}%{?!distsuffix:mga}%{?distro_release:%distro_release}
+
+#==============================================================================
+# ---- Build policy macros.
+#
+#---------------------------------------------------------------------
+#   Expanded at end of %install scriptlet.
+#
+
+%__os_install_post    \
+    %{?__spec_helper_post}%{?!__spec_helper_post:/usr/share/spec-helper/spec-helper} \
+%{nil}
+
+%__debug_install_post   \
+   @RPMVENDORDIR@/find-debuginfo.sh "%{_builddir}/%{?buildsubdir}"\
+%{nil}
+
+
+#==============================================================================
+# ---- specfile macros.
+#	Macro(s) here can be used reliably for reproducible builds.
+#	(Note: Above is the goal, below are the macros under development)
+#
+
+%old_makeinstall \
+    make \\\
+	prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
+	exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
+	bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
+	sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
+	sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
+	datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
+	includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
+	libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
+	libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
+	localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
+	sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
+	mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
+	infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
+    install
+
+
+#------------------------------------------------------------------------------
+# Useful python macros
+%pyver	%(python -V 2>&1 | cut -f2 -d" " | cut -f1,2 -d".")
+
+#------------------------------------------------------------------------------
+# Useful perl macros 
+# (initially from Artur Frysiak <wiget at t17.ds.pwr.wroc.pl>)
+# (modified by Pixel <pixel at mandriva.com>)
+#
+#	[...]
+#	Group: Development/Perl
+#	[...]
+#	%build
+#	perl Makefile.PL INSTALLDIRS=vendor
+#	%make
+#	[...]
+#	%install
+#	rm -rf $RPM_BUILD_ROOT
+#	make install PREFIX="$RPM_BUILD_ROOT/%{prefix}"
+#	[...]
+#	%files
+#	%defattr(644,root,root,755)
+#	%{perl_vendorlib}/CGI
+# or
+#	%{perl_vendorarch}/DBI
+#	%{perl_vendorarch}/auto/DBI
+#	%{_mandir}/*/*
+#
+
+
+%perl_convert_version() %(perl -Mversion -le '
+	$x = "%{1}";
+	$y = $x;
+	$x =~ s/[[:alpha:]]*$//;
+	$y =~ s/^$x//;
+	$x =~ s/\D*$//;
+	$v = version->new($x)->normal;
+	$v =~ s/^v//;
+	print "$v$y";
+')
+
+# kept for compatibility, but should not be used, especially the ugly perl_archlib!
+%perl_sitearch	%(eval "`perl -V:installsitearch`"; echo $installsitearch)
+%perl_archlib	%(eval "`perl -V:installarchlib`"; echo $installarchlib)
+
+#--------------------------------------------------------------------------------
+# Macro from conectiva
+
+%rename() \
+Obsoletes: %{1} < %{version}-%{release} \
+Provides: %{1} = %{version}-%{release}
+
+# Shorthand for %{defined with_...}
+# macros provided by rpm 4.4, but buggy :(
+%_with() %{expand: %%{?_with_%1:1} %%{!?_with_%1: %%{?_without_%1:0} %%{!?_without_%1: %%{?with_%1:%%{with_%1}} %%{!?with_%1: %%{?without_%1:!%%{without_%1}} %%{!?without_%1: %%{?2:%%2} %%{!?2:1} } } } } }
+%_without() !%{expand: %%{with %1 %{?2:%2}}}
+
+%_package_i18n(g:f:) \
+%%package -n %{?1:%{1}}%{?!1:%{name}}-i18n\
+Summary: Internationalization and locale data for %{?1:%{1}}%{?!1:%{name}}\
+License: %{license}\
+Group: %{?-g:%{-g*}}%{?!-g:%{group}}\
+\
+%%description -n %{?1:%{1}}%{?!1:%{name}}-i18n\
+Internationalization and locale data for %{?1:%{1}}%{?!1:%{name}}\
+\
+%%files -n %{?1:%{1}}%{?!1:%{name}}-i18n %{?-f:%{-f}}%{?!-f:-f %{?1:%{1}}%{?!1:%{name}}.lang}\
+%{nil}
+
+
+#------------------------------------------------------------------------------
+# Python specific macros
+
+# (from rpm 4.4.6)
+%python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
+%python_sitelib	%(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
+%python_version	%(%{__python} -c "import sys; print(sys.version[0:3])")
+
+# More Python specific macro definitions (originally from PLD).
+#
+%py_ver                 %(python -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)
+%py_prefix              %(python -c "import sys; print sys.prefix" 2>/dev/null || echo PYTHON-NOT-FOUND)
+# backward compatibility
+%py_libdir              %py_purelibdir
+%py_platlibdir          %(python -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(standard_lib=1,plat_specific=1)' 2>/dev/null || echo PYTHON-LIBDIR-NOT-FOUND)
+%py_purelibdir          %(python -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(standard_lib=1,plat_specific=0)' 2>/dev/null || echo PYTHON-LIBDIR-NOT-FOUND)
+%py_incdir              %(python -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_inc()' 2>/dev/null || echo PYTHON-INCLUDEDIR-NOT-FOUND)
+%py_sitedir             %py_puresitedir
+%py_platsitedir         %(python -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(plat_specific=1)' 2>/dev/null || echo PYTHON-LIBDIR-NOT-FOUND)
+%py_puresitedir         %(python -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()' 2>/dev/null || echo PYTHON-LIBDIR-NOT-FOUND)
+
+%py_compile(O)  \
+find %1 -name '*.pyc' -exec rm -f {} \\; \
+python -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
+%{-O: \
+find %1 -name '*.pyo' -exec rm -f {} \\; \
+python -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
+}
+%py_requires(d) \
+BuildRequires: python %{-d:python-devel}
+
+
+#------------------------------------------------------------------------------
+# Ocaml macro
+#
+
+%ocaml_sitelib %(if [ -x /usr/bin/ocamlc ]; then ocamlc -where;fi)/site-lib
+
+#------------------------------------------------------------------------------
+# Ruby gem macros
+#
+
+%__gem_helper @RPMVENDORDIR@/gem_helper.rb
+
+%gem_build(f:j:) \
+	%__gem_helper build \\\
+	%{-f:-f%{-f*}} \\\
+	%{!-j:%{_smp_mflags}}%{-j:-j%{-j*}}
+
+%gem_install(i:n:C) \
+	DESTDIR=${DESTDIR:-%{buildroot}} \\\
+	%__gem_helper install \\\
+	--env-shebang --rdoc --ri --force --ignore-dependencies \\\
+	%{!-i:--install-dir %{buildroot}%{ruby_gemdir}}%{-i:--install-dir %{-i*}} \\\
+	%{!-n:--bindir %{buildroot}%{_bindir}}%{-n:--bindir%{-n*}} \\\
+	%{!-C:--fix-permissions}
+
+#------------------------------------------------------------------------------
+# Redefine RPM sections to allow jumping over them using "--without <section>".
+# This an interesting alternative to --short-circuit.
+# The following are mostly equivalent:
+# % rpmbuild -bi --short-circuit foo.spec && rpmbuild -bb --short-circuit foo.spec
+# % rpmbuild -bb --without build foo.spec
+
+%prep %%prep \
+[ %{_with prep} -eq 1 ] || exit 0 \
+[ %{_with build} -eq 1 ] || exit 0 \
+[ %{_with install} -eq 1 ] || exit 0 \
+%{nil}
+
+%build %%build \
+[ %{_with install} -eq 1 ] || exit 0 \
+[ %{_with build} -eq 1 ] || exit 0 \
+%{nil}
+
+%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package_and_restore}}}\
+%%install\
+[ %{_with install} -eq 1 ] || exit 0 \
+%{nil}
+
+%check %%check \
+[ %{_with check} -eq 1 ] || exit 0 \
+%{nil}

Added: rpm/rpm-setup/trunk/configure.ac
===================================================================
--- rpm/rpm-setup/trunk/configure.ac	                        (rev 0)
+++ rpm/rpm-setup/trunk/configure.ac	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,168 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+# $Id: configure.ac 271266 2010-11-04 10:43:28Z fwang $
+
+AC_PREREQ(2.59)
+AC_INIT(rpm-mageia-setup, 1.114, nanardon at mageia.org)
+AC_CANONICAL_TARGET
+AM_INIT_AUTOMAKE(1.9 -Wno-portability)
+AC_CONFIG_SRCDIR
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+AC_CONFIG_FILES([
+                 Makefile
+                 ])
+
+dnl See if we have pkgconfig for rpm, resort to old behavior if not
+PKG_CHECK_MODULES([RPM], [rpm], [
+      AC_DEFINE_UNQUOTED([HAVE_RPM],1,[Define if RPM backend is available])
+      CPPFLAGS="$RPM_CFLAGS $CPPFLAGS"
+      LDFLAGS="$RPM_LIBS $LDFLAGS"
+   ], [
+      AC_PATH_PROG(RPM_PATH,rpm,none)
+      if test "$RPM_PATH" = "none"; then
+         AC_MSG_ERROR([RPM executable was not found in your system])
+      else
+         AC_DEFINE_UNQUOTED([HAVE_RPM],1,[Define if RPM backend is available])
+      fi
+   ]
+)
+
+AC_CHECK_LIB([rpmio], [rpmLoadMacroFile])
+AC_HEADER_STDC
+AC_CHECK_HEADERS([string.h rpm/rpmmacro.h rpm/rpmlib.h rpm/rpmio.h rpm/rpmtag.h])
+
+CANONTARGETCPU=${target_cpu}
+CANONTARGETGNU=-gnu
+
+case "${target_cpu}" in
+    *86|athlon|k6|pentium*) 
+    RPMALLARCH="i386 i486 i586 i686 k6 athlon pentium3 pentium4"
+    CANONTARGETCPU=i586
+    ;;
+    x86_64|amd64)
+    RPMALLARCH="i386 i486 i586 i686 k6 athlon pentium3 pentium4 amd64 x86_64"
+    CANONTARGETCPU=x86_64
+    CANONTARGETCPU32=i586
+    ;;
+    ppc|powerpc)
+    RPMALLARCH="ppc"
+    CANONTARGETCPU=ppc
+    ;;
+    ppc64|powerpc64)
+    RPMALLARCH="ppc ppc32 ppc64"
+    CANONTARGETCPU=ppc64
+    ;;
+    sparc|sparcv9)
+    RPMALLARCH="sparc"
+    CANONTARGETCPU=sparc
+    ;;
+    sparc64)
+    RPMALLARCH="sparc sparc64"
+    CANONTARGETCPU=sparc64
+    ;;
+    mipsel)
+    RPMALLARCH="mipsel mips32el mips64el"
+    CANONTARGETCPU=mipsel
+    ;;
+    armv4tl)
+    RPMALLARCH="arml armv4tl"
+    CANONTARGETCPU=armv4tl
+    CANONTARGETGNU=-gnueabi
+    ;;
+    armv5tl)
+    RPMALLARCH="arml armv4tl armv5tl"
+    CANONTARGETCPU=armv5tl
+    CANONTARGETGNU=-gnueabi
+    ;;
+    # some armv5te cpu have buggy instruction so better disable
+    # the "e" extension
+    armv5tel)
+    RPMALLARCH="arml armv4tl armv5tel armv5tl"
+    CANONTARGETCPU=armv5tl
+    CANONTARGETGNU=-gnueabi
+    ;;
+    armv7l)
+    RPMALLARCH="arml armv4tl armv5tl armv5tel armv7l"
+    CANONTARGETCPU=armv7l
+    CANONTARGETGNU=-gnueabi
+esac
+RPMALLARCH="${RPMALLARCH} noarch"
+AC_SUBST(RPMALLARCH)
+AC_SUBST(CANONTARGETCPU)
+AC_SUBST(CANONTARGETCPU32)
+AC_SUBST(CANONTARGETGNU)
+
+#
+# get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os
+#
+if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then
+    build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'`
+fi
+if echo "$build_os" | grep '.*-gnu' > /dev/null ; then
+    build_os=`echo "${build_os}" | sed 's/-gnu$//'`
+fi
+
+changequote(<, >)
+build_os_exact="${build_os}"
+build_os_major=`echo "${build_os}" | sed 's/\..*$//'`
+build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'`
+changequote([, ])
+
+dnl Find our os
+RPMOS="$build_os_noversion"
+AC_SUBST(RPMOS)
+
+# Checks for library functions.
+RPMVENDOR="Mageia"
+AC_ARG_WITH(vendor, [  --with-vendor            the vendor of this config  ])
+if test $with_vendor; then
+    RPMVENDOR=$with_vendor
+fi
+AC_SUBST(RPMVENDOR)
+
+RPMCANONVENDOR=`echo "${RPMVENDOR}" | tr [A-Z] [a-z]`
+AC_SUBST(RPMCANONVENDOR)
+
+if test X"$prefix" = XNONE ; then
+    usrprefix="$ac_default_prefix"
+else
+    usrprefix=$prefix
+fi
+
+RPMLIBDIR="${usrprefix}/lib/rpm"
+AC_ARG_WITH(rpmlibdir, [  --with-rpmlibdir=dir    location of rpm config file ])
+if test $with_rpmlibdir; then
+    RPMLIBDIR=$with_rpmlibdir
+fi
+AC_SUBST(RPMLIBDIR)
+
+RPMCONFDIR=${RPMLIBDIR}
+AC_ARG_WITH(rpmconfdir, [  --with-rpmconfdir=dir    location of our config ])
+if test $with_rpmconfdir; then
+    RPMCONFDIR=$with_rpmconfdir
+fi
+AC_SUBST(RPMCONFDIR)
+
+RPMVENDORDIR="${RPMCONFDIR}/${RPMCANONVENDOR}"
+AC_SUBST(RPMVENDORDIR)
+
+RPMSYSCONFDIR="/etc/rpm"
+AC_ARG_WITH(rpmsysconfdir, [  --with-rpmsysconfdir=dir location of etc ])
+if test $with_rpmsysconfdir; then
+    RPMSYSCONFDIR=$with_rpmsysconfdir
+fi
+AC_SUBST(RPMSYSCONFDIR)
+
+
+AC_ARG_WITH(rpmplatform, [  --with-rpmplatform		use /etc/rpm/platform ])
+AM_CONDITIONAL([RPMPLATFORM],[test $with_rpmplatform])
+
+AC_ARG_WITH(only-rpmrc, [  --with-only-rpmrc		rpm uses rpmrc ])
+AM_CONDITIONAL([ONLY_RPMRC],[test $with_only_rpmrc])
+
+AC_OUTPUT

Added: rpm/rpm-setup/trunk/filter.sh
===================================================================
--- rpm/rpm-setup/trunk/filter.sh	                        (rev 0)
+++ rpm/rpm-setup/trunk/filter.sh	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,36 @@
+#!/bin/sh
+#---------------------------------------------------------------
+# Project         : Mageia
+# Module          : rpm
+# File            : filter.sh
+# Version         : $Id: filter.sh 227371 2007-09-08 15:34:39Z anssi $
+# Author          : Frederic Lepied
+# Created On      : Tue May 13 15:45:17 2003
+# Purpose         : filter using grep and first argument the
+# command passed as the rest of the command line
+#---------------------------------------------------------------
+
+GREP_ARG="$1"
+FILE_GREP_ARG="$2"
+BUILDROOT="$3"
+PROG="$4"
+shift 4
+
+# use ' ' to signify no arg as rpm filter empty strings from
+# command line :(
+if [ "$FILE_GREP_ARG" != ' ' ]; then
+	# get rid of double and trailing slashes
+	BUILDROOT="$(echo "$BUILDROOT" | perl -pe 's,/+,/,g;s,/$,,')"
+	perl -pe "s,^$BUILDROOT,," | grep -v "$FILE_GREP_ARG" | perl -pe "s,^,$BUILDROOT,"
+else
+	cat
+fi | \
+$PROG "$@" | \
+if [ "$GREP_ARG" != ' ' ]; then
+	grep -v "$GREP_ARG"
+else
+	cat
+fi
+exit 0
+
+# filter.sh ends here


Property changes on: rpm/rpm-setup/trunk/filter.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:eol-style
   + native

Added: rpm/rpm-setup/trunk/find-debuginfo.sh
===================================================================
--- rpm/rpm-setup/trunk/find-debuginfo.sh	                        (rev 0)
+++ rpm/rpm-setup/trunk/find-debuginfo.sh	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,353 @@
+#!/bin/bash
+#find-debuginfo.sh - automagically generate debug info and file list
+#for inclusion in an rpm spec file.
+#
+# Usage: find-debuginfo.sh [--strict-build-id] [-g]
+#	 		   [-o debugfiles.list]
+#			   [[-l filelist]... [-p 'pattern'] -o debuginfo.list]
+#			   [builddir]
+#
+# The -g flag says to use strip -g instead of full strip on DSOs.
+# The --strict-build-id flag says to exit with failure status if
+# any ELF binary processed fails to contain a build-id note.
+#
+# A single -o switch before any -l or -p switches simply renames
+# the primary output file from debugfiles.list to something else.
+# A -o switch that follows a -p switch or some -l switches produces
+# an additional output file with the debuginfo for the files in
+# the -l filelist file, or whose names match the -p pattern.
+# The -p argument is an grep -E -style regexp matching the a file name,
+# and must not use anchors (^ or $).
+#
+# All file names in switches are relative to builddir (. if not given).
+#
+
+debugedit=/usr/lib/rpm/debugedit
+if [ ! -x $debugedit ]; then
+    # rpm5 since 5.2 has moved these binaries to a separate 'bin' subdirectory
+    if [ -x /usr/lib/rpm/bin/debugedit ]; then
+	debugedit=/usr/lib/rpm/bin/debugedit
+    fi
+fi
+
+# With -g arg, pass it to strip on libraries.
+strip_g=false
+
+# Barf on missing build IDs.
+strict=false
+
+BUILDDIR=.
+out=debugfiles.list
+nout=0
+while [ $# -gt 0 ]; do
+  case "$1" in
+  --strict-build-id)
+    strict=true
+    ;;
+  -g)
+    strip_g=true
+    ;;
+  -o)
+    if [ -z "${lists[$nout]}" -a -z "${ptns[$nout]}" ]; then
+      out=$2
+    else
+      outs[$nout]=$2
+      ((nout++))
+    fi
+    shift
+    ;;
+  -l)
+    lists[$nout]="${lists[$nout]} $2"
+    shift
+    ;;
+  -p)
+    ptns[$nout]=$2
+    shift
+    ;;
+  *)
+    BUILDDIR=$1
+    shift
+    break
+    ;;
+  esac
+  shift
+done
+
+i=0
+while ((i < nout)); do
+  outs[$i]="$BUILDDIR/${outs[$i]}"
+  l=''
+  for f in ${lists[$i]}; do
+    l="$l $BUILDDIR/$f"
+  done
+  lists[$i]=$l
+  ((++i))
+done
+
+LISTFILE="$BUILDDIR/$out"
+SOURCEFILE="$BUILDDIR/debugsources.list"
+LINKSFILE="$BUILDDIR/debuglinks.list"
+
+> "$SOURCEFILE"
+> "$LISTFILE"
+> "$LINKSFILE"
+
+debugdir="${RPM_BUILD_ROOT}/usr/lib/debug"
+
+strip_to_debug()
+{
+  local g=
+  $strip_g && case "$(file -bi "$2")" in
+  application/x-sharedlib*) g=-g ;;
+  esac
+  eu-strip --remove-comment $g $([ -n "$DISABLE_DEBUG" ] || echo -f "$1") "$2" || exit
+  [ -n "$DISABLE_DEBUG" ] || chmod 444 "$1" || exit
+}
+
+# Make a relative symlink to $1 called $3$2
+shopt -s extglob
+link_relative()
+{
+  local t="$1" f="$2" pfx="$3"
+  local fn="${f#/}" tn="${t#/}"
+  local fd td d
+
+  while fd="${fn%%/*}"; td="${tn%%/*}"; [ "$fd" = "$td" ]; do
+    fn="${fn#*/}"
+    tn="${tn#*/}"
+  done
+
+  d="${fn%/*}"
+  if [ "$d" != "$fn" ]; then
+    d="${d//+([!\/])/..}"
+    tn="${d}/${tn}"
+  fi
+
+  mkdir -p "$(dirname "$pfx$f")" && ln -snf "$tn" "$pfx$f"
+}
+
+# Make a symlink in /usr/lib/debug/$2 to $1
+debug_link()
+{
+  local l="/usr/lib/debug$2"
+  local t="$1"
+  echo >> "$LINKSFILE" "$l $t"
+  link_relative "$t" "$l" "$RPM_BUILD_ROOT"
+}
+
+# Make a build-id symlink for id $1 with suffix $3 to file $2.
+make_id_link()
+{
+  local id="$1" file="$2"
+  local idfile=".build-id/${id:0:2}/${id:2}"
+  [ $# -eq 3 ] && idfile="${idfile}$3"
+  local root_idfile="$RPM_BUILD_ROOT/usr/lib/debug/$idfile"
+
+  if [ ! -L "$root_idfile" ]; then
+    debug_link "$file" "/$idfile"
+    return
+  fi
+
+  [ $# -eq 3 ] && return 0
+
+  local other=$(readlink -m "$root_idfile")
+  other=${other#$RPM_BUILD_ROOT}
+  if cmp -s "$root_idfile" "$RPM_BUILD_ROOT$file" ||
+     eu-elfcmp -q "$root_idfile" "$RPM_BUILD_ROOT$file" 2> /dev/null; then
+    # Two copies.  Maybe one has to be setuid or something.
+    echo >&2 "*** WARNING: identical binaries are copied, not linked:"
+    echo >&2 "        $file"
+    echo >&2 "   and  $other"
+  else
+    # This is pathological, break the build.
+    echo >&2 "*** ERROR: same build ID in nonidentical files!"
+    echo >&2 "        $file"
+    echo >&2 "   and  $other"
+    exit 2
+  fi
+}
+
+get_debugfn()
+{
+  dn=$(dirname "${1#$RPM_BUILD_ROOT}")
+  bn=$(basename "$1" .debug).debug
+
+  debugdn=${debugdir}${dn}
+  debugfn=${debugdn}/${bn}
+}
+
+set -o pipefail
+
+strict_error=ERROR
+$strict || strict_error=WARNING
+
+[[ -n "$EXCLUDE_FROM_STRIP" ]] && \
+EXCLUDE_REGEXP=`perl -e 'print "(", join("|", @ARGV), ")"' $EXCLUDE_FROM_STRIP`
+
+echo $EXCLUDE_REGEXP
+# Strip ELF binaries
+find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \
+     		     \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \
+		     -print |
+file -N -f - | sed -n -e 's/^\(.*\):[ 	]*.*ELF.*, not stripped/\1/p' |
+xargs --no-run-if-empty stat -c '%h %D_%i %n' |
+while read nlinks inum f; do
+  [[ -n "$EXCLUDE_REGEXP" ]] && grep -E -q "$EXCLUDE_REGEXP" <<< "$f" && \
+  continue
+  [ -n "$DISABLE_DEBUG" ] && strip_to_debug "" "$f" && continue
+
+  get_debugfn "$f"
+  [ -f "${debugfn}" ] && continue
+
+  # If this file has multiple links, keep track and make
+  # the corresponding .debug files all links to one file too.
+  if [ $nlinks -gt 1 ]; then
+    eval linked=\$linked_$inum
+    if [ -n "$linked" ]; then
+      link=$debugfn
+      get_debugfn "$linked"
+      echo "hard linked $link to $debugfn"
+      ln -nf "$debugfn" "$link"
+      continue
+    else
+      eval linked_$inum=\$f
+      echo "file $f has $[$nlinks - 1] other hard links"
+    fi
+  fi
+
+  echo "extracting debug info from $f"
+  id=$($debugedit -b "$RPM_BUILD_DIR" -d /usr/src/debug \
+			      -i -l "$SOURCEFILE" "$f") || exit
+  if [ -z "$id" ]; then
+    echo >&2 "*** ${strict_error}: No build ID note found in $f"
+    $strict && exit 2
+  fi
+
+  # A binary already copied into /usr/lib/debug doesn't get stripped,
+  # just has its file names collected and adjusted.
+  case "$dn" in
+  /usr/lib/debug/*)
+    [ -z "$id" ] || make_id_link "$id" "$dn/$(basename $f)"
+    continue ;;
+  esac
+
+  mkdir -p "${debugdn}"
+  if test -w "$f"; then
+    strip_to_debug "${debugfn}" "$f"
+  else
+    chmod u+w "$f"
+    strip_to_debug "${debugfn}" "$f"
+    chmod u-w "$f"
+  fi
+
+  if [ -n "$id" ]; then
+    make_id_link "$id" "$dn/$(basename $f)"
+    make_id_link "$id" "/usr/lib/debug$dn/$bn" .debug
+  fi
+done || exit
+
+# For each symlink whose target has a .debug file,
+# make a .debug symlink to that file.
+find $RPM_BUILD_ROOT ! -path "${debugdir}/*" -type l -print |
+while read f
+do
+  t=$(readlink -m "$f").debug
+  f=${f#$RPM_BUILD_ROOT}
+  t=${t#$RPM_BUILD_ROOT}
+  if [ -f "$debugdir$t" ]; then
+    echo "symlinked /usr/lib/debug$t to /usr/lib/debug${f}.debug"
+    debug_link "/usr/lib/debug$t" "${f}.debug"
+  fi
+done
+
+if [ -s "$SOURCEFILE" ]; then
+  mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug"
+  LC_ALL=C sort -z -u "$SOURCEFILE" | grep -E -v -z '(<internal>|<built-in>)$' |
+  (cd "$RPM_BUILD_DIR"; cpio -pd0mL "${RPM_BUILD_ROOT}/usr/src/debug")
+  # stupid cpio creates new directories in mode 0700, fixup
+  find "${RPM_BUILD_ROOT}/usr/src/debug" -type d -print0 |
+  xargs --no-run-if-empty -0 chmod a+rx
+fi
+
+if [ -d "${RPM_BUILD_ROOT}/usr/lib" -o -d "${RPM_BUILD_ROOT}/usr/src" ]; then
+  ((nout > 0)) ||
+  test ! -d "${RPM_BUILD_ROOT}/usr/lib/debug" ||
+  (cd "${RPM_BUILD_ROOT}/usr/lib"; find debug -type d) |
+  sed 's,^,%dir /usr/lib/,' >> "$LISTFILE"
+
+  (cd "${RPM_BUILD_ROOT}/usr"
+   test ! -d lib/debug || find lib/debug ! -type d
+   test ! -d src/debug || find src/debug -mindepth 1 -maxdepth 1
+  ) | sed 's,^,/usr/,' >> "$LISTFILE"
+fi
+
+# Append to $1 only the lines from stdin not already in the file.
+append_uniq()
+{
+  grep -F -f "$1" -x -v >> "$1"
+}
+
+# Helper to generate list of corresponding .debug files from a file list.
+filelist_debugfiles()
+{
+  local extra="$1"
+  shift
+  sed 's/^%[a-z0-9_][a-z0-9_]*([^)]*) *//
+s/^%[a-z0-9_][a-z0-9_]* *//
+/^$/d
+'"$extra" "$@"
+}
+
+# Write an output debuginfo file list based on given input file lists.
+filtered_list()
+{
+  local out="$1"
+  shift
+  test $# -gt 0 || return
+  grep -F -f <(filelist_debugfiles 's,^.*$,/usr/lib/debug&.debug,' "$@") \
+  	-x $LISTFILE >> $out
+  sed -n -f <(filelist_debugfiles 's/[\\.*+#]/\\&/g
+h
+s,^.*$,s# &$##p,p
+g
+s,^.*$,s# /usr/lib/debug&.debug$##p,p
+' "$@") "$LINKSFILE" | append_uniq "$out"
+}
+
+# Write an output debuginfo file list based on an grep -E -style regexp.
+pattern_list()
+{
+  local out="$1" ptn="$2"
+  test -n "$ptn" || return
+  grep -E -x -e "$ptn" "$LISTFILE" >> "$out"
+  sed -n -r "\#^$ptn #s/ .*\$//p" "$LINKSFILE" | append_uniq "$out"
+}
+
+#
+# When given multiple -o switches, split up the output as directed.
+#
+i=0
+while ((i < nout)); do
+  > ${outs[$i]}
+  filtered_list ${outs[$i]} ${lists[$i]}
+  pattern_list ${outs[$i]} "${ptns[$i]}"
+  grep -Fvx -f ${outs[$i]} "$LISTFILE" > "${LISTFILE}.new"
+  mv "${LISTFILE}.new" "$LISTFILE"
+  ((++i))
+done
+if ((nout > 0)); then
+  # Now add the right %dir lines to each output list.
+  (cd "${RPM_BUILD_ROOT}"; find usr/lib/debug -type d) |
+  sed 's#^.*$#\\@^/&/@{h;s@^.*$@%dir /&@p;g;}#' |
+  LC_ALL=C sort -ur > "${LISTFILE}.dirs.sed"
+  i=0
+  while ((i < nout)); do
+    sed -n -f "${LISTFILE}.dirs.sed" "${outs[$i]}" | sort -u > "${outs[$i]}.new"
+    cat "${outs[$i]}" >> "${outs[$i]}.new"
+    mv -f "${outs[$i]}.new" "${outs[$i]}"
+    ((++i))
+  done
+  sed -n -f "${LISTFILE}.dirs.sed" "${LISTFILE}" | sort -u > "${LISTFILE}.new"
+  cat "$LISTFILE" >> "${LISTFILE}.new"
+  mv "${LISTFILE}.new" "$LISTFILE"
+fi


Property changes on: rpm/rpm-setup/trunk/find-debuginfo.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:eol-style
   + native

Added: rpm/rpm-setup/trunk/find-lang.pl
===================================================================
--- rpm/rpm-setup/trunk/find-lang.pl	                        (rev 0)
+++ rpm/rpm-setup/trunk/find-lang.pl	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,147 @@
+#!/usr/bin/perl
+
+# $Id: find-lang.pl 243013 2008-06-23 13:01:50Z pixel $
+
+use strict;
+use warnings;
+use File::Find;
+use Getopt::Long;
+use Pod::Usage;
+
+GetOptions(
+    'all-name'   => \my $allname,
+    'with-gnome' => \my $withgnome,
+    'with-kde'   => \my $withkde,
+    'with-html'  => \my $withhtml,
+    'without-mo' => \my $withoutmo,
+    'with-man' => \my $withman,
+    'debug' =>  \my $debug,
+) or pod2usage();
+
+my ($buildroot, @searchname) = @ARGV;
+$buildroot or die "No buildroot given\n";
+$buildroot =~ s:/+$::; # removing trailing /
+my ($pkgname) = @searchname or die "Main name to find missing\n";
+
+sub debug {
+    $debug or return;
+    my ($msg, @val) = @_;
+    printf("DEBUG: $msg\n", @val);
+}
+
+my %finallist; # filename => attr, easy way to perform uniq
+
+File::Find::find(
+    sub {
+        my $file = substr($File::Find::name, length($buildroot));
+        -f $File::Find::name or -l $File::Find::name or return;
+        debug("next file is %s", $file);
+        my $langfile = $file;
+        if ($file =~ m:^((.*/share/locale)/([^/@]+)[^/]*).*/([^/]+)\.mo:) {
+            if ($withoutmo) {
+                return;
+            }
+            my ($pkg, $lang, $parent, $langfile) = ($4, $3, $2, $1);
+            if (pkg_match($pkg)) {
+                own_file($file, $lang);
+            }
+        } elsif ($file =~ m:^((.*/gnome/help)/([^/]+)/([^/]+)).*:) {
+            if (!$withgnome) {
+                return;
+            }
+            my ($pkg, $lang, $parent, $langfile) = ($3, $4, $2, $1);
+            if (pkg_match($pkg)) {
+                parent_to_own($langfile, $file, $lang);
+            }
+        } elsif ($file =~ m:^((.*/doc/kde)/HTML/([^/@]+)[^/]*)/([^/]+)/.*:) {
+            if (!$withkde) {
+                return;
+            }
+            my ($pkg, $lang, $parent, $langfile) = ($4, $3, $2, $1);
+            if (pkg_match($pkg)) {
+                parent_to_own($langfile, $file, $lang);
+            }
+        } elsif ($file =~ m:^((.*/doc)/HTML/([^/@]+)[^/]*)/([^/_]+).*:) {
+            if (!$withhtml) {
+                return;
+            }
+            my ($pkg, $lang, $parent, $langfile) = ($4, $3, $2, $1);
+            if (pkg_match($pkg)) {
+                parent_to_own($langfile, $file, $lang);
+            }
+        } elsif ($file =~ m:^((/+usr/share/man)/([^/@\.]+)[^/]*)/man[^/]+/([^/.]+)\.\d[^/]*:) {
+            if (!$withman) {
+                return;
+            }
+            my ($pkg, $lang, $parent, $langfile) = ($4, $3, undef, $1);
+            $file =~ s/\.[^\.]+$//;
+            $file .= '.*';
+            if (pkg_match($pkg)) {
+                parent_to_own($langfile, $file, $lang);
+            }
+        } else {
+            return;
+        }
+    },
+    $buildroot || '/'
+);
+
+open(my $hlang, '>', "$pkgname.lang") or die "canno't open $pkgname.lang\n";
+
+foreach my $f (sort keys %finallist) {
+    my ($lang, @otherlang) = keys %{ $finallist{$f}{'lang'} || {}};
+    my $l = sprintf("%s%s%s",
+        $finallist{$f}{'dir'} ? '%dir ' : '',
+        @otherlang == 0 && $lang && $lang ne 'C'
+            ? "%lang($lang) "
+            : '', # skip if multiple lang, 'C' or dir
+        $f
+    );
+    debug('OUT: %s', $l);
+    print $hlang "$l\n";
+
+}
+
+close($hlang);
+
+exit(0);
+
+sub pkg_match {
+    my ($pkg) = @_;
+    if ($allname) { return 1 };
+    if (grep { $_ eq $pkg } @searchname) {
+        return 1;
+    }
+    return;
+}
+
+sub own_file {
+    my ($file, $lang) = @_;
+    $finallist{$file}{'lang'}{$lang} = 1;
+}
+
+sub parent_to_own {
+    my ($parent, $file, $lang) = @_;
+    debug("parent_to_own: $parent, $file, $lang");
+    if ($allname) {
+        #my @subdir = grep { $_ } split('/', substr($file, length($parent)));
+        #$parent .= '/' . shift(@subdir);
+        $finallist{$parent}{'lang'}{$lang} = 1;
+        debug("Parent %s will be %s", $parent, $lang);
+    } else {
+    my @subdir = grep { $_ } split('/', substr($file, length($parent)));
+    pop(@subdir);
+    $finallist{$parent}{dir} = 1;
+    $finallist{$parent}{'lang'}{$lang} = 1;
+    debug("Parent %s will be %s", $parent, $lang);
+    while (my $part = shift(@subdir)) {
+        $parent .= "/$part";
+        $finallist{$parent}{dir} = 1;
+        $finallist{$parent}{'lang'}{$lang} = 1;
+        debug("Parent %s will be %s", $parent, $lang);
+    }
+        own_file($file, $lang);
+        debug("Parent %s will be %s", $file, $lang);
+
+    }
+}

Added: rpm/rpm-setup/trunk/find-provides.in
===================================================================
--- rpm/rpm-setup/trunk/find-provides.in	                        (rev 0)
+++ rpm/rpm-setup/trunk/find-provides.in	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+# This script reads filenames from STDIN and outputs any relevant provides
+# information that needs to be included in the package.
+
+filelist=`sed "s/['\"]/\\\&/g"`
+
+solist=$(echo "$filelist" | egrep -v "^/lib/ld\.so|/usr/lib(64)?/gcj/" | egrep '(/usr(/X11R6)?)?/lib(64)?/.*\.so' | \
+	xargs file -L 2>/dev/null | grep "ELF.*shared object" | cut -d: -f1)
+pythonlist=
+tcllist=
+rubygemlist=$(echo "$filelist"| egrep "\.gemspec$")                                                                                                         
+
+#
+# --- Alpha does not mark 64bit dependencies
+case `uname -m` in
+  alpha*)	mark64="" ;;
+  *)		mark64="()(64bit)" ;;
+esac
+
+#
+# --- Library sonames and weak symbol versions (from glibc).
+for f in $solist; do
+    soname=$(objdump -p $f 2>/dev/null | awk '/SONAME/ {print $2}')
+
+    lib64=`if file -L $f 2>/dev/null | \
+	grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
+    if [ "$soname" != "" ]; then
+	if [ ! -L $f ]; then
+	    echo $soname$lib64
+	    objdump -p $f 2>/dev/null | awk '
+		BEGIN { START=0 ; }
+		/Version definitions:/ { START=1; }
+		/^[0-9]/ && (START==1) { print $4; }
+		/^$/ { START=0; }
+	    ' | \
+		grep -v $soname | \
+		while read symbol ; do
+		    echo "$soname($symbol)`echo $lib64 | sed 's/()//'`"
+		done
+	fi
+    else
+	echo ${f##*/}$lib64
+    fi
+done | sort -u
+
+#
+# --- Perl modules.
+[ -x @RPMVENDORDIR@/perl.prov ] &&
+    echo "$filelist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/perl.prov | grep 'perl([[:upper:]]' | sort -u
+
+#
+# --- Python modules.
+[ -x @RPMVENDORDIR@/pythoneggs.py -a -n "$filelist" ] &&
+    echo "$filelist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/pythoneggs.py --provides | sort -u
+
+#
+# --- Tcl modules.
+[ -x @RPMVENDORDIR@/tcl.prov -a -n "$tcllist" ] &&
+    echo "$tcllist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/tcl.prov | sort -u
+
+#
+# --- Php modules.
+[ -x @RPMVENDORDIR@/php.prov ] &&
+    echo "$filelist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/php.prov | sort -u
+
+#
+# --- Kernel modules.
+[ -x @RPMVENDORDIR@/kmod.prov ] &&
+    echo "$filelist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/kmod.prov | sort -u
+
+#
+# --- Pkgconfig deps
+[ -x @RPMVENDORDIR@/pkgconfigdeps.sh ] &&
+    echo "$filelist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/pkgconfigdeps.sh -P | sort -u
+
+if [ -n "$LIBTOOLDEP" ]; then
+#
+# --- libtooldep deps
+[ -x @RPMLIBDIR@/libtooldeps.sh ] &&
+    echo "$filelist" | tr '[:blank:]' \\n | @RPMLIBDIR@/libtooldeps.sh -P | sort -u
+
+fi
+
+#
+# --- Ruby gems
+[ -x @RPMVENDORDIR@/rubygems.rb -a -n "$rubygemlist" ] &&
+    echo $rubygemlist | tr '[:blank:]' \\n | @RPMVENDORDIR@/rubygems.rb --provides | sort -u
+
+#
+# --- .so files.
+for i in `echo $filelist | tr '[:blank:]' "\n" | egrep '(/usr(/X11R6)?)?/lib(|64)(/gcc(-lib)?/.+)?/[^/]+\.so$'`; do
+    objd=`objdump -p ${i} | grep SONAME`
+    [ -h ${i} -a -n "${objd}" ] && \
+    lib64=`if file -L $i 2>/dev/null | grep "ELF 64-bit" >/dev/null; then echo "(64bit)"; fi` && \
+    echo ${objd} | perl -p -e "s/.*SONAME\s+(\S+)\.so.*/devel(\1$lib64)/g"
+done | sort -u
+
+#
+# --- mono provides
+if [ -x /usr/bin/mono-find-provides ]; then
+echo $filelist | tr '[:blank:]' '\n' | /usr/bin/mono-find-provides
+fi
+
+
+#
+# --- haskell provides
+if [ -x /usr/bin/haskell-find-provides ]; then
+echo $filelist | tr '[:blank:]' '\n' | /usr/bin/haskell-find-provides
+fi
+
+#
+# --- gstreamer modules.
+[ -x @RPMVENDORDIR@/gstreamer.prov ] &&
+    echo "$solist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/gstreamer.prov | sort -u
+
+exit 0


Property changes on: rpm/rpm-setup/trunk/find-provides.in
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/find-provides.perl.in
===================================================================
--- rpm/rpm-setup/trunk/find-provides.perl.in	                        (rev 0)
+++ rpm/rpm-setup/trunk/find-provides.perl.in	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+exec @RPMVENDORDIR@/find-provides
+


Property changes on: rpm/rpm-setup/trunk/find-provides.perl.in
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/find-requires.in
===================================================================
--- rpm/rpm-setup/trunk/find-requires.in	                        (rev 0)
+++ rpm/rpm-setup/trunk/find-requires.in	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,289 @@
+#!/bin/bash
+
+#
+# Auto-generate requirements for ELF executables and library
+# sonames, script interpreters, and perl modules.
+#
+
+ulimit -c 0
+
+#
+# --- Set needed to 0 for traditional find-requires behavior.
+needed=1
+if [ X"$3" = Xldd ]; then
+    needed=0
+elif [ X"$3" = Xobjdump ]; then
+    needed=1
+fi
+
+# --- Mageia specific part
+case "$LD_PRELOAD" in
+    *libfakeroot*)
+	unset LD_PRELOAD
+	;;
+esac
+
+RPM_BUILD_ROOT=$1
+RPM_ARCH=$2
+
+if [ -n "$RPM_BUILD_ROOT" ]; then
+    lib_path_64=$RPM_BUILD_ROOT/usr/X11R6/lib64:$RPM_BUILD_ROOT/usr/lib64:$RPM_BUILD_ROOT/lib64
+    lib_path_32=$RPM_BUILD_ROOT/usr/X11R6/lib:$RPM_BUILD_ROOT/usr/lib:$RPM_BUILD_ROOT/lib
+    LD_LIBRARY_PATH=$lib_path_64:$lib_path_32
+    export LD_LIBRARY_PATH
+fi
+
+
+#
+# --- Grab the file manifest and classify files.
+#filelist=`sed "s/['\"]/\\\&/g"`
+filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"`
+exelist=`echo "$filelist" | xargs -r file | egrep -v ":.* (commands|script) " | \
+	grep ":.*ELF.*executable" | cut -d: -f1`
+scriptlist=`echo "$filelist" | grep -v /usr/doc | grep -v /usr/share/doc | xargs -r file | \
+	egrep ":.* (commands|script) " | cut -d: -f1`
+liblist=`echo "$filelist" | egrep -v "/usr/lib(64)?/gcj/" | xargs -r file | \
+	grep ":.*shared object" | cut -d : -f1`
+ocamllist=`echo "$filelist" | xargs -r file | \
+    grep ":.*Objective caml interface file" | cut -d : -f1`
+phplist=`echo "$filelist" | grep -v /usr/doc | grep -v /usr/share/doc | egrep "\.php$"`
+
+interplist=
+perllist=
+pythonlist=
+tcllist=
+rubygemlist=`echo "$filelist"| egrep "\.gemspec$"`
+
+uniqdeplist=
+
+#
+# --- Alpha does not mark 64bit dependencies
+case `uname -m` in
+  alpha*)	mark64="" ;;
+  *)		mark64="()(64bit)" ;;
+esac
+
+if [ "$needed" -eq 0 ]; then
+#
+# --- Executable dependency sonames.
+  for f in $exelist; do
+    [ -r $f -a -x $f ] || continue
+    lib64=`if file -L $f 2>/dev/null | \
+	grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
+    ldd $f | awk '/=>/ {
+	if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/) {
+	    gsub(/'\''"/,"\\&",$1);
+	    printf "%s'$lib64'\n", $1
+	}
+    }'
+  done | xargs -r -n 1 basename | sort -u | grep -v 'libsafe|libfakeroot'
+
+#
+# --- Library dependency sonames.
+  for f in $liblist; do
+    [ -r $f ] || continue
+    lib64=`if file -L $f 2>/dev/null | \
+	grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
+    ldd $f | awk '/=>/ {
+	if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/) {
+	    gsub(/'\''"/,"\\&",$1);
+	    printf "%s'$lib64'\n", $1
+	}
+    }'
+  done | xargs -r -n 1 basename | sort -u | grep -v 'libsafe|libfakeroot'
+fi
+
+#
+# --- Perl or python deps
+perlepoch=`rpm -q --qf '%|EPOCH?{[%{EPOCH}]:}|' perl-base`
+if [ $? != 0 ]; then
+	unset perlepoch
+fi
+
+tmpdeplist=
+for f in $filelist; do
+    dep="`echo $f | sed -n -e "s at .*/usr/lib/perl5/\(vendor_perl/\|site_perl/\|\)\([.0-9]\{1,\}\).*\\$@perl-base >= $perlepoch\2 at p"`"
+    if [[ -n $dep && -z `echo $uniqdeplist $tmpdeplist|grep "$dep"` ]]; then
+	tmpdeplist+="$dep\n"
+    fi
+done
+echo -n -e $tmpdeplist | sort -u
+uniqdeplist+="$tmpdeplist"
+
+
+#
+# --- Script interpreters.
+for f in $scriptlist; do
+    [ -r $f -a -x $f ] || continue
+    interp=`head -n 1 $f | grep '^#!' | sed -e 's/^\#\![ 	]*//' | cut -d" " -f1`
+    interplist="$interplist $interp"
+    case $interp in
+    */perl)	perllist="$perllist $f" ;;
+    esac
+done
+if [ -n "$interplist" ]; then
+    tmpdeplist=
+    for i in `echo "$interplist" | tr '[:blank:]' \\\n `; do
+        dep=`rpm -qf $i --qf '%{name}\n'` && i=$dep
+	if [[ -z `echo $uniqdeplist $tmpdeplist|grep "$i"` ]]; then
+	    tmpdeplist+="$i\n"
+	fi
+    done
+    echo -n -e $tmpdeplist | sort -u | grep -v 'libsafe|libfakeroot'
+    uniqdeplist="$tmpdeplist"
+fi
+
+#
+# --- Add perl module files to perllist.
+for f in $filelist; do
+    [ -r $f -a "${f%.pm}" != "${f}" ] && perllist="$perllist $f"
+done
+
+#
+# --- Weak symbol versions (from glibc).
+[ -n "$mark64" ] && mark64="(64bit)"
+for f in $liblist $exelist ; do
+    [ -r $f ] || continue
+    lib64=`if file -L $f 2>/dev/null | \
+	grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
+    objdump -p $f | awk 'BEGIN { START=0; LIBNAME=""; needed='$needed'; }
+	/^$/ { START=0; }
+	/^Dynamic Section:$/ { START=1; }
+	(START==1) && /NEEDED/ {
+	    if (needed) {
+		if ("'$lib64'" != "") {
+		    sub(/$/, "()'$lib64'", $2) ;
+		}
+		print $2 ;
+	    }
+	}
+	(START==1) && /GNU_HASH/ {
+	    print "rtld(GNU_HASH)";
+	}
+	/^Version References:$/ { START=2; }
+	(START==2) && /required from/ {
+	    sub(/:/, "", $3);
+	    LIBNAME=$3;
+	}
+	(START==2) && (LIBNAME!="") && ($4!="") && (($4~/^GLIBC_*/) || ($4~/^GCC_*/)) {
+	    print LIBNAME "(" $4 ")'$lib64'";
+	}
+    '
+done | sort -u | grep -v 'libsafe|libfakeroot'
+
+# --- OCaml dependency
+if [ -x /usr/bin/ocamlc -a -n "$ocamllist" ]; then
+   version=`ocamlc -v | grep version | awk '{print $6}' | sed -e 's/+/./'`
+   echo "ocaml = $version"
+fi
+
+#
+# --- Perl modules.
+perlmeta=$( echo $filelist | tr '[:blank:]' \\n | egrep 'doc/[^/]+/META.(yml|json)$' | head -1 )
+if [ -n "$perlmeta" ]
+then
+    [ -x @RPMVENDORDIR@/perl.req-from-meta ] && \
+	@RPMVENDORDIR@/perl.req-from-meta $perlmeta
+else
+    [ -x @RPMVENDORDIR@/perl.req -a -n "$perllist" ] && \
+	echo $perllist | tr '[:blank:]' \\n | @RPMVENDORDIR@/perl.req | grep 'perl([[:upper:]]' | egrep -v '^perl\((Be|FreeBSD|HPUX|Mac|MSDOS|MVS|OS2|Riscos|SGI|Solaris|VMS|Win32|WinNT)::' | sort -u
+fi
+
+#
+# --- If libperl.so exists and if XS modules are found, depend on perlapi-<version> and libperl.so
+if [ -n "$perllist" ]; then
+    if perl -V:useshrplib | grep -q true ; then
+	if echo $perllist | grep -q `perl -MConfig -e 'print $Config{archname}'` ; then
+            version=`perl -MConfig -e 'print $Config{version}'`
+            echo perlapi-$version
+
+	    f=`perl -MConfig -e 'print $Config{archlib}'`/CORE/libperl.so
+	    lib64=`if file -L $f 2>/dev/null | \
+		grep "ELF 64-bit" >/dev/null; then echo "()$mark64"; fi`
+	    echo libperl.so$lib64
+	fi
+    fi
+fi
+
+#
+# --- Python modules.
+[ -x @RPMVENDORDIR@/pythoneggs.py -a -n "$filelist" ] && \
+    echo $filelist | tr '[:blank:]' \\n | @RPMVENDORDIR@/pythoneggs.py --requires | sort -u
+
+#
+# --- Tcl modules.
+[ -x @RPMVENDORDIR@/tcl.req -a -n "$tcllist" ] && \
+    echo $tcllist | tr '[:blank:]' \\n | @RPMVENDORDIR@/tcl.req | sort -u
+
+#
+# --- Php modules.
+[ -x @RPMVENDORDIR@/php.req -a -n "$phplist" ] && \
+    echo $phplist | tr '[:blank:]' \\n | @RPMVENDORDIR@/php.req | sort -u
+
+#
+# --- Pkgconfig deps
+[ -x @RPMVENDORDIR@/pkgconfigdeps.sh ] &&
+    echo "$filelist" | tr '[:blank:]' \\n | @RPMVENDORDIR@/pkgconfigdeps.sh -R | sort -u
+
+
+if [ -n "$LIBTOOLDEP" ]; then
+#
+# --- libtooldep deps
+[ -x @RPMLIBDIR@/libtooldeps.sh ] &&
+    echo "$filelist" | tr '[:blank:]' \\n | @RPMLIBDIR@/libtooldeps.sh -R | sort -u
+
+fi
+
+#
+# --- Ruby gems
+[ -x @RPMVENDORDIR@/rubygems.rb -a -n "$rubygemlist" ] &&
+    echo $rubygemlist | tr '[:blank:]' \\n | @RPMVENDORDIR@/rubygems.rb --requires | sort -u
+
+#
+# --- .so files.
+for i in `echo $filelist | tr '[:blank:]' "\n" | egrep "(/usr(/X11R6)?)?/lib(|64)/[^/]+\.so$"`; do
+    objd=`objdump -p ${i} | grep SONAME`
+    lib64=`if file -L $i 2>/dev/null | grep "ELF 64-bit" >/dev/null; then echo "(64bit)"; fi` && \
+    if [ -h ${i} -a -n "${objd}" ]; then
+      if [ "$needed" -eq 0 ]; then
+       ldd ${i} \
+       | grep -v "statically linked" \
+       | grep -v "/\(lib\|lib64\)/\(ld\|ld64\|ld-linux.*\)\.so" \
+       | perl -p -e "s/\s+(\S+)\.so.*/devel(\1$lib64)/g"
+      else
+       objdump -p $i | grep -v "\(ld\|ld64\|ld-linux.*\)\.so" \
+                     | awk 'BEGIN { START=0; }
+       /^$/ { START=0; }
+       /^Dynamic Section:$/ { START=1; }
+       (START==1) && /NEEDED/ {
+           sub(/^/, "devel(", $2) ;
+           sub(/\.so.*$/, "'$lib64')", $2) ;
+           print $2 ;
+       }
+       '
+      fi
+    fi
+done | egrep -v 'devel\(linux-gate|linux-vdso32|linux-vdso64|lib(c|pthread|rt)(\(64bit\))?\)' | sort -u
+
+#
+# --- pkgconfig
+echo $filelist |  tr '[:blank:]' '\n' | egrep -q '/usr/(share|lib(64)?)/pkgconfig/.*\.pc' && echo pkgconfig
+
+#
+# --- multiarch-utils
+echo $filelist |  tr '[:blank:]' '\n' | grep -q '/multiarch-.*-linux/' && echo multiarch-utils
+
+#
+# --- mono requires
+if [ -x /usr/bin/mono-find-requires ]; then
+echo $filelist | tr '[:blank:]' '\n' | /usr/bin/mono-find-requires
+fi
+
+#
+# haskell requires
+if [ -x /usr/bin/haskell-find-requires ]; then
+echo $filelist | tr '[:blank:]' '\n' | /usr/bin/haskell-find-requires
+fi
+
+
+exit 0


Property changes on: rpm/rpm-setup/trunk/find-requires.in
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/gem_helper.rb
===================================================================
--- rpm/rpm-setup/trunk/gem_helper.rb	                        (rev 0)
+++ rpm/rpm-setup/trunk/gem_helper.rb	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,173 @@
+#!/usr/bin/env ruby
+#--
+# Copyright 2010 Per Øyvind Karlsen <peroyvind at mandriva.org>
+# This program is free software. It may be redistributed and/or modified under
+# the terms of the LGPL version 2.1 (or later).
+#++
+
+require 'optparse'
+
+if ARGV[0] == "build" or ARGV[0] == "install"
+  require 'yaml'
+  require 'zlib'
+
+  filter = nil
+  opts = nil
+  keepcache = false
+  fixperms = false
+  gemdir = nil
+  dry_run = false
+  files = []
+  argv = ARGV[1..-1]
+  # Push this into some environment variables as the modified classes doesn't
+  # seem to be able to access our global variables.. </lameworkaround>
+  ENV['GEM_MODE'] = ARGV[0]
+  if ARGV[0] == "build"
+    opts = OptionParser.new("#{$0} <--filter PATTERN>")
+    opts.on("-f", "--filter PATTERN", "Filter pattern to use for gem files") do |val|
+      filter = val
+    end
+    opts.on("-j", "--jobs JOBS", "Number  of  jobs to run simultaneously.") do |val|
+      ENV['jobs'] = "-j"+val
+    end
+    opts.on("--dry-run", "Only show the files the gem will include") do
+      ARGV.delete("--dry-run")
+      dry_run = true
+    end
+  elsif ARGV[0] == "install"
+    opts = OptionParser.new("#{$0} <--keep-cache>")
+    opts.on("--keep-cache", "Don't delete gem copy from cache") do
+      ARGV.delete("--keep-cache")
+      keepcache = true
+    end
+    opts.on("--fix-permissions", "Force standard permissions for files installed") do
+      ARGV.delete("--fix-permissions")
+      fixperms = true
+    end    
+    opts.on("-i", "--install-dir GEMDIR", "Gem repository directory") do |val|
+      gemdir = val
+    end
+  end
+  while argv.length > 0
+    begin
+      opts.parse!(argv)
+    rescue OptionParser::InvalidOption => e
+      e.recover(argv)
+    end
+    argv.delete_at(0)
+  end
+
+  file_data = Zlib::GzipReader.open("metadata.gz")
+  header = YAML::load(file_data)
+  file_data.close()
+  body = header.instance_variable_get :@ivars
+
+  require 'rubygems'
+  spec = Gem::Specification.from_yaml(YAML.dump(header))
+
+  if ARGV[0] == "install"
+    system("gem %s %s.gem" % [ARGV.join(' '), spec.full_name])
+    if !keepcache
+      require 'fileutils'
+      FileUtils.rm_rf("%s/cache" % gemdir)
+    end
+    if fixperms
+      chmod = "chmod u+r,u+w,g-w,g+r,o+r -R %s" % gemdir
+      print "\nFixing permissions:\n\n%s\n" % chmod
+      system("%s" % chmod)
+      print "\n"
+    end
+  end
+
+  if body['extensions'].size > 0
+    require 'rubygems/ext'
+    module Gem::Ext
+      class Builder
+	def self.make(dest_path, results)
+	  make_program = ENV['make']
+	  unless make_program then
+	    make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
+	  end
+	  cmd = make_program
+	  if ENV['GEM_MODE'] == "build"
+  	    cmd += " %s" % ENV['jobs']
+	  elsif ENV['GEM_MODE'] == "install"
+	    cmd += " DESTDIR='%s' install" % ENV['DESTDIR']
+	  end
+	  results << cmd
+	  results << `#{cmd} #{redirector}`
+
+	  raise Gem::ExtensionBuildError, "make failed:\n\n#{results}" unless
+	  $?.success?
+	end
+      end
+    end
+
+    require 'rubygems/installer'
+    module Gem
+      class Installer
+      	def initialize(spec, options={})
+	  @gem_dir = Dir.pwd
+      	  @spec = spec
+	end
+      end
+      class ConfigFile
+	def really_verbose
+	  true
+	end
+      end
+    end
+
+    unless dry_run
+      Gem::Installer.new(spec).build_extensions
+    else
+      for ext in body['extensions']
+	files.push(ext[0..ext.rindex("/")-1]+".so")
+      end
+    end
+
+    body['extensions'].clear()
+  end
+  if ARGV[0] == "build"
+    body['test_files'].clear()
+
+    # We don't want ext/ in require_paths, it will only contain content for
+    # building extensions which needs to be installed in sitearchdir anyways..
+    idx = 0
+    for i in 0..body['require_paths'].size()-1
+      if body['require_paths'][idx].match("^ext(/|$)")
+	body['require_paths'].delete_at(idx)
+      else
+	idx += 1
+      end
+    end
+
+    # We'll get rid of all the files we don't really need to install
+    idx = 0
+    for i in 0..body['files'].size()-1
+      if filter and body['files'][idx].match(filter)
+	match = true
+      else
+	match = false
+	for path in body['require_paths']
+	  if body['files'][idx].match("^%s/" % path)
+	    match = true
+	  end
+	end
+      end
+      if !match
+	body['files'].delete_at(idx)
+      else
+	idx += 1
+      end
+    end
+
+    spec = Gem::Specification.from_yaml(YAML.dump(header))
+    unless dry_run
+      Gem::Builder.new(spec).build
+    else
+      files.concat(spec.files)
+      print "%s\n" % files.join("\n")
+    end
+  end
+end


Property changes on: rpm/rpm-setup/trunk/gem_helper.rb
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/git-repository--after-tarball
===================================================================
--- rpm/rpm-setup/trunk/git-repository--after-tarball	                        (rev 0)
+++ rpm/rpm-setup/trunk/git-repository--after-tarball	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,70 @@
+#!/bin/sh -ex
+
+# usage: git-repository--after-tarball [<tarballs>]
+# with optional environment variables:
+# - GIT_URL="git://xxx/foo.git [branch]"
+# - GIT_REPOSITORY_CACHE=/zzz/foo.git
+#
+# the GIT_REPOSITORY_CACHE can be used with or without GIT_URL
+# - if GIT_URL is given, GIT_REPOSITORY_CACHE will be a "bare" clone of GIT_URL
+# - otherwise, GIT_REPOSITORY_CACHE can be created using:
+#   % git clone --bare BUILD/foo-1 $GIT_REPOSITORY_CACHE
+#   where foo-1 is the previous version
+
+
+tarballs="$*"
+
+
+git_clone_in_cwd() {
+    URL=$1
+    [ -n "$2" ] && BRANCH="origin/$2"
+
+    git clone $URL .git-tmp
+
+    cd .git-tmp
+    git checkout $BRANCH
+    cd ..
+
+    mv .git-tmp/.git .
+    rm -r .git-tmp
+}
+
+our_git_clone() {
+    URL=$1
+    HEAD=$2
+
+    if [ -n "$GIT_REPOSITORY_CACHE" ]; then
+      if [ -d "$GIT_REPOSITORY_CACHE" ]; then
+        cd "$GIT_REPOSITORY_CACHE"
+	git fetch $GIT_URL
+        cd -
+      else
+        git clone --bare $URL "$GIT_REPOSITORY_CACHE"	
+      fi
+      git_clone_in_cwd "$GIT_REPOSITORY_CACHE" $HEAD
+    else
+      git_clone_in_cwd $URL $HEAD
+    fi
+}
+
+set_GIT_AUTHOR_DATE() {
+    # taking date of first tarball, sorry for the other tarballs ;)
+    tarball=$1
+    export GIT_AUTHOR_DATE=`stat -c '%y' "$RPM_SOURCE_DIR/$tarball"`
+}
+
+if [ ! -e .git ]; then
+  if [ -n "$GIT_URL" ]; then
+    our_git_clone $GIT_URL
+  elif [ -n "$GIT_REPOSITORY_CACHE" -a -d "$GIT_REPOSITORY_CACHE" ]; then
+    git_clone_in_cwd "$GIT_REPOSITORY_CACHE" vanilla
+  else
+    git init
+  fi
+fi
+git add . 
+set_GIT_AUTHOR_DATE $tarballs
+git commit -q -a --author="unknown author <mageia-dev at mageia.org>" -m "imported $tarballs" 
+git branch -f vanilla
+git branch -f patches-applied
+git checkout patches-applied


Property changes on: rpm/rpm-setup/trunk/git-repository--after-tarball
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/git-repository--apply-patch
===================================================================
--- rpm/rpm-setup/trunk/git-repository--apply-patch	                        (rev 0)
+++ rpm/rpm-setup/trunk/git-repository--apply-patch	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,158 @@
+#!/usr/bin/perl
+
+# this script can be used instead of "/usr/bin/patch [options] -i xxx.patch"
+
+
+use strict;
+use warnings;
+
+my @argv = @ARGV;
+my $verbose;
+
+my @patches;
+while ($argv[-1] =~ /\.(patch|diff)$/) {
+    unshift @patches, pop @argv;
+}
+
+ at patches or die "git-repository--apply-patch can not work with compressed patches\n"; # happens when the patch is passed through stdin
+
+my @opts;
+while (@argv) {
+    my $s = shift @argv;
+    if ($s eq '-b') {
+	# we don't want .xxx files
+    } elsif ($s eq '--suffix') {
+	# we don't want .xxx files
+	shift @argv;
+    } elsif ($s eq '-i') {
+	# ignore "-i"
+    } else {
+	push @opts, $s;
+    }
+}
+
+# we really don't want .orig when using git (even when there are hunks)
+push @opts, '--no-backup-if-mismatch';
+
+foreach my $patch_file (@patches) { 
+    my @header = get_patch_header($patch_file);
+
+    if (grep { /^Subject:/ } @header) {
+	my $patch_file_ = fix_git_patch($patch_file);
+	system_("git am " . ($patch_file_ || $patch_file));
+	$patch_file_ and unlink $patch_file_;
+    } else {
+	system_("patch @opts -i $patch_file");
+
+	my ($patch_name) = $patch_file =~ m!([^/]*)\.(patch|diff)$!;
+
+	system_('git add .');
+	git_commit(commit_line_from_patch_name($patch_name) . 
+		     (@header ? "\n\n" . join('', cleanup_patch_header(@header)) : ''),
+		   # use the date of the patch for the commit:
+		   (stat($patch_file))[9] . " +0000");
+    }
+}
+
+sub system_ {
+    my ($cmd) = @_;
+    print "$cmd\n" if $verbose;
+    system($cmd) == 0 or die "$cmd failed\n";
+}
+
+sub git_commit {
+    my ($msg, $date) = @_;
+
+    $ENV{GIT_AUTHOR_DATE} = $date;
+    open(my $F, '| git commit -q --author="unknown author <mageia-dev at mageia.org>" --file=-');
+    print $F $msg;
+    close $F or die "git commit failed\n";
+}
+
+sub commit_line_from_patch_name {
+    my ($name) = @_;
+
+    # remove prefix (eg: "libtool-1.5.26-xxx" => "xxx")
+    my $re_name = qr([a-z][\w+]*([_-][a-z][\w+]*)*)i;
+    my $re_rc = qr((rc\d*|RC\d+|beta\d*|pre\d*|p\d+|test));
+    my $re_special_version = qr([a-z]([._-]$re_rc?)?|[._-]?$re_rc?|[a-z]);
+    $name =~ s/^ $re_name [._-] \d+ (\.\d+)+ $re_special_version [._-]//x;
+
+    if (my $pkg_name = $ENV{PKG_NAME}) {
+	$name =~ s/^\Q$pkg_name\E[_-]//;
+    }
+	    
+    # replace "-" (resp. "_") with spaces if there is no spaces nor "_" (resp. "-")
+    if ($name !~ /[\s_]/ && $name !~ /--/) {
+	$name =~ s/-/ /g;
+    } elsif ($name !~ /[\s-]/ && $name !~ /__/) {
+	$name =~ s/_/ /g;
+    }
+    $name;
+}
+
+sub get_patch_header { 
+    my ($file) = @_;
+    open(my $F, '<', $file) or die "can not open $file: $!\n";
+
+    my @header;
+    while (my $s = <$F>) {
+	last if $s =~ /^--- /;
+	push @header, $s;
+    }
+    pop @header while @header && $header[-1] !~ /^\s*$/;
+
+    @header;
+}
+
+sub cleanup_patch_header {
+    my (@header) = @_;
+
+    my @r;
+    foreach (@header) {
+	s/^##\s// or last;
+	push @r, $_;
+    }
+    @r == @header and return @r;
+
+    @header;
+}
+
+# "git format-patch" and "git am" do not agree how to handle commit logs when
+# the first line is not separated from the rest.
+# eg:
+#
+# > Subject: [PATCH 01/34] Delay NSS initialization until actually used
+# >  - since NSS is allergic (ie becomes non-functional) after forking, delay
+# >    it's initialization until really needed, ie lazy init in rpmDigestInit()
+#
+# workarounding by transforming header to:
+#
+# > Subject: [PATCH 01/34] Delay NSS initialization until actually used
+# >
+# >  - since NSS is allergic (ie becomes non-functional) after forking, delay
+# >    it's initialization until really needed, ie lazy init in rpmDigestInit()
+sub fix_git_patch {
+    my ($file) = @_;
+    open(my $F, '<', $file) or die "can not open $file: $!\n";
+
+    my ($last_line, @l);
+    while (my $s = <$F>) {
+	push @l, $s;
+
+	if ($s !~ /^\S+:\s/ && $last_line && $last_line =~ /^Subject:/) {
+	    # argh, we are in the header, but the value is weird
+	    # applying the fix
+	    $l[-1] = "\n" . $l[-1];
+	    push @l, <$F>;
+	    output("$file.tmp", @l);
+	    return "$file.tmp";
+	} elsif ($s =~ /^\s*$/ || $s =~ /^--- /) {
+	    last;
+	}
+	$last_line = $s;
+    }
+    undef;
+}
+
+sub output { my $f = shift; open(my $F, '>', $f) or die "output in file $f failed: $!\n"; print $F $_ foreach @_; 1 }


Property changes on: rpm/rpm-setup/trunk/git-repository--apply-patch
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/http.req
===================================================================
--- rpm/rpm-setup/trunk/http.req	                        (rev 0)
+++ rpm/rpm-setup/trunk/http.req	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,165 @@
+#!/usr/bin/perl
+
+# This file can find requirements of html and jhtml files (cgi, gif,
+# java dependencies).  It is a bit of a hack but it turns out to work
+# well.  We track only dependencies between Relative URLs, absolute
+# URL's are assumed to be extenernal to the RPM system.  We do not
+# parse the HTML but look through the set of strings (text surrounded
+# by quotes) for something which looks like a reference.  This avoids
+# writing a full HTML parsers and tends to work really well.  In this
+# manner we can track dependencies for: href, src, action and other
+# HTML tags which have not been invented yet.
+
+
+# The reference:
+#
+#	href="http://www.perl.org/images/arrow.gif"
+#
+# does not create a dependency but the reference
+#
+#	href="images/arrow.gif"
+#
+# will create a dependency.  
+
+# Additionally this program will find the requirements for sun jhtml
+# (html with embedded java) since jhtml is deprecated so is this part
+# of the code.
+
+# These references create dependencies:
+
+#	<form action="signup.jhtml" method="POST">
+#
+#	<img src="images/spacer.gif" width=1>
+#
+#	<A HREF="signup.jhtml">
+#
+#	adWidget.writeAd(out, "login.html", "expired");
+#
+#	response.sendRedirect("http://"+request.getServerName()+"/mailcom/login.jhtml");
+
+
+# Notice how we look for strings WITH the proper ending. This is
+# because the java sometimes has really strange double quoting
+# conventions.  Look at how splitting out the strings in this
+# fragment would get you the wrong text.
+
+#      <img src="`c.getImage("bhunterlogo.gif")`" width=217 >
+
+# Ignore non relative references since these dependencies can not be
+# met. (ie, no package you install will ever provide
+# 'http://www.yahoo.com').
+
+# I use basename since I have seen too many http references which
+# begin with '../' and I can not figure out where the document root
+# is for the webserver this would just kill the dependnecy tracking
+# mechanism.
+
+
+
+use File::Basename;
+
+# this is the pattern of extensions to call requirements
+
+$DEPS_PAT = '\.((cgi)|(ps)|(pdf)|(png)|(jpg)|(gif)|(tiff)|(tif)|(xbm)|(html)|(htm)|(shtml)|(jhtml))'; #'
+
+if ("@ARGV") {
+  foreach (@ARGV) {
+    process_file($_);
+  }
+} else {
+  
+  # notice we are passed a list of filenames NOT as common in unix the
+  # contents of the file.
+  
+  foreach (<>) {
+    process_file($_);
+  }
+}
+
+
+
+foreach $key (sort keys %seen) {
+  print "$key\n";
+}
+
+
+sub process_file {
+
+  my ($file) = @_;
+  chomp $file;
+  
+  open(FILE, "<$file")||
+    die("$0: Could not open file: '$file' : $!\n");
+  
+  # we have to suck in the whole file at once because too many people
+  # split lines around <java></java> tags.
+  
+  my (@file) = <FILE>;
+  
+  $_= "@file";
+
+  # ignore line based comments ( careful although it has two slashes
+  # 'http://www.yahoo.com' is not a comment! )
+
+  s!^\s*//.*$!!mg;
+  s!//\s.*$!!mg;
+  s!\s//.*$!!mg;
+  
+  # ignore multi-line comments 
+  # (use non greedy operators)
+  
+  s!/\*.*?\*/!!g;
+  s/<!--.*?-->//g;
+
+  # Ignore non relative references since these dependencies can not be
+  # met. (ie, no package you install will ever provide
+  # 'http://www.yahoo.com').
+
+  # I use basename since I have seen too many http references which
+  # begin with '../' and I can not figure out where the document root
+  # is for the webserver this would just kill the dependnecy tracking
+  # mechanism.
+
+
+  # Notice how we look for strings WITH the proper ending. This is
+  # because the java sometimes has really strange double quoting
+  # conventions.  Look at how splitting out the strings in this
+  # fragment would get you the wrong text.
+
+  #      <img src="`c.getImage("bhunterlogo.gif")`" width=217 >
+
+  while ( m{\"([^\"]+$DEPS_PAT)\"}g ) {
+    my $string = $1;
+    chomp $string;
+    if ( $string !~ m!http://! ) {
+      $string = basename($string);
+      $string =~ s!\s+!!g;
+      $seen{"http(${string})"} = 1;
+    }
+  }
+
+  {
+
+  # This section is only for use with (Sun) jhtml dependencies, and
+  # since jhtml is deprecated so is this code.
+
+  # java imports in jhtml (may have stars for leaf class)
+  # these may span several lines
+  
+    while (  m!<java type=((import)|(extends))>\s*([^<]+)\s*<!g ) {
+      my $java_list = $4;
+      $java_list =~ s/;/ /g;
+      $java_list =~ s/\n+/ /g;
+      $java_list =~ s/\s+/ /g;
+      foreach $java_class ( split(/\s+/, $java_list) ) {
+	$seen{"java(${java_class})"} = 1;
+      }
+    }
+    
+  }
+
+  close(FILE)||
+    die("$0: Could not close file: '$file' : $!\n");
+  
+  return ;
+}


Property changes on: rpm/rpm-setup/trunk/http.req
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/kmod.prov
===================================================================
--- rpm/rpm-setup/trunk/kmod.prov	                        (rev 0)
+++ rpm/rpm-setup/trunk/kmod.prov	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+provideslist=`sed "s/['\"]/\\\&/g"`
+modulelist=$(echo "$provideslist" | egrep '^.*(/lib/modules/|/var/lib/dkms/).*\.ko(\.gz)?$')
+echo $modulelist | xargs -r /sbin/modinfo | \
+        perl -lne '
+$name = $1 if m!^filename:\s*(?:.*/)?([^/]+)\.k?o!;
+$ver = $1 if /^version:\s*[a-zA-Z]{0,6}\-?(\d+[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*-?[a-zA-Z]{0,6}\d?).*/;
+if (/^vermagic:/) {
+  print "kmod\($name\)" . ($ver ? " = $ver" : "") if $name;
+  undef $name; undef $ver;
+}
+'
+dkmslist=$(echo "$provideslist" | egrep '(/var/lib/dkms-binary/[^/]+/[^/]+|/usr/src)/[^/]+/dkms.conf$')
+[ -n "$dkmslist" ] && for d in $dkmslist; do
+    VERSION=`sed -rne 's/^PACKAGE_VERSION="?([^"]+)"?$/\1/;T;p' $d`
+    [ -z "$VERSION" ] && continue
+    PACKAGE_NAME=`sed -rne 's/^PACKAGE_NAME="?([^"]+)"?$/\1/;T;p' $d`
+    MODULES=`sed -rne 's/^DEST_MODULE_NAME\[[0-9]+\]="?([^"]+)"?$/\1/;T;p' $d`
+    [ -z "$MODULES" ] && MODULES=`sed -rne 's/^BUILT_MODULE_NAME\[[0-9]+\]="?([^"]+)"?$/\1/;T;p' $d`
+    # default on PACKAGE_NAME if no BUILT_MODULE_NAME is specified
+    [ -z "$MODULES" ] && MODULES=$PACKAGE_NAME
+    echo "$MODULES" | sed -re "s/\\\$PACKAGE_NAME/$PACKAGE_NAME/" | while read m; do
+	echo "kmod($m) = $VERSION"
+    done
+done


Property changes on: rpm/rpm-setup/trunk/kmod.prov
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/macros-perarch.in
===================================================================
--- rpm/rpm-setup/trunk/macros-perarch.in	                        (rev 0)
+++ rpm/rpm-setup/trunk/macros-perarch.in	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,22 @@
+# Per-platform rpm configuration file.
+# $Id: macros-perarch.in 233523 2008-01-28 17:41:27Z pixel $
+
+#==============================================================================
+# ---- per-platform macros.
+#
+%_arch			@RPMARCH@
+%_os			@RPMOS@
+%optflags		@RPMOPTFLAGS@
+
+#==============================================================================
+# ---- configure macros.
+#
+%_lib			@LIB@
+
+ at MULTILIBSTART@
+#---------------------------------------------------------------------
+#	Multilibs
+%_multilibno		@MULTILIBNO@
+%_multilibpatt		(/%{_lib}|/usr/%{_lib}(|/gconv)|/usr/local/%{_lib}|/usr/X11R6/%{_lib}|/opt/%{_lib})/[^/]*\\.([oa]|la|so[0-9.]*)$
+ at MULTILIBEND@
+

Added: rpm/rpm-setup/trunk/macros.in
===================================================================
--- rpm/rpm-setup/trunk/macros.in	                        (rev 0)
+++ rpm/rpm-setup/trunk/macros.in	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,56 @@
+# @RPMVENDORDIR@/macros:
+# Main Mangeia rpm configuration
+# Only modified macros goes here
+#
+# $Id: macros.in 260920 2009-09-25 10:10:18Z blino $
+#
+# This is a global RPM configuration file. All changes made here will
+# be lost when the rpm package is upgraded. Any per-system configuration
+# should be added to /etc/rpm/macros, while per-user configuration should
+# be added to ~/.rpmmacros.
+
+%_host_vendor @RPMCANONVENDOR@
+%_real_vendor @RPMCANONVENDOR@
+
+%_vendor @RPMVENDOR@
+
+%_gnu @CANONTARGETGNU@
+%_target_platform	%{_target_cpu}-%{_real_vendor}-%{_target_os}%{?_gnu}
+
+%_host %{_host_cpu}-%{_real_vendor}-%{_host_os}
+
+%_changelog_truncate	3 years ago
+
+# use LZMA to compress binary packages:
+%_binary_payload w5.lzdio
+
+#==============================================================================
+# ---- GPG/PGP/PGP5 signature macros.
+#	Macro(s) to hold the arguments passed to GPG/PGP for package
+#	signing and verification.
+#
+
+# We disable the gpg key automatic querying 
+%_hkp_keyserver_query   %nil
+
+
+#	Verify digest/signature flags for various rpm modes:
+#	0x30300 (_RPMVSF_NODIGESTS)    --nohdrchk      if set, don't check digest(s)
+#	0xc0c00 (_RPMVSF_NOSIGNATURES) --nosignature   if set, don't check signature(s)
+#	0xf0000 (_RPMVSF_NOPAYLOAD)    --nolegacy      if set, check header+payload (if possible)
+#	0x00f00 (_RPMVSF_NOHEADER)     --nohdrchk      if set, don't check rpmdb headers
+%_vsflags_query		0xc0c00
+
+
+#	Open all indices before doing chroot(2).
+#
+%_openall_before_chroot	1
+
+%_repackage_all_erasures	0
+
+%_query_all_fmt		%%{name}-%%{version}-%%{release}
+
+%_rpmlock_path  %{_dbpath}/__db.000
+
+# activate filetriggers (cf http://wiki.mandriva.com/en/Rpm_filetriggers)
+%_filetriggers_dir /var/lib/rpm/filetriggers

Added: rpm/rpm-setup/trunk/magic.prov
===================================================================
--- rpm/rpm-setup/trunk/magic.prov	                        (rev 0)
+++ rpm/rpm-setup/trunk/magic.prov	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,167 @@
+#!/usr/bin/perl
+
+use File::Basename;
+use Getopt::Long;
+
+# this dependency analysis program is the only one which need to know
+# the RPM buildroot to do its work.
+
+# Figuring out what files are really executables via magic numbers is
+# hard.  Not only is every '#!' an executable of some type (with a
+# potentially infinite supply of interpreters) but there are thousands
+# of valid binary magic numbers for old OS's and old CPU types.
+
+# Permissions do not always help discriminate binaries from the rest
+# of the files, on Solaris the shared libraries are marked as
+# 'executable'.
+
+#	-rwxr-xr-x   1 bin      bin      1013248 Jul  1  1998 /lib/libc.so.1
+
+# I would like to let the 'file' command take care of the magic
+# numbers for us. Alas! under linux file prints different kind of
+# messages for each interpreter, there is no common word 'script' to
+# look for.
+
+#	' perl commands text'
+#	' Bourne shell script text'
+#	' a /usr/bin/wish -f script text'
+
+# WORSE on solaris there are entries which say:
+
+# 	' current ar archive, not a dynamic executable or shared object' 
+
+# how do I grep for 'executable' when people put a 'not executable' in
+# there?  I trim off everything after the first comma (if there is
+# one) and if the result has the string 'executable' in it then it may
+# be one.
+
+
+# so we must also do some magic number processing ourselves, and be
+# satisfied with 'good enough'.
+
+# I look for files which have atleast one of the executable bits set
+# and are either labled 'executable' by the file command (see above
+# restriction) OR have a '#!' as their first two characters.
+
+
+$is_mode_executable=oct(111);
+
+# set a known path
+  
+$ENV{'PATH'}= (
+	       ':/usr/bin'.
+	       ':/bin'.
+	       '');
+
+# taint perl requires we clean up these bad environmental variables.
+  
+delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
+
+$BUILDROOT = '';
+%option_linkage = (
+		   "buildroot" => \$BUILDROOT,
+		  );
+
+if( !GetOptions (\%option_linkage, "buildroot=s") ) {
+  die("Illegal options in \@ARGV: '@ARGV'\n");
+
+}
+
+if ($BUILDROOT == '/') {
+  $BUILDROOT = '';
+}
+
+if ("@ARGV") {
+  foreach (@ARGV) {
+    process_file($_);
+  }
+} else {
+  
+  # notice we are passed a list of filenames NOT as common in unix the
+  # contents of the file.
+  
+  foreach (<>) {
+    process_file($_);
+  }
+}
+
+
+foreach $module (sort keys %provides) {
+  print "executable($module)\n";
+}
+
+exit 0;
+
+
+
+
+sub is_file_script {
+  
+  my ($file) = @_;
+  chomp $file;
+  
+  my $out = 0;
+  open(FILE, "<$file")||
+    die("$0: Could not open file: '$file' : $!\n");
+  
+  my $rc = sysread(FILE,$line,2);
+  
+  if ( ($rc > 1) && ($line =~ m/^\#\!/) ) {
+    $out = 1;
+  } 
+
+  close(FILE) ||
+    die("$0: Could not close file: '$file' : $!\n");
+  
+  return $out; 
+}
+
+
+
+sub is_file_binary_executable {
+  my ($file) = @_;
+
+  $file_out=`file $file`;
+  # trim off any extra descriptions.
+  $file_out =~ s/\,.*$//;
+  
+  my $out = 0;
+  if ($file_out =~ m/executable/ ) {
+    $out = 1;
+  }
+  return $out;
+}
+
+
+sub process_file {
+  my ($file) = @_;
+  chomp $file;
+
+  my $prov_name = $file;
+  $prov_name =~ s!^$BUILDROOT!!;
+
+  # If its a link find the file it points to.  Dead links do not
+  # provide anything.
+
+  while (-l $file) {
+    my $newfile = readlink($file);
+    if ($newfile !~ m!^/!) {
+      $newfile = dirname($file).'/'.$newfile;
+    } else {
+      $newfile = $BUILDROOT.$newfile;
+    }
+    $file = $newfile;
+  }
+
+  (-f $file) || return ;  
+  ( (stat($file))[2] & $is_mode_executable ) || return ;
+
+  is_file_script($file) || 
+    is_file_binary_executable($file) || 
+      return ;
+
+  $provides{$prov_name}=1;
+  $provides{basename($prov_name)}=1;
+    
+  return ; 
+}


Property changes on: rpm/rpm-setup/trunk/magic.prov
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/magic.req
===================================================================
--- rpm/rpm-setup/trunk/magic.req	                        (rev 0)
+++ rpm/rpm-setup/trunk/magic.req	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,143 @@
+#!/usr/bin/perl
+
+# Given a list of filenames on the command line or on stdin this
+# script returns the interpreter that is required to run the
+# filenames.  Usually this is extracted from the #! line of the file
+# but we also handle the various 'exec' tricks that people use to
+# start the interpreter via an intermediate shell.  
+
+# Also we want to convert:
+# 	/usr/local/bin/perl5.00404 
+# 	/usr/local/bin/tclsh8.0 
+# into dependencies with RPM version numbers.
+
+
+
+
+
+# These have all been seen on our system or are "recommended" in
+# various man pages.
+
+# Examples:
+
+#   #!/bin/sh
+#   # the next line restarts using wish \
+#   exec wish "$0" "$@"
+
+
+#   #!/bin/sh -- # -*- perl -*- -p
+#     eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
+#       if $running_under_some_shell;
+
+
+#   #!/bin/sh -- # -*- perl -*- -p
+#   eval '(exit $?0)' && eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
+
+
+#   #!/bin/sh -- # -*- perl -*- -p
+#   & eval 'exec /usr/bin/perl -wS $0 $argv:q'
+#     if $running_under_some_shell;
+
+
+#   #! /usr/bin/env python
+
+
+use File::Basename;
+
+if ("@ARGV") {
+  foreach (@ARGV) {
+    process_file($_);
+  }
+} else {
+  
+  # notice we are passed a list of filenames NOT as common in unix the
+  # contents of the file.
+  
+  foreach (<>) {
+    process_file($_);
+  }
+}
+
+
+foreach $prog (sort keys %require) {
+
+
+  # ignore variable interpolation and any program whose name is made
+  # up only of non word characters ('<', '&&', etc).
+
+  ( ( $prog != /\$/ ) || ( $prog =~ /^\W+$/ ) ) && 
+    next;
+
+  # filenames of the form './miniperl' will be reported in canonical
+  # manner 'miniperl'
+
+   $prog =~ s!^\./!!;
+
+  if ( $prog !~ /\$/ ) {
+    print "exectuable($prog)\n";
+  }
+
+  $prog=basename($prog);
+
+  if ( $prog !~ /\$/ ) {
+    print "exectuable($prog)\n";
+
+    # get the correct version dependencies for magic numbers like:
+    # 	/usr/local/bin/perl5.00404 
+    # 	/usr/local/bin/tclsh8.0 
+    # these are always PACKAGE versions since typical executables do not
+    # have versions
+
+    my $version = "";
+    if ($module =~ s/([.0-9]+)$//) {
+      $version = "$1";
+      print "$prog>=$version\n";
+    }
+
+  }
+
+}
+
+exit 0;
+
+
+sub process_file {
+  
+  my ($file) = @_;
+  chomp $file;
+  
+  my ($version, $magic) = ();
+  
+  (-f $file) || return ;  
+
+  open(FILE, "<$file")||
+    die("$0: Could not open file: '$file' : $!\n");
+  
+  my $rc = sysread(FILE,$line,1000);
+
+  $rc =~ s/\#.*\n//g;
+
+  # Ignore all parameter substitution.
+  # I have no hope of parsing something like: 
+  #  exec ${SHELL:-/bin/sh}
+  $rc =~ s/\$\{.*\}//g;
+  $rc =~ s/echo\s+.*[\n;]//g;
+  
+  if  ( ($rc > 1) && ($line =~ m/^\#\!\s*/) )  {
+    
+    if ($line =~ m/\b(exec|env)\s+([\'\"\`\\]+)?([^ \t\n\r]+)/) {
+      $require{$3} = 1;
+    }
+    
+    # strip off extra lines and any arguments
+    if ($line =~ m/^\#\!\s*([^ \t\n\r]+)/) {
+      $require{$1} = 1;
+    }
+
+  }
+
+  close(FILE) ||
+    die("$0: Could not close file: '$file' : $!\n");
+  
+  return ; 
+}


Property changes on: rpm/rpm-setup/trunk/magic.req
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/make_arch_macrosfiles.sh.in
===================================================================
--- rpm/rpm-setup/trunk/make_arch_macrosfiles.sh.in	                        (rev 0)
+++ rpm/rpm-setup/trunk/make_arch_macrosfiles.sh.in	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+# $Id: make_arch_macrosfiles.sh.in 233560 2008-01-29 15:58:29Z pixel $
+
+MINPUT="$1"
+ARCH="$2"
+
+LIB=lib
+OS=@RPMOS@
+OPTFLAGS=`perl -ane "m/^optflags:\s*${ARCH}\b\s*(.*)/ and print \\$1" < rpmrc`
+MULTILIBNO=
+
+case $ARCH in
+    i*86|k6|athlon|pentium*)
+    MULTILIBNO=1
+    CANONARCH=i386
+    ;;
+    amd64|x86_64)
+    MULTILIBNO=2
+    CANONARCH=x86_64
+    LIB=lib64
+    ;;
+    sparc|sparcv9)
+    MULTILIBNO=1
+    CANONARCH=sparc
+    ;;
+    sparc64)
+    MULTILIBNO=2
+    CANONARCH=sparc64
+    LIB=lib64
+    ;;
+    ppc|powerpc|ppc32)
+    MULTILIBNO=1
+    CANONARCH=ppc
+    ;;
+    ppc64|powerpc64)
+    MULTILIBNO=2
+    CANONARCH=ppc64
+    LIB=lib64
+    ;;
+    alpha)
+    CANONARCH=alpha
+    ;;
+    s390)
+    CANONARCH=s390-linux
+    MULTILIBNO=1
+    ;;
+    s390x)
+    CANONARCH=s390x
+    LIB=lib64;
+    MULTILIBNO=2 ;;
+    *)
+    CANONARCH=$ARCH
+    LIB=lib
+    ;;
+esac
+
+if [ -n "$MULTILIBNO" ]; then
+    MULTILIBSED='-e /^@MULTILIB/d -e s, at MULTILIBNO@,'$MULTILIBNO,
+else
+    MULTILIBSED='-e /^@MULTILIBSTART@/,/^@MULTILIBEND@/d'
+fi
+
+if [ -n "$OPTFLAGS" ]; then
+    OPTFLAGSSED="s/@RPMOPTFLAGS@/${OPTFLAGS}/g"
+else
+    OPTFLAGSSED='s,^%optflags.*,,'
+fi
+
+cat "$MINPUT" | sed \
+    -e "s, at RPMARCH@,$CANONARCH,g" \
+    -e "s, at LIB@,$LIB,g" \
+    -e "$OPTFLAGSSED" \
+    $MULTILIBSED

Added: rpm/rpm-setup/trunk/perl.prov
===================================================================
--- rpm/rpm-setup/trunk/perl.prov	                        (rev 0)
+++ rpm/rpm-setup/trunk/perl.prov	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,187 @@
+#!/usr/bin/perl
+
+# RPM (and it's source code) is covered under two separate licenses.
+
+# The entire code base may be distributed under the terms of the GNU
+# General Public License (GPL), which appears immediately below.
+# Alternatively, all of the source code in the lib subdirectory of the
+# RPM source code distribution as well as any code derived from that
+# code may instead be distributed under the GNU Library General Public
+# License (LGPL), at the choice of the distributor. The complete text
+# of the LGPL appears at the bottom of this file.
+
+# This alternative is allowed to enable applications to be linked
+# against the RPM library (commonly called librpm) without forcing
+# such applications to be distributed under the GPL.
+
+# Any questions regarding the licensing of RPM should be addressed to
+# Erik Troan <ewt at redhat.com>.
+
+# a simple script to print the proper name for perl libraries.
+
+# To save development time I do not parse the perl grammmar but
+# instead just lex it looking for what I want.  I take special care to
+# ignore comments and pod's.
+
+# it would be much better if perl could tell us the proper name of a
+# given script.
+
+# The filenames to scan are either passed on the command line or if
+# that is empty they are passed via stdin.
+
+# If there are lines in the file which match the pattern
+#      (m/^\s*\$VERSION\s*=\s+/)
+# then these are taken to be the version numbers of the modules.
+# Special care is taken with a few known idioms for specifying version
+# numbers of files under rcs/cvs control.
+
+# If there are strings in the file which match the pattern
+#     m/^\s*\$RPM_Provides\s*=\s*["'](.*)['"]/i
+# then these are treated as additional names which are provided by the
+# file and are printed as well.
+
+# I plan to rewrite this in C so that perl is not required by RPM at
+# build time.
+
+# by Ken Estes Mail.com kestes at staff.mail.com
+
+if ("@ARGV") {
+  foreach (@ARGV) {
+    next if !/\.pm$/;
+    process_file($_);
+  }
+} else {
+
+  # notice we are passed a list of filenames NOT as common in unix the
+  # contents of the file.
+
+  foreach (<>) {
+    chomp $_;
+    next if !/\.pm$/;
+    process_file($_) if -f $_;
+  }
+}
+
+
+foreach $module (sort keys %require) {
+  if (length($require{$module}) == 0) {
+    print "perl($module)\n";
+  } else {
+
+    # I am not using rpm3.0 so I do not want spaces arround my
+    # operators. Also I will need to change the processing of the
+    # $RPM_* variable when I upgrade.
+
+    my $v = qx{ rpm --eval '%perl_convert_version $require{$module}' };
+    print "perl($module) = $v\n";
+  }
+}
+
+exit 0;
+
+
+
+sub process_file {
+
+  my ($file) = @_;
+  
+  open(FILE, "<$file") || return;
+
+  my ($package, $version, $incomment, $inover) = ();
+
+  while (<FILE>) {
+    
+    # skip the documentation
+
+    # we should not need to have item in this if statement (it
+    # properly belongs in the over/back section) but people do not
+    # read the perldoc.
+
+    if (m/^=(head1|head2|pod|item)/) {
+      $incomment = 1;
+    }
+
+    if (m/^=(cut)/) {
+      $incomment = 0;
+      $inover = 0;
+    }
+    
+    if (m/^=(over)/) {
+      $inover = 1;
+    }
+
+    if (m/^=(back)/) {
+      $inover = 0;
+    }
+
+    if ($incomment || $inover || m/^\s*#/) {
+       next;
+    }
+    
+    # skip the data section
+    if (m/^__(DATA|END)__$/) {
+      last;
+    }
+
+    # not everyone puts the package name of the file as the first
+    # package name so we report all namespaces as if they were
+    # provided packages (really ugly).
+
+    if (m/^\s*package\s+([_:a-zA-Z0-9]+)\s*;/) {
+	# some internal packages, like DB, might be temporarily redefined inside a module.
+	if (!($package && $1 eq 'DB')) {
+	    $package=$1;
+	    undef $version;
+	    $require{$package}=undef;
+	}
+    }
+
+    # after we found the package name take the first assignment to
+    # $VERSION as the version number. Exporter requires that the
+    # variable be called VERSION so we are safe.
+
+    # here are examples of VERSION lines from the perl distribution
+
+    #FindBin.pm:$VERSION = $VERSION = sprintf("%d.%02d", q$Revision: 270245 $ =~ /(\d+)\.(\d+)/);
+    #ExtUtils/Install.pm:$VERSION = substr q$Revision: 270245 $, 10;
+    #CGI/Apache.pm:$VERSION = (qw$Revision: 270245 $)[1];
+    #DynaLoader.pm:$VERSION = $VERSION = "1.03";     # avoid typo warning
+    #$Locale::Maketext::Simple::VERSION = '0.21';
+
+    if ( 
+	($package) && 
+    (m/^(.*;)?\s*((my|our)\s+)?\$(${package}::)?VERSION\s*=\s+/)
+       ) {
+
+      # first see if the version string contains the string
+      # '$Revision' this often causes bizzare strings and is the most
+      # common method of non static numbering.
+
+      if (m/(\$Revision: (\d+[.0-9]+))/) {
+	$version= $2; 
+      } elsif (m/[\'\"]?(\d+[.0-9]+)[\'\"]?/) {
+	
+	# look for a static number hard coded in the script
+	
+	$version= $1; 
+      }
+      $require{$package}=$version;
+    }
+    
+    # Each keyword can appear multiple times.  Don't
+    #  bother with datastructures to store these strings,
+    #  if we need to print it print it now.
+	
+    if ( m/^\s*\$RPM_Provides\s*=\s*["'](.*)['"]/i) {
+      foreach $_ (split(/\s+/, $1)) {
+	print "$_\n";
+      }
+    }
+
+  }
+
+  close(FILE) ||
+    die("$0: Could not close file: '$file' : $!\n");
+
+  return ;
+}


Property changes on: rpm/rpm-setup/trunk/perl.prov
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/perl.req
===================================================================
--- rpm/rpm-setup/trunk/perl.req	                        (rev 0)
+++ rpm/rpm-setup/trunk/perl.req	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,245 @@
+#!/usr/bin/perl
+
+# RPM (and it's source code) is covered under two separate licenses. 
+
+# The entire code base may be distributed under the terms of the GNU
+# General Public License (GPL), which appears immediately below.
+# Alternatively, all of the source code in the lib subdirectory of the
+# RPM source code distribution as well as any code derived from that
+# code may instead be distributed under the GNU Library General Public
+# License (LGPL), at the choice of the distributor. The complete text
+# of the LGPL appears at the bottom of this file.
+
+# This alternatively is allowed to enable applications to be linked
+# against the RPM library (commonly called librpm) without forcing
+# such applications to be distributed under the GPL.
+
+# Any questions regarding the licensing of RPM should be addressed to
+# Erik Troan <ewt at redhat.com>.
+
+# a simple makedepends like script for perl.
+ 
+# To save development time I do not parse the perl grammmar but
+# instead just lex it looking for what I want.  I take special care to
+# ignore comments and pod's.
+
+# It would be much better if perl could tell us the dependencies of a
+# given script.
+
+# The filenames to scan are either passed on the command line or if
+# that is empty they are passed via stdin.
+
+# If there are strings in the file which match the pattern
+#     m/^\s*\$RPM_Requires\s*=\s*["'](.*)['"]/i
+# then these are treated as additional names which are required by the
+# file and are printed as well.
+
+# I plan to rewrite this in C so that perl is not required by RPM at
+# build time.
+
+# by Ken Estes Mail.com kestes at staff.mail.com
+
+if ("@ARGV") {
+  foreach (@ARGV) {
+    process_file($_);
+  }
+} else {
+  
+  # notice we are passed a list of filenames NOT as common in unix the
+  # contents of the file.
+  
+  foreach (<>) {
+    chomp $_;
+    process_file($_) if -f $_;
+  }
+}
+
+
+foreach $module (sort keys %require) {
+  if (length($require{$module}) == 0) {
+    print "perl($module)\n";
+  } else {
+
+    # I am not using rpm3.0 so I do not want spaces arround my
+    # operators. Also I will need to change the processing of the
+    # $RPM_* variable when I upgrade.
+
+    my $v = qx{ rpm --eval '%perl_convert_version $require{$module}' };
+    print "perl($module) >= $v\n";
+  }
+}
+
+exit 0;
+
+
+
+sub process_file {
+  
+  my ($file) = @_;
+  
+  open(FILE, "<$file") || return;
+  
+  while (<FILE>) {
+    
+    # skip the "= <<" block
+
+    if ( ( m/^\s*\$(.*)\s*=\s*<<\s*["'](.*)['"]/i) ||
+         ( m/^\s*\$(.*)\s*=\s*<<\s*(.*);/i) ) {
+      $tag = $2;
+      while (<FILE>) {
+        ( $_ =~ /^$tag/) && last;
+      }
+    }
+
+    # skip the documentation
+
+    # we should not need to have item in this if statement (it
+    # properly belongs in the over/back section) but people do not
+    # read the perldoc.
+
+    if ( (m/^=(head1|head2|pod|item)/) .. (m/^=(cut)/) ) {
+      next;
+    }
+
+    if ( (m/^=(over)/) .. (m/^=(back)/) ) {
+      next;
+    }
+    
+    # skip the data section
+    if (m/^__(DATA|END)__$/) {
+      last;
+    }
+
+    # Each keyword can appear multiple times.  Don't
+    #  bother with datastructures to store these strings,
+    #  if we need to print it print it now.
+    
+    if ( m/^\s*\$RPM_Requires\s*=\s*["'](.*)['"]/i) {
+      foreach $_ (split(/\s+/, $1)) {
+	print "$_\n";
+      }
+    }
+
+    if ( 
+
+# ouch could be in a eval, perhaps we do not want these since we catch
+# an exception they must not be required
+
+#   eval { require Term::ReadLine } or die $@;
+#   eval "require Term::Rendezvous;" or die $@;
+#   eval { require Carp } if defined $^S; # If error/warning during compilation,
+
+
+	(m/^(\s*)         # we hope the inclusion starts the line
+	 (require|use)\s+(?!\{)     # do not want 'do {' loops
+	 # quotes around name are always legal
+	 [\'\"]?([^\;\ \'\"\t]*)[\'\"]?[\t\;\ ]
+	 # the syntax for 'use' allows version requirements
+	 \s*([.0-9]*)
+	 /x)
+       ) {
+      my ($whitespace, $statement, $module, $version) = ($1, $2, $3,$4);
+      my $usebase;
+
+      # we only consider require statements that are flush against
+      # the left edge. any other require statements give too many
+      # false positives, as they are usually inside of an if statement
+      # as a fallback module or a rarely used option
+
+      ($whitespace ne "" && $statement eq "require") && next;
+
+      # if there is some interpolation of variables just skip this
+      # dependency, we do not want
+      #        do "$ENV{LOGDIR}/$rcfile";
+
+      ($module =~ m/\$/) && next;
+
+      # skip if the phrase was "use of" -- shows up in gimp-perl, et al
+      next if $module eq 'of';
+
+      # if the module ends in a comma we probaly caught some
+      # documentation of the form 'check stuff,\n do stuff, clean
+      # stuff.' there are several of these in the perl distribution
+
+      ($module  =~ m/[,>]$/) && next;
+
+      # if the module name starts in a dot it is not a module name.
+      # Is this necessary?  Please give me an example if you turn this
+      # back on.
+
+      #      ($module =~ m/^\./) && next;
+
+      # if the module ends with .pm strip it to leave only basename.
+      # starts with /, which means its an absolute path to a file
+      if ($module =~ m(^/)) {
+        print "$module\n";
+        next;
+      }
+
+      # as seen in some perl scripts
+      # use base qw(App::CLI Class::Accessor::Chained::Fast App::CLI::Command);
+      if ($module eq 'base') {
+	  $require{$module} = $version;
+	  $line{$module} = $current_line;
+	  ($module = $_) =~ s/use\s*base\s*//;
+	  $module =~ s/qw\((.*)\)\s*;/$1/;
+	  $module =~ s/qw(.)(.*)\1\s*;/$2/;
+	  $module =~ s/\s*;$//;
+	  $module =~ s/#.*//;
+	  $usebase = 1;
+      }
+      # sometimes people do use POSIX qw(foo), or use POSIX(qw(foo)) etc
+      # we can strip qw.*$, as well as (.*$:
+      $module =~ s/qw.*$//;
+      $module =~ s/\(.*$//;
+
+      $module =~ s/\.pm$//;
+
+      # some perl programmers write 'require URI/URL;' when 
+      # they mean 'require URI::URL;'
+
+      $module =~ s/\//::/;
+
+      # trim off trailing parenthesis if any.  Sometimes people pass
+      # the module an empty list.
+
+      $module =~ s/\(\s*\)$//;
+
+      # if module is a number then both require and use interpret that
+      # to mean that a particular version of perl is specified. Don't
+      # add a dependency, though, since the rpm will already require
+      # perl-base at the build version (via find-requires)
+      next if $module =~ /^v?\d/;
+
+      # ph files do not use the package name inside the file.
+      # perlmodlib  documentation says:
+      #       the .ph files made by h2ph will probably end up as
+      #       extension modules made by h2xs.
+      # so do not spend much effort on these.
+
+      # there is no easy way to find out if a file named systeminfo.ph
+      # will be included with the name sys/systeminfo.ph so only use the
+      # basename of *.ph files
+
+      ($module  =~ m/\.ph$/) && next;
+
+      # if the module was loaded trough base, we need to split the list
+      if ($usebase) {
+          my $current_line = $_;
+          foreach (split(/\s+/, $module)) {
+              next unless $_;
+              $require{$_} = $version;
+              $line{$_} = $current_line;
+          }
+      } else {
+	  $require{$module}=$version;
+	  $line{$module}=$current_line;
+      }
+    }
+  }
+
+  close(FILE) ||
+    die("$0: Could not close file: '$file' : $!\n");
+
+  return ;
+}


Property changes on: rpm/rpm-setup/trunk/perl.req
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/perl.req-from-meta
===================================================================
--- rpm/rpm-setup/trunk/perl.req-from-meta	                        (rev 0)
+++ rpm/rpm-setup/trunk/perl.req-from-meta	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use JSON qw{ from_json };
+use YAML qw{ Load      };
+
+# slurp the file
+my $path = shift;
+open my $fh, '<', $path or die "can't open $path: $!";
+my $data = do { local $/; <$fh> };
+close $fh;
+
+# parse meta - either yaml or json
+my $meta = $path =~ /\.yml$/
+    ? Load( $data )
+    : from_json( $data );
+
+# dump the requires with their version
+my $requires = $meta->{"meta-spec"}{version} >= 2
+    ? $meta->{prereqs}{runtime}{requires}
+    : $meta->{requires};
+foreach my $module ( sort keys %$requires ) {
+    next if $module eq 'perl'; # minimum perl version
+    my $version = $requires->{$module};
+    if ( $version == 0 ) {
+        print "perl($module)\n";
+    } else {
+        my $v = qx{ rpm --eval '%perl_convert_version $version' };
+        print "perl($module) >= $v";
+    }
+}
+
+exit;
+
+=head1 NAME
+
+perl.req-from-meta - extract requires from meta file
+
+=head1 SYNOPSIS
+
+    $ perl.req-from-meta /path/to/META.yml
+    $ perl.req-from-meta /path/to/META.json
+
+=head1 DESCRIPTION
+
+This script will extract Perl requirements from the distribution meta
+file. For each such requires, it'll convert the minimum version to
+follow Mageia perl versioning (using C<%perl_convert_version>), and
+print them as:
+
+    perl(Foo::Bar)
+    perl(App::Frobnizer) >= 1.23.456
+
+Minimum perl version are skipped.


Property changes on: rpm/rpm-setup/trunk/perl.req-from-meta
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/php.prov
===================================================================
--- rpm/rpm-setup/trunk/php.prov	                        (rev 0)
+++ rpm/rpm-setup/trunk/php.prov	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+#####################################################################
+#                                                                   #
+# Check system dependences between php-pear modules                 #
+#                                                                   #
+# Pawe\xB3 Go\xB3aszewski <blues at ds.pg.gda.pl>                            #
+# Micha\xB3 Moskal <malekith at pld-linux.org>                            #
+# ------------------------------------------------------------------#
+# TODO:                                                             #
+#####################################################################
+
+$pear = "/usr/share/pear";
+
+foreach (@ARGV ? @ARGV : <>) {
+	chomp;
+	$f = $_;
+	next unless ($f =~ /$pear.*\.php$/);
+	$f =~ s/.*$pear\///;
+	print "pear($f)\n";
+}


Property changes on: rpm/rpm-setup/trunk/php.prov
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/php.req
===================================================================
--- rpm/rpm-setup/trunk/php.req	                        (rev 0)
+++ rpm/rpm-setup/trunk/php.req	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,81 @@
+#!/usr/bin/perl
+#####################################################################
+#                                                                   #
+# Check system dependences between php-pear modules                 #
+#                                                                   #
+# Pawe\xB3 Go\xB3aszewski <blues at ds.pg.gda.pl>                            #
+# Micha\xB3 Moskal <malekith at pld-linux.org>                            #
+# ------------------------------------------------------------------#
+# TODO:                                                             #
+# - extension_loaded - dependencies.                                #
+# - some clean-up...                                                #
+#####################################################################
+
+$pear = "/usr/share/pear";
+
+ at files = ();
+%req = ();
+
+foreach (@ARGV ? $ARGV : <> ) {
+	chomp;
+	$f = $_;
+	push @files, $f;
+	open(F, "< $f") or die;
+
+	if ($f =~ /$pear/) {
+		$file_dir = $f;
+		$file_dir =~ s|.*$pear/||;
+		$file_dir =~ s|/[^/]*$||;
+	} else {
+		$file_dir = undef;
+	}
+
+	while (<F>) {
+		# skip comments
+		next if (/^\s*(#|\/\/|\*|\/\*)/);
+		while (/(\W|^)(require|include)(_once)?
+			  \s* \(? \s* ("([^"]*)"|'([^']*)') 
+			  \s* \)? \s* ;/xg) {
+
+			if ($5 ne "") {
+				$x = $5;
+			} elsif ($6 ne "") {
+				$x = $6;
+			} else {
+				next;
+			}
+			do $x =~ s/\/\.?\//\//g while $x =~ /\/\.?\//;
+			do $x =~ s/(\/|^)[^\/]*[^.]\/\.\.\//\1/g while $x =~ /(\/|^)[^\/]*[^.]\/\.\.\//;
+			next if ($x =~ m|^\.\.?/| or $x =~ /\$/);
+			next unless ($x =~ /\.php$/);
+			$req{$x} = 1;
+		}
+
+		next unless (defined $file_dir);
+
+		while (/(\W|^)(require|include)(_once)?
+			  \s* \(? \s* dirname \s* \( \s* __FILE__ \s* \) \s* \. \s*
+			  ("([^"]*)"|'([^']*)') 
+			  \s* \)? \s* ;/xg) {
+			if ($5 ne "") {
+				$x = $5;
+			} elsif ($6 ne "") {
+				$x = $6;
+			} else {
+				next;
+			}
+
+			next unless ($x =~ /\.php$/);
+
+			$x = "$file_dir/$x";
+			do $x =~ s/\/\.?\//\//g while $x =~ /\/\.?\//;
+			do $x =~ s/(\/|^)[^\/]*[^.]\/\.\.\//\1/g while $x =~ /(\/|^)[^\/]*[^.]\/\.\.\//;
+			$req{$x} = 1;
+		}
+	}
+}
+
+f: for $f (keys %req) {
+	for $g (@files) { next f if ($g =~ /\Q$f\E$/); }
+	print "pear($f)\n";
+}


Property changes on: rpm/rpm-setup/trunk/php.req
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/pkgconfigdeps.sh
===================================================================
--- rpm/rpm-setup/trunk/pkgconfigdeps.sh	                        (rev 0)
+++ rpm/rpm-setup/trunk/pkgconfigdeps.sh	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+pkgconfig=/usr/bin/pkg-config
+test -x $pkgconfig || {
+    cat > /dev/null
+    exit 0
+}
+
+[ $# -ge 1 ] || {
+    cat > /dev/null
+    exit 0
+}
+
+case $1 in
+-P|--provides)
+    while read filename ; do
+    case "${filename}" in
+    *.pc)
+	# Assume that this file doesn't contain useful information.
+    pcfiles=${pcfiles}" ${filename}"
+    PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(dirname ${filename})
+	;;
+    esac
+    done
+	# Query the dependencies of the package.
+	PKG_CONFIG_PATH=$PKG_CONFIG_PATH $pkgconfig --print-provides $pcfiles 2> /dev/null | while read n r v ; do
+	    # We have a dependency.  Make a note that we need the pkgconfig
+	    # tool for this package.
+	    echo "pkgconfig($n)" "$r" "$v"
+	done
+	# The dependency on the pkgconfig package itself.
+    ;;
+-R|--requires)
+    while read filename ; do
+    case "${filename}" in
+    *.pc)
+    pcfiles=${pcfiles}" ${filename}"
+    PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(dirname ${filename})
+    esac
+    done
+    PKG_CONFIG_PATH=$PKG_CONFIG_PATH $pkgconfig --print-requires ${pcfiles} 2> /dev/null | while read n r v ; do
+	    echo "pkgconfig($n)" "$r" "$v"
+    done
+    ;;
+esac
+exit 0


Property changes on: rpm/rpm-setup/trunk/pkgconfigdeps.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:eol-style
   + native

Added: rpm/rpm-setup/trunk/pythoneggs.py
===================================================================
--- rpm/rpm-setup/trunk/pythoneggs.py	                        (rev 0)
+++ rpm/rpm-setup/trunk/pythoneggs.py	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,180 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright 2010 Per Øyvind Karlsen <peroyvind at mandriva.org>
+#
+# This program is free software. It may be redistributed and/or modified under
+# the terms of the LGPL version 2.1 (or later).
+#
+# RPM5 python (egg) dependency generator.
+#
+
+from getopt import getopt
+from os.path import basename, dirname, isdir, sep, splitext
+from sys import argv, stdin, version
+from pkg_resources import Distribution, FileMetadata, PathMetadata
+from distutils.sysconfig import get_python_lib
+
+
+opts, args = getopt(argv[1:], 'hPRSCOE',
+        ['help', 'provides', 'requires', 'suggests', 'conflicts', 'obsoletes', 'extras'])
+
+Provides = False
+Requires = False
+Suggests = False
+Conflicts = False
+Obsoletes = False
+Extras = False
+
+for o, a in opts:
+    if o in ('-h', '--help'):
+        print '-h, --help\tPrint help'
+        print '-P, --provides\tPrint Provides'
+        print '-R, --requires\tPrint Requires'
+        print '-S, --suggests\tPrint Suggests'
+        print '-C, --conflicts\tPrint Conflicts'
+        print '-O, --obsoletes\tPrint Obsoletes (unused)'
+        print '-E, --extras\tPrint Extras '
+        exit(1)
+    elif o in ('-P', '--provides'):
+        Provides = True
+    elif o in ('-R', '--requires'):
+        Requires = True
+    elif o in ('-S', '--suggests'):
+        Suggests = True
+    elif o in ('-C', '--conflicts'):
+        Conflicts = True
+    elif o in ('-O', '--obsoletes'):
+        Obsoletes = True
+    elif o in ('-E', '--extras'):
+        Extras = True
+
+if Requires:
+    py_abi = True
+else:
+    py_abi = False
+py_deps = {}
+if args:
+    files = args
+else:
+    files = stdin.readlines()
+for f in files:
+    f = f.strip()
+    lower = f.lower()
+    name = 'python(abi)'
+    # add dependency based on path, versioned if within versioned python directory
+    if py_abi and (lower.endswith('.py') or lower.endswith('.pyc') or lower.endswith('.pyo')):
+        if not name in py_deps:
+            py_deps[name] = []
+        purelib = get_python_lib(standard_lib=1, plat_specific=0).split(version[:3])[0]
+        platlib = get_python_lib(standard_lib=1, plat_specific=1).split(version[:3])[0]
+        for lib in (purelib, platlib):
+            if lib in f:
+                spec = ('==',f.split(lib)[1].split(sep)[0])
+                if not spec in py_deps[name]:
+                    py_deps[name].append(spec)
+    # Determine provide, requires, conflicts & suggests based on egg metadata
+    if lower.endswith('.egg') or \
+            lower.endswith('.egg-info') or \
+            lower.endswith('.egg-link'):
+        dist_name = basename(f)
+        if isdir(f):
+            path_item = dirname(f)
+            metadata = PathMetadata(path_item, f)
+        else:
+            path_item = f
+            metadata = FileMetadata(f)
+        dist = Distribution.from_location(path_item, dist_name, metadata)
+        if Provides:
+            # If egg metadata says package name is python, we provide python(abi)
+            if dist.key == 'python':
+                name = 'python(abi)'
+                if not name in py_deps:
+                    py_deps[name] = []
+                py_deps[name].append(('==', dist.py_version))
+            name = 'pythonegg(%s)' % dist.project_name
+            if not name in py_deps:
+                py_deps[name] = []
+            if dist.version:
+                spec = ('==', dist.version)
+                if not spec in py_deps[name]:
+                    py_deps[name].append(spec)
+        if Requires or (Suggests and dist.extras):
+            name = 'python(abi)'
+            # If egg metadata says package name is python, we don't add dependency on python(abi)
+            if dist.key == 'python':
+                py_abi = False
+                if name in py_deps:
+                    py_deps.pop(name)
+            elif py_abi and dist.py_version:
+                if not name in py_deps:
+                    py_deps[name] = []
+                spec = ('==', dist.py_version)
+                if not spec in py_deps[name]:
+                    py_deps[name].append(spec)
+            deps = dist.requires()
+            if Suggests:
+                depsextras = dist.requires(extras=dist.extras)
+                if not Requires:
+                    for dep in reversed(depsextras):
+                        if dep in deps:
+                            depsextras.remove(dep)
+                deps = depsextras
+            # add requires/suggests based on egg metadata
+            for dep in deps:
+                name = 'pythonegg(%s)' % dep.project_name
+                for spec in dep.specs:
+                    if spec[0] != '!=':
+                        if not name in py_deps:
+                            py_deps[name] = []
+                        if not spec in py_deps[name]:
+                            py_deps[name].append(spec)
+                if not dep.specs:
+                    py_deps[name] = []
+        # Unused, for automatic sub-package generation based on 'extras' from egg metadata
+        # TODO: implement in rpm later, or...?
+        if Extras:
+            deps = dist.requires()
+            extras = dist.extras
+            print extras
+            for extra in extras:
+                print '%%package\textras-%s' % extra
+                print 'Summary:\t%s extra for %s python egg' % (extra, dist.project_name)
+                print 'Group:\t\tDevelopment/Python'
+                depsextras = dist.requires(extras=[extra])
+                for dep in reversed(depsextras):
+                    if dep in deps:
+                        depsextras.remove(dep)
+                deps = depsextras
+                for dep in deps:
+                    for spec in dep.specs:
+                        if spec[0] == '!=':
+                            print 'Conflicts:\t%s %s %s' % (dep.project_name, '==', spec[1])
+                        else:
+                            print 'Requires:\t%s %s %s' % (dep.project_name, spec[0], spec[1])
+                print '%%description\t%s' % extra
+                print '%s extra for %s python egg' % (extra, dist.project_name)
+                print '%%files\t\textras-%s\n' % extra
+        if Conflicts:
+            # Should we really add conflicts for extras?
+            # Creating a meta package per extra with suggests on, which has
+            # the requires/conflicts in stead might be a better solution...
+            for dep in dist.requires(extras=dist.extras):
+                name = dep.project_name
+                for spec in dep.specs:
+                    if spec[0] == '!=':
+                        if not name in py_deps:
+                            py_deps[name] = []
+                        spec = ('==', spec[1])
+                        if not spec in py_deps[name]:
+                            py_deps[name].append(spec)
+names = py_deps.keys()
+names.sort()
+for name in names:
+    if py_deps[name]:
+        # Print out versioned provides, requires, suggests, conflicts
+        for spec in py_deps[name]:
+            print '%s %s %s' % (name, spec[0], spec[1])
+    else:
+        # Print out unversioned provides, requires, suggests, conflicts
+        print name


Property changes on: rpm/rpm-setup/trunk/pythoneggs.py
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/rpm-spec-mode.el
===================================================================
--- rpm/rpm-setup/trunk/rpm-spec-mode.el	                        (rev 0)
+++ rpm/rpm-setup/trunk/rpm-spec-mode.el	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,1366 @@
+;;; rpm-spec-mode.el --- RPM spec file editing commands for Emacs/XEmacs
+
+;; $Id: rpm-spec-mode.el 232641 2007-12-20 09:58:22Z pixel $
+
+;; Copyright (C) 1997-2002 Stig Bj\xF8rlykke, <stigb at tihlde.org>
+
+;; Author:   Stig Bj\xF8rlykke, <stigb at tihlde.org>
+;; Keywords: unix, languages
+;; Version:  0.12
+
+;; This file is part of XEmacs.
+
+;; XEmacs 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, or (at your option)
+;; any later version.
+
+;; XEmacs 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 XEmacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+;; MA 02111-1307, USA.
+
+;;; Synched up with: not in GNU Emacs.
+
+;;; Thanx to:
+
+;;     Tore Olsen <toreo at tihlde.org> for some general fixes.
+;;     Steve Sanbeg <sanbeg at dset.com> for navigation functions and
+;;          some Emacs fixes.
+;;     Tim Powers <timp at redhat.com> and Trond Eivind Glomsr\xF8d
+;;          <teg at redhat.com> for Red Hat adaptions and some fixes.
+;;     Chmouel Boudjnah <chmouel at mandrakesoft.com> for Mandrake fixes.
+
+;;; ToDo:
+
+;; - rewrite function names.
+;; - autofill changelog entries.
+;; - customize rpm-tags-list and rpm-group-tags-list.
+;; - get values from `rpm --showrc'.
+;; - ssh/rsh for compile.
+;; - finish integrating the new navigation functions in with existing stuff.
+;; - use a single prefix consistently (internal)
+
+;;; Commentary:
+
+;; This mode is used for editing spec files used for building RPM packages.
+;;
+;; Most recent version is available from:
+;;  <URL:http://www.tihlde.org/~stigb/rpm-spec-mode.el>
+;;
+;; Put this in your .emacs file to enable autoloading of rpm-spec-mode,
+;; and auto-recognition of ".spec" files:
+;;
+;;  (autoload 'rpm-spec-mode "rpm-spec-mode.el" "RPM spec mode." t)
+;;  (setq auto-mode-alist (append '(("\\.spec" . rpm-spec-mode))
+;;                                auto-mode-alist))
+;;------------------------------------------------------------
+;;
+
+;;; Code:
+(require 'cl)
+
+(defconst rpm-spec-mode-version "0.12" "Version of `rpm-spec-mode'.")
+
+;Fix for GNU/Emacs
+(if (not(featurep 'xemacs))
+	(fset 'define-obsolete-variable-alias 'make-obsolete))
+
+(defgroup rpm-spec nil
+  "RPM spec mode with Emacs/XEmacs enhancements."
+  :prefix "rpm-spec-"
+  :group 'languages)
+
+(defcustom rpm-spec-build-command "rpmbuild"
+  "Command for building a RPM package."
+  :type 'string
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-add-attr nil
+  "Add \"%attr\" entry for file listings or not."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-short-circuit nil
+  "Skip straight to specified stage.
+(ie, skip all stages leading up to the specified stage).  Only valid
+in \"%build\" and \"%install\" stage."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-no-deps nil
+  "Do not verify the dependencies."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-timecheck "0"
+  "Set the \"timecheck\" age (0 to disable).
+The timecheck value expresses, in seconds, the maximum age of a file
+being packaged.  Warnings will be printed for all files beyond the
+timecheck age."
+  :type 'integer
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-buildroot ""
+  "Override the BuildRoot tag with directory <dir>."
+  :type 'string
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-target ""
+  "Interpret given string as `arch-vendor-os'.
+Set the macros _target, _target_arch and _target_os accordingly"
+  :type 'string
+  :group 'rpm-spec)
+
+(define-obsolete-variable-alias
+  'rpm-completion-ignore-case 'rpm-spec-completion-ignore-case)
+
+(defcustom rpm-spec-completion-ignore-case t
+  "*Non-nil means that case differences are ignored during completion.
+A value of nil means that case is significant.
+This is used during Tempo template completion."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-clean nil
+  "Remove the build tree after the packages are made."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-rmsource nil
+  "Remove the source and spec file after the packages are made."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-nobuild nil
+  "Do not execute any build stages.  Useful for testing out spec files."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-sign-gpg nil
+  "Embed a GPG signature in the package.
+This signature can be used to verify the integrity and the origin of
+the package."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-nodeps nil
+  "Do not verify build dependencies."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-old-rpm nil
+  "Set if using `rpm' as command for building packages."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(define-obsolete-variable-alias
+  'rpm-initialize-sections 'rpm-spec-initialize-sections)
+
+(defcustom rpm-spec-initialize-sections t
+  "Automatically add empty section headings to new spec files."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-use-tabs nil
+  "Use tabs instead of a space to indent tags."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(define-obsolete-variable-alias
+  'rpm-insert-version 'rpm-spec-insert-changelog-version)
+
+(defcustom rpm-spec-insert-changelog-version t
+  "Automatically add version in a new change log entry."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-insert-changelog-version-with-shell t
+  "Automatically add version with shell in a new change log entry."
+  :type 'boolean
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-user-full-name nil
+  "*Full name of the user.
+This is used in the change log and the Packager tag.  It defaults to the
+value returned by function `user-full-name'."
+  :type '(choice (const :tag "Use `user-full-name'" nil)
+                 string)
+  :group 'rpm-spec)
+
+(defcustom rpm-spec-user-mail-address nil
+  "*Email address of the user.
+This is used in the change log and the Packager tag.  It defaults to the
+value returned by function `user-mail-address'."
+  :type '(choice (const :tag "Use `user-mail-address'" nil)
+                 string)
+  :group 'rpm-spec)
+
+(defgroup rpm-spec-faces nil
+  "Font lock faces for `rpm-spec-mode'."
+  :group 'rpm-spec
+  :group 'faces)
+
+;;------------------------------------------------------------
+;; variables used by navigation functions.
+
+(defconst rpm-sections
+  '("preamble" "description" "prep" "setup" "build" "install" "clean"
+    "changelog" "files")
+  "Partial list of section names.")
+(defvar rpm-section-list
+  '(("preamble") ("description") ("prep") ("setup") ("build") ("install")
+    ("clean") ("changelog") ("files"))
+  "Partial list of section names.")
+(defconst rpm-scripts
+  '("pre" "post" "preun" "postun"
+    "trigger" "triggerin" "triggerun" "triggerpostun")
+  "List of rpm scripts.")
+(defconst rpm-section-seperate "^%\\(\\w+\\)\\s-")
+(defconst rpm-section-regexp
+  (eval-when-compile
+    (concat "^%"
+            (regexp-opt
+             ;; From RPM 4.1 sources, file build/parseSpec.c: partList[].
+             '("build" "changelog" "clean" "description" "files" "install"
+               "package" "post" "postun" "pre" "prep" "preun" "trigger"
+               "triggerin" "triggerpostun" "triggerun" "verifyscript") t)
+            "\\b"))
+  "Regular expression to match beginning of a section.")
+
+;;------------------------------------------------------------
+
+(defface rpm-spec-tag-face
+  '(( ((class color) (background light)) (:foreground "blue") )
+    ( ((class color) (background dark)) (:foreground "blue") ))
+  "*The face used for tags."
+  :group 'rpm-spec-faces)
+
+(defface rpm-spec-macro-face
+  '(( ((class color) (background light)) (:foreground "purple") )
+    ( ((class color) (background dark)) (:foreground "yellow") ))
+  "*The face used for macros."
+  :group 'rpm-spec-faces)
+
+(defface rpm-spec-var-face
+  '(( ((class color) (background light)) (:foreground "maroon") )
+    ( ((class color) (background dark)) (:foreground "maroon") ))
+  "*The face used for environment variables."
+  :group 'rpm-spec-faces)
+
+(defface rpm-spec-doc-face
+  '(( ((class color) (background light)) (:foreground "magenta") )
+    ( ((class color) (background dark)) (:foreground "magenta") ))
+  "*The face used for document files."
+  :group 'rpm-spec-faces)
+
+(defface rpm-spec-dir-face
+  '(( ((class color) (background light)) (:foreground "green") )
+    ( ((class color) (background dark)) (:foreground "green") ))
+  "*The face used for directories."
+  :group 'rpm-spec-faces)
+
+(defface rpm-spec-package-face
+  '(( ((class color) (background light)) (:foreground "red") )
+    ( ((class color) (background dark)) (:foreground "red") ))
+  "*The face used for files."
+  :group 'rpm-spec-faces)
+
+(defface rpm-spec-ghost-face
+  '(( ((class color) (background light)) (:foreground "red") )
+    ( ((class color) (background dark)) (:foreground "red") ))
+  "*The face used for ghost tags."
+  :group 'rpm-spec-faces)
+
+;;; GNU emacs font-lock needs these...
+(defvar rpm-spec-macro-face
+  'rpm-spec-macro-face "*Face for macros.")
+(defvar rpm-spec-var-face
+  'rpm-spec-var-face "*Face for environment variables.")
+(defvar rpm-spec-tag-face
+  'rpm-spec-tag-face "*Face for tags.")
+(defvar rpm-spec-package-face
+  'rpm-spec-package-face "*Face for package tag.")
+(defvar rpm-spec-dir-face
+  'rpm-spec-dir-face "*Face for directory entries.")
+(defvar rpm-spec-doc-face
+  'rpm-spec-doc-face "*Face for documentation entries.")
+(defvar rpm-spec-ghost-face
+  'rpm-spec-ghost-face "*Face for \"%ghost\" files.")
+
+(defvar rpm-default-umask "-"
+  "*Default umask for files, specified with \"%attr\".")
+(defvar rpm-default-owner "root"
+  "*Default owner for files, specified with \"%attr\".")
+(defvar rpm-default-group "root"
+  "*Default group for files, specified with \"%attr\".")
+
+;;------------------------------------------------------------
+
+(defvar rpm-no-gpg nil "Tell rpm not to sign package.")
+
+(defvar rpm-tags-list
+  ;; From RPM 4.1 sources, file build/parsePreamble.c: preambleList[].")
+  '(("AutoProv")
+    ("AutoReq")
+    ("AutoReqProv")
+    ("BuildArch")
+    ("BuildArchitectures")
+    ("BuildConflicts")
+    ("BuildPreReq")
+    ("BuildRequires")
+    ("BuildRoot")
+    ("Conflicts")
+    ("License")
+    ("%description")
+    ("Distribution")
+    ("DistURL")
+    ("DocDir")
+    ("Epoch")
+    ("ExcludeArch")
+    ("ExcludeOS")
+    ("ExclusiveArch")
+    ("ExclusiveOS")
+    ("%files")
+    ("Group")
+    ("Icon")
+    ("%ifarch")
+    ("License")
+    ("Name")
+    ("NoPatch")
+    ("NoSource")
+    ("Obsoletes")
+    ("%package")
+    ("Packager")
+    ("Patch")
+    ("Prefix")
+    ("Prefixes")
+    ("PreReq")
+    ("Provides")
+    ("Release")
+    ("Requires")
+    ("RHNPlatform")
+    ("Serial")
+    ("Source")
+    ("Summary")
+    ("URL")
+    ("Vendor")
+    ("Version"))
+  "List of elements that are valid tags.")
+
+;; echo "(defvar rpm-group-tags-list"
+;; echo "      ;; Auto generated from Mageia GROUPS file"
+;; printf "\t%s\n" "'("
+;; cat /usr/share/doc/*/GROUPS | while read i; do
+;;             printf "\t   %s%s%s\n" '("' "$i" '")'
+;; done
+;; printf "\t%s\n\t%s" ")" '"List of elements that are valid group tags.")'
+
+(defvar rpm-group-tags-list
+      ;; Auto generated from Mageia GROUPS file
+	'(
+	   ("Accessibility")
+	   ("Archiving/Backup")
+	   ("Archiving/Cd burning")
+	   ("Archiving/Compression")
+	   ("Archiving/Other")
+	   ("Books/Computer books")
+	   ("Books/Faqs")
+	   ("Books/Howtos")
+	   ("Books/Literature")
+	   ("Books/Other")
+	   ("Communications")
+	   ("Databases")
+	   ("Development/C")
+	   ("Development/C++")
+	   ("Development/Databases")
+	   ("Development/GNOME and GTK+")
+	   ("Development/Java")
+	   ("Development/KDE and Qt")
+	   ("Development/Kernel")
+	   ("Development/Other")
+	   ("Development/Perl")
+	   ("Development/PHP")
+	   ("Development/Python")
+	   ("Development/Ruby")
+	   ("Editors")
+	   ("Education")
+	   ("Emulators")
+	   ("File tools")
+	   ("Games/Adventure")
+	   ("Games/Arcade")
+	   ("Games/Boards")
+	   ("Games/Cards")
+	   ("Games/Other")
+	   ("Games/Puzzles")
+	   ("Games/Sports")
+	   ("Games/Strategy")
+	   ("Graphical desktop/Enlightenment")
+	   ("Graphical desktop/FVWM based")
+	   ("Graphical desktop/GNOME")
+	   ("Graphical desktop/Icewm")
+	   ("Graphical desktop/KDE")
+	   ("Graphical desktop/Other")
+	   ("Graphical desktop/Sawfish")
+	   ("Graphical desktop/WindowMaker")
+	   ("Graphical desktop/Xfce")
+	   ("Graphics")
+	   ("Monitoring")
+	   ("Networking/Chat")
+	   ("Networking/File transfer")
+	   ("Networking/IRC")
+	   ("Networking/Instant messaging")
+	   ("Networking/Mail")
+	   ("Networking/News")
+	   ("Networking/Other")
+	   ("Networking/Remote access")
+	   ("Networking/WWW")
+	   ("Office")
+	   ("Publishing")
+	   ("Sciences/Astronomy")
+	   ("Sciences/Biology")
+	   ("Sciences/Chemistry")
+	   ("Sciences/Computer science")
+	   ("Sciences/Geosciences")
+	   ("Sciences/Mathematics")
+	   ("Sciences/Other")
+	   ("Sciences/Physics")
+	   ("Shells")
+	   ("Sound")
+	   ("System/Base")
+	   ("System/Configuration/Boot and Init")
+	   ("System/Configuration/Hardware")
+	   ("System/Configuration/Networking")
+	   ("System/Configuration/Other")
+	   ("System/Configuration/Packaging")
+	   ("System/Configuration/Printing")
+	   ("System/Fonts/Console")
+	   ("System/Fonts/True type")
+	   ("System/Fonts/Type1")
+	   ("System/Fonts/X11 bitmap")
+	   ("System/Internationalization")
+	   ("System/Kernel and hardware")
+	   ("System/Libraries")
+	   ("System/Servers")
+	   ("System/X11")
+	   ("Terminals")
+	   ("Text tools")
+	   ("Toys")
+	   ("Video")
+	)
+	"List of elements that are valid group tags.")
+
+(defvar rpm-spec-mode-syntax-table nil
+  "Syntax table in use in `rpm-spec-mode' buffers.")
+(unless rpm-spec-mode-syntax-table
+  (setq rpm-spec-mode-syntax-table (make-syntax-table))
+  (modify-syntax-entry ?\\ "\\" rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?\n ">   " rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?\f ">   " rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?\# "<   " rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?/ "." rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?* "." rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?+ "." rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?- "." rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?= "." rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?% "_" rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?< "." rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?> "." rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?& "." rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?| "." rpm-spec-mode-syntax-table)
+  (modify-syntax-entry ?\' "." rpm-spec-mode-syntax-table))
+
+(defvar rpm-spec-mode-map nil
+  "Keymap used in `rpm-spec-mode'.")
+(unless rpm-spec-mode-map
+  (setq rpm-spec-mode-map (make-sparse-keymap))
+  (and (functionp 'set-keymap-name)
+       (set-keymap-name rpm-spec-mode-map 'rpm-spec-mode-map))
+  (define-key rpm-spec-mode-map "\C-c\C-c"  'rpm-change-tag)
+  (define-key rpm-spec-mode-map "\C-c\C-e"  'rpm-add-change-log-entry)
+  (define-key rpm-spec-mode-map "\C-c\C-i"  'rpm-insert-tag)
+  (define-key rpm-spec-mode-map "\C-c\C-n"  'rpm-forward-section)
+  (define-key rpm-spec-mode-map "\C-c\C-o"  'rpm-goto-section)
+  (define-key rpm-spec-mode-map "\C-c\C-p"  'rpm-backward-section)
+  (define-key rpm-spec-mode-map "\C-c\C-r"  'rpm-increase-release-tag)
+  (define-key rpm-spec-mode-map "\C-c\C-u"  'rpm-insert-true-prefix)
+  (define-key rpm-spec-mode-map "\C-c\C-ba" 'rpm-build-all)
+  (define-key rpm-spec-mode-map "\C-c\C-bb" 'rpm-build-binary)
+  (define-key rpm-spec-mode-map "\C-c\C-bc" 'rpm-build-compile)
+  (define-key rpm-spec-mode-map "\C-c\C-bi" 'rpm-build-install)
+  (define-key rpm-spec-mode-map "\C-c\C-bl" 'rpm-list-check)
+  (define-key rpm-spec-mode-map "\C-c\C-bp" 'rpm-build-prepare)
+  (define-key rpm-spec-mode-map "\C-c\C-bs" 'rpm-build-source)
+  (define-key rpm-spec-mode-map "\C-c\C-dd" 'rpm-insert-dir)
+  (define-key rpm-spec-mode-map "\C-c\C-do" 'rpm-insert-docdir)
+  (define-key rpm-spec-mode-map "\C-c\C-fc" 'rpm-insert-config)
+  (define-key rpm-spec-mode-map "\C-c\C-fd" 'rpm-insert-doc)
+  (define-key rpm-spec-mode-map "\C-c\C-ff" 'rpm-insert-file)
+  (define-key rpm-spec-mode-map "\C-c\C-fg" 'rpm-insert-ghost)
+  (define-key rpm-spec-mode-map "\C-c\C-xa" 'rpm-toggle-add-attr)
+  (define-key rpm-spec-mode-map "\C-c\C-xb" 'rpm-change-buildroot-option)
+  (define-key rpm-spec-mode-map "\C-c\C-xc" 'rpm-toggle-clean)
+  (define-key rpm-spec-mode-map "\C-c\C-xd" 'rpm-toggle-nodeps)
+  (define-key rpm-spec-mode-map "\C-c\C-xf" 'rpm-files-group)
+  (define-key rpm-spec-mode-map "\C-c\C-xg" 'rpm-toggle-sign-gpg)
+  (define-key rpm-spec-mode-map "\C-c\C-xi" 'rpm-change-timecheck-option)
+  (define-key rpm-spec-mode-map "\C-c\C-xn" 'rpm-toggle-nobuild)
+  (define-key rpm-spec-mode-map "\C-c\C-xo" 'rpm-files-owner)
+  (define-key rpm-spec-mode-map "\C-c\C-xp" 'rpm-change-target-option)
+  (define-key rpm-spec-mode-map "\C-c\C-xr" 'rpm-toggle-rmsource)
+  (define-key rpm-spec-mode-map "\C-cxd"    'rpm-toggle-no-deps)
+  (define-key rpm-spec-mode-map "\C-c\C-xs" 'rpm-toggle-short-circuit)
+  (define-key rpm-spec-mode-map "\C-c\C-xu" 'rpm-files-umask)
+  ;;(define-key rpm-spec-mode-map "\C-q" 'indent-spec-exp)
+  ;;(define-key rpm-spec-mode-map "\t" 'sh-indent-line)
+  )
+
+(defconst rpm-spec-mode-menu
+  (purecopy '("RPM spec"
+              ["Insert Tag..."           rpm-insert-tag                t]
+              ["Change Tag..."           rpm-change-tag                t]
+              "---"
+              ["Go to section..."        rpm-mouse-goto-section  :keys "C-c C-o"]
+              ["Forward section"         rpm-forward-section           t]
+              ["Backward section"        rpm-backward-section          t]
+              "---"
+              ["Add change log entry..." rpm-add-change-log-entry      t]
+              ["Increase release tag"    rpm-increase-release-tag      t]
+              "---"
+              ("Add file entry"
+               ["Regular file..."        rpm-insert-file               t]
+               ["Config file..."         rpm-insert-config             t]
+               ["Document file..."       rpm-insert-doc                t]
+               ["Ghost file..."          rpm-insert-ghost              t]
+               "---"
+               ["Directory..."           rpm-insert-dir                t]
+               ["Document directory..."  rpm-insert-docdir             t]
+               "---"
+               ["Insert %{prefix}"       rpm-insert-true-prefix        t]
+               "---"
+               ["Default add \"%attr\" entry" rpm-toggle-add-attr
+                :style toggle :selected rpm-spec-add-attr]
+               ["Change default umask for files..."  rpm-files-umask   t]
+               ["Change default owner for files..."  rpm-files-owner   t]
+               ["Change default group for files..."  rpm-files-group   t])
+              ("Build Options"
+               ["Short circuit" rpm-toggle-short-circuit
+                :style toggle :selected rpm-spec-short-circuit]
+			   ["No deps" rpm-toggle-no-deps
+				:style toggle :selected rpm-spec-no-deps]
+               ["Remove source" rpm-toggle-rmsource
+                :style toggle :selected rpm-spec-rmsource]
+               ["Clean"         rpm-toggle-clean
+                :style toggle :selected rpm-spec-clean]
+               ["No build"      rpm-toggle-nobuild
+                :style toggle :selected rpm-spec-nobuild]
+               ["GPG sign"      rpm-toggle-sign-gpg
+                :style toggle :selected rpm-spec-sign-gpg]
+               ["Ignore dependencies" rpm-toggle-nodeps
+                :style toggle :selected rpm-spec-nodeps]
+               "---"
+               ["Change timecheck value..."  rpm-change-timecheck-option   t]
+               ["Change buildroot value..."  rpm-change-buildroot-option   t]
+               ["Change target value..."     rpm-change-target-option      t])
+              ("RPM Build"
+               ["Execute \"%prep\" stage"    rpm-build-prepare             t]
+               ["Do a \"list check\""        rpm-list-check                t]
+               ["Do the \"%build\" stage"    rpm-build-compile             t]
+               ["Do the \"%install\" stage"  rpm-build-install             t]
+               "---"
+               ["Build binary package"       rpm-build-binary              t]
+               ["Build source package"       rpm-build-source              t]
+               ["Build binary and source"    rpm-build-all                 t])
+              "---"
+              ["About rpm-spec-mode"         rpm-about-rpm-spec-mode       t]
+              )))
+
+(defvar rpm-spec-font-lock-keywords
+  '(
+    ("%[a-zA-Z0-9-_]+" 0 rpm-spec-macro-face)
+    ("^\\([a-zA-Z0-9]+\\)\\(\([a-zA-Z0-9,]+\)\\):"
+     (1 rpm-spec-tag-face)
+     (2 rpm-spec-ghost-face))
+    ("^\\([a-zA-Z0-9]+\\):" 1 rpm-spec-tag-face)
+    ("%\\(de\\(fine\\|scription\\)\\|files\\|package\\)[ \t]+\\([^-][^ \t\n]*\\)"
+     (3 rpm-spec-package-face))
+    ("%p\\(ost\\|re\\)\\(un\\)?[ \t]+\\([^-][^ \t\n]*\\)"
+     (3 rpm-spec-package-face))
+    ("%configure " 0 rpm-spec-macro-face)
+    ("%dir[ \t]+\\([^ \t\n]+\\)[ \t]*" 1 rpm-spec-dir-face)
+    ("%doc\\(dir\\)?[ \t]+\\(.*\\)\n" 2 rpm-spec-doc-face)
+    ("%\\(ghost\\|config\\)[ \t]+\\(.*\\)\n" 2 rpm-spec-ghost-face)
+    ("^%.+-[a-zA-Z][ \t]+\\([a-zA-Z0-9\.-]+\\)" 1 rpm-spec-doc-face)
+    ("^\\(.+\\)(\\([a-zA-Z]\\{2,2\\}\\)):"
+     (1 rpm-spec-tag-face)
+     (2 rpm-spec-doc-face))
+    ("^\\*\\(.*[0-9] \\)\\(.*\\)\\(<.*>\\)\\(.*\\)\n"
+     (1 rpm-spec-dir-face)
+     (2 rpm-spec-package-face)
+     (3 rpm-spec-tag-face)
+     (4 font-lock-warning-face))
+    ("%{[^{}]*}" 0 rpm-spec-macro-face)
+    ("$[a-zA-Z0-9_]+" 0 rpm-spec-var-face)
+    ("${[a-zA-Z0-9_]+}" 0 rpm-spec-var-face)
+    )
+  "Additional expressions to highlight in `rpm-spec-mode'.")
+
+;;Initialize font lock for xemacs
+(put 'rpm-spec-mode 'font-lock-defaults '(rpm-spec-font-lock-keywords))
+
+(defvar rpm-spec-mode-abbrev-table nil
+  "Abbrev table in use in `rpm-spec-mode' buffers.")
+(define-abbrev-table 'rpm-spec-mode-abbrev-table ())
+
+;;------------------------------------------------------------
+
+;;;###autoload
+(defun rpm-spec-mode ()
+  "Major mode for editing RPM spec files.
+This is much like C mode except for the syntax of comments.  It uses
+the same keymap as C mode and has the same variables for customizing
+indentation.  It has its own abbrev table and its own syntax table.
+
+Turning on RPM spec mode calls the value of the variable `rpm-spec-mode-hook'
+with no args, if that value is non-nil."
+  (interactive)
+  (kill-all-local-variables)
+  (condition-case nil
+      (require 'shindent)
+    (error
+     (require 'sh-script)))
+  (require 'cc-mode)
+  (use-local-map rpm-spec-mode-map)
+  (setq major-mode 'rpm-spec-mode)
+  (rpm-update-mode-name)
+  (setq local-abbrev-table rpm-spec-mode-abbrev-table)
+  (set-syntax-table rpm-spec-mode-syntax-table)
+
+  (require 'easymenu)
+  (easy-menu-define rpm-spec-call-menu rpm-spec-mode-map
+                    "Post menu for `rpm-spec-mode'." rpm-spec-mode-menu)
+  (easy-menu-add rpm-spec-mode-menu)
+
+  (if (= (buffer-size) 0)
+      (rpm-spec-initialize))
+
+  (if (executable-find "rpmbuild")
+      (setq rpm-spec-build-command "rpmbuild")
+    (setq rpm-spec-old-rpm t)
+    (setq rpm-spec-build-command "rpm"))
+  
+  (make-local-variable 'paragraph-start)
+  (setq paragraph-start (concat "$\\|" page-delimiter))
+  (make-local-variable 'paragraph-separate)
+  (setq paragraph-separate paragraph-start)
+  (make-local-variable 'paragraph-ignore-fill-prefix)
+  (setq paragraph-ignore-fill-prefix t)
+;  (make-local-variable 'indent-line-function)
+;  (setq indent-line-function 'c-indent-line)
+  (make-local-variable 'require-final-newline)
+  (setq require-final-newline t)
+  (make-local-variable 'comment-start)
+  (setq comment-start "# ")
+  (make-local-variable 'comment-end)
+  (setq comment-end "")
+  (make-local-variable 'comment-column)
+  (setq comment-column 32)
+  (make-local-variable 'comment-start-skip)
+  (setq comment-start-skip "#+ *")
+;  (make-local-variable 'comment-indent-function)
+;  (setq comment-indent-function 'c-comment-indent)
+  ;;Initialize font lock for GNU emacs.
+  (make-local-variable 'font-lock-defaults)
+  (setq font-lock-defaults '(rpm-spec-font-lock-keywords nil t))
+  (run-hooks 'rpm-spec-mode-hook))
+
+(defun rpm-command-filter (process string)
+  "Filter to process normal output."
+  (save-excursion
+    (set-buffer (process-buffer process))
+    (save-excursion
+      (goto-char (process-mark process))
+      (insert-before-markers string)
+      (set-marker (process-mark process) (point)))))
+
+; insert one space, or the number of tabs if rpm-spec-use-tabs is true
+(defun rpm-insert-space-or-tabs (tabs)
+  (if rpm-spec-use-tabs
+      (if (> tabs 0)
+	  (concat "\t" (rpm-insert-space-or-tabs (1- tabs)))
+	  "")
+      " "))
+
+;;------------------------------------------------------------
+
+(defun rpm-add-change-log-entry (&optional change-log-entry)
+  "Find change log and add an entry for today."
+  (interactive "P")
+  (goto-char (point-min))
+    (if (search-forward-regexp "^%changelog[ \t]*$" nil t)
+	(let* ((address (or rpm-spec-user-mail-address user-mail-address))
+	       (fullname (or rpm-spec-user-full-name user-full-name))
+	       (string (concat "* " (substring (current-time-string) 0 11)
+			       (substring (current-time-string) -4) " "
+			       fullname " <" address "> "
+			       (or 
+				(and rpm-spec-insert-changelog-version
+				     (or (and rpm-spec-insert-changelog-version-with-shell
+					      (rpm-find-spec-version-with-shell))
+					 (rpm-find-spec-version))))
+				"")))
+	  (if (not (search-forward string nil t))
+	      (insert "\n" string "\n")
+	      (progn (next-line 1)
+		     (beginning-of-line)))
+	  (unless (eq (point) (1- (point-max)))
+	    (insert "\n")
+	    (previous-line 1))
+	  (insert "- ")
+	  (if change-log-entry
+	      (insert (concat (format "%s." change-log-entry)))))
+	(message "No \"%%changelog\" entry found...")))
+
+;;------------------------------------------------------------
+
+(defun rpm-insert-f (&optional filetype filename)
+  "Insert new \"%files\" entry."
+  (save-excursion
+    (and (rpm-goto-section "files") (rpm-end-of-section))
+    (if (or (eq filename 1) (not filename))
+        (insert (read-file-name
+                 (concat filetype "filename: ") "" "" nil) "\n")
+      (insert filename "\n"))
+    (forward-line -1)
+    (if rpm-spec-add-attr
+        (let ((rpm-default-mode rpm-default-umask))
+          (insert "%attr(" rpm-default-mode ", " rpm-default-owner ", "
+                  rpm-default-group ") ")))
+    (insert filetype)))
+
+(defun rpm-insert-file (&optional filename)
+  "Insert regular file."
+  (interactive "p")
+  (rpm-insert-f "" filename))
+
+(defun rpm-insert-config (&optional filename)
+  "Insert config file."
+  (interactive "p")
+  (rpm-insert-f "%config " filename))
+
+(defun rpm-insert-doc (&optional filename)
+  "Insert doc file."
+  (interactive "p")
+  (rpm-insert-f "%doc " filename))
+
+(defun rpm-insert-ghost (&optional filename)
+  "Insert ghost file."
+  (interactive "p")
+  (rpm-insert-f "%ghost " filename))
+
+(defun rpm-insert-dir (&optional dirname)
+  "Insert directory."
+  (interactive "p")
+  (rpm-insert-f "%dir " dirname))
+
+(defun rpm-insert-docdir (&optional dirname)
+  "Insert doc directory."
+  (interactive "p")
+  (rpm-insert-f "%docdir " dirname))
+
+;;------------------------------------------------------------
+(defun rpm-completing-read (prompt table &optional pred require init hist)
+  "Read from the minibuffer, with completion.
+Like `completing-read', but the variable `rpm-spec-completion-ignore-case'
+controls whether case is significant."
+  (let ((completion-ignore-case rpm-spec-completion-ignore-case))
+    (completing-read prompt table pred require init hist)))
+
+(defun rpm-insert (&optional what file-completion)
+  "Insert given tag.  Use file-completion if argument is t."
+  (beginning-of-line)
+  (if (not what)
+      (setq what (rpm-completing-read "Tag: " rpm-tags-list)))
+  (if (string-match "^%" what)
+      (setq read-text (concat "Packagename for " what ": ")
+            insert-text (concat what " "))
+    (setq read-text (concat what ": ")
+          insert-text (concat what ": ")))
+  (cond
+   ((string-equal what "Group")
+    (rpm-insert-group))
+   ((string-equal what "Source")
+    (rpm-insert-n "Source"))
+   ((string-equal what "Patch")
+    (rpm-insert-n "Patch"))
+   (t
+    (if file-completion
+        (insert insert-text (read-file-name (concat read-text) "" "" nil) "\n")
+      (insert insert-text (read-from-minibuffer (concat read-text)) "\n")))))
+
+(defun rpm-topdir ()
+  (or
+   (getenv "RPM")
+   (getenv "rpm")
+   (if (file-directory-p "~/rpm") "~/rpm/")
+   (if (file-directory-p "~/RPM") "~/RPM/")
+   (if (file-directory-p "/usr/src/redhat/") "/usr/src/redhat/")
+   "/usr/src/RPM"))
+
+(defun rpm-insert-n (what &optional arg)
+  "Insert given tag with possible number."
+  (save-excursion
+    (goto-char (point-max))
+    (if (search-backward-regexp (concat "^" what "\\([0-9]*\\):") nil t)
+        (let ((release (1+ (string-to-int (match-string 1)))))
+          (forward-line 1)
+          (let ((default-directory (concat (rpm-topdir) "/SOURCES/")))
+            (insert what (int-to-string release) ": "
+                    (read-file-name (concat what "file: ") "" "" nil) "\n")))
+      (goto-char (point-min))
+      (rpm-end-of-section)
+      (insert what ": " (read-from-minibuffer (concat what "file: ")) "\n"))))
+
+(defun rpm-change (&optional what arg)
+  "Update given tag."
+  (save-excursion
+    (if (not what)
+        (setq what (rpm-completing-read "Tag: " rpm-tags-list)))
+    (cond
+     ((string-equal what "Group")
+      (rpm-change-group))
+     ((string-equal what "Source")
+      (rpm-change-n "Source"))
+     ((string-equal what "Patch")
+      (rpm-change-n "Patch"))
+     (t
+      (goto-char (point-min))
+      (if (search-forward-regexp (concat "^" what ":\\s-*\\(.*\\)$") nil t)
+          (replace-match
+           (concat what ": " (read-from-minibuffer
+                              (concat "New " what ": ") (match-string 1))))
+        (message (concat what " tag not found...")))))))
+
+(defun rpm-change-n (what &optional arg)
+  "Change given tag with possible number."
+  (save-excursion
+    (goto-char (point-min))
+    (let ((number (read-from-minibuffer (concat what " number: "))))
+      (if (search-forward-regexp
+           (concat "^" what number ":\\s-*\\(.*\\)") nil t)
+          (let ((default-directory (concat (rpm-topdir) "/SOURCES/")))
+            (replace-match
+             (concat what number ": "
+                     (read-file-name (concat "New " what number " file: ")
+                                     "" "" nil (match-string 1)))))
+        (message (concat what " number \"" number "\" not found..."))))))
+
+(defun rpm-insert-group (group)
+  "Insert Group tag."
+  (interactive (list (rpm-completing-read "Group: " rpm-group-tags-list)))
+  (beginning-of-line)
+  (insert "Group:" (rpm-insert-space-or-tabs 2) group "\n"))
+
+(defun rpm-change-group (&optional arg)
+  "Update Group tag."
+  (interactive "p")
+  (save-excursion
+    (goto-char (point-min))
+    (if (search-forward-regexp "^Group:[ \t]*\\(.*\\)$" nil t)
+        (replace-match
+         (concat "Group:"
+		 (rpm-insert-space-or-tabs 2)
+                 (rpm-completing-read "Group: " rpm-group-tags-list
+				      nil nil (match-string 1))))
+      (message "Group tag not found..."))))
+
+(defun rpm-insert-tag (&optional arg)
+  "Insert or change a tag."
+  (interactive "p")
+  (if current-prefix-arg
+      (rpm-change)
+    (rpm-insert)))
+
+(defun rpm-change-tag (&optional arg)
+  "Change a tag."
+  (interactive "p")
+  (rpm-change))
+
+(defun rpm-insert-packager (&optional arg)
+  "Insert Packager tag."
+  (interactive "p")
+  (beginning-of-line)
+  (insert "Packager:"
+	  (rpm-insert-space-or-tabs 1)
+	  (or rpm-spec-user-full-name (user-full-name))
+          " <" (or rpm-spec-user-mail-address (user-mail-address)) ">\n"))
+
+(defun rpm-change-packager (&optional arg)
+  "Update Packager tag."
+  (interactive "p")
+  (rpm-change "Packager"))
+
+;;------------------------------------------------------------
+
+(defun rpm-current-section nil
+  (interactive)
+  (save-excursion
+    (rpm-forward-section)
+    (rpm-backward-section)
+    (if (bobp) "preamble"
+      (buffer-substring (match-beginning 1) (match-end 1)))))
+
+(defun rpm-backward-section nil
+  "Move backward to the beginning of the previous section.
+Go to beginning of previous section."
+  (interactive)
+  (or (re-search-backward rpm-section-regexp nil t)
+      (goto-char (point-min))))
+
+(defun rpm-beginning-of-section nil
+  "Move backward to the beginning of the current section.
+Go to beginning of current section."
+  (interactive)
+  (or (and (looking-at rpm-section-regexp) (point))
+      (re-search-backward rpm-section-regexp nil t)
+      (goto-char (point-min))))
+
+(defun rpm-forward-section nil
+  "Move forward to the beginning of the next section."
+  (interactive)
+  (forward-char)
+  (if (re-search-forward rpm-section-regexp nil t)
+      (progn (forward-line 0) (point))
+    (goto-char (point-max))))
+
+(defun rpm-end-of-section nil
+  "Move forward to the end of this section."
+  (interactive)
+  (forward-char)
+  (if (re-search-forward rpm-section-regexp nil t)
+      (forward-line -1)
+    (goto-char (point-max)))
+;;  (while (or (looking-at paragraph-separate) (looking-at "^\\s-*#"))
+  (while (looking-at "^\\s-*\\($\\|#\\)")
+    (forward-line -1))
+  (forward-line 1)
+  (point))
+
+(defun rpm-goto-section (section)
+  "Move point to the beginning of the specified section;
+leave point at previous location."
+  (interactive (list (rpm-completing-read "Section: " rpm-section-list)))
+  (push-mark)
+  (goto-char (point-min))
+  (or
+   (equal section "preamble")
+   (re-search-forward (concat "^%" section "\\b") nil t)
+   (let ((s (cdr rpm-sections)))
+     (while (not (equal section (car s)))
+       (re-search-forward (concat "^%" (car s) "\\b") nil t)
+       (setq s (cdr s)))
+     (if (re-search-forward rpm-section-regexp nil t)
+         (forward-line -1) (goto-char (point-max)))
+     (insert "\n%" section "\n"))))
+
+(defun rpm-mouse-goto-section (&optional section)
+  (interactive
+   (x-popup-menu
+    nil
+    (list "sections"
+          (cons "Sections" (mapcar (lambda (e) (list e e)) rpm-sections))
+          (cons "Scripts" (mapcar (lambda (e) (list e e)) rpm-scripts))
+          )))
+  ;; If user doesn't pick a section, exit quietly.
+  (and section
+       (if (member section rpm-sections)
+           (rpm-goto-section section)
+         (goto-char (point-min))
+         (or (re-search-forward (concat "^%" section "\\b") nil t)
+             (and (re-search-forward "^%files\\b" nil t) (forward-line -1))
+             (goto-char (point-max))))))
+
+(defun rpm-insert-true-prefix ()
+  (interactive)
+  (insert "%{prefix}"))
+
+;;------------------------------------------------------------
+
+(defun rpm-build (buildoptions)
+  "Build this RPM package."
+  (setq rpm-buffer-name
+        (concat "*" rpm-spec-build-command " " 
+                (file-name-nondirectory buffer-file-name) "*"))
+  (rpm-process-check rpm-buffer-name)
+  (if (get-buffer rpm-buffer-name)
+      (kill-buffer rpm-buffer-name))
+  (create-file-buffer rpm-buffer-name)
+  (display-buffer rpm-buffer-name)
+  (setq buildoptions (list buildoptions buffer-file-name))
+  (if (or rpm-spec-short-circuit rpm-spec-nobuild)
+      (setq rpm-no-gpg t))
+  (if rpm-spec-rmsource
+      (setq buildoptions (cons "--rmsource" buildoptions)))
+  (if rpm-spec-clean
+      (setq buildoptions (cons "--clean" buildoptions)))
+  (if rpm-spec-short-circuit
+      (setq buildoptions (cons "--short-circuit" buildoptions)))
+  (if rpm-spec-no-deps
+      (setq buildoptions (cons "--nodeps" buildoptions)))
+  (if (and (not (equal rpm-spec-timecheck "0"))
+           (not (equal rpm-spec-timecheck "")))
+      (setq buildoptions (cons "--timecheck" (cons rpm-spec-timecheck
+                                                   buildoptions))))
+  (if (not (equal rpm-spec-buildroot ""))
+      (setq buildoptions (cons "--buildroot" (cons rpm-spec-buildroot
+                                                   buildoptions))))
+  (if (not (equal rpm-spec-target ""))
+      (setq buildoptions (cons "--target" (cons rpm-spec-target
+                                                buildoptions))))
+  (if rpm-spec-nobuild
+      (setq buildoptions (cons (if rpm-spec-old-rpm "--test" "--nobuild")
+			       buildoptions)))
+  (if rpm-spec-nodeps
+      (setq buildoptions (cons "--nodeps" buildoptions)))
+  (if (and rpm-spec-sign-gpg (not rpm-no-gpg))
+      (setq buildoptions (cons "--sign" buildoptions)))
+  (save-excursion
+    (set-buffer (get-buffer rpm-buffer-name))
+    (goto-char (point-max)))
+  (let ((process
+         (apply 'start-process rpm-spec-build-command rpm-buffer-name
+		rpm-spec-build-command buildoptions)))
+    (if (and rpm-spec-sign-gpg (not rpm-no-gpg))
+        (let ((rpm-passwd-cache (read-passwd "GPG passphrase: ")))
+          (process-send-string process (concat rpm-passwd-cache "\n"))))
+    (set-process-filter process 'rpm-command-filter)))
+
+(defun rpm-build-prepare (&optional arg)
+  "Run a `rpmbuild -bp'."
+  (interactive "p")
+   (setq rpm-no-gpg t)
+   (rpm-build "-bp"))
+
+(defun rpm-list-check (&optional arg)
+  "Run a `rpmbuild -bl'."
+  (interactive "p")
+  (setq rpm-no-gpg t)
+  (rpm-build "-bl"))
+
+(defun rpm-build-compile (&optional arg)
+  "Run a `rpmbuild -bc'."
+  (interactive "p")
+  (setq rpm-no-gpg t)
+  (rpm-build "-bc"))
+
+(defun rpm-build-install (&optional arg)
+  "Run a `rpmbuild -bi'."
+  (interactive "p")
+  (setq rpm-no-gpg t)
+  (rpm-build "-bi"))
+
+(defun rpm-build-binary (&optional arg)
+  "Run a `rpmbuild -bb'."
+  (interactive "p")
+  (setq rpm-no-gpg nil)
+  (rpm-build "-bb"))
+
+(defun rpm-build-source (&optional arg)
+  "Run a `rpmbuild -bs'."
+  (interactive "p")
+  (setq rpm-no-gpg nil)
+  (rpm-build "-bs"))
+
+(defun rpm-build-all (&optional arg)
+  "Run a `rpmbuild -ba'."
+  (interactive "p")
+  (setq rpm-no-gpg nil)
+    (rpm-build "-ba"))
+
+(defun rpm-process-check (buffer)
+  "Check if BUFFER has a running process.
+If so, give the user the choice of aborting the process or the current
+command."
+  (let ((process (get-buffer-process (get-buffer buffer))))
+    (if (and process (eq (process-status process) 'run))
+        (if (yes-or-no-p (concat "Process `" (process-name process)
+                                 "' running.  Kill it? "))
+            (delete-process process)
+          (error "Cannot run two simultaneous processes ...")))))
+
+;;------------------------------------------------------------
+
+(defun rpm-toggle-short-circuit (&optional arg)
+  "Toggle `rpm-spec-short-circuit'."
+  (interactive "p")
+  (setq rpm-spec-short-circuit (not rpm-spec-short-circuit))
+  (rpm-update-mode-name)
+  (message (concat "Turned `--short-circuit' "
+                   (if rpm-spec-short-circuit "on" "off") ".")))
+
+(defun rpm-toggle-no-deps (&optional arg)
+  "Toggle rpm-spec-no-deps."
+  (interactive "p")
+  (setq rpm-spec-no-deps (not rpm-spec-no-deps))
+  (rpm-update-mode-name)
+  (message (concat "Turned `--nodeps' "
+                   (if rpm-spec-no-deps "on" "off") ".")))
+
+(defun rpm-toggle-rmsource (&optional arg)
+  "Toggle `rpm-spec-rmsource'."
+  (interactive "p")
+  (setq rpm-spec-rmsource (not rpm-spec-rmsource))
+  (rpm-update-mode-name)
+  (message (concat "Turned `--rmsource' "
+                   (if rpm-spec-rmsource "on" "off") ".")))
+
+(defun rpm-toggle-clean (&optional arg)
+  "Toggle `rpm-spec-clean'."
+  (interactive "p")
+  (setq rpm-spec-clean (not rpm-spec-clean))
+  (rpm-update-mode-name)
+  (message (concat "Turned `--clean' "
+                   (if rpm-spec-clean "on" "off") ".")))
+
+(defun rpm-toggle-nobuild (&optional arg)
+  "Toggle `rpm-spec-nobuild'."
+  (interactive "p")
+  (setq rpm-spec-nobuild (not rpm-spec-nobuild))
+  (rpm-update-mode-name)
+  (message (concat "Turned `" (if rpm-spec-old-rpm "--test" "--nobuild") "' "
+                   (if rpm-spec-nobuild "on" "off") ".")))
+
+(defun rpm-toggle-sign-gpg (&optional arg)
+  "Toggle `rpm-spec-sign-gpg'."
+  (interactive "p")
+  (setq rpm-spec-sign-gpg (not rpm-spec-sign-gpg))
+  (rpm-update-mode-name)
+  (message (concat "Turned `--sign' "
+                   (if rpm-spec-sign-gpg "on" "off") ".")))
+
+(defun rpm-toggle-add-attr (&optional arg)
+  "Toggle `rpm-spec-add-attr'."
+  (interactive "p")
+  (setq rpm-spec-add-attr (not rpm-spec-add-attr))
+  (rpm-update-mode-name)
+  (message (concat "Default add \"attr\" entry turned "
+                   (if rpm-spec-add-attr "on" "off") ".")))
+
+(defun rpm-toggle-nodeps (&optional arg)
+  "Toggle `rpm-spec-nodeps'."
+  (interactive "p")
+  (setq rpm-spec-nodeps (not rpm-spec-nodeps))
+  (rpm-update-mode-name)
+  (message (concat "Turned `--nodeps' "
+                   (if rpm-spec-nodeps "on" "off") ".")))
+
+(defun rpm-update-mode-name ()
+  "Update `mode-name' according to values set."
+  (setq mode-name "RPM-SPEC")
+  (setq modes (concat (if rpm-spec-add-attr      "A")
+                      (if rpm-spec-clean         "C")
+                      (if rpm-spec-nodeps        "D")
+                      (if rpm-spec-sign-gpg      "G")
+                      (if rpm-spec-nobuild       "N")
+                      (if rpm-spec-rmsource      "R")
+                      (if rpm-spec-short-circuit "S")
+					  (if rpm-spec-no-deps       "D")
+                      ))
+  (if (not (equal modes ""))
+      (setq mode-name (concat mode-name ":" modes))))
+
+;;------------------------------------------------------------
+
+(defun rpm-change-timecheck-option (&optional arg)
+  "Change the value for timecheck."
+  (interactive "p")
+  (setq rpm-spec-timecheck
+        (read-from-minibuffer "New timecheck: " rpm-spec-timecheck)))
+
+(defun rpm-change-buildroot-option (&optional arg)
+  "Change the value for buildroot."
+  (interactive "p")
+  (setq rpm-spec-buildroot
+        (read-from-minibuffer "New buildroot: " rpm-spec-buildroot)))
+
+(defun rpm-change-target-option (&optional arg)
+  "Change the value for target."
+  (interactive "p")
+  (setq rpm-spec-target
+        (read-from-minibuffer "New target: " rpm-spec-target)))
+
+(defun rpm-files-umask (&optional arg)
+  "Change the default umask for files."
+  (interactive "p")
+  (setq rpm-default-umask
+        (read-from-minibuffer "Default file umask: " rpm-default-umask)))
+
+(defun rpm-files-owner (&optional arg)
+  "Change the default owner for files."
+  (interactive "p")
+  (setq rpm-default-owner
+        (read-from-minibuffer "Default file owner: " rpm-default-owner)))
+
+(defun rpm-files-group (&optional arg)
+  "Change the source directory."
+  (interactive "p")
+  (setq rpm-default-group
+        (read-from-minibuffer "Default file group: " rpm-default-group)))
+
+(defun rpm-increase-release-tag (&optional arg)
+  "Increase the release tag by 1."
+  (interactive "p")
+  (save-excursion
+    (goto-char (point-min))
+	(if (search-forward-regexp "^Release:\\([ \t]*\\)\\(\\([^.\n]+\\.\\)*\\)\\([0-9]+\\)\\(.*\\)" nil t)
+		(let ((release (1+ (string-to-int (match-string 4)))))
+		  (setq release (concat (match-string 1) (match-string 2) (int-to-string release) (match-string 5)))
+		  (replace-match (concat "Release:" release))
+		  (message (concat "Release tag changed to " release ".")))
+	  (if (search-forward-regexp "^Release:[ \t]*%{?\\([^}]*\\)}?$" nil t)
+		  (rpm-increase-release-with-macros)
+		(message "No Release tag found...")))))
+
+;;------------------------------------------------------------
+
+(defun rpm-spec-field-value (field max)
+  "Get the value of FIELD, searching up to buffer position MAX.
+See `search-forward-regexp'."
+  (save-excursion
+    (ignore-errors
+      (let ((str
+             (progn
+               (goto-char (point-min))
+               (search-forward-regexp (concat
+                                       field ":[ \t]*\\(.*?\\)[ \t]*$") max)
+               (match-string 1))))
+        (if (string-match "%{?\\([^}]*\\)}?$" str)
+            (progn
+              (goto-char (point-min))
+              (search-forward-regexp
+               (concat "%define[ \t]+" (substring str (match-beginning 1)
+                                                  (match-end 1))
+                       "[ \t]+\\(.*\\)"))
+              (match-string 1))
+          str)))))
+
+(defun rpm-find-spec-version (&optional with-epoch)
+  "Get the version string.
+If WITH-EPOCH is non-nil, the string contains the Epoch/Serial value,
+if one is present in the file."
+  (save-excursion
+    (goto-char (point-min))
+    (let* ((max (search-forward-regexp rpm-section-regexp))
+           (version (rpm-spec-field-value "Version" max))
+           (release (rpm-spec-field-value "Release" max))
+           (epoch   (rpm-spec-field-value "Epoch"   max)) )
+      (when (and version (< 0 (length version)))
+        (unless epoch (setq epoch (rpm-spec-field-value "Serial" max)))
+        (concat (and with-epoch epoch (concat epoch ":"))
+                version
+                (and release (concat "-" release)))))))
+
+(defun rpm--with-temp-file (prefix f)
+  (let ((file (make-temp-file prefix)))
+    (unwind-protect
+	(funcall f file)
+      (delete-file file))))
+
+(defun rpm-find-spec-version-with-shell ()
+  "Find the version and release with the rpm command 
+   more robust but slower than the lisp version"
+  (rpm--with-temp-file "spec" (lambda (tmpfile)
+     (write-region (point-min) (point-max) tmpfile nil 1)
+  (let ((relver))
+	(with-temp-buffer
+	  (apply 'call-process "rpm" nil t nil 
+			 (list "-q" "--qf" "'%{VERSION}-%{RELEASE}\\n'" "--specfile" tmpfile))
+	  (goto-char (point-min))
+	  (if (re-search-forward "\\([0-9]+.+\\)" nil t)
+	      (setq relver (match-string 1)))
+	  )
+  relver)
+  )))
+
+(defun rpm-increase-release-with-macros ()
+  (save-excursion
+    (let ((str
+           (progn
+             (goto-char (point-min))
+             (search-forward-regexp (concat "Release:[ \t]*\\(.+\\).*$") nil)
+             (match-string 1)))
+	  (increase-macro (lambda (macros)
+		   (goto-char (point-min))
+                   (if (search-forward-regexp
+			(concat "%define[ \t]+" macros
+				"\\([ \t]+\\)\\(\\([^.\n]+\\.\\)*\\)\\([0-9]+\\)\\(.*\\)") nil t)
+		       (let ((dinrel (concat macros (match-string 1) (match-string 2)
+			       (int-to-string (1+ (string-to-int
+						   (match-string 4))))
+			       (match-string 5))))
+			 (replace-match (concat "%define " dinrel))
+			 (message (concat "Release tag changed to " dinrel "."))
+			 t)))))
+
+      (if (string-match "%{?\\([^}]*\\)}?$" str)
+	  (let ((macros (substring str (match-beginning 1) (match-end 1))))
+	    (or (funcall increase-macro macros)
+		(and (search-forward-regexp
+		      (concat "%define[ \t]+" macros "[ \t]+%mkrel[ \t]+%{rel}") nil t)
+		     (funcall increase-macro "rel"))
+		(and (search-forward-regexp "\\(%mkrel[ \t]+\\)\\([0-9]+\\)$" nil t)
+		     (replace-match (concat (match-string 1) (int-to-string (1+ (string-to-int (match-string 2)))))))
+	    ))))))
+
+;;------------------------------------------------------------
+
+(defun rpm-spec-initialize ()
+  "Create a default spec file if one does not exist or is empty."
+  (let (file name version (release "1"))
+    (setq file (if (buffer-file-name)
+                   (file-name-nondirectory (buffer-file-name))
+                 (buffer-name)))
+    (string-match "\\(.*\\).spec" file)
+    (setq name (match-string 1 file))
+
+    (insert
+	 "%define name " (or name "")
+	 "\n%define version " (or version "")
+	 "\n%define release %mkrel " (or release "")
+	 "\n\nSummary:" (rpm-insert-space-or-tabs 1)
+	 "\nName:" (rpm-insert-space-or-tabs 2) "%{name}"
+	 "\nVersion:" (rpm-insert-space-or-tabs 1) "%{version}" 
+	 "\nRelease:" (rpm-insert-space-or-tabs 1) "%{release}"
+	 "\nSource0:" (rpm-insert-space-or-tabs 1) "%{name}-%{version}.tar.bz2"
+	 "\nLicense:" (rpm-insert-space-or-tabs 1)
+	 "\nGroup:" (rpm-insert-space-or-tabs 2)
+	 "\nUrl:" (rpm-insert-space-or-tabs 2)
+	 "\nBuildRoot:" (rpm-insert-space-or-tabs 1) "%{_tmppath}/%{name}-%{version}-%{release}-buildroot\n"
+	 "\n\n%description\n"
+	 "\n%prep\n%setup -q\n\n%build\n\n%install\nrm -rf %{buildroot}"
+	 "\n\n\n%clean\nrm -rf %{buildroot}"
+	 "\n\n%files\n%defattr(-,root,root)\n" 
+	 "\n\n%changelog\n"))
+    (goto-char (point-min)))
+
+;;------------------------------------------------------------
+
+(defun rpm-about-rpm-spec-mode (&optional arg)
+  "About `rpm-spec-mode'."
+  (interactive "p")
+  (message
+   (concat "rpm-spec-mode version "
+           rpm-spec-mode-version
+           " by Stig Bj\xF8rlykke, <stigb at tihlde.org>")))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.spec$" . rpm-spec-mode))
+
+(provide 'rpm-spec-mode)
+
+;;; rpm-spec-mode.el ends here

Added: rpm/rpm-setup/trunk/rpmeval.c
===================================================================
--- rpm/rpm-setup/trunk/rpmeval.c	                        (rev 0)
+++ rpm/rpm-setup/trunk/rpmeval.c	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,36 @@
+/* $Id: rpmeval.c 271130 2010-10-16 11:12:45Z peroyvind $ */
+
+#include <stdint.h>
+
+#ifdef HAVE_RPM_RPMLIB_H
+#include <rpm/rpmlib.h>
+#else
+#include <rpm/rpmio.h>
+#include <rpm/rpmtag.h>
+#endif
+#include <rpm/rpmmacro.h>
+
+int main(int argc, char **argv)
+{
+    rpmRC rc;
+    char *results;
+    if (argc != 3) {
+        fprintf(stdout, "Not enough arguments: %d\n", argc);
+        return 1;
+    }
+    if (rc = rpmReadConfigFiles(NULL, NULL)) {
+        fprintf(stderr, "Cannot load configuration\n");
+        return rc;
+    }
+    if (rc = rpmLoadMacroFile(rpmGlobalMacroContext, argv[1]
+#ifndef RPMDBI_LABEL
+	    ,2
+#endif
+	    )) {
+        fprintf(stderr, "Cannot read %s\n", argv[1]);
+        return rc;
+    }
+    results = rpmExpand(argv[2], NULL);
+    fprintf(stdout, "%s\n", results);
+    return 0;
+}


Property changes on: rpm/rpm-setup/trunk/rpmeval.c
___________________________________________________________________
Added: svn:eol-style
   + native

Added: rpm/rpm-setup/trunk/rpmgenplatform.in
===================================================================
--- rpm/rpm-setup/trunk/rpmgenplatform.in	                        (rev 0)
+++ rpm/rpm-setup/trunk/rpmgenplatform.in	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+# $Id$
+use strict;
+use warnings;
+use Getopt::Long;
+
+GetOptions(
+    'o=s' => \my $output,
+);
+
+my @ALLARCH=qw{
+    noarch
+    @RPMALLARCH@
+};
+
+my $anysuffix = '-.*- at RPMOS@';
+my $suffix = '- at RPMCANONVENDOR@- at RPMOS@-gnu';
+my $canonarch = $ARGV[0] || `uname -m`;
+chomp($canonarch);
+
+my $houtput;
+if ($output && $output ne '-') {
+    open($houtput, '>', $output) or die "Cannot open `$output': $!\n";
+} else {
+    $houtput = *STDOUT;
+}
+
+foreach my $suf ($suffix, $anysuffix) {
+    my $found = 0;
+    my %done = ();
+    foreach my $arch (reverse @ALLARCH) {
+        $arch eq $canonarch and $found = 1;
+        $found or next;
+        $done{$arch} and next;
+        $done{$arch} = 1;
+        print $houtput "$arch$suf\n";
+    }
+}
+
+close($houtput) if ($houtput);

Added: rpm/rpm-setup/trunk/rpmrc.in
===================================================================
--- rpm/rpm-setup/trunk/rpmrc.in	                        (rev 0)
+++ rpm/rpm-setup/trunk/rpmrc.in	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,103 @@
+# $Id: rpmrc.in 232782 2008-01-07 17:34:01Z pixel $
+#
+# @RPMVENDORDIR@/rpmrc
+
+#############################################################
+# Values for RPM_OPT_FLAGS for various platforms
+
+optflags: i386 %{__common_cflags_with_ssp} -fomit-frame-pointer -march=i386 -fasynchronous-unwind-tables
+optflags: i486 %{__common_cflags_with_ssp} -fomit-frame-pointer -march=i486 -fasynchronous-unwind-tables
+optflags: k6   %{__common_cflags_with_ssp} -fomit-frame-pointer -march=k6 -fasynchronous-unwind-tables
+optflags: i586 %{__common_cflags_with_ssp} -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables
+optflags: i686 %{__common_cflags_with_ssp} -fomit-frame-pointer -march=i686 -fasynchronous-unwind-tables
+optflags: athlon %{__common_cflags_with_ssp} -fomit-frame-pointer -march=athlon -fasynchronous-unwind-tables
+optflags: pentium3 %{__common_cflags_with_ssp} -fomit-frame-pointer -march=pentium3 -fasynchronous-unwind-tables
+optflags: pentium4 %{__common_cflags_with_ssp} -fomit-frame-pointer -march=pentium4 -fasynchronous-unwind-tables
+
+optflags: x86_64 %{__common_cflags_with_ssp}
+optflags: amd64 %{__common_cflags_with_ssp}
+optflags: ia32e %{__common_cflags_with_ssp}
+
+optflags: ia64 %{__common_cflags}
+  
+  # XXX Please note that -mieee has been added in rpm-3.0.5.
+optflags: alpha %{__common_cflags} -mieee -mcpu=ev5
+optflags: alphaev5 %{__common_cflags} -mieee -mcpu=ev5
+optflags: alphaev56 %{__common_cflags} -mieee -mcpu=ev56
+optflags: alphapca56 %{__common_cflags} -mieee -mcpu=pca56
+optflags: alphaev6 %{__common_cflags} -mieee -mcpu=ev6
+optflags: alphaev67 %{__common_cflags} -mieee -mcpu=ev67
+
+optflags: sparc %{__common_cflags} -m32 -mtune=ultrasparc
+optflags: sparcv9 %{__common_cflags} -m32 -mcpu=ultrasparc
+optflags: sparc64 %{__common_cflags} -m64 -mcpu=ultrasparc
+
+optflags: m68k %{__common_cflags} -fomit-frame-pointer
+
+optflags: ppc %{__common_cflags_with_ssp} -fsigned-char -mcpu=750 -mtune=7450
+optflags: ppciseries %{__common_cflags_with_ssp} -fsigned-char
+optflags: ppcpseries %{__common_cflags_with_ssp} -fsigned-char
+optflags: ppc32 %{__common_cflags_with_ssp} -m32 -fsigned-char -mcpu=power4 -mtune=cell
+optflags: ppc64 %{__common_cflags_with_ssp} -m64 -fsigned-char -mcpu=power4 -mtune=cell
+
+optflags: parisc %{__common_cflags} -mpa-risc-1-0
+optflags: hppa1.0 %{__common_cflags} -mpa-risc-1-0
+optflags: hppa1.1 %{__common_cflags} -mpa-risc-1-0
+optflags: hppa1.2 %{__common_cflags} -mpa-risc-1-0
+optflags: hppa2.0 %{__common_cflags} -mpa-risc-1-0
+
+optflags: mips %{__common_cflags}
+optflags: mipsel %{__common_cflags}
+
+optflags: armv3l %{__common_cflags} -fsigned-char -fomit-frame-pointer -march=armv3
+optflags: armv4b %{__common_cflags} -fsigned-char -fomit-frame-pointer -march=armv4
+optflags: armv4l %{__common_cflags} -fsigned-char -fomit-frame-pointer -march=armv4
+
+optflags: atarist %{__common_cflags} -fomit-frame-pointer
+optflags: atariste %{__common_cflags} -fomit-frame-pointer
+optflags: ataritt %{__common_cflags} -fomit-frame-pointer
+optflags: falcon %{__common_cflags} -fomit-frame-pointer
+optflags: atariclone %{__common_cflags} -fomit-frame-pointer
+optflags: milan %{__common_cflags} -fomit-frame-pointer
+optflags: hades %{__common_cflags} -fomit-frame-pointer
+
+optflags: s390 %{__common_cflags_with_ssp}
+optflags: s390x %{__common_cflags_with_ssp}
+
+#############################################################
+# Canonical arch names and numbers
+
+arch_canon:	sparc64:sparc64 10
+arch_canon:	sun4u:	sparc64 10
+
+arch_canon:	x86_64:	x86_64	19
+
+#############################################################
+# Canonical OS names and numbers
+
+#############################################################
+# For a given uname().machine, the default build arch
+
+buildarchtranslate: athlon: i586
+buildarchtranslate: pentium4: i586
+buildarchtranslate: pentium3: i586
+buildarchtranslate: i686: i586
+buildarchtranslate: k6: i586
+buildarchtranslate: i586: i586
+buildarchtranslate: i486: i486
+buildarchtranslate: i386: i386
+buildarchtranslate: i386: i386
+
+#############################################################
+# Architecture compatibility
+
+arch_compat: k6: i586
+
+arch_compat: osfmach3_i686: i686 osfmach3_i586
+arch_compat: osfmach3_i586: i586 osfmach3_i486
+arch_compat: osfmach3_i486: i486 osfmach3_i386
+arch_compat: osfmach3_i386: i486
+
+buildarch_compat: k6: i486
+
+macrofiles: @RPMLIBDIR@/macros:@RPMLIBDIR@/%{_target}/macros:@RPMVENDORDIR@/macros:@RPMVENDORDIR@/%{_target}/macros:@RPMSYSCONFDIR@/macros:@RPMSYSCONFDIR@/%{_target}/macros:@RPMSYSCONFDIR@/macros.cdb:@RPMSYSCONFDIR@/macros.d/*.macros:~/.rpmmacros

Added: rpm/rpm-setup/trunk/rubygems.rb
===================================================================
--- rpm/rpm-setup/trunk/rubygems.rb	                        (rev 0)
+++ rpm/rpm-setup/trunk/rubygems.rb	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,84 @@
+#!/usr/bin/env ruby
+#--
+# Copyright 2010 Per Øyvind Karlsen <peroyvind at mandriva.org>
+# This program is free software. It may be redistributed and/or modified under
+# the terms of the LGPL version 2.1 (or later).
+#++
+
+require 'optparse'
+require 'rubygems'
+
+provides = false
+requires = false
+
+opts = OptionParser.new("#{$0} <--provides|--requires>")
+opts.on("-P", "--provides", "Print provides") do |val|
+    provides = true
+end
+opts.on("-R", "--requires", "Print requires") do |val|
+    requires= true
+end
+
+rest = opts.permute(ARGV)
+
+if rest.size != 0 or (!provides and !requires) or (provides and requires)
+    $stderr.puts "Use either --provides OR --requires"
+    $stderr.puts opts
+    exit(1)
+end
+
+specpath = "%s/specifications/.*\.gemspec$" % Gem::dir
+gems = []
+for gemspec in $stdin.readlines
+  if gemspec.match(specpath)
+    gems.push(gemspec.chomp)
+  end
+end
+if gems.length > 0
+  if requires
+    require 'rbconfig'
+
+    module Gem
+      class Requirement
+        def rpm_dependency_transform(name, version)
+          pessimistic = ""
+          if version == "> 0.0.0" or version == ">= 0"
+            version = ""
+          else
+            if version[0..1] == "~>"
+              pessimistic = "rubygem(%s) < %s\n" % [name, Gem::Version.create(version[3..-1]).bump]
+              version = version.gsub(/\~>/, '=>')
+            end
+            version = version.gsub(/^/, ' ')
+          end
+          version = "rubygem(%s)%s\n%s" % [name, version, pessimistic]
+        end
+
+        def to_rpm(name)
+          result = as_list
+          return result.map { |version| rpm_dependency_transform(name, version) }
+        end
+
+      end
+    end
+    # TODO: Should we add a strict dependency on ruby version here?
+    #print "ruby < %s%s\n" % [Config::CONFIG["ruby_version"][0..-2], Config::CONFIG["ruby_version"][-1..-1].to_i + 1]
+    print "ruby >= %s\n" % Config::CONFIG["ruby_version"]
+  end
+
+  for gem in gems
+    data = File.read(gem)
+    spec = eval(data)
+    if provides
+      print "rubygem(%s) = %s\n" % [spec.name, spec.version]
+    end
+    if requires
+      for d in spec.dependencies
+        print d.requirement.to_rpm(d.name)
+      end
+      for d in spec.required_rubygems_version.to_rpm("rubygems")
+        print d.gsub(/(rubygem\()|(\))/, "")
+      end
+    end
+  end
+end


Property changes on: rpm/rpm-setup/trunk/rubygems.rb
___________________________________________________________________
Added: svn:executable
   + *

Added: rpm/rpm-setup/trunk/tests/findlang.pl
===================================================================
--- rpm/rpm-setup/trunk/tests/findlang.pl	                        (rev 0)
+++ rpm/rpm-setup/trunk/tests/findlang.pl	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More qw(no_plan);
+
+my $pwd = `pwd`;
+chomp($pwd);
+my $testarbo = "$pwd/find-lang-root";
+
+
+my %files = (
+    # file => [ lang, is_%dir ]
+    '/usr/share/man/fr' => [ 'fr', 1 ],
+    '/usr/share/man/fr/man1' => [ 'fr', 1 ],
+    '/usr/share/man/fr/man1/lang.1.*' => [ 'fr', 0 ],
+    '/usr/share/locale/pt_BR' => [ 'pt_BR', 1 ],
+    '/usr/share/gnome/help/lang/pt_BR' => [ 'pt_BR', 1 ],
+    '/usr/share/gnome/help/lang/pt_BR/any.html' => [ 'pt_BR', 0 ],
+    '/usr/share/gnome/help/lang/en_GB' => [ 'en_GB', 1 ],
+    '/usr/share/gnome/help/lang/en_GB/any.html' => [ 'en_GB', 0 ],
+    '/usr/share/gnome/help/lang' => [ '', 1 ],
+    '/usr/share/locale/pt_BR/LC_MESSAGES' => [ 'pt_BR', 1 ],
+    '/usr/share/locale/pt_BR/LC_MESSAGES/lang.mo' => [ 'pt_BR', 0 ],
+);
+
+system("/usr/bin/perl find-lang.pl $testarbo lang --with-man --with-gnome") and die "can't run find-lang $@";
+
+open(my $h, '<', 'lang.lang') or die "can't open lang.lang";
+
+while (my $line = <$h>) {
+    chomp($line);
+    $line =~ /svn/ and next;
+    my ($file) = $line =~ / ([^ ]+)$/;
+    my ($lang) = $line =~ /%lang\(([^\)]+)\)/;
+    $lang ||= '';
+    my $dir = $line =~ /%dir/;
+    $dir ||= 0;
+    print STDERR "$file\n";
+    is($lang, $files{$file}[0], "lang is find");
+    is($dir, $files{$file}[1], "%dir is properly set if need");
+}
+

Added: rpm/rpm-setup/trunk/tests/findlang.sh
===================================================================
--- rpm/rpm-setup/trunk/tests/findlang.sh	                        (rev 0)
+++ rpm/rpm-setup/trunk/tests/findlang.sh	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+rm -fr find-lang-root
+for file in \
+    find-lang-root/usr/share/man/fr/man1/lang.1.lzma \
+    find-lang-root/usr/share/locale/pt_BR/LC_MESSAGES/lang.mo \
+    find-lang-root/usr/share/gnome/help/lang/pt_BR/any.html \
+    find-lang-root/usr/share/gnome/help/lang/en_GB/any.html
+do install -D Makefile $file
+done
+
+exec perl tests/findlang.pl


Property changes on: rpm/rpm-setup/trunk/tests/findlang.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:eol-style
   + native

Added: rpm/rpm-setup/trunk/tests/macros.sh
===================================================================
--- rpm/rpm-setup/trunk/tests/macros.sh	                        (rev 0)
+++ rpm/rpm-setup/trunk/tests/macros.sh	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# $Id: macros.sh 242828 2008-06-02 12:41:00Z pixel $
+
+RPMEVAL=./rpmeval
+
+err=0
+
+mcheck() {
+    macro=$1
+    is=$2
+    echo -n "${macro}... "
+    res=`$RPMEVAL macros ${macro}`
+    if [ "X${res}" != "X${is}" ]; then
+        echo "give ${res} not ${is}"
+        err=$[ $err + 1]
+    else
+        echo "OK"
+    fi
+}
+
+mcheck %_var /var
+mcheck %_bindir /usr/bin
+mcheck %_sbindir /usr/sbin
+mcheck %_prefix /usr
+
+exit $err


Property changes on: rpm/rpm-setup/trunk/tests/macros.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:eol-style
   + native

Added: rpm/rpm-setup/trunk/tests.sh
===================================================================
--- rpm/rpm-setup/trunk/tests.sh	                        (rev 0)
+++ rpm/rpm-setup/trunk/tests.sh	2011-01-06 17:30:05 UTC (rev 231)
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# $Id: tests.sh 22753 2007-02-22 13:01:24Z nanardon $
+
+allerrs=0
+
+for i in tests/*.sh; do
+    /bin/sh ${i}
+    err=$?
+    if [ $err -ne 0 ]; then
+        echo "${i}: $err test(s) failed"
+        allerrs=$[ $allerrs + $err ]
+    else
+        echo "${i}: All test succefully passed"
+    fi
+done
+
+exit $allerrs


Property changes on: rpm/rpm-setup/trunk/tests.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:eol-style
   + native
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20110106/a538e442/attachment-0001.html>


More information about the Mageia-sysadm mailing list