summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKim Kibum <kb0929.kim@samsung.com>2012-05-21 17:49:08 +0900
committerKim Kibum <kb0929.kim@samsung.com>2012-05-21 17:49:08 +0900
commitdec48cfa66e17ba4a7e50c92cb24b913289feb12 (patch)
treee1f48cd5cabb40a1d604b36949ff072d01267cb5 /scripts
parentb7a3bffb8e0341b7e4ef69def268bca3a7f279ff (diff)
downloadrpm-dec48cfa66e17ba4a7e50c92cb24b913289feb12.tar.gz
rpm-dec48cfa66e17ba4a7e50c92cb24b913289feb12.tar.bz2
rpm-dec48cfa66e17ba4a7e50c92cb24b913289feb12.zip
Upload Tizen:Base source
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am42
-rw-r--r--scripts/Makefile.in596
-rwxr-xr-xscripts/brp-compress55
-rw-r--r--scripts/brp-java-gcjcompile40
-rw-r--r--scripts/brp-python-bytecompile75
-rwxr-xr-xscripts/brp-python-hardlink19
-rwxr-xr-xscripts/brp-strip20
-rwxr-xr-xscripts/brp-strip-comment-note26
-rw-r--r--scripts/brp-strip-shared25
-rwxr-xr-xscripts/brp-strip-static-archive20
-rwxr-xr-xscripts/check-buildroot37
-rwxr-xr-xscripts/check-files29
-rwxr-xr-xscripts/check-prereqs17
-rwxr-xr-xscripts/check-rpaths28
-rwxr-xr-xscripts/check-rpaths-worker156
-rwxr-xr-xscripts/desktop-file.prov23
-rw-r--r--scripts/find-debuginfo.sh348
-rwxr-xr-xscripts/find-lang.sh192
-rw-r--r--scripts/find-php-provides20
-rw-r--r--scripts/find-php-requires30
-rwxr-xr-xscripts/find-provides.php19
-rwxr-xr-xscripts/find-requires.php46
-rwxr-xr-xscripts/fontconfig.prov24
-rw-r--r--scripts/gendiff24
-rw-r--r--scripts/libtooldeps.sh42
-rw-r--r--scripts/macros.perl12
-rw-r--r--scripts/macros.php9
-rw-r--r--scripts/macros.python18
-rw-r--r--scripts/mono-find-provides42
-rw-r--r--scripts/mono-find-requires86
-rw-r--r--scripts/ocaml-find-provides.sh56
-rw-r--r--scripts/ocaml-find-requires.sh68
-rw-r--r--scripts/osgideps.pl388
-rwxr-xr-xscripts/perl.prov202
-rwxr-xr-xscripts/perl.req286
-rwxr-xr-xscripts/perldeps.pl1116
-rwxr-xr-xscripts/pkgconfigdeps.sh57
-rwxr-xr-xscripts/pythondeps.sh32
-rwxr-xr-xscripts/rpm.daily13
-rw-r--r--scripts/rpm.log5
-rwxr-xr-xscripts/rpm2cpio.sh36
-rwxr-xr-xscripts/rpmdb_loadcvt69
-rwxr-xr-xscripts/script.req9
-rw-r--r--scripts/tcl.req101
-rwxr-xr-xscripts/tgpg36
-rwxr-xr-xscripts/vpkg-provides.sh398
46 files changed, 4992 insertions, 0 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
new file mode 100644
index 0000000..a080991
--- /dev/null
+++ b/scripts/Makefile.am
@@ -0,0 +1,42 @@
+# Makefile for rpm scripts.
+
+include $(top_srcdir)/rpm.am
+
+CLEANFILES =
+
+EXTRA_DIST = \
+ brp-compress brp-python-bytecompile brp-java-gcjcompile \
+ brp-strip brp-strip-comment-note brp-python-hardlink \
+ brp-strip-shared brp-strip-static-archive \
+ check-files check-prereqs \
+ check-buildroot check-rpaths check-rpaths-worker \
+ find-debuginfo.sh find-lang.sh \
+ perldeps.pl perl.prov perl.req pythondeps.sh osgideps.pl \
+ rpmdb_loadcvt rpm.daily rpm.log rpm2cpio.sh \
+ tcl.req tgpg vpkg-provides.sh \
+ find-requires.php find-provides.php \
+ find-php-provides find-php-requires \
+ mono-find-requires mono-find-provides \
+ ocaml-find-requires.sh ocaml-find-provides.sh \
+ pkgconfigdeps.sh libtooldeps.sh \
+ fontconfig.prov desktop-file.prov script.req \
+ macros.perl macros.php macros.python
+
+rpmconfig_SCRIPTS = \
+ brp-compress brp-python-bytecompile brp-java-gcjcompile \
+ brp-strip brp-strip-comment-note brp-python-hardlink \
+ brp-strip-shared brp-strip-static-archive \
+ check-files check-prereqs \
+ check-buildroot check-rpaths check-rpaths-worker \
+ find-lang.sh \
+ perl.prov perl.req perldeps.pl pythondeps.sh osgideps.pl \
+ mono-find-requires mono-find-provides \
+ pkgconfigdeps.sh libtooldeps.sh \
+ ocaml-find-requires.sh ocaml-find-provides.sh \
+ fontconfig.prov desktop-file.prov script.req \
+ rpmdb_loadcvt rpm2cpio.sh tcl.req tgpg
+
+rpmconfig_DATA = \
+ rpm.daily rpm.log \
+ macros.perl macros.php macros.python
+
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
new file mode 100644
index 0000000..bd91b3a
--- /dev/null
+++ b/scripts/Makefile.in
@@ -0,0 +1,596 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Makefile for rpm scripts.
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/rpm.am
+subdir = scripts
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(rpmconfigdir)" \
+ "$(DESTDIR)$(rpmconfigdir)"
+SCRIPTS = $(rpmconfig_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+DATA = $(rpmconfig_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FIXPERMS = @FIXPERMS@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+HAVE_DOT = @HAVE_DOT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+LUA_CFLAGS = @LUA_CFLAGS@
+LUA_LIBS = @LUA_LIBS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POSUB = @POSUB@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RPMCANONARCH = @RPMCANONARCH@
+RPMCANONCOLOR = @RPMCANONCOLOR@
+RPMCANONGNU = @RPMCANONGNU@
+RPMCANONOS = @RPMCANONOS@
+RPMCANONVENDOR = @RPMCANONVENDOR@
+RPMCONFIGDIR = @RPMCONFIGDIR@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WITH_ACL_LIB = @WITH_ACL_LIB@
+WITH_BZ2_LIB = @WITH_BZ2_LIB@
+WITH_CAP_LIB = @WITH_CAP_LIB@
+WITH_DB_LIB = @WITH_DB_LIB@
+WITH_LIBELF_LIB = @WITH_LIBELF_LIB@
+WITH_LZMA_LIB = @WITH_LZMA_LIB@
+WITH_MAGIC_INCLUDE = @WITH_MAGIC_INCLUDE@
+WITH_MAGIC_LIB = @WITH_MAGIC_LIB@
+WITH_NSS_INCLUDE = @WITH_NSS_INCLUDE@
+WITH_NSS_LIB = @WITH_NSS_LIB@
+WITH_POPT_INCLUDE = @WITH_POPT_INCLUDE@
+WITH_POPT_LIB = @WITH_POPT_LIB@
+WITH_PYTHON_INCLUDE = @WITH_PYTHON_INCLUDE@
+WITH_PYTHON_LIB = @WITH_PYTHON_LIB@
+WITH_SELINUX_LIB = @WITH_SELINUX_LIB@
+WITH_SEMANAGE_LIB = @WITH_SEMANAGE_LIB@
+WITH_ZLIB_INCLUDE = @WITH_ZLIB_INCLUDE@
+WITH_ZLIB_LIB = @WITH_ZLIB_LIB@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__BZIP2 = @__BZIP2@
+__CAT = @__CAT@
+__CC = @__CC@
+__CHGRP = @__CHGRP@
+__CHMOD = @__CHMOD@
+__CHOWN = @__CHOWN@
+__CP = @__CP@
+__CPIO = @__CPIO@
+__CURL = @__CURL@
+__FAKECHROOT = @__FAKECHROOT@
+__FILE = @__FILE@
+__GPG = @__GPG@
+__GREP = @__GREP@
+__GZIP = @__GZIP@
+__ID = @__ID@
+__INSTALL = @__INSTALL@
+__LD = @__LD@
+__LRZIP = @__LRZIP@
+__LZIP = @__LZIP@
+__MAKE = @__MAKE@
+__MKDIR = @__MKDIR@
+__MKDIR_P = @__MKDIR_P@
+__MV = @__MV@
+__NM = @__NM@
+__OBJCOPY = @__OBJCOPY@
+__OBJDUMP = @__OBJDUMP@
+__PATCH = @__PATCH@
+__PERL = @__PERL@
+__PGP = @__PGP@
+__PYTHON = @__PYTHON@
+__RESTORECON = @__RESTORECON@
+__RM = @__RM@
+__RSH = @__RSH@
+__SED = @__SED@
+__SEMODULE = @__SEMODULE@
+__SSH = @__SSH@
+__STRIP = @__STRIP@
+__TAR = @__TAR@
+__UNZIP = @__UNZIP@
+__XZ = @__XZ@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+dirstamp = @dirstamp@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Internal binaries
+rpmlibexecdir = $(prefix)/lib/rpm
+
+# Host independent config files
+rpmconfigdir = $(prefix)/lib/rpm
+CLEANFILES =
+EXTRA_DIST = \
+ brp-compress brp-python-bytecompile brp-java-gcjcompile \
+ brp-strip brp-strip-comment-note brp-python-hardlink \
+ brp-strip-shared brp-strip-static-archive \
+ check-files check-prereqs \
+ check-buildroot check-rpaths check-rpaths-worker \
+ find-debuginfo.sh find-lang.sh \
+ perldeps.pl perl.prov perl.req pythondeps.sh osgideps.pl \
+ rpmdb_loadcvt rpm.daily rpm.log rpm2cpio.sh \
+ tcl.req tgpg vpkg-provides.sh \
+ find-requires.php find-provides.php \
+ find-php-provides find-php-requires \
+ mono-find-requires mono-find-provides \
+ ocaml-find-requires.sh ocaml-find-provides.sh \
+ pkgconfigdeps.sh libtooldeps.sh \
+ fontconfig.prov desktop-file.prov script.req \
+ macros.perl macros.php macros.python
+
+rpmconfig_SCRIPTS = \
+ brp-compress brp-python-bytecompile brp-java-gcjcompile \
+ brp-strip brp-strip-comment-note brp-python-hardlink \
+ brp-strip-shared brp-strip-static-archive \
+ check-files check-prereqs \
+ check-buildroot check-rpaths check-rpaths-worker \
+ find-lang.sh \
+ perl.prov perl.req perldeps.pl pythondeps.sh osgideps.pl \
+ mono-find-requires mono-find-provides \
+ pkgconfigdeps.sh libtooldeps.sh \
+ ocaml-find-requires.sh ocaml-find-provides.sh \
+ fontconfig.prov desktop-file.prov script.req \
+ rpmdb_loadcvt rpm2cpio.sh tcl.req tgpg
+
+rpmconfig_DATA = \
+ rpm.daily rpm.log \
+ macros.perl macros.php macros.python
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/rpm.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign scripts/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign scripts/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-rpmconfigSCRIPTS: $(rpmconfig_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(rpmconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(rpmconfigdir)"
+ @list='$(rpmconfig_SCRIPTS)'; test -n "$(rpmconfigdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(rpmconfigdir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rpmconfigdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-rpmconfigSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(rpmconfig_SCRIPTS)'; test -n "$(rpmconfigdir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(rpmconfigdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(rpmconfigdir)" && rm -f $$files
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-rpmconfigDATA: $(rpmconfig_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(rpmconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(rpmconfigdir)"
+ @list='$(rpmconfig_DATA)'; test -n "$(rpmconfigdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(rpmconfigdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(rpmconfigdir)" || exit $$?; \
+ done
+
+uninstall-rpmconfigDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(rpmconfig_DATA)'; test -n "$(rpmconfigdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(rpmconfigdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(rpmconfigdir)" && rm -f $$files
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(rpmconfigdir)" "$(DESTDIR)$(rpmconfigdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-rpmconfigDATA install-rpmconfigSCRIPTS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-rpmconfigDATA uninstall-rpmconfigSCRIPTS
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-rpmconfigDATA \
+ install-rpmconfigSCRIPTS install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-rpmconfigDATA uninstall-rpmconfigSCRIPTS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/scripts/brp-compress b/scripts/brp-compress
new file mode 100755
index 0000000..1e8772d
--- /dev/null
+++ b/scripts/brp-compress
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# 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="gzip -9 -n"
+COMPRESS_EXT=.gz
+
+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 ! -name dir`
+ do
+ [ -f "$f" ] || continue
+
+ case "$f" in
+ *.gz|*.Z) gunzip -f $f; b=`echo $f | sed -e 's/\.\(gz\|Z\)$//'`;;
+ *.bz2) bunzip2 -f $f; b=`echo $f | sed -e 's/\.bz2$//'`;;
+ *.xz|*.lzma) unxz -f $f; b=`echo $f | sed -e 's/\.\(xz\|lzma\)$//'`;;
+ *) 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\|Z\|bz2\|xz\|lzma\)$//'`
+ rm -f $f
+ b=`echo $f | sed -e 's/\.\(gz\|Z\|bz2\|xz\|lzma\)$//'`
+ ln -sf $l$COMPRESS_EXT $b$COMPRESS_EXT
+ done
+done
diff --git a/scripts/brp-java-gcjcompile b/scripts/brp-java-gcjcompile
new file mode 100644
index 0000000..708a649
--- /dev/null
+++ b/scripts/brp-java-gcjcompile
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# If using normal root, avoid changing anything.
+[ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ] && exit 0
+
+# If we are a noarch package, avoid changing anything.
+[ "$RPM_ARCH" = "noarch" ] && exit 0
+
+# If we don't have the required executables, avoid changing anything.
+gcj=${1:-/usr/bin/gcj}
+[ ! -x "$gcj" -o ! -x "$gcj-dbtool" ] && exit 0
+
+# Now get to work...
+libdir="/usr/lib" # XXX need to sed this in or something
+dbdir=`gcj-dbtool -p "$libdir"`.d/"$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION"
+cflags="$RPM_OPT_FLAGS -fPIC -findirect-dispatch"
+ldflags="-Wl,-Bsymbolic"
+
+# XXX make it so you can override the list, for mx4j et al.
+for jar in `find $RPM_BUILD_ROOT -type f -name "*.?ar"`; do
+ [ `head -c 2 "$jar"` != "PK" ] && continue
+
+ [ -d "$RPM_BUILD_ROOT/$libdir" ] || mkdir -p "$RPM_BUILD_ROOT/$libdir"
+
+ lib="$libdir/lib`basename $jar`.so"
+ [ -f "$RPM_BUILD_ROOT/$lib" ] && continue
+
+ # XXX need splits to handle #158308
+ # (til then we can just compile big ones ourselves)
+ echo "$PS4$gcj -shared $cflags $ldflags -o $lib $jar"
+ $gcj -shared $cflags $ldflags -o "$RPM_BUILD_ROOT/$lib" "$jar"
+
+ [ -d "$RPM_BUILD_ROOT/$dbdir" ] || mkdir -p "$RPM_BUILD_ROOT/$dbdir"
+
+ db="$dbdir/`basename $jar`.db"
+ [ -f "$RPM_BUILD_ROOT/$db" ] && exit 1
+
+ $gcj-dbtool -n "$RPM_BUILD_ROOT/$db" 64
+ $gcj-dbtool -f "$RPM_BUILD_ROOT/$db" "$jar" "$lib"
+done
diff --git a/scripts/brp-python-bytecompile b/scripts/brp-python-bytecompile
new file mode 100644
index 0000000..79996ea
--- /dev/null
+++ b/scripts/brp-python-bytecompile
@@ -0,0 +1,75 @@
+#!/bin/bash
+errors_terminate=$2
+
+# If using normal root, avoid changing anything.
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+# If we don't have a python interpreter, avoid changing anything.
+default_python=${1:-/usr/bin/python}
+if [ ! -x "$default_python" ]; then
+ exit 0
+fi
+
+# Figure out how deep we need to descend. We could pick an insanely high
+# number and hope it's enough, but somewhere, somebody's sure to run into it.
+depth=`(find $RPM_BUILD_ROOT -type f -name "*.py" -print0 ; echo /) | \
+ xargs -0 -n 1 dirname | sed 's,[^/],,g' | sort -u | tail -n 1 | wc -c`
+if [ -z "$depth" -o "$depth" -le "1" ]; then
+ exit 0
+fi
+
+# .pyc/.pyo files embed a "magic" value, identifying the ABI version of Python
+# bytecode that they are for.
+#
+# The files below RPM_BUILD_ROOT could be targetting multiple versions of
+# python (e.g. a single build that emits several subpackages e.g. a
+# python26-foo subpackage, a python31-foo subpackage etc)
+#
+# Support this by assuming that below each /usr/lib/python$VERSION/, all
+# .pyc/.pyo files are to be compiled for /usr/bin/python$VERSION.
+#
+# For example, below /usr/lib/python2.6/, we're targetting /usr/bin/python2.6
+# and below /usr/lib/python3.1/, we're targetting /usr/bin/python3.1
+
+shopt -s nullglob
+for python_libdir in $RPM_BUILD_ROOT/usr/lib{,64}/python[0-9].[0-9]/ ;
+do
+ python_binary=/usr/bin/$(basename $python_libdir)
+ real_libdir=${python_libdir/$RPM_BUILD_ROOT/}
+ echo "Bytecompiling .py files below $python_libdir using $python_binary"
+
+ # Generate normal (.pyc) byte-compiled files.
+ $python_binary -c 'import compileall, sys; sys.exit(not compileall.compile_dir("'"$python_libdir"'", '"$depth"', "'"$real_libdir"'", force=1, quiet=1))'
+ if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
+ # One or more of the files had a syntax error
+ exit 1
+ fi
+
+ # Generate optimized (.pyo) byte-compiled files.
+ $python_binary -O -c 'import compileall, sys; sys.exit(not compileall.compile_dir("'"$python_libdir"'", '"$depth"', "'"$real_libdir"'", force=1, quiet=1))'
+ if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
+ # One or more of the files had a syntax error
+ exit 1
+ fi
+done
+
+
+# Handle other locations in the filesystem using the default python
+# implementation:
+
+# Generate normal (.pyc) byte-compiled files.
+$default_python -c 'import compileall, re, sys; sys.exit (not compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1, re.compile(r"'"/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]"'"), quiet=1))'
+if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
+ # One or more of the files had a syntax error
+ exit 1
+fi
+
+# Generate optimized (.pyo) byte-compiled files.
+$default_python -O -c 'import compileall, re, sys; sys.exit(not compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1, re.compile(r"'"/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]"'"), quiet=1))' > /dev/null
+if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
+ # One or more of the files had a syntax error
+ exit 1
+fi
+exit 0
diff --git a/scripts/brp-python-hardlink b/scripts/brp-python-hardlink
new file mode 100755
index 0000000..5453866
--- /dev/null
+++ b/scripts/brp-python-hardlink
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# If using normal root, avoid changing anything.
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+# Hardlink identical *.pyc and *.pyo, originally from PLD's rpm-build-macros
+# Modified to use sha1sum instead of cmp to avoid a diffutils dependency.
+find "$RPM_BUILD_ROOT" -type f -name "*.pyc" | while read pyc ; do
+ pyo="${pyc%c}o"
+ if [ -f "$pyo" ] ; then
+ csha="$(sha1sum -b $pyc | cut -d' ' -f 1)" && \
+ osha="$(sha1sum -b $pyo | cut -d' ' -f 1)" && \
+ if [ "$csha" = "$osha" ] ; then
+ ln -f "$pyc" "$pyo"
+ fi
+ fi
+done
diff --git a/scripts/brp-strip b/scripts/brp-strip
new file mode 100755
index 0000000..8acc22f
--- /dev/null
+++ b/scripts/brp-strip
@@ -0,0 +1,20 @@
+#!/bin/sh
+# If using normal root, avoid changing anything.
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+STRIP=${1:-strip}
+
+case `uname -a` in
+Darwin*) exit 0 ;;
+*) ;;
+esac
+
+# 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
diff --git a/scripts/brp-strip-comment-note b/scripts/brp-strip-comment-note
new file mode 100755
index 0000000..90cd2ae
--- /dev/null
+++ b/scripts/brp-strip-comment-note
@@ -0,0 +1,26 @@
+#!/bin/sh
+# If using normal root, avoid changing anything.
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+STRIP=${1:-strip}
+OBJDUMP=${2:-objdump}
+
+case `uname -a` in
+Darwin*) exit 0 ;;
+*) ;;
+esac
+
+# 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 | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
+ grep ALLOC >/dev/null; then
+ note=
+ fi
+ $STRIP -R .comment $note "$f" || :
+done
diff --git a/scripts/brp-strip-shared b/scripts/brp-strip-shared
new file mode 100644
index 0000000..da46431
--- /dev/null
+++ b/scripts/brp-strip-shared
@@ -0,0 +1,25 @@
+#!/bin/sh
+# Conectiva brp - strip shared libraries. Based on Red Hat's brp-strip.
+# Thu Apr 20 - Guilherme Manika <gwm@conectiva.com.br>
+# Created file
+
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+STRIP=${1:-strip}
+
+case `uname -a` in
+Darwin*) exit 0 ;;
+*) ;;
+esac
+
+# Strip ELF shared objects
+# Please note we don't restrict our search to executable files because
+# our libraries are not (should not be, at least) +x.
+for f in `find $RPM_BUILD_ROOT -type f -a -exec file {} \; | \
+ grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
+ grep ' shared object,' | \
+ sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
+ $STRIP --strip-unneeded "$f"
+done
diff --git a/scripts/brp-strip-static-archive b/scripts/brp-strip-static-archive
new file mode 100755
index 0000000..d7bff33
--- /dev/null
+++ b/scripts/brp-strip-static-archive
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+STRIP=${1:-strip}
+
+case `uname -a` in
+Darwin*) exit 0 ;;
+*) ;;
+esac
+
+# 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
diff --git a/scripts/check-buildroot b/scripts/check-buildroot
new file mode 100755
index 0000000..0cfb34f
--- /dev/null
+++ b/scripts/check-buildroot
@@ -0,0 +1,37 @@
+#! /bin/sh
+
+# Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+test -z "$QA_SKIP_BUILD_ROOT" || exit 0
+
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+tmp=$(mktemp ${TMPDIR:-/tmp}/cbr.XXXXXX)
+trap "rm -f $tmp" EXIT
+
+find "$RPM_BUILD_ROOT" \! \( \
+ -name '*.pyo' -o -name '*.pyc' -o -name '*.elc' -o -name '.packlist' \
+ \) -type f -print0 | \
+ LANG=C xargs -0r grep -F "$RPM_BUILD_ROOT" >$tmp
+
+test -s "$tmp" && {
+ cat "$tmp"
+ echo "Found '$RPM_BUILD_ROOT' in installed files; aborting"
+ exit 1
+} || :
diff --git a/scripts/check-files b/scripts/check-files
new file mode 100755
index 0000000..b397f1c
--- /dev/null
+++ b/scripts/check-files
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# Gets file list on standard input and RPM_BUILD_ROOT as first parameter
+# and searches for omitted files (not counting directories).
+# Returns it's output on standard output.
+#
+# filon@pld.org.pl
+
+RPM_BUILD_ROOT=$1
+
+if [ ! -d "$RPM_BUILD_ROOT" ] ; then
+ cat > /dev/null
+ exit 1
+fi
+
+[ "$TMPDIR" ] || TMPDIR=/tmp
+FILES_DISK=`mktemp $TMPDIR/rpmXXXXXX`
+FILES_RPM=`mktemp $TMPDIR/rpmXXXXXX`
+
+find $RPM_BUILD_ROOT -type f -o -type l | LC_ALL=C sort > $FILES_DISK
+LC_ALL=C sort > $FILES_RPM
+
+diff -d "$FILES_DISK" "$FILES_RPM" | grep "^< " | cut -c3- |
+while read f; do
+ echo $f | sed -e "s#^$RPM_BUILD_ROOT# #g"
+done
+
+rm -f $FILES_DISK
+rm -f $FILES_RPM
diff --git a/scripts/check-prereqs b/scripts/check-prereqs
new file mode 100755
index 0000000..e6c9452
--- /dev/null
+++ b/scripts/check-prereqs
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+bashit="/bin/bash --rpm-requires"
+
+# Make sure that this bash has the rpm-requires hack
+$bashit < /dev/null 2>&1 > /dev/null || exit $?
+
+prereqs="`cat | $bashit | sort | uniq | sed -e 's/^bash(//' -e 's/)$//' -e 's/^executable(//' -e 's/)$//'`"
+[ -z "$prereqs" ] && exit 0
+
+for prereq in $prereqs
+do
+ case $prereq in
+ /*) echo $prereq ;;
+ *) echo "`which $prereq`" ;;
+ esac
+done | sort | uniq
diff --git a/scripts/check-rpaths b/scripts/check-rpaths
new file mode 100755
index 0000000..b94630b
--- /dev/null
+++ b/scripts/check-rpaths
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+# Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+test -z "$QA_SKIP_RPATHS" || {
+ echo $"WARNING: '\$QA_SKIP_RPATHS' is obsoleted by 'QA_RPATHS=[0-7]'" >&2
+ exit 0
+}
+
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+find "$RPM_BUILD_ROOT" -type f -print0 | xargs -0r /usr/lib/rpm/check-rpaths-worker
diff --git a/scripts/check-rpaths-worker b/scripts/check-rpaths-worker
new file mode 100755
index 0000000..7ea4fb4
--- /dev/null
+++ b/scripts/check-rpaths-worker
@@ -0,0 +1,156 @@
+#! /bin/bash
+
+# Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+fail=
+already_shown=0
+
+# effect of this expression is obviously:
+# * match paths beginning with:
+# - $SOMETHING/<something>/..
+# - /<something>/..
+# * but not paths beginning with
+# - $SOMETHING/..
+# - $SOMETHING/../../../.....
+BADNESS_EXPR_32='\(\(\$[^/]\+\)\?\(/.*\)\?/\(\([^.][^/]*\)\|\(\.[^./][^/]*\)\|\(\.\.[^/]\+\)\)\)/\.\.\(/.*\)\?$'
+
+function showHint()
+{
+ test "$already_shown" -eq 0 || return
+ already_shown=1
+
+ cat <<EOF >&2
+*******************************************************************************
+*
+* WARNING: 'check-rpaths' detected a broken RPATH and will cause 'rpmbuild'
+* to fail. To ignore these errors, you can set the '\$QA_RPATHS'
+* environment variable which is a bitmask allowing the values
+* below. The current value of QA_RPATHS is $(printf '0x%04x' $QA_RPATHS).
+*
+* 0x0001 ... standard RPATHs (e.g. /usr/lib); such RPATHs are a minor
+* issue but are introducing redundant searchpaths without
+* providing a benefit. They can also cause errors in multilib
+* environments.
+* 0x0002 ... invalid RPATHs; these are RPATHs which are neither absolute
+* nor relative filenames and can therefore be a SECURITY risk
+* 0x0004 ... insecure RPATHs; these are relative RPATHs which are a
+* SECURITY risk
+* 0x0008 ... the special '\$ORIGIN' RPATHs are appearing after other
+* RPATHs; this is just a minor issue but usually unwanted
+* 0x0010 ... the RPATH is empty; there is no reason for such RPATHs
+* and they cause unneeded work while loading libraries
+* 0x0020 ... an RPATH references '..' of an absolute path; this will break
+* the functionality when the path before '..' is a symlink
+*
+*
+* Examples:
+* - to ignore standard and empty RPATHs, execute 'rpmbuild' like
+* \$ QA_RPATHS=\$[ 0x0001|0x0010 ] rpmbuild my-package.src.rpm
+* - to check existing files, set \$RPM_BUILD_ROOT and execute check-rpaths like
+* \$ RPM_BUILD_ROOT=<top-dir> /usr/lib/rpm/check-rpaths
+*
+*******************************************************************************
+EOF
+}
+
+function msg()
+{
+ local val=$1
+ local cmp=$2
+ local msg=
+ local fail=
+ local code
+
+ test $[ $val & $cmp ] -ne 0 || return 0
+
+ code=$(printf '%04x' $cmp)
+ if test $[ $val & ~$QA_RPATHS ] -eq 0; then
+ msg="WARNING"
+ else
+ showHint
+ msg="ERROR "
+ fail=1
+ fi
+
+ shift 2
+ echo "$msg $code: $@" >&2
+
+ test -z "$fail"
+}
+
+: ${QA_RPATHS:=0}
+old_IFS=$IFS
+
+for i; do
+ pos=0
+ rpath=$(readelf -d "$i" 2>/dev/null | LANG=C grep '(RPATH).*:') || continue
+ rpath=$(echo "$rpath" | LANG=C sed -e 's!.*(RPATH).*: \[\(.*\)\]!\1!p;d')
+ tmp=aux:$rpath:/lib/aux || :
+ IFS=:
+ set -- $tmp
+ IFS=$old_IFS
+ shift
+
+ allow_ORIGIN=1
+ for j; do
+ new_allow_ORIGIN=0
+
+ if test -z "$j"; then
+ badness=16
+ elif expr match "$j" "$BADNESS_EXPR_32" >/dev/null; then
+ badness=32
+ else
+ case "$j" in
+ (/lib/*|/usr/lib/*|/usr/X11R6/lib/*|/usr/local/lib/*)
+ badness=0;;
+ (/lib64/*|/usr/lib64/*|/usr/X11R6/lib64/*|/usr/local/lib64/*)
+ badness=0;;
+
+ (\$ORIGIN|\${ORIGINX}|\$ORIGIN/*|\${ORIGINX}/*)
+ test $allow_ORIGIN -eq 0 && badness=8 || {
+ badness=0
+ new_allow_ORIGIN=1
+ }
+ ;;
+ (/*\$PLATFORM*|/*\${PLATFORM}*|/*\$LIB*|/*\${LIB}*)
+ badness=0;;
+
+ (/lib|/usr/lib|/usr/X11R6/lib)
+ badness=1;;
+ (/lib64|/usr/lib64|/usr/X11R6/lib64)
+ badness=1;;
+
+ (.*)
+ badness=4;;
+ (*) badness=2;;
+ esac
+ fi
+
+ allow_ORIGIN=$new_allow_ORIGIN
+
+ base=${i##$RPM_BUILD_ROOT}
+ msg "$badness" 1 "file '$base' contains a standard rpath '$j' in [$rpath]" || fail=1
+ msg "$badness" 2 "file '$base' contains an invalid rpath '$j' in [$rpath]" || fail=1
+ msg "$badness" 4 "file '$base' contains an insecure rpath '$j' in [$rpath]" || fail=1
+ msg "$badness" 8 "file '$base' contains the \$ORIGIN rpath specifier at the wrong position in [$rpath]" || fail=1
+ msg "$badness" 16 "file '$base' contains an empty rpath in [$rpath]" || fail=1
+ msg "$badness" 32 "file '$base' contains an rpath referencing '..' of an absolute path [$rpath]" || fail=2
+ let ++pos
+ done
+done
+
+test -z "$fail"
diff --git a/scripts/desktop-file.prov b/scripts/desktop-file.prov
new file mode 100755
index 0000000..5b159ae
--- /dev/null
+++ b/scripts/desktop-file.prov
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# Transform desktop mimetype info into RPM mimehandler(type) provides
+#
+# Author: Richard Hughes <richard@hughsie.com>
+# Based on other provides scripts from RPM
+
+OLD_IFS="$IFS"
+while read instfile ; do
+ case "$instfile" in
+ *.desktop)
+ if ! grep -q '^Type=Application$' "$instfile"; then continue; fi
+ if ! grep -q '^Exec=' "$instfile"; then continue; fi
+ mime=`grep '^MimeType=' "$instfile" | cut -d'=' -f2`
+ IFS=';'
+ for type in $mime ; do
+ echo 'mimehandler('$type')'
+ done
+ ;;
+ esac
+done
+IFS=$OLD_IFS
+
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
new file mode 100644
index 0000000..505dbde
--- /dev/null
+++ b/scripts/find-debuginfo.sh
@@ -0,0 +1,348 @@
+#!/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] [-r]
+# [-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.
+# The -r flag says to use eu-strip --reloc-debug-sections.
+#
+# 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).
+#
+
+# With -g arg, pass it to strip on libraries.
+strip_g=false
+
+# with -r arg, pass --reloc-debug-sections to eu-strip.
+strip_r=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
+ ;;
+ -r)
+ strip_r=true
+ ;;
+ *)
+ 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=
+ local r=
+ $strip_r && r=--reloc-debug-sections
+ $strip_g && case "$(file -bi "$2")" in
+ application/x-sharedlib*) g=-g ;;
+ esac
+ eu-strip --remove-comment $r $g -f "$1" "$2" || exit
+ 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
+
+# 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
+ 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"
+ mkdir -p "$(dirname "$link")" && 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=$(/usr/lib/rpm/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
+
+ [ -x /usr/bin/gdb-add-index ] && /usr/bin/gdb-add-index "$f" > /dev/null 2>&1
+
+ # 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" ||
+ (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
diff --git a/scripts/find-lang.sh b/scripts/find-lang.sh
new file mode 100755
index 0000000..c3dbdbe
--- /dev/null
+++ b/scripts/find-lang.sh
@@ -0,0 +1,192 @@
+#!/bin/sh
+#findlang - automagically generate list of language specific files
+#for inclusion in an rpm spec file.
+#This does assume that the *.mo files are under .../locale/...
+#Run with no arguments gets a usage message.
+
+#findlang is copyright (c) 1998 by W. L. Estes <wlestes@uncg.edu>
+
+#Redistribution and use of this software are hereby permitted for any
+#purpose as long as this notice and the above copyright notice remain
+#in tact and are included with any redistribution of this file or any
+#work based on this file.
+
+# 2004-06-20 Arkadiusz Miśkiewicz <arekm@pld-linux.org>
+# * merge PLD changes, kde, all-name (mkochano,pascalek@PLD)
+# 1999-10-19 Artur Frysiak <wiget@pld-linux.org>
+# * added support for GNOME help files
+# * start support for KDE help files
+
+usage () {
+cat <<EOF
+
+Usage: $0 TOP_DIR PACKAGE_NAME [prefix]
+
+where TOP_DIR is
+the top of the tree containing the files to be processed--should be
+\$RPM_BUILD_ROOT usually. TOP_DIR gets sed'd out of the output list.
+PACKAGE_NAME is the %{name} of the package. This should also be
+the basename of the .mo files. the output is written to
+PACKAGE_NAME.lang unless \$3 is given in which case output is written
+to \$3.
+Additional options:
+ --with-gnome find GNOME help files
+ --with-kde find KDE help files
+ --with-qt find Qt translation files
+ --with-man find localized man pages
+ --all-name match all package/domain names
+ --without-mo do not find locale files
+EOF
+exit 1
+}
+
+if [ -z "$1" ] ; then usage
+elif [ $1 = / ] ; then echo $0: expects non-/ argument for '$1' 1>&2
+elif [ ! -d $1 ] ; then
+ echo $0: $1: no such directory
+ exit 1
+else TOP_DIR="`echo $1|sed -e 's:/$::'`"
+fi
+shift
+
+if [ -z "$1" ] ; then usage
+else NAME=$1
+fi
+shift
+
+GNOME=#
+KDE=#
+QT=#
+MAN=#
+MO=
+MO_NAME=$NAME.lang
+ALL_NAME=#
+NO_ALL_NAME=
+
+while test $# -gt 0 ; do
+ case "${1}" in
+ --with-gnome )
+ GNOME=
+ shift
+ ;;
+ --with-kde )
+ KDE=
+ shift
+ ;;
+ --with-qt )
+ QT=
+ shift
+ ;;
+ --with-man )
+ MAN=
+ shift
+ ;;
+ --without-mo )
+ MO=#
+ shift
+ ;;
+ --all-name )
+ ALL_NAME=
+ NO_ALL_NAME=#
+ shift
+ ;;
+ * )
+ MO_NAME=${1}
+ shift
+ ;;
+ esac
+done
+
+find $TOP_DIR -type f -o -type l|sed '
+s:'"$TOP_DIR"'::
+'"$ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*\.mo$\):%lang(\2) \1\2\3:
+'"$NO_ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*/'"$NAME"'\.mo$\):%lang(\2) \1\2\3:
+s:^\([^%].*\)::
+s:%lang(C) ::
+/^$/d' > $MO_NAME
+
+find $TOP_DIR -type d|sed '
+s:'"$TOP_DIR"'::
+'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'$\):%dir \1:
+'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'/[a-zA-Z0-9.\_\-]/.\+\)::
+'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'\/\)\([^/_]\+\):%lang(\2) \1\2:
+'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
+'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]/.\+\)::
+'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+\/\)\([^/_]\+\):%lang(\2) \1\2:
+s:%lang(.*) .*/gnome/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+/.*::
+s:^\([^%].*\)::
+s:%lang(C) ::
+/^$/d' >> $MO_NAME
+
+find $TOP_DIR -type d|sed '
+s:'"$TOP_DIR"'::
+'"$NO_ALL_NAME$GNOME"'s:\(.*/omf/'"$NAME"'$\):%dir \1:
+'"$ALL_NAME$GNOME"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
+s:^\([^%].*\)::
+/^$/d' >> $MO_NAME
+
+find $TOP_DIR -type f|sed '
+s:'"$TOP_DIR"'::
+'"$NO_ALL_NAME$GNOME"'s:\(.*/omf/'"$NAME"'/'"$NAME"'-\([^/.]\+\)\.omf\):%lang(\2) \1:
+'"$ALL_NAME$GNOME"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+-\([^/.]\+\)\.omf\):%lang(\2) \1:
+s:^[^%].*::
+s:%lang(C) ::
+/^$/d' >> $MO_NAME
+
+KDE3_HTML=`kde-config --expandvars --install html 2>/dev/null`
+if [ x"$KDE3_HTML" != x -a -d "$TOP_DIR$KDE3_HTML" ]; then
+find $TOP_DIR$KDE3_HTML -type d|sed '
+s:'"$TOP_DIR"'::
+'"$NO_ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/'"$NAME"'/\)::
+'"$NO_ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/'"$NAME"'\)$:%lang(\2) \1\2\3:
+'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+/\)::
+'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
+s:^\([^%].*\)::
+s:%lang(C) ::
+/^$/d' >> $MO_NAME
+fi
+
+KDE4_HTML=`kde4-config --expandvars --install html 2>/dev/null`
+if [ x"$KDE4_HTML" != x -a -d "$TOP_DIR$KDE4_HTML" ]; then
+find $TOP_DIR$KDE4_HTML -type d|sed '
+s:'"$TOP_DIR"'::
+'"$NO_ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/'"$NAME"'/\)::
+'"$NO_ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/'"$NAME"'\)$:%lang(\2) \1\2\3:
+'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+/\)::
+'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
+s:^\([^%].*\)::
+s:%lang(C) ::
+/^$/d' >> $MO_NAME
+fi
+
+find $TOP_DIR -type f -o -type l|sed '
+s:'"$TOP_DIR"'::
+'"$NO_ALL_NAME$QT"'s:\(.*/'"$NAME"'_\([a-zA-Z]\{2\}\([_@].*\)\?\)\.qm$\):%lang(\2) \1:
+'"$ALL_NAME$QT"'s:\(.*/[^/_]\+_\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1:
+'"$ALL_NAME$QT"'s:\(.*/[^/_]\+_\([a-zA-Z]\{2\}\)\.qm$\):%lang(\2) \1:
+'"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1:
+'"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\{2\}\)\.qm$\):%lang(\2) \1:
+s:^[^%].*::
+s:%lang(C) ::
+/^$/d' >> $MO_NAME
+
+find $TOP_DIR -type d|sed '
+s:'"$TOP_DIR"'::
+'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+/\)::
+'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+$\):%lang(\2) \1*:
+s:^\([^%].*\)::
+s:%lang(C) ::
+/^$/d' >> $MO_NAME
+
+find $TOP_DIR -type f -o -type l|sed '
+s:'"$TOP_DIR"'::
+'"$NO_ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+/'"$NAME"'\.[a-z0-9].*\):%lang(\2) \1*:
+s:^\([^%].*\)::
+s:%lang(C) ::
+/^$/d' >> $MO_NAME
+
+if ! grep -q / $MO_NAME; then
+ echo "No translations found for ${NAME} in ${TOP_DIR}"
+ exit 1
+fi
+exit 0
diff --git a/scripts/find-php-provides b/scripts/find-php-provides
new file mode 100644
index 0000000..02e0c42
--- /dev/null
+++ b/scripts/find-php-provides
@@ -0,0 +1,20 @@
+#!/bin/sh
+cd `rpm --eval %{_builddir}`
+
+filelist=`sed "s/['\"]/\\\&/g"`
+if [ -f __rpm_noautoprovfiles ] ; then
+ for i in `cat __rpm_noautoprovfiles`; do
+ filelist=`echo $filelist | sed "s![[:space:]]*$i[[:space:]]*!!g"`
+ done
+fi
+
+
+echo $filelist|/usr/lib/rpm/find-provides
+provides_php=`echo $filelist | xargs /usr/lib/rpm/php.prov`
+if [ -f __rpm_noautoprov ] ; then
+ for i in `cat __rpm_noautoprov`; do
+ provides_php=`echo $provides_php | sed "s!\<$i[[:space:]]*!!g"`
+ done
+fi
+
+echo "$provides_php"
diff --git a/scripts/find-php-requires b/scripts/find-php-requires
new file mode 100644
index 0000000..9d08151
--- /dev/null
+++ b/scripts/find-php-requires
@@ -0,0 +1,30 @@
+#!/bin/sh
+cd `rpm --eval %{_builddir}`
+
+filelist=`sed "s/['\"]/\\\&/g"`
+if [ -f __rpm_noautoreqfiles ] ; then
+ for i in `cat __rpm_noautoreqfiles`; do
+ filelist=`echo $filelist | sed "s![[:space:]]*$i[[:space:]]*!!g"`
+ done
+fi
+
+requires="`echo $filelist | /usr/lib/rpm/find-requires`"
+requires_php="`echo $filelist | xargs /usr/lib/rpm/php.req`"
+
+if [ -f __rpm_noautoreq ] ; then
+ for i in `cat __rpm_noautoreq`; do
+ requires_php=`echo $requires_php | sed "s!\<$i[[:space:]]*!!g"`
+ done
+fi
+
+requires_php_t="$requires_php"
+if [ -f __rpm_noautoreqdep ] ; then
+ for i in `cat __rpm_noautoreqdep`; do
+ requires_php_t=`echo $requires_php_t | sed "s!\<$i[[:space:]]*!!g"`
+ done
+fi
+
+requires_mod="`LC_ALL=C rpm -q --whatprovides --qf "%{NAME}\n" $requires_php_t 2>/dev/null`"
+echo "$requires
+$requires_php
+$requires_mod"| grep -v "no package provides" | sort -u
diff --git a/scripts/find-provides.php b/scripts/find-provides.php
new file mode 100755
index 0000000..4e6a03d
--- /dev/null
+++ b/scripts/find-provides.php
@@ -0,0 +1,19 @@
+#!/bin/sh
+if [ $# -lt 1 ]; then
+ echo "You have to specify input file"
+ exit 1
+fi
+
+filelist=`echo $@`
+for i in $filelist; do
+ i=`echo $i | grep "\.php$"`
+ if [ -n "$i" ]; then
+ j=`cat $i |grep -E -i "^Class" |cut -f 2 -d " "| tr -d "\r"`
+ if [ -n "$j" ]; then
+ for p in $j; do
+ echo "pear($p)"
+ done
+ j=""
+ fi
+ fi
+done
diff --git a/scripts/find-requires.php b/scripts/find-requires.php
new file mode 100755
index 0000000..4c064fc
--- /dev/null
+++ b/scripts/find-requires.php
@@ -0,0 +1,46 @@
+#!/bin/sh
+#####################################################################
+# #
+# Check system dependences between php-pear modules #
+# #
+# Pawe³ Go³aszewski <blues@ds.pg.gda.pl> #
+# ------------------------------------------------------------------#
+# TODO: #
+# - extension_loaded - dependencies. #
+# - some clean-up... #
+#####################################################################
+if [ $# -lt 1 ]; then
+ echo "You have to specify input file"
+ exit 1
+fi
+
+for files in `echo $@`; do
+ files=`echo $files | grep "\.php$"`
+ if [ -n "$files" ]; then
+ # Requires trough new call:
+ j=`cat $files | grep -i new | grep -E "(=|return)" | grep -E -v "^[[:space:]*]*(\/\/|#|\*|/\*)" | tr -d "\r" | grep -E "[;|(|)|{|}|,][[:space:]*]*$" | awk -F "new " '{ print $2 }' | sed "s/[(|;|.]/ /g" | cut -f 1 -d " " | sed "s/^$.*//"`
+ if [ -n "$j" ]; then
+ for feature in $j; do
+ echo "pear($feature)"
+ done
+ j=""
+ fi
+ # requires trough class extension
+ k=`cat $files | grep -E -i "(^Class.*extends)" | awk -F " extends " '{ print $2 }' | sed "s/{.*/ /" | cut -f 1 -d " " | tr -d "\r"`
+ if [ -n "$k" ]; then
+ for feature in $k; do
+ echo "pear($feature)"
+ done
+ k=""
+ fi
+ # requires trough class:: call
+ l=`cat $files | grep "::" | grep -E -v "^[[:space:]*]*(\/\/|#|\*|/\*)" | sed "s/[(|'|!|\"|&|@|;]/ /g" | awk -F "::" '{ print $1 }' | sed "s/.*\ \([:alphanum:]*\)/\1/" | sed "s/^$.*//" | sed "s/[.]//g" | tr -d "\r"`
+ if [ -n "$l" ]; then
+ for feature in $l; do
+ echo "pear($feature)"
+ done
+ l=""
+ fi
+ fi
+done
+
diff --git a/scripts/fontconfig.prov b/scripts/fontconfig.prov
new file mode 100755
index 0000000..bfb6ea0
--- /dev/null
+++ b/scripts/fontconfig.prov
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# Script to install in:
+# /usr/lib/rpm/redhat/find-provides.d
+#
+# Transform font files into RPM provides
+# Requires fontconfig >= 2.6.90
+#
+# Author: Behdad Esfahbod <behdad@redhat.com>
+# Based on other provides scripts from RPM
+#
+
+fcquery=/usr/bin/fc-query
+
+if [ ! -x $fcquery ]; then
+ cat > /dev/null
+ exit 0
+fi
+
+# filter out anything outside main fontconfig path
+grep /usr/share/fonts/ |
+while read fn; do
+ $fcquery --format '%{=pkgkit}' "${fn}" 2> /dev/null
+done
diff --git a/scripts/gendiff b/scripts/gendiff
new file mode 100644
index 0000000..d9b0c21
--- /dev/null
+++ b/scripts/gendiff
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+[ -z "$1" -o -z "$2" ] && {
+# usage
+ echo "usage: $0 <directory> <diff-extension>" 1>&2
+ exit 1
+}
+
+: ${DIFF:=diff}
+: ${GENDIFF_DIFF_ARGS:=-up}
+: ${GENDIFF_DIFF_CHANGELOG_ARGS:=-U0}
+
+find $1 \( -name "*$2" -o -name ".*$2" \) -print | sort |
+while read f; do
+ U="${GENDIFF_DIFF_ARGS}"
+ [ "`basename $f`" = "ChangeLog$2" ] && U="${GENDIFF_DIFF_CHANGELOG_ARGS}"
+ diffcmd="${DIFF} ${U} /dev/null ${f%$2}"
+# ${DIFF} ${U} $f `echo $f | sed s/$2\$//`
+ if [ -r "$f" ]; then
+ diffcmd="${DIFF} ${U} ${f} ${f%$2}"
+ fi
+ echo "${diffcmd}"
+ ${diffcmd}
+done
diff --git a/scripts/libtooldeps.sh b/scripts/libtooldeps.sh
new file mode 100644
index 0000000..d8937c8
--- /dev/null
+++ b/scripts/libtooldeps.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+[ $# -ge 2 ] || {
+ cat > /dev/null
+ exit 0
+}
+
+case $1 in
+-P|--provides)
+ shift
+ RPM_BUILD_ROOT="$1"
+ while read possible
+ do
+ case "$possible" in
+ *.la)
+ if grep -iq '^# Generated by ltmain.sh' "$possible" 2> /dev/null ; then
+ possible="`echo ${possible} | sed -e s,${RPM_BUILD_ROOT}/,/,`"
+ echo "libtool($possible)"
+ fi
+ ;;
+ esac
+ done
+ ;;
+-R|--requires)
+ while read possible ; do
+ case "$possible" in
+ *.la)
+ for dep in `grep '^dependency_libs='"$possible" 2> /dev/null | \
+ sed -e "s,^dependency_libs='\(.*\)',\1,g"`
+ do
+ case "$dep" in
+ /*.la)
+ echo "libtool($dep)"
+ ;;
+ esac
+ done
+ ;;
+ esac
+ done
+ ;;
+esac
+exit 0
diff --git a/scripts/macros.perl b/scripts/macros.perl
new file mode 100644
index 0000000..0370411
--- /dev/null
+++ b/scripts/macros.perl
@@ -0,0 +1,12 @@
+# Perl specific macro definitions.
+# To make use of these macros insert the following line into your spec file:
+# %include %{_rpmconfigdir}/macros.perl
+
+%define __find_requires %{_rpmconfigdir}/find-perl-requires
+%define __find_provides %{_rpmconfigdir}/find-perl-provides
+
+%define perl_sitelib %(eval "`perl -V:installsitelib`"; echo $installsitelib)
+%define perl_sitearch %(eval "`perl -V:installsitearch`"; echo $installsitearch)
+%define perl_archlib %(eval "`perl -V:installarchlib`"; echo $installarchlib)
+%define perl_privlib %(eval "`perl -V:installprivlib`"; echo $installprivlib)
+
diff --git a/scripts/macros.php b/scripts/macros.php
new file mode 100644
index 0000000..cf20728
--- /dev/null
+++ b/scripts/macros.php
@@ -0,0 +1,9 @@
+# Perl specific macro definitions.
+# To make use of these macros insert the following line into your spec file:
+# %include %{_rpmconfigdir}/macros.php
+
+%define __find_requires %{_rpmconfigdir}/find-php-requires
+%define __find_provides %{_rpmconfigdir}/find-php-provides
+
+%define php_pear_dir %{_datadir}/pear
+
diff --git a/scripts/macros.python b/scripts/macros.python
new file mode 100644
index 0000000..ea1f200
--- /dev/null
+++ b/scripts/macros.python
@@ -0,0 +1,18 @@
+# Python specific macro definitions.
+# To make use of these macros insert the following line into your spec file:
+# %include %{_rpmconfigdir}/macros.python
+
+# python main version
+%define py_ver %(echo `python -c "import sys; sys.stdout.write(sys.version[:3])"`)
+
+# directories
+%define py_prefix %(echo `python -c "import sys; sys.stdout.write(sys.prefix)"`)
+%define py_libdir %{py_prefix}/lib/python%{py_ver}
+%define py_incdir /usr/include/python%{py_ver}
+%define py_sitedir %{py_libdir}/site-packages
+%define py_dyndir %{py_libdir}/lib-dynload
+
+# pure python modules compilation
+%define py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
+
+%define py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
diff --git a/scripts/mono-find-provides b/scripts/mono-find-provides
new file mode 100644
index 0000000..9348457
--- /dev/null
+++ b/scripts/mono-find-provides
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# mono-find-provides
+#
+# Authors:
+# Ben Maurer (bmaurer@ximian.com)
+#
+# (C) 2005 Novell (http://www.novell.com)
+#
+# Args: builddir buildroot libdir
+
+IFS=$'\n'
+filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/'))
+monolist=($(printf "%s\n" "${filelist[@]}" | grep -E "\\.(exe|dll)\$"))
+
+# If monodis is in the package being installed, use that one
+# This is to support building mono
+build_bindir="$2/usr/bin"
+build_libdir="$2$3"
+
+if [ -x $build_bindir/monodis ]; then
+ monodis="$build_bindir/monodis"
+ export LD_LIBRARY_PATH=$build_libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+elif [ -x /usr/bin/monodis ]; then
+ monodis="/usr/bin/monodis"
+else
+ exit 0;
+fi
+
+export MONO_SHARED_DIR=$1
+
+for i in "${monolist[@]}"; do
+ ($monodis --assembly $i | awk '
+ BEGIN { LIBNAME=""; VERSION=""; }
+ /^Version:/ { VERSION=$2 }
+ /^Name:/ { LIBNAME=$2 }
+ END {
+ if (VERSION && LIBNAME)
+ print "mono(" LIBNAME ") = " VERSION
+ }
+ ') 2>/dev/null
+done
diff --git a/scripts/mono-find-requires b/scripts/mono-find-requires
new file mode 100644
index 0000000..ea58cae
--- /dev/null
+++ b/scripts/mono-find-requires
@@ -0,0 +1,86 @@
+#!/bin/bash
+#
+# mono-find-requires
+#
+# Authors:
+# Ben Maurer (bmaurer@ximian.com)
+#
+# (C) 2005 Novell (http://www.novell.com)
+#
+# Args: builddir buildroot libdir
+
+IFS=$'\n'
+filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/'))
+monolist=($(printf "%s\n" "${filelist[@]}" | grep -E "\\.(exe|dll)\$"))
+
+# If monodis is in the package being installed, use that one
+# This is to support building mono
+build_bindir="$2/usr/bin"
+build_libdir="$2$3"
+
+if [ -x $build_bindir/monodis ]; then
+ monodis="$build_bindir/monodis"
+ export LD_LIBRARY_PATH=$build_libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+elif [ -x /usr/bin/monodis ]; then
+ monodis="/usr/bin/monodis"
+else
+ exit 0;
+fi
+
+export MONO_SHARED_DIR=$1
+
+REQUIRES=$(
+ for i in "${monolist[@]}"; do
+ ($monodis --assemblyref $i | awk '
+ BEGIN { START=0; LIBNAME=""; VERSION=""; }
+ (START==0) && /^[0-9]+: Version=/ {
+ START=1;
+ sub(/Version=/, "", $2);
+ VERSION=$2
+ }
+
+ (START==1) && /^\tName=/ {
+ sub(/Name=/, "", $1);
+ LIBNAME=$1
+
+ print "mono(" LIBNAME ") = " VERSION
+ START=0
+ }
+ ') 2> /dev/null
+ done
+)
+
+PROVIDES=$(
+ for i in "${monolist[@]}"; do
+ ($monodis --assembly $i | awk '
+ BEGIN { LIBNAME=""; VERSION=""; }
+ /^Version:/ { VERSION=$2 }
+ /^Name:/ { LIBNAME=$2 }
+ END {
+ if (VERSION && LIBNAME)
+ print "mono(" LIBNAME ") = " VERSION
+ }
+ ') 2>/dev/null
+ done
+)
+#
+# This is a little magic trick to get all REQUIRES that are not
+# in PROVIDES. While RPM functions correctly when such deps exist,
+# they make the metadata a bit bloated.
+#
+
+# Filter out dups from both lists
+REQUIRES=$(echo "$REQUIRES" | sort | uniq)
+PROVIDES=$(echo "$PROVIDES" | sort | uniq)
+
+#
+# Get a list of elements that exist in exactly one of PROVIDES or REQUIRES
+#
+UNIQ=$(echo "$PROVIDES
+$REQUIRES" | sort | uniq -u)
+
+#
+# Of those, only chose the ones that are in REQUIRES
+#
+echo "$UNIQ
+$REQUIRES" | sort | uniq -d
diff --git a/scripts/ocaml-find-provides.sh b/scripts/ocaml-find-provides.sh
new file mode 100644
index 0000000..a4441cb
--- /dev/null
+++ b/scripts/ocaml-find-provides.sh
@@ -0,0 +1,56 @@
+#!/bin/sh -
+# OCaml-specific "find-provides" for RPM.
+# By Richard W.M. Jones <rjones@redhat.com>
+# $Id: ocaml-find-provides.sh,v 1.2 2007/09/06 11:49:59 rjones Exp $
+
+#set -x
+
+# Usage:
+# (1) If you don't want the module to depend on the exact compiler
+# version then use ocaml-find-requires.sh -c, but this is not something
+# you should do normally.
+#
+# (2) For any modules which you want to ignore, use '-i Modulename'.
+
+OCAMLOBJINFO=ocamlobjinfo
+TEMP=`getopt -o i:f: -n ocaml-find-provides.sh -- "$@"`
+if [ $? != 0 ]; then echo "ocaml-find-provides.sh: failed" >&2; exit 1; fi
+eval set -- "$TEMP"
+
+ignore_modules=nOTREAL
+
+while true; do
+ case "$1" in
+ -i) ignore_modules="$2 $ignore_modules"; shift 2;;
+ -f) OCAMLOBJINFO="$2"; shift 2;;
+ --) shift; break;;
+ *) echo "ocaml-find-provides.sh: option error at $1"; exit 1;;
+ esac
+done
+
+# Get the list of files.
+files=`sed "s/['\"]/\\\&/g"`
+
+# Get list of .cmi, .cmo and .cma files.
+files=`echo $files | tr [:blank:] '\n' | grep '\.cm[ioa]$'`
+
+if [ -z "$files" ]; then exit 0; fi
+
+# Get the list of modules exported by the files.
+modules=`$OCAMLOBJINFO $files |
+ grep -E '(Unit|Module) name: ' |
+ awk '{print $3}'`
+
+# Turn list of modules into a regexp that matches the module names.
+modules_re=`echo $modules | sed 's/ /|/g'`
+ignore_modules_re=`echo $ignore_modules | sed 's/ /|/g'`
+
+# Get a list of the modules these file(s) provide.
+$OCAMLOBJINFO $files |
+grep -Eo '[0-9a-f]{32}[[:space:]]+[A-Za-z0-9_]+' |
+grep -E '[0-9a-f]{32}[[:space:]]+'"($modules_re)\$" |
+while read md5sum module; do
+ echo "ocaml($module) = $md5sum"
+done |
+grep -Ev "$ignore_modules_re" |
+sort -u
diff --git a/scripts/ocaml-find-requires.sh b/scripts/ocaml-find-requires.sh
new file mode 100644
index 0000000..bee3478
--- /dev/null
+++ b/scripts/ocaml-find-requires.sh
@@ -0,0 +1,68 @@
+#!/bin/sh -
+# OCaml-specific "find-requires" for RPM.
+# By Richard W.M. Jones <rjones@redhat.com>
+# $Id: ocaml-find-requires.sh,v 1.5 2009/10/04 22:34:51 rjones Exp $
+
+#set -x
+
+# Usage:
+# (1) If you don't want the module to depend on the exact compiler
+# version then use ocaml-find-requires.sh -c, but this is not something
+# you should do normally.
+#
+# (2) For any modules which you want to ignore, use '-i Modulename'.
+
+OCAMLOBJINFO=ocamlobjinfo
+TEMP=`getopt -o ci:f: -n ocaml-find-requires.sh -- "$@"`
+if [ $? != 0 ]; then echo "ocaml-find-requires.sh: failed" >&2; exit 1; fi
+eval set -- "$TEMP"
+
+emit_compiler_version=yes
+ignore_modules=nOTREAL
+
+while true; do
+ case "$1" in
+ -c) emit_compiler_version=; shift;;
+ -i) ignore_modules="$2 $ignore_modules"; shift 2;;
+ -f) OCAMLOBJINFO="$2"; shift 2;;
+ --) shift; break;;
+ *) echo "ocaml-find-requires.sh: option error at $1"; exit 1;;
+ esac
+done
+
+# Get the list of files.
+files=`sed "s/['\"]/\\\&/g"`
+
+# Use ordinary find-requires first.
+# echo $files | tr [:blank:] '\n' | /usr/lib/rpm/find-requires
+
+# Get list of .cmi, .cmo and .cma files.
+files=`echo $files | tr [:blank:] '\n' | grep '\.cm[ioa]$'`
+
+if [ -z "$files" ]; then exit 0; fi
+
+# Get the list of modules exported by the file(s).
+modules=`$OCAMLOBJINFO $files |
+ grep -E '(Unit|Module) name: ' |
+ awk '{print $3}'`
+
+# Turn list of modules into a regexp that matches the module names.
+modules_re=`echo $modules | sed 's/ /|/g'`
+ignore_modules_re=`echo $ignore_modules | sed 's/ /|/g'`
+
+# Get a list of the modules these file(s) depend on.
+$OCAMLOBJINFO $files |
+grep -Eo '[0-9a-f]{32}[[:space:]]+[A-Za-z0-9_]+' |
+grep -Ev '[0-9a-f]{32}[[:space:]]+'"($modules_re)\$" |
+while read md5sum module; do
+ echo "ocaml($module) = $md5sum"
+done |
+grep -Ev "$ignore_modules_re" |
+grep -Ev "^ocaml\((Annot|Asttypes|Outcometree|Cmo_format|Parsetree)\) =" |
+sort -u
+
+if [ -n "$emit_compiler_version" ]; then
+ # Every OCaml program depends on the version of the
+ # runtime which was used to compile it.
+ echo "ocaml(runtime) = `ocamlrun -version | awk '{print $NF}' | sed 's/\+.*//'`"
+fi
diff --git a/scripts/osgideps.pl b/scripts/osgideps.pl
new file mode 100644
index 0000000..ab92b65
--- /dev/null
+++ b/scripts/osgideps.pl
@@ -0,0 +1,388 @@
+#!/usr/bin/perl
+#
+# osgideps.pl -- Analyze dependencies of OSGi bundles.
+#
+# Kyu Lee (initial idea)
+# Alphonse Van Assche <alcapcom@fedoraproject.org> (current maintainer)
+#
+# $Id: osgideps.pl,v 1.0 2009/06/08 12:12:12 mej Exp $
+
+use Getopt::Long;
+use File::Temp qw/ tempdir /;
+use threads;
+use Thread::Queue;
+
+$MANIFEST_NAME = "META-INF/MANIFEST.MF";
+
+# parse options
+my ( $show_provides, $show_requires, $show_system_bundles, $debug );
+my $result = GetOptions(
+ "provides" => \$show_provides,
+ "requires" => \$show_requires,
+ "system" => \$show_system_bundles,
+ "debug" => \$debug
+);
+exit(1) if ( not $result );
+
+# run selected function
+@allfiles = <STDIN>;
+if ($show_provides) {
+ getProvides(@allfiles);
+}
+if ($show_requires) {
+ getRequires(@allfiles);
+}
+if ($show_system_bundles) {
+ getSystemBundles(@allfiles);
+}
+exit(0);
+
+# this function print provides of OSGi aware files
+sub getProvides {
+
+ my $queue = Thread::Queue->new;
+ foreach $file (@_) {
+ $queue->enqueue($file);
+ }
+
+ my @workers;
+ push @workers, threads->create('getProvidesWorker');
+ push @workers, threads->create('getProvidesWorker');
+ push @workers, threads->create('getProvidesWorker');
+ push @workers, threads->create('getProvidesWorker');
+
+ map { $_->join } @workers;
+
+ sub getProvidesWorker {
+ while ( my $file = $queue->dequeue_nb ) {
+ chomp($file);
+ # we don't follow symlinks for provides
+ next if ( -f $file && -r _ && -l _ );
+ $file =~ s/[^[:print:]]//g;
+ if ( $file =~ m/$MANIFEST_NAME$/ || $file =~ m/\.jar$/ ) {
+ if ( $file =~ m/\.jar$/ ) {
+ if ( `zipinfo -1 $file 2> /dev/null | grep -e \^$MANIFEST_NAME` eq "$MANIFEST_NAME\n" ) {
+ # extract MANIFEST.MF file from jar to temporary directory
+ $tmpdir = tempdir( CLEANUP => 1 );
+ `unzip -d $tmpdir -qqo $file $MANIFEST_NAME`;
+ open( MANIFEST, "$tmpdir/$MANIFEST_NAME" );
+ }
+ } else {
+ open( MANIFEST, "$file" );
+ }
+ my $bundleName = "";
+ my $version = "";
+ # parse Bundle-SymbolicName, Bundle-Version and Export-Package attributes
+ while (<MANIFEST>) {
+ # get rid of non-print chars (some manifest files contain weird chars)
+ s/[^[:print]]//g;
+ if ( m/(^(Bundle-SymbolicName): )(.*)$/ ) {
+ $bundleName = "$3" . "\n";
+ while (<MANIFEST>) {
+ if ( m/^[[:upper:]][[:alpha:]]+-[[:upper:]][[:alpha:]]+: .*/ ) {
+ $len = length $_;
+ seek MANIFEST, $len * -1, 1;
+ last;
+ }
+ $bundleName .= "$_";
+ }
+ $bundleName =~ s/\s+//g;
+ $bundleName =~ s/;.*//g;
+ }
+ if ( m/(^Bundle-Version: )(.*)/ ) {
+ $version = $2;
+ }
+ if ( m/(^(Export-Package): )(.*)$/ ) {
+ my $bunlist = "$3" . "\n";
+ while (<MANIFEST>) {
+ if ( m/^[[:upper:]][[:alpha:]]+-[[:upper:]][[:alpha:]]+: .*/ ) {
+ $len = length $_;
+ seek MANIFEST, $len * -1, 1;
+ last;
+ }
+ $bunlist .= "$_";
+ }
+ push @bundlelist, parsePkgString($bunlist, $file);
+ }
+ }
+
+ # skip this jar if no bundle name exists
+ if ( !$bundleName eq "" ) {
+ if ( !$version eq "" ) {
+ $version = parseVersion($version);
+ push @bundlelist, { FILE => "$file", NAME => "$bundleName", VERSION => "$version" };
+ } else {
+ push @bundlelist, { FILE => "$file", NAME => "$bundleName", VERSION => "" };
+ }
+ }
+ `rm -rf $tmpdir`;
+ }
+ }
+ if ( !$debug ) { @bundlelist = prepareOSGiBundlesList(@bundlelist); }
+ $list = "";
+ for $bundle (@bundlelist) {
+ if ( !$debug ) {
+ $list .= "osgi(" . $bundle->{NAME} . ")" . $bundle->{VERSION} . "\n";
+ } else {
+ $list .= $bundle->{FILE} . " osgi(" . $bundle->{NAME} . ")" . $bundle->{VERSION} . "\n";
+ }
+ }
+ print $list;
+ }
+}
+
+# this function print requires of OSGi aware files
+sub getRequires {
+
+ my $queue = Thread::Queue->new;
+ foreach $file (@_) {
+ $queue->enqueue($file);
+ }
+
+ my @workers;
+ push @workers, threads->create('getRequiresWorker');
+ push @workers, threads->create('getRequiresWorker');
+ push @workers, threads->create('getRequiresWorker');
+ push @workers, threads->create('getRequiresWorker');
+
+ map { $_->join } @workers;
+
+ sub getRequiresWorker {
+ while ( my $file = $queue->dequeue_nb ) {
+ next if ( -f $file && -r _ );
+ $file =~ s/[^[:print:]]//g;
+ if ( $file =~ m/$MANIFEST_NAME$/ || $file =~ m/\.jar$/ ) {
+ # we explicitly requires symlinked jars
+ # _that_reside_outside_the_package_
+ if (-l $file) {
+ $exist = 0;
+ $lnksrc = `readlink -qen $file`;
+ foreach $exfile ( @allfiles ) {
+ $exfile =~ s/[^[:print:]]//g;
+ if ( $lnksrc =~ m/$exfile$/ ) {
+ $exist = 1;
+ last;
+ }
+ }
+ print "$lnksrc\n" if (!$exist);
+ next;
+ }
+
+ if ( $file =~ m/\.jar$/ ) {
+ if ( `zipinfo -1 $file 2> /dev/null | grep -e \^$MANIFEST_NAME` eq "$MANIFEST_NAME\n" ) {
+ # extract MANIFEST.MF file from jar to temporary directory
+ $tmpdir = tempdir( CLEANUP => 1 );
+ `unzip -d $tmpdir -qqo $file $MANIFEST_NAME`;
+ open( MANIFEST, "$tmpdir/$MANIFEST_NAME" );
+ }
+ } else {
+ open( MANIFEST, "$file" );
+ }
+ while (<MANIFEST>) {
+ if ( m/(^(Require-Bundle|Import-Package): )(.*)$/ ) {
+ my $bunlist = "$3" . "\n";
+ while (<MANIFEST>) {
+ if (m/^[[:upper:]][[:alpha:]]+-[[:upper:]][[:alpha:]]+: .*/ ) {
+ $len = length $_;
+ seek MANIFEST, $len * -1, 1;
+ last;
+ }
+ $bunlist .= "$_";
+ }
+ push @bundlelist, parsePkgString($bunlist, $file);
+ }
+ # we also explicitly require symlinked jars define by
+ # Bundle-ClassPath attribut
+ if ( m/(^(Bundle-ClassPath): )(.*)$/ ) {
+ $bunclp = "$3" . "\n";
+ while (<MANIFEST>) {
+ if ( m/^[[:upper:]][[:alpha:]]+-[[:upper:]][[:alpha:]]+: .*/ ) {
+ $len = length $_;
+ seek MANIFEST, $len * -1, 1;
+ last;
+ }
+ $bunclp .= "$_";
+ }
+ $bunclp =~ s/\ //g;
+ $bunclp =~ s/\n//g;
+ $bunclp =~ s/[^[:print:]]//g;
+ $dir = `dirname $file`;
+ $dir =~ s/\n//g;
+ @jars = split /,/, $bunclp;
+ for $jarfile (@jars) {
+ $jarfile = "$dir\/\.\.\/$jarfile";
+ $jarfile = readlink $jarfile;
+ if ( !$jarfile eq "" ) {
+ print "$jarfile" . "\n";
+ }
+ }
+ }
+ }
+ `rm -rf $tmpdir`;
+ }
+ }
+ if ( !$debug ) { @bundlelist = prepareOSGiBundlesList(@bundlelist); }
+ $list = "";
+ for $bundle (@bundlelist) {
+ # replace '=' by '>=' because qualifiers are set on provides
+ # but not on requires.
+ $bundle->{VERSION} =~ s/\ =/\ >=/g;
+ if ( !$debug ) {
+ $list .= "osgi(" . $bundle->{NAME} . ")" . $bundle->{VERSION} . "\n";
+ } else {
+ $list .= $bundle->{FILE} . " osgi(" . $bundle->{NAME} . ")" . $bundle->{VERSION} . "\n";
+ }
+ }
+ print $list;
+ }
+}
+
+# this function print system bundles of OSGi profile files.
+sub getSystemBundles {
+ foreach $file (@_) {
+ if ( ! -f $file || ! -r _ ) {
+ print "'$file' file not found or cannot be read!";
+ next;
+ } else {
+ open( PROFILE, "$file" );
+ while (<PROFILE>) {
+ if ( $file =~ m/\.profile$/ ) {
+ if (m/(^(org\.osgi\.framework\.system\.packages)[=|\ ]+)(.*)$/) {
+ $syspkgs = "$3" . "\n";
+ while (<PROFILE>) {
+ if (m/^[a-z]/) {
+ $len = length $_;
+ seek MANIFEST, $len * -1, 1;
+ last;
+ }
+ $syspkgs .= "$_";
+ }
+ $syspkgs =~ s/\s+//g;
+ $syspkgs =~ s/\\//g;
+ @bundles = split /,/, $syspkgs;
+ foreach $bundle (@bundles) {
+ print "osgi(" . $bundle . ")\n";
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+sub parsePkgString {
+ my $bunstr = $_[0];
+ my $file = $_[1];
+ my @return;
+ $bunstr =~ s/ //g;
+ $bunstr =~ s/\n//g;
+ $bunstr =~ s/[^[:print:]]//g;
+ $bunstr =~ s/("[[:alnum:]|\-|\_|\.|\(|\)|\[|\]]+)(,)([[:alnum:]|\-|\_|\.|\(|\)|\[|\]]+")/$1 $3/g;
+ # remove uses bundle from Export-Package attribute
+ $bunstr =~ s/uses:="[[:alnum:]|\-|\_|\.|\(|\)|\[|\]|,]+"//g;
+ # remove optional dependencies
+ $bunstr =~ s/,.*;resolution:=optional//g;
+ # remove x-friends
+ $bunstr =~ s/;x-friends:="[[:alnum:]|\-|\_|\.|\(|\)|\[|\]|,]+"//g;
+ # remove signatures
+ $bunstr =~ s/Name:.*SHA1-Digest:.*//g;
+ @reqcomp = split /,/, $bunstr;
+ foreach $reqelement (@reqcomp) {
+ @reqelementfrmnt = split /;/, $reqelement;
+ $name = "";
+ $version = "";
+ $name = $reqelementfrmnt[0];
+ $name =~ s/\"//g;
+ # ignoring OSGi 'system.bundle'
+ next if ( $name =~ m/^system\.bundle$/ );
+ for $i ( 1 .. $#reqelementfrmnt ) {
+ if ( $reqelementfrmnt[$i] =~ m/(^(bundle-|)version=")(.*)(")/ ) {
+ $version = $3;
+ last;
+ }
+ }
+ $version = parseVersion($version);
+ push @return, { FILE => "$file", NAME => "$name", VERSION => "$version" };
+ }
+ return @return;
+}
+
+sub parseVersion {
+ my $ver = $_[0];
+ if ( $ver eq "" ) { return ""; }
+ if ( $ver =~ m/(^[\[|\(])(.+)\ (.+)([\]|\)]$)/ ) {
+ if ( $1 eq "\[" ) {
+ $ver = " >= $2";
+ } else {
+ $ver = " > $2";
+ }
+ } else {
+ $ver = " = $ver";
+ }
+ # we always return a full OSGi version to be able to match 1.0
+ # and 1.0.0 as equal in RPM.
+ ( $major, $minor, $micro, $qualifier ) = split( '\.', $ver );
+ if ( !defined($minor) || !$minor ) {
+ $minor = 0;
+ }
+ if ( !defined($micro) || !$micro ) {
+ $micro = 0;
+ }
+ if ( !defined($qualifier) || !$qualifier ) {
+ $qualifier = "";
+ } else {
+ $qualifier = "." . $qualifier;
+ }
+ $ver = $major . "." . $minor . "." . $micro . $qualifier;
+ return $ver;
+}
+
+# this function put the max version on each bundles to be able to remove
+# duplicate deps with 'sort -u' command.
+sub prepareOSGiBundlesList {
+ foreach $bundle (@_) {
+ foreach $cmp (@_) {
+ if ( $bundle->{NAME} eq $cmp->{NAME} ) {
+ $result = compareVersion( $bundle->{VERSION}, $cmp->{VERSION} );
+ if ( $result < 0 ) {
+ $bundle->{VERSION} = $cmp->{VERSION};
+ }
+ }
+ }
+ }
+ return @_;
+}
+
+# this function returns a negative integer, zero, or a positive integer if
+# $ver1 is less than, equal to, or greater than $ver2.
+#
+# REMEMBER: we mimic org.osgi.framework.Version#compareTo method but
+# *at this time* we don't take care of the qualifier part of the version.
+sub compareVersion {
+ my $ver1 = $_[0];
+ my $ver2 = $_[1];
+
+ $ver1 = "0.0.0" if ( $ver1 eq "" );
+ $ver2 = "0.0.0" if ( $ver2 eq "" );
+
+ $ver1 =~ m/([0-9]+)(\.)([0-9]+)(\.)([0-9]+)/;
+ $major1 = $1;
+ $minor1 = $3;
+ $micro1 = $5;
+
+ $ver2 =~ m/([0-9]+)(\.)([0-9]+)(\.)([0-9]+)/;
+ $major2 = $1;
+ $minor2 = $3;
+ $micro2 = $5;
+
+ $result = $major1 - $major2;
+ return $result if ( $result != 0 );
+
+ $result = $minor1 - $minor2;
+ return $result if ( $result != 0 );
+
+ $result = $micro1 - $micro2;
+ return $result if ( $result != 0 );
+
+ return $result;
+}
diff --git a/scripts/perl.prov b/scripts/perl.prov
new file mode 100755
index 0000000..9886dd9
--- /dev/null
+++ b/scripts/perl.prov
@@ -0,0 +1,202 @@
+#!/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@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@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 (<>) {
+ process_file($_);
+ }
+}
+
+
+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.
+
+ print "perl($module) = $require{$module}\n";
+ }
+}
+
+exit 0;
+
+
+
+sub process_file {
+
+ my ($file) = @_;
+ chomp $file;
+
+ if (!open(FILE, $file)) {
+ warn("$0: Warning: Could not open file '$file' for reading: $!\n");
+ 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/^=(head[1-4]|pod|for|item)/) {
+ $incomment = 1;
+ }
+
+ if (m/^=(cut)/) {
+ $incomment = 0;
+ $inover = 0;
+ }
+
+ if (m/^=(over)/) {
+ $inover = 1;
+ }
+
+ if (m/^=(back)/) {
+ $inover = 0;
+ }
+
+ if ($incomment || $inover) {
+ 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 except some common
+ # false positives as if they were provided packages (really ugly).
+
+ if (m/^\s*package\s+([_:a-zA-Z0-9]+)\s*;/) {
+ $package = $1;
+ undef $version;
+ if ($package eq 'main') {
+ undef $package;
+ } else {
+ # If $package already exists in the $require hash, it means
+ # the package definition is broken up over multiple blocks.
+ # In that case, don't stomp a previous $VERSION we might have
+ # found. (See BZ#214496.)
+ $require{$package} = undef unless (exists $require{$package});
+ }
+ }
+
+ # 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: 1.9 $ =~ /(\d+)\.(\d+)/);
+ #ExtUtils/Install.pm:$VERSION = substr q$Revision: 1.9 $, 10;
+ #CGI/Apache.pm:$VERSION = (qw$Revision: 1.9 $)[1];
+ #DynaLoader.pm:$VERSION = $VERSION = "1.03"; # avoid typo warning
+ #General.pm:$Config::General::VERSION = 2.33;
+ #
+ # or with the new "our" pragma you could (read will) see:
+ #
+ # our $VERSION = '1.00'
+ if ($package && m/^\s*(our\s+)?\$(\Q$package\E::)?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;
+ }
+
+ # Allow someone to have a variable that defines virtual packages
+ # The variable is called $RPM_Provides. It must be scoped with
+ # "our", but not "local" or "my" (just would not make sense).
+ #
+ # For instance:
+ #
+ # $RPM_Provides = "blah bleah"
+ #
+ # Will generate provides for "blah" and "bleah".
+ #
+ # 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*(our\s+)?\$RPM_Provides\s*=\s*["'](.*)['"]/i) {
+ foreach $_ (split(/\s+/, $2)) {
+ print "$_\n";
+ }
+ }
+
+ }
+
+ close(FILE) ||
+ die("$0: Could not close file: '$file' : $!\n");
+
+ return;
+}
diff --git a/scripts/perl.req b/scripts/perl.req
new file mode 100755
index 0000000..c676c73
--- /dev/null
+++ b/scripts/perl.req
@@ -0,0 +1,286 @@
+#!/usr/bin/perl
+
+# RPM (and its 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@redhat.com>.
+
+# a simple makedepend like script for perl.
+
+# To save development time I do not parse the perl grammar 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@staff.mail.com
+
+$HAVE_VERSION = 0;
+eval { require version; $HAVE_VERSION = 1; };
+
+
+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 $perlver (sort keys %perlreq) {
+ print "perl >= $perlver\n";
+}
+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 around my
+ # operators. Also I will need to change the processing of the
+ # $RPM_* variable when I upgrade.
+
+ print "perl($module) >= $require{$module}\n";
+ }
+}
+
+exit 0;
+
+
+
+sub add_require {
+ my ($module, $newver) = @_;
+ my $oldver = $require{$module};
+ if ($oldver) {
+ $require{$module} = $newver
+ if ($HAVE_VERSION && $newver && version->new($oldver) < $newver);
+ }
+ else {
+ $require{$module} = $newver;
+ }
+}
+
+sub process_file {
+
+ my ($file) = @_;
+ chomp $file;
+
+ if (!open(FILE, $file)) {
+ warn("$0: Warning: Could not open file '$file' for reading: $!\n");
+ return;
+ }
+
+ while (<FILE>) {
+
+ # skip the "= <<" block
+
+ if (m/^\s*\$(?:.*)\s*=\s*<<\s*(["'`])(.+?)\1/ ||
+ m/^\s*\$(.*)\s*=\s*<<(\w+)\s*;/) {
+ $tag = $2;
+ while (<FILE>) {
+ chomp;
+ ( $_ eq $tag ) && last;
+ }
+ $_ = <FILE>;
+ }
+
+ # skip q{} quoted sections - just hope we don't have curly brackets
+ # within the quote, nor an escaped hash mark that isn't a comment
+ # marker, such as occurs right here. Draw the line somewhere.
+ if ( m/^.*\Wq[qxwr]?\s*([{([#|\/])[^})\]#|\/]*$/ && ! m/^\s*(require|use)\s/ ) {
+ $tag = $1;
+ $tag =~ tr/{\(\[\#|\//})]#|\//;
+ while (<FILE>) {
+ ( $_ =~ m/\}/ ) && 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 (/^=(head[1-4]|pod|for|item)/) {
+ /^=cut/ && next while <FILE>;
+ }
+
+ if (/^=over/) {
+ /^=back/ && next while <FILE>;
+ }
+
+ # 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.
+ #
+ # Again allow for "our".
+ if (m/^\s*(our\s+)?\$RPM_Requires\s*=\s*["'](.*)['"]/i) {
+ foreach $_ (split(/\s+/, $2)) {
+ print "$_\n";
+ }
+ }
+
+ my $modver_re = qr/[.0-9]+/;
+
+ 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
+ # the latter part is for "use base qw(Foo)" and friends special case
+ \s*($modver_re|(qw\s*[(\/'"]\s*|['"])[^)\/"'\$]*?\s*[)\/"'])?
+ /x)
+ ) {
+ my ($whitespace, $statement, $module, $version) = ($1, $2, $3, $4);
+
+ # we only consider require statements that are flushed 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 probably 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 starts with /, it is an absolute path to a file
+ if ($module =~ m(^/)) {
+ print "$module\n";
+ next;
+ }
+
+ # 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/\(.*$//;
+
+ # if the module ends with .pm, strip it to leave only basename.
+ $module =~ s/\.pm$//;
+
+ # some perl programmers write 'require URI/URL;' when
+ # they mean 'require URI::URL;'
+
+ $module =~ s/\//::/;
+
+ # trim off trailing parentheses if any. Sometimes people pass
+ # the module an empty list.
+
+ $module =~ s/\(\s*\)$//;
+
+ if ( $module =~ m/^v?([0-9._]+)$/ ) {
+ # if module is a number then both require and use interpret that
+ # to mean that a particular version of perl is specified
+
+ my $ver = $1;
+ if ($ver =~ /5.00/) {
+ $perlreq{"0:$ver"} = 1;
+ next;
+ }
+ else {
+ $perlreq{"1:$ver"} = 1;
+ next;
+ }
+
+ };
+
+ # 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 expend 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;
+
+ # use base qw(Foo) dependencies
+ if ($statement eq "use" && $module eq "base") {
+ add_require($module, undef);
+ if ($version =~ /^qw\s*[(\/'"]\s*([^)\/"']+?)\s*[)\/"']/) {
+ add_require($_, undef) for split(' ', $1);
+ }
+ elsif ($version =~ /(["'])([^"']+)\1/) {
+ add_require($2, undef);
+ }
+ next;
+ }
+ $version = undef unless $version =~ /^$modver_re$/o;
+
+ add_require($module, $version);
+ }
+
+ }
+
+ close(FILE) ||
+ die("$0: Could not close file: '$file' : $!\n");
+
+ return;
+}
diff --git a/scripts/perldeps.pl b/scripts/perldeps.pl
new file mode 100755
index 0000000..bffad67
--- /dev/null
+++ b/scripts/perldeps.pl
@@ -0,0 +1,1116 @@
+#!/usr/bin/perl -Tw
+#
+# perldeps.pl -- Analyze dependencies of Perl packages
+#
+# Michael Jennings
+# 7 November 2005
+#
+# $Id: perldeps.pl,v 1.6 2006/04/04 20:12:03 mej Exp $
+#
+
+use strict;
+use Config;
+use File::Basename;
+use File::Find;
+use Getopt::Long;
+use POSIX;
+
+############### Debugging stolen from Mezzanine::Util ###############
+my $DEBUG = 0;
+
+# Debugging output
+sub
+dprintf(@)
+{
+ my ($f, $l, $s, $format);
+ my @params = @_;
+
+ return if (! $DEBUG);
+ $format = shift @params;
+ if (!scalar(@params)) {
+ return dprint($format);
+ }
+ (undef, undef, undef, $s) = caller(1);
+ if (!defined($s)) {
+ $s = "MAIN";
+ }
+ (undef, $f, $l) = caller(0);
+ $f =~ s/^.*\/([^\/]+)$/$1/;
+ $s =~ s/^\w+:://g;
+ $s .= "()" if ($s =~ /^\w+$/);
+ $f = "" if (!defined($f));
+ $l = "" if (!defined($l));
+ $format = "" if (!defined($format));
+ for (my $i = 0; $i < scalar(@params); $i++) {
+ if (!defined($params[$i])) {
+ $params[$i] = "<undef>";
+ }
+ }
+ printf("[$f/$l/$s] $format", @params);
+}
+
+sub
+dprint(@)
+{
+ my ($f, $l, $s);
+ my @params = @_;
+
+ return if (! $DEBUG);
+ (undef, undef, undef, $s) = caller(1);
+ if (!defined($s)) {
+ $s = "MAIN";
+ }
+ (undef, $f, $l) = caller(0);
+ $f =~ s/^.*\/([^\/]+)$/$1/;
+ $s =~ s/\w+:://g;
+ $s .= "()" if ($s =~ /^\w+$/);
+ $f = "" if (!defined($f));
+ $l = "" if (!defined($l));
+ $s = "" if (!defined($s));
+ for (my $i = 0; $i < scalar(@params); $i++) {
+ if (!defined($params[$i])) {
+ $params[$i] = "<undef>";
+ }
+ }
+ print "[$f/$l/$s] ", @params;
+}
+
+############### Module::ScanDeps Code ###############
+use constant dl_ext => ".$Config{dlext}";
+use constant lib_ext => $Config{lib_ext};
+use constant is_insensitive_fs => (
+ -s $0
+ and (-s lc($0) || -1) == (-s uc($0) || -1)
+ and (-s lc($0) || -1) == -s $0
+);
+
+my $CurrentPackage = '';
+my $SeenTk;
+
+# Pre-loaded module dependencies
+my %Preload = (
+ 'AnyDBM_File.pm' => [qw( SDBM_File.pm )],
+ 'Authen/SASL.pm' => 'sub',
+ 'Bio/AlignIO.pm' => 'sub',
+ 'Bio/Assembly/IO.pm' => 'sub',
+ 'Bio/Biblio/IO.pm' => 'sub',
+ 'Bio/ClusterIO.pm' => 'sub',
+ 'Bio/CodonUsage/IO.pm' => 'sub',
+ 'Bio/DB/Biblio.pm' => 'sub',
+ 'Bio/DB/Flat.pm' => 'sub',
+ 'Bio/DB/GFF.pm' => 'sub',
+ 'Bio/DB/Taxonomy.pm' => 'sub',
+ 'Bio/Graphics/Glyph.pm' => 'sub',
+ 'Bio/MapIO.pm' => 'sub',
+ 'Bio/Matrix/IO.pm' => 'sub',
+ 'Bio/Matrix/PSM/IO.pm' => 'sub',
+ 'Bio/OntologyIO.pm' => 'sub',
+ 'Bio/PopGen/IO.pm' => 'sub',
+ 'Bio/Restriction/IO.pm' => 'sub',
+ 'Bio/Root/IO.pm' => 'sub',
+ 'Bio/SearchIO.pm' => 'sub',
+ 'Bio/SeqIO.pm' => 'sub',
+ 'Bio/Structure/IO.pm' => 'sub',
+ 'Bio/TreeIO.pm' => 'sub',
+ 'Bio/LiveSeq/IO.pm' => 'sub',
+ 'Bio/Variation/IO.pm' => 'sub',
+ 'Crypt/Random.pm' => sub {
+ _glob_in_inc('Crypt/Random/Provider', 1);
+ },
+ 'Crypt/Random/Generator.pm' => sub {
+ _glob_in_inc('Crypt/Random/Provider', 1);
+ },
+ 'DBI.pm' => sub {
+ grep !/\bProxy\b/, _glob_in_inc('DBD', 1);
+ },
+ 'DBIx/SearchBuilder.pm' => 'sub',
+ 'DBIx/ReportBuilder.pm' => 'sub',
+ 'Device/ParallelPort.pm' => 'sub',
+ 'Device/SerialPort.pm' => [ qw(
+ termios.ph asm/termios.ph sys/termiox.ph sys/termios.ph sys/ttycom.ph
+ ) ],
+ 'ExtUtils/MakeMaker.pm' => sub {
+ grep /\bMM_/, _glob_in_inc('ExtUtils', 1);
+ },
+ 'File/Basename.pm' => [qw( re.pm )],
+ 'File/Spec.pm' => sub {
+ require File::Spec;
+ map { my $name = $_; $name =~ s!::!/!g; "$name.pm" } @File::Spec::ISA;
+ },
+ 'HTTP/Message.pm' => [ qw(
+ URI/URL.pm URI.pm
+ ) ],
+ 'IO.pm' => [ qw(
+ IO/Handle.pm IO/Seekable.pm IO/File.pm
+ IO/Pipe.pm IO/Socket.pm IO/Dir.pm
+ ) ],
+ 'IO/Socket.pm' => [qw( IO/Socket/UNIX.pm )],
+ 'LWP/UserAgent.pm' => [ qw(
+ URI/URL.pm URI/http.pm LWP/Protocol/http.pm
+ LWP/Protocol/https.pm
+ ), _glob_in_inc("LWP/Authen", 1) ],
+ 'Locale/Maketext/Lexicon.pm' => 'sub',
+ 'Locale/Maketext/GutsLoader.pm' => [qw( Locale/Maketext/Guts.pm )],
+ 'Mail/Audit.pm' => 'sub',
+ 'Math/BigInt.pm' => 'sub',
+ 'Math/BigFloat.pm' => 'sub',
+ 'Module/Build.pm' => 'sub',
+ 'Module/Pluggable.pm' => sub {
+ _glob_in_inc("$CurrentPackage/Plugin", 1);
+ },
+ 'MIME/Decoder.pm' => 'sub',
+ 'Net/DNS/RR.pm' => 'sub',
+ 'Net/FTP.pm' => 'sub',
+ 'Net/SSH/Perl.pm' => 'sub',
+ 'PDF/API2/Resource/Font.pm' => 'sub',
+ 'PDF/API2/Basic/TTF/Font.pm' => sub {
+ _glob_in_inc('PDF/API2/Basic/TTF', 1);
+ },
+ 'PDF/Writer.pm' => 'sub',
+ 'POE' => [ qw(
+ POE/Kernel.pm POE/Session.pm
+ ) ],
+ 'POE/Kernel.pm' => [
+ map "POE/Resource/$_.pm", qw(
+ Aliases Events Extrefs FileHandles
+ SIDs Sessions Signals Statistics
+ )
+ ],
+ 'Parse/AFP.pm' => 'sub',
+ 'Parse/Binary.pm' => 'sub',
+ 'Regexp/Common.pm' => 'sub',
+ 'SOAP/Lite.pm' => sub {
+ (($] >= 5.008 ? ('utf8.pm') : ()), _glob_in_inc('SOAP/Transport', 1));
+ },
+ 'SQL/Parser.pm' => sub {
+ _glob_in_inc('SQL/Dialects', 1);
+ },
+ 'SVN/Core.pm' => sub {
+ _glob_in_inc('SVN', 1),
+ map "auto/SVN/$_->{name}", _glob_in_inc('auto/SVN'),
+ },
+ 'SVK/Command.pm' => sub {
+ _glob_in_inc('SVK', 1);
+ },
+ 'SerialJunk.pm' => [ qw(
+ termios.ph asm/termios.ph sys/termiox.ph sys/termios.ph sys/ttycom.ph
+ ) ],
+ 'Template.pm' => 'sub',
+ 'Term/ReadLine.pm' => 'sub',
+ 'Tk.pm' => sub {
+ $SeenTk = 1;
+ qw( Tk/FileSelect.pm Encode/Unicode.pm );
+ },
+ 'Tk/Balloon.pm' => [qw( Tk/balArrow.xbm )],
+ 'Tk/BrowseEntry.pm' => [qw( Tk/cbxarrow.xbm Tk/arrowdownwin.xbm )],
+ 'Tk/ColorEditor.pm' => [qw( Tk/ColorEdit.xpm )],
+ 'Tk/FBox.pm' => [qw( Tk/folder.xpm Tk/file.xpm )],
+ 'Tk/Toplevel.pm' => [qw( Tk/Wm.pm )],
+ 'URI.pm' => sub {
+ grep !/.\b[_A-Z]/, _glob_in_inc('URI', 1);
+ },
+ 'Win32/EventLog.pm' => [qw( Win32/IPC.pm )],
+ 'Win32/Exe.pm' => 'sub',
+ 'Win32/TieRegistry.pm' => [qw( Win32API/Registry.pm )],
+ 'Win32/SystemInfo.pm' => [qw( Win32/cpuspd.dll )],
+ 'XML/Parser.pm' => sub {
+ _glob_in_inc('XML/Parser/Style', 1),
+ _glob_in_inc('XML/Parser/Encodings', 1),
+ },
+ 'XML/Parser/Expat.pm' => sub {
+ ($] >= 5.008) ? ('utf8.pm') : ();
+ },
+ 'XML/SAX.pm' => [qw( XML/SAX/ParserDetails.ini ) ],
+ 'XMLRPC/Lite.pm' => sub {
+ _glob_in_inc('XMLRPC/Transport', 1),;
+ },
+ 'diagnostics.pm' => sub {
+ _find_in_inc('Pod/perldiag.pod')
+ ? 'Pod/perldiag.pl'
+ : 'pod/perldiag.pod';
+ },
+ 'utf8.pm' => [
+ 'utf8_heavy.pl', do {
+ my $dir = 'unicore';
+ my @subdirs = qw( To );
+ my @files = map "$dir/lib/$_->{name}", _glob_in_inc("$dir/lib");
+
+ if (@files) {
+ # 5.8.x
+ push @files, (map "$dir/$_.pl", qw( Exact Canonical ));
+ }
+ else {
+ # 5.6.x
+ $dir = 'unicode';
+ @files = map "$dir/Is/$_->{name}", _glob_in_inc("$dir/Is")
+ or return;
+ push @subdirs, 'In';
+ }
+
+ foreach my $subdir (@subdirs) {
+ foreach (_glob_in_inc("$dir/$subdir")) {
+ push @files, "$dir/$subdir/$_->{name}";
+ }
+ }
+ @files;
+ }
+ ],
+ 'charnames.pm' => [
+ _find_in_inc('unicore/Name.pl') ? 'unicore/Name.pl' : 'unicode/Name.pl'
+ ],
+);
+
+my $Keys = 'files|keys|recurse|rv|skip|first|execute|compile';
+sub scan_deps {
+ my %args = (
+ rv => {},
+ (@_ and $_[0] =~ /^(?:$Keys)$/o) ? @_ : (files => [@_], recurse => 1)
+ );
+
+ scan_deps_static(\%args);
+
+ if ($args{execute} or $args{compile}) {
+ scan_deps_runtime(
+ rv => $args{rv},
+ files => $args{files},
+ execute => $args{execute},
+ compile => $args{compile},
+ skip => $args{skip}
+ );
+ }
+
+ return ($args{rv});
+}
+
+sub scan_deps_static {
+ my ($args) = @_;
+ my ($files, $keys, $recurse, $rv, $skip, $first, $execute, $compile) =
+ @$args{qw( files keys recurse rv skip first execute compile )};
+
+ $rv ||= {};
+ $skip ||= {};
+
+ foreach my $file (@{$files}) {
+ my $key = shift @{$keys};
+ next if $skip->{$file}++;
+ next if is_insensitive_fs()
+ and $file ne lc($file) and $skip->{lc($file)}++;
+
+ local *FH;
+ open FH, $file or die "Cannot open $file: $!";
+
+ $SeenTk = 0;
+
+ # Line-by-line scanning
+ LINE:
+ while (<FH>) {
+ chomp(my $line = $_);
+ foreach my $pm (scan_line($line)) {
+ last LINE if $pm eq '__END__';
+
+ if ($pm eq '__POD__') {
+ while (<FH>) { last if (/^=cut/) }
+ next LINE;
+ }
+
+ $pm = 'CGI/Apache.pm' if /^Apache(?:\.pm)$/;
+
+ add_deps(
+ used_by => $key,
+ rv => $rv,
+ modules => [$pm],
+ skip => $skip
+ );
+
+ my $preload = $Preload{$pm} or next;
+ if ($preload eq 'sub') {
+ $pm =~ s/\.p[mh]$//i;
+ $preload = [ _glob_in_inc($pm, 1) ];
+ }
+ elsif (UNIVERSAL::isa($preload, 'CODE')) {
+ $preload = [ $preload->($pm) ];
+ }
+
+ add_deps(
+ used_by => $key,
+ rv => $rv,
+ modules => $preload,
+ skip => $skip
+ );
+ }
+ }
+ close FH;
+
+ # }}}
+ }
+
+ # Top-level recursion handling {{{
+ while ($recurse) {
+ my $count = keys %$rv;
+ my @files = sort grep -T $_->{file}, values %$rv;
+ scan_deps_static({
+ files => [ map $_->{file}, @files ],
+ keys => [ map $_->{key}, @files ],
+ rv => $rv,
+ skip => $skip,
+ recurse => 0,
+ }) or ($args->{_deep} and return);
+ last if $count == keys %$rv;
+ }
+
+ # }}}
+
+ return $rv;
+}
+
+sub scan_deps_runtime {
+ my %args = (
+ perl => $^X,
+ rv => {},
+ (@_ and $_[0] =~ /^(?:$Keys)$/o) ? @_ : (files => [@_], recurse => 1)
+ );
+ my ($files, $rv, $execute, $compile, $skip, $perl) =
+ @args{qw( files rv execute compile skip perl )};
+
+ $files = (ref($files)) ? $files : [$files];
+
+ my ($inchash, $incarray, $dl_shared_objects) = ({}, [], []);
+ if ($compile) {
+ my $file;
+
+ foreach $file (@$files) {
+ ($inchash, $dl_shared_objects, $incarray) = ({}, [], []);
+ _compile($perl, $file, $inchash, $dl_shared_objects, $incarray);
+
+ my $rv_sub = _make_rv($inchash, $dl_shared_objects, $incarray);
+ _merge_rv($rv_sub, $rv);
+ }
+ }
+ elsif ($execute) {
+ my $excarray = (ref($execute)) ? $execute : [@$files];
+ my $exc;
+ my $first_flag = 1;
+ foreach $exc (@$excarray) {
+ ($inchash, $dl_shared_objects, $incarray) = ({}, [], []);
+ _execute(
+ $perl, $exc, $inchash, $dl_shared_objects, $incarray,
+ $first_flag
+ );
+ $first_flag = 0;
+ }
+
+ my $rv_sub = _make_rv($inchash, $dl_shared_objects, $incarray);
+ _merge_rv($rv_sub, $rv);
+ }
+
+ return ($rv);
+}
+
+sub scan_line {
+ my $line = shift;
+ my %found;
+
+ return '__END__' if $line =~ /^__(?:END|DATA)__$/;
+ return '__POD__' if $line =~ /^=\w/;
+
+ $line =~ s/\s*#.*$//;
+ $line =~ s/[\\\/]+/\//g;
+
+ foreach (split(/;/, $line)) {
+ if (/^\s*package\s+(\w+);/) {
+ $CurrentPackage = $1;
+ $CurrentPackage =~ s{::}{/}g;
+ return;
+ }
+ return if /^\s*(use|require)\s+[\d\._]+/;
+
+ if (my ($libs) = /\b(?:use\s+lib\s+|(?:unshift|push)\W+\@INC\W+)(.+)/)
+ {
+ my $archname =
+ defined($Config{archname}) ? $Config{archname} : '';
+ my $ver = defined($Config{version}) ? $Config{version} : '';
+ foreach (grep(/\w/, split(/["';() ]/, $libs))) {
+ unshift(@INC, "$_/$ver") if -d "$_/$ver";
+ unshift(@INC, "$_/$archname") if -d "$_/$archname";
+ unshift(@INC, "$_/$ver/$archname") if -d "$_/$ver/$archname";
+ }
+ next;
+ }
+
+ $found{$_}++ for scan_chunk($_);
+ }
+
+ return sort keys %found;
+}
+
+sub scan_chunk {
+ my $chunk = shift;
+
+ # Module name extraction heuristics {{{
+ my $module = eval {
+ $_ = $chunk;
+
+ return [ 'base.pm',
+ map { s{::}{/}g; "$_.pm" }
+ grep { length and !/^q[qw]?$/ } split(/[^\w:]+/, $1) ]
+ if /^\s* use \s+ base \s+ (.*)/sx;
+
+ return [ 'Class/Autouse.pm',
+ map { s{::}{/}g; "$_.pm" }
+ grep { length and !/^:|^q[qw]?$/ } split(/[^\w:]+/, $1) ]
+ if /^\s* use \s+ Class::Autouse \s+ (.*)/sx
+ or /^\s* Class::Autouse \s* -> \s* autouse \s* (.*)/sx;
+
+ return [ 'POE.pm',
+ map { s{::}{/}g; "POE/$_.pm" }
+ grep { length and !/^q[qw]?$/ } split(/[^\w:]+/, $1) ]
+ if /^\s* use \s+ POE \s+ (.*)/sx;
+
+ return [ 'encoding.pm',
+ map { _find_encoding($_) }
+ grep { length and !/^q[qw]?$/ } split(/[^\w:]+/, $1) ]
+ if /^\s* use \s+ encoding \s+ (.*)/sx;
+
+ return $1 if /(?:^|\s)(?:use|no|require)\s+([\w:\.\-\\\/\"\']+)/;
+ return $1
+ if /(?:^|\s)(?:use|no|require)\s+\(\s*([\w:\.\-\\\/\"\']+)\s*\)/;
+
+ if ( s/(?:^|\s)eval\s+\"([^\"]+)\"/$1/
+ or s/(?:^|\s)eval\s*\(\s*\"([^\"]+)\"\s*\)/$1/)
+ {
+ return $1 if /(?:^|\s)(?:use|no|require)\s+([\w:\.\-\\\/\"\']*)/;
+ }
+
+ return "File/Glob.pm" if /<[^>]*[^\$\w>][^>]*>/;
+ return "DBD/$1.pm" if /\b[Dd][Bb][Ii]:(\w+):/;
+ if (/(?:(:encoding)|\b(?:en|de)code)\(\s*['"]?([-\w]+)/) {
+ my $mod = _find_encoding($2);
+ return [ 'PerlIO.pm', $mod ] if $1 and $mod;
+ return $mod if $mod;
+ }
+ return $1 if /(?:^|\s)(?:do|require)\s+[^"]*"(.*?)"/;
+ return $1 if /(?:^|\s)(?:do|require)\s+[^']*'(.*?)'/;
+ return $1 if /[^\$]\b([\w:]+)->\w/ and $1 ne 'Tk';
+ return $1 if /\b(\w[\w:]*)::\w+\(/;
+
+ if ($SeenTk) {
+ my @modules;
+ while (/->\s*([A-Z]\w+)/g) {
+ push @modules, "Tk/$1.pm";
+ }
+ while (/->\s*Scrolled\W+([A-Z]\w+)/g) {
+ push @modules, "Tk/$1.pm";
+ push @modules, "Tk/Scrollbar.pm";
+ }
+ return \@modules;
+ }
+ return;
+ };
+
+ # }}}
+
+ return unless defined($module);
+ return wantarray ? @$module : $module->[0] if ref($module);
+
+ $module =~ s/^['"]//;
+ return unless $module =~ /^\w/;
+
+ $module =~ s/\W+$//;
+ $module =~ s/::/\//g;
+ return if $module =~ /^(?:[\d\._]+|'.*[^']|".*[^"])$/;
+
+ $module .= ".pm" unless $module =~ /\./;
+ return $module;
+}
+
+sub _find_encoding {
+ return unless $] >= 5.008 and eval { require Encode; %Encode::ExtModule };
+
+ my $mod = $Encode::ExtModule{ Encode::find_encoding($_[0])->name }
+ or return;
+ $mod =~ s{::}{/}g;
+ return "$mod.pm";
+}
+
+sub _add_info {
+ my ($rv, $module, $file, $used_by, $type) = @_;
+ return unless defined($module) and defined($file);
+
+ $rv->{$module} ||= {
+ file => $file,
+ key => $module,
+ type => $type,
+ };
+
+ push @{ $rv->{$module}{used_by} }, $used_by
+ if defined($used_by)
+ and $used_by ne $module
+ and !grep { $_ eq $used_by } @{ $rv->{$module}{used_by} };
+}
+
+sub add_deps {
+ my %args =
+ ((@_ and $_[0] =~ /^(?:modules|rv|used_by)$/)
+ ? @_
+ : (rv => (ref($_[0]) ? shift(@_) : undef), modules => [@_]));
+
+ my $rv = $args{rv} || {};
+ my $skip = $args{skip} || {};
+ my $used_by = $args{used_by};
+
+ foreach my $module (@{ $args{modules} }) {
+ next if exists $rv->{$module};
+
+ my $file = _find_in_inc($module) or next;
+ next if $skip->{$file};
+ next if is_insensitive_fs() and $skip->{lc($file)};
+
+ my $type = 'module';
+ $type = 'data' unless $file =~ /\.p[mh]$/i;
+ _add_info($rv, $module, $file, $used_by, $type);
+
+ if ($module =~ /(.*?([^\/]*))\.p[mh]$/i) {
+ my ($path, $basename) = ($1, $2);
+
+ foreach (_glob_in_inc("auto/$path")) {
+ next if $skip->{$_->{file}};
+ next if is_insensitive_fs() and $skip->{lc($_->{file})};
+ next if $_->{file} =~ m{\bauto/$path/.*/}; # weed out subdirs
+ next if $_->{name} =~ m/(?:^|\/)\.(?:exists|packlist)$/;
+ my $ext = lc($1) if $_->{name} =~ /(\.[^.]+)$/;
+ next if $ext eq lc(lib_ext());
+ my $type = 'shared' if $ext eq lc(dl_ext());
+ $type = 'autoload' if $ext eq '.ix' or $ext eq '.al';
+ $type ||= 'data';
+
+ _add_info($rv, "auto/$path/$_->{name}", $_->{file}, $module,
+ $type);
+ }
+ }
+ }
+
+ return $rv;
+}
+
+sub _find_in_inc {
+ my $file = shift;
+
+ # absolute file names
+ return $file if -f $file;
+
+ foreach my $dir (grep !/\bBSDPAN\b/, @INC) {
+ return "$dir/$file" if -f "$dir/$file";
+ }
+ return;
+}
+
+sub _glob_in_inc {
+ my $subdir = shift;
+ my $pm_only = shift;
+ my @files;
+
+ require File::Find;
+
+ foreach my $dir (map "$_/$subdir", grep !/\bBSDPAN\b/, @INC) {
+ next unless -d $dir;
+ File::Find::find({
+ "wanted" => sub {
+ my $name = $File::Find::name;
+ $name =~ s!^\Q$dir\E/!!;
+ return if $pm_only and lc($name) !~ /\.p[mh]$/i;
+ push @files, $pm_only
+ ? "$subdir/$name"
+ : { file => $File::Find::name,
+ name => $name,
+ }
+ if -f;
+ },
+ "untaint" => 1,
+ "untaint_skip" => 1,
+ "untaint_pattern" => qr|^([-+@\w./]+)$|
+ }, $dir
+ );
+ }
+
+ return @files;
+}
+
+# App::Packer compatibility functions
+
+sub new {
+ my ($class, $self) = @_;
+ return bless($self ||= {}, $class);
+}
+
+sub set_file {
+ my $self = shift;
+ foreach my $script (@_) {
+ my $basename = $script;
+ $basename =~ s/.*\///;
+ $self->{main} = {
+ key => $basename,
+ file => $script,
+ };
+ }
+}
+
+sub set_options {
+ my $self = shift;
+ my %args = @_;
+ foreach my $module (@{ $args{add_modules} }) {
+ $module =~ s/::/\//g;
+ $module .= '.pm' unless $module =~ /\.p[mh]$/i;
+ my $file = _find_in_inc($module) or next;
+ $self->{files}{$module} = $file;
+ }
+}
+
+sub calculate_info {
+ my $self = shift;
+ my $rv = scan_deps(
+ keys => [ $self->{main}{key}, sort keys %{ $self->{files} }, ],
+ files => [ $self->{main}{file},
+ map { $self->{files}{$_} } sort keys %{ $self->{files} },
+ ],
+ recurse => 1,
+ );
+
+ my $info = {
+ main => { file => $self->{main}{file},
+ store_as => $self->{main}{key},
+ },
+ };
+
+ my %cache = ($self->{main}{key} => $info->{main});
+ foreach my $key (sort keys %{ $self->{files} }) {
+ my $file = $self->{files}{$key};
+
+ $cache{$key} = $info->{modules}{$key} = {
+ file => $file,
+ store_as => $key,
+ used_by => [ $self->{main}{key} ],
+ };
+ }
+
+ foreach my $key (sort keys %{$rv}) {
+ my $val = $rv->{$key};
+ if ($cache{ $val->{key} }) {
+ push @{ $info->{ $val->{type} }->{ $val->{key} }->{used_by} },
+ @{ $val->{used_by} };
+ }
+ else {
+ $cache{ $val->{key} } = $info->{ $val->{type} }->{ $val->{key} } =
+ { file => $val->{file},
+ store_as => $val->{key},
+ used_by => $val->{used_by},
+ };
+ }
+ }
+
+ $self->{info} = { main => $info->{main} };
+
+ foreach my $type (sort keys %{$info}) {
+ next if $type eq 'main';
+
+ my @val;
+ if (UNIVERSAL::isa($info->{$type}, 'HASH')) {
+ foreach my $val (sort values %{ $info->{$type} }) {
+ @{ $val->{used_by} } = map $cache{$_} || "!!$_!!",
+ @{ $val->{used_by} };
+ push @val, $val;
+ }
+ }
+
+ $type = 'modules' if $type eq 'module';
+ $self->{info}{$type} = \@val;
+ }
+}
+
+sub get_files {
+ my $self = shift;
+ return $self->{info};
+}
+
+# scan_deps_runtime utility functions
+
+sub _compile {
+ my ($perl, $file, $inchash, $dl_shared_objects, $incarray) = @_;
+
+ my $fname = File::Temp::mktemp("$file.XXXXXX");
+ my $fhin = FileHandle->new($file) or die "Couldn't open $file\n";
+ my $fhout = FileHandle->new("> $fname") or die "Couldn't open $fname\n";
+
+ my $line = do { local $/; <$fhin> };
+ $line =~ s/use Module::ScanDeps::DataFeed.*?\n//sg;
+ $line =~ s/^(.*?)((?:[\r\n]+__(?:DATA|END)__[\r\n]+)|$)/
+use Module::ScanDeps::DataFeed '$fname.out';
+sub {
+$1
+}
+$2/s;
+ $fhout->print($line);
+ $fhout->close;
+ $fhin->close;
+
+ system($perl, $fname);
+
+ _extract_info("$fname.out", $inchash, $dl_shared_objects, $incarray);
+ unlink("$fname");
+ unlink("$fname.out");
+}
+
+sub _execute {
+ my ($perl, $file, $inchash, $dl_shared_objects, $incarray, $firstflag) = @_;
+
+ $DB::single = $DB::single = 1;
+
+ my $fname = _abs_path(File::Temp::mktemp("$file.XXXXXX"));
+ my $fhin = FileHandle->new($file) or die "Couldn't open $file";
+ my $fhout = FileHandle->new("> $fname") or die "Couldn't open $fname";
+
+ my $line = do { local $/; <$fhin> };
+ $line =~ s/use Module::ScanDeps::DataFeed.*?\n//sg;
+ $line = "use Module::ScanDeps::DataFeed '$fname.out';\n" . $line;
+ $fhout->print($line);
+ $fhout->close;
+ $fhin->close;
+
+ File::Path::rmtree( ['_Inline'], 0, 1); # XXX hack
+ system($perl, $fname) == 0 or die "SYSTEM ERROR in executing $file: $?";
+
+ _extract_info("$fname.out", $inchash, $dl_shared_objects, $incarray);
+ unlink("$fname");
+ unlink("$fname.out");
+}
+
+sub _make_rv {
+ my ($inchash, $dl_shared_objects, $inc_array) = @_;
+
+ my $rv = {};
+ my @newinc = map(quotemeta($_), @$inc_array);
+ my $inc = join('|', sort { length($b) <=> length($a) } @newinc);
+
+ require File::Spec;
+
+ my $key;
+ foreach $key (keys(%$inchash)) {
+ my $newkey = $key;
+ $newkey =~ s"^(?:(?:$inc)/?)""sg if File::Spec->file_name_is_absolute($newkey);
+
+ $rv->{$newkey} = {
+ 'used_by' => [],
+ 'file' => $inchash->{$key},
+ 'type' => _gettype($inchash->{$key}),
+ 'key' => $key
+ };
+ }
+
+ my $dl_file;
+ foreach $dl_file (@$dl_shared_objects) {
+ my $key = $dl_file;
+ $key =~ s"^(?:(?:$inc)/?)""s;
+
+ $rv->{$key} = {
+ 'used_by' => [],
+ 'file' => $dl_file,
+ 'type' => 'shared',
+ 'key' => $key
+ };
+ }
+
+ return $rv;
+}
+
+sub _extract_info {
+ my ($fname, $inchash, $dl_shared_objects, $incarray) = @_;
+
+ use vars qw(%inchash @dl_shared_objects @incarray);
+ my $fh = FileHandle->new($fname) or die "Couldn't open $fname";
+ my $line = do { local $/; <$fh> };
+ $fh->close;
+
+ eval $line;
+
+ $inchash->{$_} = $inchash{$_} for keys %inchash;
+ @$dl_shared_objects = @dl_shared_objects;
+ @$incarray = @incarray;
+}
+
+sub _gettype {
+ my $name = shift;
+ my $dlext = quotemeta(dl_ext());
+
+ return 'autoload' if $name =~ /(?:\.ix|\.al|\.bs)$/i;
+ return 'module' if $name =~ /\.p[mh]$/i;
+ return 'shared' if $name =~ /\.$dlext$/i;
+ return 'data';
+}
+
+sub _merge_rv {
+ my ($rv_sub, $rv) = @_;
+
+ my $key;
+ foreach $key (keys(%$rv_sub)) {
+ my %mark;
+ if ($rv->{$key} and _not_dup($key, $rv, $rv_sub)) {
+ warn "different modules for file: $key: were found" .
+ "(using the version) after the '=>': ".
+ "$rv->{$key}{file} => $rv_sub->{$key}{file}\n";
+
+ $rv->{$key}{used_by} = [
+ grep (!$mark{$_}++,
+ @{ $rv->{$key}{used_by} },
+ @{ $rv_sub->{$key}{used_by} })
+ ];
+ @{ $rv->{$key}{used_by} } = grep length, @{ $rv->{$key}{used_by} };
+ $rv->{$key}{file} = $rv_sub->{$key}{file};
+ }
+ elsif ($rv->{$key}) {
+ $rv->{$key}{used_by} = [
+ grep (!$mark{$_}++,
+ @{ $rv->{$key}{used_by} },
+ @{ $rv_sub->{$key}{used_by} })
+ ];
+ @{ $rv->{$key}{used_by} } = grep length, @{ $rv->{$key}{used_by} };
+ }
+ else {
+ $rv->{$key} = {
+ used_by => [ @{ $rv_sub->{$key}{used_by} } ],
+ file => $rv_sub->{$key}{file},
+ key => $rv_sub->{$key}{key},
+ type => $rv_sub->{$key}{type}
+ };
+
+ @{ $rv->{$key}{used_by} } = grep length, @{ $rv->{$key}{used_by} };
+ }
+ }
+}
+
+sub _not_dup {
+ my ($key, $rv1, $rv2) = @_;
+ (_abs_path($rv1->{$key}{file}) ne _abs_path($rv2->{$key}{file}));
+}
+
+sub _abs_path {
+ return join(
+ '/',
+ Cwd::abs_path(File::Basename::dirname($_[0])),
+ File::Basename::basename($_[0]),
+ );
+}
+
+#####################################################
+### Actual perldeps.pl code starts here.
+
+# Print usage information
+sub
+print_usage_info($)
+{
+ my $code = shift || 0;
+ my ($leader, $underbar);
+
+ print "\n";
+ $leader = "$0 Usage Information";
+ $underbar = $leader;
+ $underbar =~ s/./-/g;
+ print "$leader\n$underbar\n";
+ print "\n";
+ print " Syntax: $0 [ options ] [ path(s)/file(s) ]\n";
+ print "\n";
+ print " -h --help Show this usage information\n";
+ print " -v --version Show version and copyright\n";
+ print " -d --debug Turn on debugging\n";
+ print " -p --provides Find things provided by path(s)/file(s)\n";
+ print " -r --requires Find things required by path(s)/file(s)\n";
+ #print " \n";
+ print "\nNOTE: Path(s)/file(s) can also be specified on STDIN. Default is \@INC.\n\n";
+ exit($code);
+}
+
+# Locate perl modules (*.pm) in given locations.
+sub
+find_perl_modules(@)
+{
+ my @locations = @_;
+ my %modules;
+
+ foreach my $loc (@locations) {
+ if (-f $loc) {
+ # It's a file. Assume it's a Perl module.
+ #print "Found module: $loc.\n";
+ $modules{$loc} = 1;
+ } elsif (-d $loc) {
+ my @tmp;
+
+ # Recurse the directory tree looking for all modules inside it.
+ &File::Find::find({
+ "wanted" => sub {
+ if ((-s _) && (substr($File::Find::fullname, -3, 3) eq ".pm")) {
+ push @tmp, $File::Find::fullname;
+ }
+ },
+ "follow_fast" => 1,
+ "no_chdir" => 1,
+ "untaint" => 1,
+ "untaint_skip" => 1,
+ "untaint_pattern" => qr|^([-+@\w./]+)$|
+ }, $loc);
+
+ # @tmp is now a list with all non-empty *.pm files in and under $loc.
+ # Untaint and save in %modules hash.
+ foreach my $module (@tmp) {
+ if ($module =~ /^([-+@\w.\/]+)$/) {
+ $modules{$1} = 1;
+ #print "Found module: $1\n";
+ }
+ }
+ } else {
+ # Something wicked this way comes.
+ print STDERR "$0: Error: Don't know what to do with location \"$loc\"\n";
+ }
+ }
+ return keys(%modules);
+}
+
+# Generate an RPM-style "Provides:" list for the given modules.
+sub
+find_provides(@)
+{
+ my @modules = @_;
+ my @prov;
+
+ foreach my $mod (@modules) {
+ my (@contents, @pkgs);
+ my $mod_path;
+ local *MOD;
+
+ $mod_path = dirname($mod);
+ if (!open(MOD, $mod)) {
+ warn "Unable to read module $mod -- $!\n";
+ next;
+ }
+ @contents = <MOD>;
+ if (!close(MOD)) {
+ warn "Unable to close module $mod -- $!\n";
+ }
+
+ if (!scalar(grep { $_ eq $mod_path } @INC)) {
+ push @INC, $mod_path;
+ }
+ foreach my $line (grep { $_ =~ /^\s*package\s+/ } @contents) {
+ if ($line =~ /^\s*package\s+([^\;\s]+)\s*\;/) {
+ push @pkgs, $1;
+ }
+ }
+
+ # Now we have a list of packages. Load up the modules and get their versions.
+ foreach my $pkg (@pkgs) {
+ my $ret;
+ local ($SIG{"__WARN__"}, $SIG{"__DIE__"});
+
+ # Make sure eval() can't display warnings/errors.
+ $SIG{"__DIE__"} = $SIG{"__WARN__"} = sub {0;};
+ $ret = eval("no strict ('vars', 'subs', 'refs'); use $pkg (); return $pkg->VERSION || 0.0;");
+ if ($@) {
+ dprint "Unable to parse version number from $pkg -- $@. Assuming 0.\n";
+ $ret = 0;
+ }
+
+ if (! $ret) {
+ $ret = 0;
+ }
+ push @prov, "perl($pkg) = $ret";
+ }
+ }
+ printf("Provides: %s\n", join(", ", sort(@prov)));
+}
+
+# Generate an RPM-style "Requires:" list for the given modules.
+sub
+find_requires(@)
+{
+ my @modules = @_;
+ my @reqs;
+ my $reqs;
+
+ $reqs = &scan_deps("files" => \@modules, "recurse" => 0);
+ foreach my $key (grep { $reqs->{$_}{"type"} eq "module" } sort(keys(%{$reqs}))) {
+ if (substr($key, -3, 3) eq ".pm") {
+ $key = substr($key, 0, -3);
+ }
+ $key =~ s!/!::!g;
+ push @reqs, "perl($key)";
+ }
+ printf("Requires: %s\n", join(", ", @reqs));
+}
+
+sub
+main()
+{
+ my $VERSION = '1.0';
+ my (@locations, @modules);
+ my %OPTION;
+
+ # For taint checks
+ delete @ENV{("IFS", "CDPATH", "ENV", "BASH_ENV")};
+ $ENV{"PATH"} = "/bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/ucb";
+ foreach my $shell ("/bin/bash", "/usr/bin/ksh", "/bin/ksh", "/bin/sh", "/sbin/sh") {
+ if (-f $shell) {
+ $ENV{"SHELL"} = $shell;
+ last;
+ }
+ }
+
+ $ENV{"LANG"} = "C" if (! $ENV{"LANG"});
+ umask 022;
+ select STDERR; $| = 1;
+ select STDOUT; $| = 1;
+
+ Getopt::Long::Configure("no_getopt_compat", "bundling", "no_ignore_case");
+ Getopt::Long::GetOptions(\%OPTION, "debug|d!", "help|h", "version|v", "provides|p", "requires|r");
+
+ # Post-parse the options stuff
+ select STDOUT; $| = 1;
+ if ($OPTION{"version"}) {
+ # Do not edit this variable. It is updated automatically by CVS when you commit
+ my $rcs_info = 'CVS Revision $Revision: 1.6 $ created on $Date: 2006/04/04 20:12:03 $ by $Author: mej $ ';
+
+ $rcs_info =~ s/\$\s*Revision: (\S+) \$/$1/;
+ $rcs_info =~ s/\$\s*Date: (\S+) (\S+) \$/$1 at $2/;
+ $rcs_info =~ s/\$\s*Author: (\S+) \$ /$1/;
+ print "\n";
+ print "perldeps.pl $VERSION by Michael Jennings <mej\@eterm.org>\n";
+ print "Copyright (c) 2005-2006, Michael Jennings\n";
+ print " ($rcs_info)\n";
+ print "\n";
+ return 0;
+ } elsif ($OPTION{"help"}) {
+ &print_usage_info(0); # Never returns
+ }
+
+ push @locations, @ARGV;
+ if (!scalar(@ARGV) && !(-t STDIN)) {
+ @locations = <STDIN>;
+ }
+ if (!scalar(@locations)) {
+ @locations = @INC;
+ }
+
+ if (!($OPTION{"provides"} || $OPTION{"requires"})) {
+ &print_usage_info(-1); # Never returns
+ }
+
+ # Catch bogus warning messages like "A thread exited while 2 threads were running"
+ $SIG{"__DIE__"} = $SIG{"__WARN__"} = sub {0;};
+
+ @modules = &find_perl_modules(@locations);
+ if ($OPTION{"provides"}) {
+ &find_provides(@modules);
+ }
+ if ($OPTION{"requires"}) {
+ &find_requires(@modules);
+ }
+ return 0;
+}
+
+exit &main();
diff --git a/scripts/pkgconfigdeps.sh b/scripts/pkgconfigdeps.sh
new file mode 100755
index 0000000..270dd74
--- /dev/null
+++ b/scripts/pkgconfigdeps.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+pkgconfig=/usr/bin/pkg-config
+test -x $pkgconfig || {
+ cat > /dev/null
+ exit 0
+}
+
+[ $# -ge 1 ] || {
+ cat > /dev/null
+ exit 0
+}
+
+$pkgconfig --atleast-pkgconfig-version="0.24" || {
+ cat > /dev/null
+ exit 0
+}
+
+case $1 in
+-P|--provides)
+ while read filename ; do
+ case "${filename}" in
+ *.pc)
+ # Query the dependencies of the package.
+ DIR="`dirname ${filename}`"
+ export PKG_CONFIG_PATH="$DIR:$DIR/../../share/pkgconfig"
+ $pkgconfig --print-provides "$filename" 2> /dev/null | while read n r v ; do
+ [ -n "$n" ] || continue
+ # We have a dependency. Make a note that we need the pkgconfig
+ # tool for this package.
+ echo -n "pkgconfig($n) "
+ [ -n "$r" ] && [ -n "$v" ] && echo -n "$r" "$v"
+ echo
+ done
+ ;;
+ esac
+ done
+ ;;
+-R|--requires)
+ while read filename ; do
+ case "${filename}" in
+ *.pc)
+ i="`expr $i + 1`"
+ [ $i -eq 1 ] && echo "$pkgconfig"
+ DIR="`dirname ${filename}`"
+ export PKG_CONFIG_PATH="$DIR:$DIR/../../share/pkgconfig"
+ $pkgconfig --print-requires --print-requires-private "$filename" 2> /dev/null | while read n r v ; do
+ [ -n "$n" ] || continue
+ echo -n "pkgconfig($n) "
+ [ -n "$r" ] && [ -n "$v" ] && echo -n "$r" "$v"
+ echo
+ done
+ esac
+ done
+ ;;
+esac
+exit 0
diff --git a/scripts/pythondeps.sh b/scripts/pythondeps.sh
new file mode 100755
index 0000000..10a060a
--- /dev/null
+++ b/scripts/pythondeps.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+[ $# -ge 1 ] || {
+ cat > /dev/null
+ exit 0
+}
+
+case $1 in
+-P|--provides)
+ shift
+ # Match buildroot/payload paths of the form
+ # /PATH/OF/BUILDROOT/usr/bin/pythonMAJOR.MINOR
+ # generating a line of the form
+ # python(abi) = MAJOR.MINOR
+ # (Don't match against -config tools e.g. /usr/bin/python2.6-config)
+ grep "/usr/bin/python.\..$" \
+ | sed -e "s|.*/usr/bin/python\(.\..\)|python(abi) = \1|"
+ ;;
+-R|--requires)
+ shift
+ # Match buildroot paths of the form
+ # /PATH/OF/BUILDROOT/usr/lib/pythonMAJOR.MINOR/ and
+ # /PATH/OF/BUILDROOT/usr/lib64/pythonMAJOR.MINOR/
+ # generating (uniqely) lines of the form:
+ # python(abi) = MAJOR.MINOR
+ grep "/usr/lib[^/]*/python.\../.*" \
+ | sed -e "s|.*/usr/lib[^/]*/python\(.\..\)/.*|python(abi) = \1|g" \
+ | sort | uniq
+ ;;
+esac
+
+exit 0
diff --git a/scripts/rpm.daily b/scripts/rpm.daily
new file mode 100755
index 0000000..3a199cc
--- /dev/null
+++ b/scripts/rpm.daily
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+tmpfile=`/bin/mktemp /var/log/rpmpkgs.XXXXXXXXX` || exit 1
+/bin/rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 \
+ | /bin/sort > "$tmpfile"
+
+if [ ! -s "$tmpfile" ]; then
+ rm -f "$tmpfile"
+ exit 1
+fi
+
+/bin/mv "$tmpfile" /var/log/rpmpkgs
+/bin/chmod 0644 /var/log/rpmpkgs
diff --git a/scripts/rpm.log b/scripts/rpm.log
new file mode 100644
index 0000000..732c301
--- /dev/null
+++ b/scripts/rpm.log
@@ -0,0 +1,5 @@
+/var/log/rpmpkgs {
+ weekly
+ notifempty
+ missingok
+}
diff --git a/scripts/rpm2cpio.sh b/scripts/rpm2cpio.sh
new file mode 100755
index 0000000..b03ee36
--- /dev/null
+++ b/scripts/rpm2cpio.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+pkg=$1
+if [ "$pkg" = "" -o ! -e "$pkg" ]; then
+ echo "no package supplied" 1>&2
+ exit 1
+fi
+
+leadsize=96
+o=`expr $leadsize + 8`
+set `od -j $o -N 8 -t u1 $pkg`
+il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
+dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
+# echo "sig il: $il dl: $dl"
+
+sigsize=`expr 8 + 16 \* $il + $dl`
+o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8 + 8`
+set `od -j $o -N 8 -t u1 $pkg`
+il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
+dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
+# echo "hdr il: $il dl: $dl"
+
+hdrsize=`expr 8 + 16 \* $il + $dl`
+o=`expr $o + $hdrsize`
+
+comp=`dd if="$pkg" ibs=$o skip=1 count=1 2>/dev/null \
+ | dd bs=3 count=1 2>/dev/null`
+
+gz="`echo . | awk '{ printf("%c%c", 0x1f, 0x8b); }'`"
+lzma="`echo . | awk '{ printf("%cLZ", 0xff); }'`"
+case "$comp" in
+ BZh) dd if="$pkg" ibs=$o skip=1 2>/dev/null | bunzip2 ;;
+ "$gz"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | gunzip ;;
+ "$lzma"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | unlzma ;;
+ *) echo "Unrecognized rpm file: $pkg"; return 1 ;;
+esac
diff --git a/scripts/rpmdb_loadcvt b/scripts/rpmdb_loadcvt
new file mode 100755
index 0000000..aa70106
--- /dev/null
+++ b/scripts/rpmdb_loadcvt
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+ac=$#
+cmd=`basename $0`
+
+rpmdb=/var/lib/rpm
+dbfiles="`/bin/ls -1 $rpmdb/*`"
+dbdump=/usr/lib/rpm/rpmdb_dump
+dbload=/usr/bin/db_load
+
+set `$dbdump -V` || {
+ echo "The file $dbdump, usually in the rpm-devel package, is needed."
+ echo " Please install the rpm-devel package and retry $cmd."
+ exit 1
+}
+dumpfmt="${5%%:}"
+
+set `$dbload -V` || {
+ echo "The file $dbload, usually in the db4-utils package, is needed."
+ echo " Please install the db4_utils package and retry $cmd."
+ exit 1
+}
+loadfmt="${5%%:}"
+
+[ "$dumpfmt" = "$loadfmt" ] && {
+ echo "Both $dbdump and $dbload use db-$loadfmt format."
+ echo "No conversion is possible."
+ exit 0
+}
+
+[ "$ac" != "0" -o "`/usr/bin/id -u`" != "0" ] && {
+ echo "$cmd: Convert $rpmdb files to db-$loadfmt format."
+ echo "$cmd: Must be run as root, takes no arguments."
+ exit 1
+}
+
+echo "Converting to db-$loadfmt compatible format (1-10 minutes per file) ..."
+
+dbfile=
+trap "
+ [ -n "$dbfile" ] && {
+ [ -f $dbfile-O ] && /bin/mv $dbfile-O $dbfile
+ /bin/rm -f $dbfile-N
+ }
+ exit 1
+" 1 2 3 15
+
+rm -f $rpmdb/__db*
+
+for dbfile in $dbfiles
+do
+ echo " `/usr/bin/file $dbfile`"
+
+ $dbdump $dbfile | $dbload $dbfile-N || {
+ echo "Failed conversion:"
+ echo " $dbdump $dbfile | $dbload $dbfile-N"
+ echo "Cleaning up and exiting ..."
+ /bin/rm -f $dbfile-N
+ exit 1
+ }
+
+ /bin/mv $dbfile $dbfile-O
+ /bin/mv $dbfile-N $dbfile
+ /bin/rm -f $dbfile-O
+done
+
+echo "Done!"
+
+exit 0
diff --git a/scripts/script.req b/scripts/script.req
new file mode 100755
index 0000000..950dc4a
--- /dev/null
+++ b/scripts/script.req
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# TODO: handle "#!/usr/bin/env foo" somehow
+while read filename; do
+ # common cases
+ sed -n -e '1s:^#![[:space:]]*\(/[^[:space:]]\{1,\}\).*:\1:p' "$filename"
+ #!/usr/bin/env /foo/bar
+ sed -n -e '1s:^#![[:space:]]*[^[:space:]]*/bin/env[[:space:]]\{1,\}\(/[^[:space:]]\{1,\}\):\1:p' "$filename"
+done
diff --git a/scripts/tcl.req b/scripts/tcl.req
new file mode 100644
index 0000000..43c5920
--- /dev/null
+++ b/scripts/tcl.req
@@ -0,0 +1,101 @@
+#!/usr/bin/perl
+
+# tcl.req - a simple makedepends like script for tcl.
+
+# I plan to rewrite this in C so that perl is not required by RPM at
+# build time.
+
+# by Ken Estes Mail.com kestes@staff.mail.com
+
+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 $module (sort keys %require) {
+ print "tcl($module)\n";
+}
+
+exit 0;
+
+
+
+sub process_file {
+
+ my ($file) = @_;
+ chomp $file;
+
+ open(FILE, "<$file")||
+ die("$0: Could not open file: '$file' : $!\n");
+
+ while (<FILE>) {
+
+ # 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 $_ (spit(/\s+/, $1)) {
+ print "$_\n";
+ }
+ }
+
+ s/\#.*//;
+
+ # 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 $_ (spit(/\s+/, $1))
+ print "$_\n";
+ }
+
+
+# we wish to capture these source statements:
+
+# source "$PATH/lib/util.tcl"
+# source "comconf.tcl"
+# if {[catch {source $env(CONTROL_PANEL_LIB_DIR)/bindings.tcl}] != 0} {
+
+ # quick check to see if the complex regexps could possibly match.
+ # This should speed things up.
+
+ (m/source/) || next;
+
+ # note we include parethesis and '$' and '\' in the pattern
+
+ if (
+ (m!source\s+([\'\"])?([0-9A-Za-z/._\-\\\(\)\$]+)!)
+ ) {
+
+ my ($module) = $2;
+
+ # If there is some interpolation of variables,
+ # see if taking the basename will give us the filename.
+
+ ($module =~ m/\$/) &&
+ ($module = basename($module));
+
+ ($module =~ m/\$/) ||
+ ($require{$module}=1);
+ }
+ }
+
+ close(FILE)||
+ die("$0: Could not close file: '$file' : $!\n");
+
+ return ;
+}
diff --git a/scripts/tgpg b/scripts/tgpg
new file mode 100755
index 0000000..238cffb
--- /dev/null
+++ b/scripts/tgpg
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+
+for pkg in $*
+do
+ if [ "$pkg" = "" -o ! -e "$pkg" ]; then
+ echo "no package supplied" 1>&2
+ exit 1
+ fi
+
+ plaintext=`mktemp ${TMPDIR:-/tmp}/tgpg-$$.XXXXXX`
+ detached=`mktemp ${TMPDIR:-/tmp}/tgpg-$$.XXXXXX`
+
+# --- Extract detached signature
+ rpm -qp -vv --qf '%{siggpg:armor}' $pkg > $detached
+
+# --- Figger the offset of header+payload in the package
+ leadsize=96
+ o=`expr $leadsize + 8`
+
+ set `od -j $o -N 8 -t u1 $pkg`
+ il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
+ dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
+
+ sigsize=`expr 8 + 16 \* $il + $dl`
+ o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8`
+
+# --- Extract header+payload
+ dd if=$pkg ibs=$o skip=1 2>/dev/null > $plaintext
+
+# --- Verify DSA signature using gpg
+ gpg --batch -vv --debug 0xfc02 --verify $detached $plaintext
+
+# --- Clean up
+ rm -f $detached $plaintext
+done
diff --git a/scripts/vpkg-provides.sh b/scripts/vpkg-provides.sh
new file mode 100755
index 0000000..c15f080
--- /dev/null
+++ b/scripts/vpkg-provides.sh
@@ -0,0 +1,398 @@
+#!/bin/sh
+
+#
+# Original Author: Tim Mooney (mooney@plains.NoDak.edu)
+# Improvements by: Ken Estes <kestes@staff.mail.com>
+#
+# This file is distributed under the terms of the GNU General Public License
+#
+
+# vpkg-provides.sh is part of RPM, the Red Hat Package Manager.
+
+# vpkg-provides.sh searches a list of directories (based on what OS
+# it's being executed on) for shared libraries and interpreter files
+# that have been installed by some packaging system other than RPM.
+# It then generates a spec file that can be used to build a "virtual
+# package" that provides all of these things without actually
+# installing any files. The spec file in effect tells rpm what it
+# needs to know about operating system files which are not under rpm
+# control. This makes it much easier to use RPM on non-Linux systems.
+
+# By default the script also generates a %verifyscript (with hard
+# coded $shlib_dirs, $ignore_dirs values) which will check that the
+# checksum of each file in the directories searched has not changed
+# since the package was built.
+
+# Comments: This script is a quick hack. A better solution is to use the
+# vendor's package management commands to actually query what's installed, and
+# build one or more spec files based on that. This is something
+# I intend to write, probably in perl, but the need for something like this
+# first effort was great, so I didn't want to wait until the better solution
+# was done.
+
+# The complete specfile will be sent to stdout.
+
+# you will need to create a spec_header for the virtual package. This
+# header will provide such specfile information as:
+#
+# Summary:
+# Name:
+# Version:
+# Release:
+# Copyright:
+# Group:
+# Source:
+
+
+# most of the command line arguments have defaults
+
+usage="usage: $0 --spec_header '/path/to/os-base-header.spec' \n"
+usage="$usage\t[--find_provides '/path/to/find-provides']\n"
+usage="$usage\t[--shlib_dirs 'dirs:which:contain:shared:libs']\n"
+usage="$usage\t[--ignore_dirs 'grep-E|pattern|of|paths|to|ignore']\n"
+
+# these two should be unnessary as the regular dependency analysis
+# should take care of interpreters as well as shared libraries.
+
+usage="$usage\t[--interp_dirs 'dirs:which:contain:interpreters']\n"
+usage="$usage\t[--interps 'files:to:assume:are:installed']\n"
+usage="$usage\t[--no_verify]\n"
+
+
+# this command may not be portable to all OS's, does something else
+# work? can this be set in the case $osname statement?
+
+sum_cmd="xargs cksum"
+
+date=`date`
+hostname=`uname -n`
+
+# if some subdirectories of the system directories needs to be ignored
+# (eg /usr/local is a subdirectory of /usr but should not be part of
+# the virtual package) then call this script with ignore_dirs set to a
+# valid grep -E pattern which discribes the directories to ignored.
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/bsd
+export PATH
+
+
+#
+# The (OS independent) default values.
+#
+spec_header='/usr/lib/rpm/os-base-header.spec';
+interps="sh:csh:ksh:dtksh:wish:tclsh:perl:awk:gawk:nawk:oawk"
+find_provides='/usr/lib/rpm/find-provides';
+
+ # no file names begin with this character so it is a good default
+ # for dirs to ignore.
+
+ignore_dirs="@"
+
+
+osname=`uname -s`
+if test $? -ne 0 || test X$osname = X ; then
+ echo "I can't determine what platform this is. Exiting"
+ exit 1
+fi
+
+
+#
+# Set OS dependent defaults
+#
+case $osname in
+ OSF1)
+ shlib_dirs='/shlib:/usr/shlib:/usr/dt/lib:/usr/opt'
+ interp_dirs='/bin:/usr/bin:/sbin:/usr/dt/bin:/usr/bin/posix'
+ ;;
+ HP-UX)
+ shlib_dirs='/usr/shlib:/usr/dt/lib:/opt'
+ shlib_dirs="$shlib_dirs:/usr/bms:/usr/obam:/usr/sam"
+ interp_dirs='/bin:/usr/bin:/sbin:/usr/dt/bin:/usr/bin/posix'
+ ;;
+ AIX)
+ shlib_dirs='/usr/lib:/usr/ccs/lib:/usr/dt/lib:/usr/lpp:/usr/opt'
+ interp_dirs='/bin:/usr/bin:/sbin:/usr/dt/bin'
+ ;;
+ SunOS)
+ shlib_dirs='/etc/lib:/etc/vx:/opt:/usr/lib:/usr/ccs/lib:/usr/dt/lib'
+ shlib_dirs="$shlib_dirs:/usr/4lib:/usr/openwin/lib:/usr/snadm/lib"
+ shlib_dirs="$shlib_dirs:/usr/ucblib:/usr/xpg4/lib"
+ interp_dirs='/bin:/usr/bin:/sbin:/usr/dt/bin:/usr/xpg4/bin'
+ ;;
+ IRIX|IRIX64)
+ shlib_dirs='/lib:/usr/lib:/usr/lib32:/usr/lib64'
+ # Irix always makes me laugh...
+ shlib_dirs="$shlib_dirs:/usr/ToolTalk:/usr/xfsm:/usr/SpeedShop"
+ shlib_dirs="$shlib_dirs:/usr/sgitcl:/usr/SGImeeting:/usr/pcp/lib"
+ shlib_dirs="$shlib_dirs:/usr/Motif-2.1"
+ interp_dirs='/bin:/usr/bin:/sbin:/usr/sbin:/usr/dt/bin'
+ ;;
+ *)
+ echo "I'm sorry. I haven't been configured yet to work on $osname."
+ echo "Please poke around your system and try figure out what directories"
+ echo "I should be searching for shared libraries. Once you have this"
+ echo "information, email it to rpm-list@redhat.com, so that your OS"
+ echo "will be supported by some future version of this script."
+ echo ""
+ echo "Thanks!"
+ echo
+ exit 2
+ ;;
+esac
+
+
+# allow the user to change defaults with the command line arguments.
+
+# Loop over all args
+
+while :
+do
+
+# Break out if there are no more args
+ case $# in
+ 0)
+ break
+ ;;
+ esac
+
+# Get the first arg, and shuffle
+ option=$1
+ shift
+
+# Make all options have two hyphens
+ orig_option=$option # Save original for error messages
+ case $option in
+ --*) ;;
+ -*) option=-$option ;;
+ esac
+
+
+ case $option in
+ --spec_header)
+ spec_header=$1
+ shift
+ ;;
+ --ignore_dirs)
+ ignore_dirs=$1
+ shift
+ ;;
+ --find_provides)
+ find_provides=$1
+ shift
+ ;;
+ --shlib_dirs)
+ shlib_dirs=$1
+ shift
+ ;;
+ --interp_dirs)
+ interp_dirs=$1
+ shift
+ ;;
+ --interps)
+ interps=$1
+ shift
+ ;;
+ --no_verify)
+ no_verify=1
+ ;;
+ --help)
+ echo $usage
+ exit 0
+ ;;
+ *)
+ echo "$0: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
+ exit 1
+ ;;
+ esac
+done
+
+
+# consistancy checks on the arguments
+
+if [ ! -f $spec_header ]; then
+ echo "You must pass me the full path to the partial spec file"
+ echo "as my first argument, since this file does not appear in the"
+ echo "default location of $default_spec_header"
+ echo
+ echo $usage
+ echo
+ exit 9
+fi
+
+
+if [ ! -f $find_provides ]; then
+ echo "You must pass me the full path to the find-provides script as my"
+ echo "second argument, since find-provides does not appear in the"
+ echo "default location of $default_find_provides"
+ echo
+ echo $usage
+ echo
+ exit 9
+fi
+
+
+
+provides_tmp=${TMPDIR:-/tmp}/provides.$$
+if test -f $provides_tmp ; then
+ echo "$provides_tmp already exists. Exiting."
+ exit 11
+fi
+
+#
+# iterate through all the directories in shlib_dirs, looking for shared
+# libraries
+#
+for d in `echo $shlib_dirs | sed -e 's/:/ /g'`
+do
+ find $d -type f -print 2>/dev/null | grep -E -v \'$ignore_dirs\' | $find_provides >> $provides_tmp
+done
+
+sum_tmp=${TMPDIR:-/tmp}/sum.$$
+if test -f $sum_tmp ; then
+ echo "$sum_tmp already exists. Exiting."
+ exit 11
+fi
+
+#
+# iterate through all the directories in shlib_dirs, record the sum
+#
+for d in `echo $shlib_dirs | sed -e 's/:/ /g'`
+do
+ find $d -type f -print 2>/dev/null | grep -E -v \'$ignore_dirs\' | $sum_cmd >> $sum_tmp
+done
+
+
+#
+# output the initial part of the spec file
+#
+cat $spec_header
+
+#
+# output the 'Provides: ' part of the spec file
+#
+{
+ #
+ # Output the shared libraries
+ #
+ for f in `cat $provides_tmp | sort -u`
+ do
+ echo "Provides: $f"
+ done
+
+ #
+ # Output the available shell interpreters
+ #
+ for d in `echo $interp_dirs | sed -e 's/:/ /g'`
+ do
+ for f in `echo $interps | sed -e 's/:/ /g'`
+ do
+ if test -f $d/$f ; then
+ echo "Provides: $d/$f"
+ fi
+ done
+ done
+} | sed -e 's/%/%%/g'
+
+#
+# Output the discription of the spec file
+#
+
+cat <<_EIEIO_
+
+
+%description
+This is a virtual RPM package. It contains no actual files. It uses the
+\`Provides' token from RPM 3.x and later to list many of the shared libraries
+and interpreters that are part of the base operating system and associated
+OS packages for $osname.
+
+This virtual package was constructed based on the vendor/system software
+installed on the '$osname' machine named '$hostname', as of the date
+'$date'.
+
+Input to the script:
+
+ spec_header=$spec_header
+ ignore_dirs=$ignore_dirs
+ find_provides=$find_provides
+ shlib_dirs=$shlib_dirs
+ interp_dirs=$interp_dirs
+ interps=$interps
+
+_EIEIO_
+
+#
+# Output the build sections of the spec file
+#
+
+echo '%prep'
+echo '# nothing to do'
+echo '%build'
+echo '# nothing to do'
+echo '%install'
+echo '# nothing to do'
+echo '%clean'
+echo '# nothing to do'
+
+if [ -z "${no_verify}" ]; then
+
+#
+# Output the optional verify section of the spec file
+#
+
+cat <<_EIEIO_
+
+%verifyscript
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/bsd
+export PATH
+
+sum_current_tmp=\${TMPDIR:-/tmp}/rpm.sum.current.\$\$
+if test -f \$sum_current_tmp ; then
+ echo "\$sum_current_tmp already exists. Exiting."
+ exit 11
+fi
+
+sum_package_tmp=\${TMPDIR:-/tmp}/rpm.sum.package.\$\$
+if test -f \$sum_package_tmp ; then
+ echo "\$sum_package_tmp already exists. Exiting."
+ exit 11
+fi
+
+for d in `echo $shlib_dirs | sed -e 's/:/ /g'`
+do
+ find \$d -type f -print 2>/dev/null | grep -E -v \'$ignore_dirs\' | $sum_cmd >> \$sum_current_tmp
+done
+
+cat >\$sum_package_tmp <<_EOF_
+_EIEIO_
+
+# the contents of the temporary file are hardcoded into the verify
+# script so that the file can be reproduced at verification time.
+
+cat $sum_tmp | sed -e 's/%/%%/g'
+
+cat <<_EIEIO_
+_EOF_
+
+
+cmp \$sum_package_tmp \$sum_current_tmp
+
+if [ \$? -ne 0 ]; then
+ echo"Differences found by: cmp \$sum_package_tmp \$sum_current_tmp"
+ exit \$?
+fi
+
+_EIEIO_
+
+# end optional verify section
+fi
+
+#
+# Output the files section of the spec file
+#
+
+echo '%files'
+echo '# no files in a virtual package'
+
+exit 0