add packaging files
authorAnas Nashif <anas.nashif@intel.com>
Thu, 11 Oct 2012 22:56:20 +0000 (15:56 -0700)
committerAnas Nashif <anas.nashif@intel.com>
Sun, 3 Feb 2013 00:44:16 +0000 (16:44 -0800)
lib/rpmte.c
packaging/db-4.8.30-integration.dif [moved from packaging/db-4.8.30-integration.patch with 100% similarity]
packaging/device-sec-policy [new file with mode: 0644]
packaging/find-docs.sh [new file with mode: 0644]
packaging/rpm-tizen_macros [new file with mode: 0644]
packaging/rpm.spec
packaging/rpmconfigcheck [new file with mode: 0644]
packaging/rpmsort [new file with mode: 0644]
packaging/symset-table [new file with mode: 0644]

index 6afd69e..af8ce48 100644 (file)
@@ -730,6 +730,8 @@ static int rpmteClose(rpmte te, int reset_fi)
     case TR_ADDED:
        if (te->fd) {
            rpmtsNotify(te->ts, te, RPMCALLBACK_INST_CLOSE_FILE, 0, 0);
+           if (te->fd) /* not yet closed */
+               Fclose(te->fd);
            te->fd = NULL;
        }
        break;
diff --git a/packaging/device-sec-policy b/packaging/device-sec-policy
new file mode 100644 (file)
index 0000000..f11dbf1
--- /dev/null
@@ -0,0 +1,45 @@
+<config>
+  <sw_source name="root" rankkey="/10020/10000.root">
+    <origin>
+      <keyinfo>
+mQENBE6MJTABCAC6pAFNW9tCbLQtgmwxzNf7ftSL5RrsjVTlPtpyeFLhxSmqmeHr
+KB10C6Co1zYB/fW8zvGXU613g3WEo4SKlS2lnOVBxviet0qn58zwCQASbdFYtckk
+thtkxiSInoKbj4n/Z+hHB9dvcyqcWqp2IFQEDDpxgP4KuzCvvj6W+e9EtYsdGt9P
+ZHsVjIAe0w+j7Hs4Q7FYWD+mdQAjgBsLlc16Ci8EPYnvBL/xdbJ3Ryfi59tTdfGG
+HnwpjM2J1WshooyvsOtHZU+T1nHtuegEzdRMVFo502Lkb60dJRsREE2iyPWFX2TE
+ZdaQqUMmkPaROUlWhGBSWIKbOVARwWBn94KDABEBAAG0CXJvb3QudGVzdIkBPgQT
+AQIAKAUCTowlMAIbAwUJA8JnAAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQ
+TTk+Qq2l7P210wgApKVLpdve9jDsy/y//gSAGvfA4fXFuGhHkH5+QW7L+QkUAo0Z
+vv0KB0Pw5qZjV+k8jlq3Q3f/vcIEKxc40d0coa3m+bUlL2vy0+0gLSTiZ4MNFAk5
+LvJgEj+7ks75/qtJVWfCZeXo9NiugSoW9D+jNflmfstd8k2wT2ucH7IJHHzK1lGm
+vZHXeJeSULRHiibVyK5cG+NH/1Akuxkgo2jOzqhLjhp4/UiJlyAD0k/J4ULfmWp8
+C9/sIhWBoS5OcrtMVQtUMTx85I2dEC/01hnfLUk8mi5VscLu3xQoJ9hNrMEgji6H
+S+MmxcPGnVziEA0Z7VNN6DpuG/xZ1i9fgXXVfLkBDQROjCUwAQgA6fyD7eqaoah/
+za0X+Xv3o1y52UHmeHMmyzM/W4UlVsd01h7KzSHWyQKHi0i0pxRtUj+pkV+r+QjV
+BiAowq2HVpyXsmre29PEgAuIVv6/pZjfZEWFKjSDsvdXpS+mT+J6LjRxYh7ZbGvv
+SR3hMiMocWYENj13XDRw5USGhC0UxlmmMfjQfWJ6eHeQTiyZWW+CZUAJ2IbEkPVP
+nBDH/fTuVMfOo4g0HwqUSJmwV47BPLec1ArSaPG1YgKX1Y+UYoNfUvo/ieiF59At
+A8UbjQMzZggIfkvJsDL8U5n4ojFL8Rs/aMYuH76OlA4wuKPAnBSt+fVBnjaAAadf
+FCy/CHZt/wARAQABiQElBBgBAgAPBQJOjCUwAhsMBQkDwmcAAAoJEE05PkKtpez9
+S7IH/j44MxOP6dAycQAreWVAzdMiw82DjP7c6jMxYZj8ss1x++iO5GW82qm0WJ6h
+IOEdll+wBhPX0acKvE4KrlNzfsB2WzDRwOyiZfuSQI0J3Jrytj8zyCVKwHTsI8VC
+RkOzaMYsEqmPc+ve+wxxcwWXC0EtoyhMRjRZlMy55IeJcEfM8bcE4wcsyotsura6
+o1fmU223Xj1k5xXxDvXalPUoXnhvsev7kMBnIQRac194qkSkTzVXGLGu5Ng7Bfxl
+BMhf6RSk31+Q43ASbn4ralnswMhsHSatJIeasbHyvsTJzMnfEoSdpb8/dQI8KnHf
+tRrR5cbqmVr8tkFjS/QK6TWfNMM=
+</keyinfo>
+    </origin>
+    <package name="unknown-sw-source"/>
+    <package name="ac-domain-system">
+      <provide>
+        <ac_domain name="_" policy="shared"/>
+      </provide>
+    </package>
+    <package name="root"/>
+    <sw_source name="_default_" rankkey="/10020/11000/10000._default_">
+      <allow>
+        <ac_domain match="*"/>
+      </allow>
+    </sw_source>
+  </sw_source>
+</config>
diff --git a/packaging/find-docs.sh b/packaging/find-docs.sh
new file mode 100644 (file)
index 0000000..afe4e22
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+usage () {
+cat << EOF
+Usage: $0 TOP_DIR
+
+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
+
+DOC_NAME=documentation.list
+touch $DOC_NAME
+
+find $TOP_DIR -type f -o -type l | sed '
+s:'"$TOP_DIR"'::
+s:\(.*/man/man./.*\.[0-9]\):%doc \1:
+s:\(.*/man/*/man./.*\.[0-9]\):%doc \1:
+s:\(.*/gtk-doc/html/.*\):%doc \1:
+s:\(.*/info/.*\info.*\):%doc \1:
+s:^\([^%].*\)::
+/^$/d' >> $DOC_NAME
+
+
+exit 0
diff --git a/packaging/rpm-tizen_macros b/packaging/rpm-tizen_macros
new file mode 100644 (file)
index 0000000..e5891fc
--- /dev/null
@@ -0,0 +1,319 @@
+# directories
+%_infodir               %{_prefix}/share/info
+%_mandir                %{_prefix}/share/man
+%_sysconfdir            /etc
+%_localstatedir         /var
+%_defaultdocdir         %{_usr}/share/doc/packages
+
+# package build macros
+%make_install           make install DESTDIR=%{?buildroot}
+%makeinstall            make DESTDIR=%{?buildroot:%{buildroot}} install
+%rb_arch                %(echo %{_host_cpu}-linux | sed -e "s/i686/i586/" -e "s/armv5tel/armv4l/" -e "s/hppa2.0/hppa/")
+%rb_ver                 %(/usr/bin/ruby -e 'puts VERSION.sub(/\\\.\\\d$/, "")')
+
+# this script calls all scripts in /usr/lib/rpm/brp-tizen.d
+%__os_install_post  \
+       /usr/lib/rpm/brp-compress \
+       /usr/lib/rpm/brp-tizen  \
+       %{!?disable_docs_package:/usr/lib/rpm/tizen/find-docs.sh %{buildroot}} \
+%{nil}
+
+# macro: %restart_on_update()
+#      Used to restart a service in postun section, if we are
+#      not running from YaST2 in instsys on update.
+%restart_on_update() \
+       test -n "$FIRST_ARG" || FIRST_ARG=$1 \
+       if test "$FIRST_ARG" -ge 1 ; then \
+          test -f /etc/sysconfig/services && . /etc/sysconfig/services \
+           if test "$YAST_IS_RUNNING" != "instsys" -a "$DISABLE_RESTART_ON_UPDATE" != yes ; then \
+              for service in %{?*} ; do \
+                 /etc/init.d/$service try-restart > /dev/null || : \
+              done \
+           fi \
+        fi \
+       %nil
+
+# macro: %stop_on_removal()
+#       Used to stop a service in preun section, if we are
+#       not running from YaST2 in instsys on removal of this package.
+%stop_on_removal() \
+        test -n "$FIRST_ARG" || FIRST_ARG=$1 \
+        if test "$FIRST_ARG" = "0" ; then \
+          test -f /etc/sysconfig/services && . /etc/sysconfig/services \
+           if test "$YAST_IS_RUNNING" != "instsys" -a "$DISABLE_STOP_ON_REMOVAL" != yes ; then \
+              for service in %{?*} ; do \
+                 /etc/init.d/$service stop > /dev/null \
+              done \
+           fi \
+        fi \
+        %nil
+# macro: %configure_kernel_source
+#
+#
+%configure_kernel_source() \
+       if test -d /usr/src/linux ; then \
+           pushd /usr/src/linux \
+           test -f .config || cp arch/%_arch/defconfig.default .config \
+           yes "" | make oldconfig \
+           make dep \
+           popd \
+       fi \
+       %nil
+
+%is_plus %(if test -f /.buildenv ; then source /.buildenv ; if [[ "$BUILD_BASENAME" == *+kde ]] ; then echo 1 ; else echo 0 ; fi ; else echo 0 ; fi)
+
+               
+%install_info(:-:) \
+    ALL_ARGS=(%{**}) \
+    NUM_ARGS=${#ALL_ARGS[@]} \
+    if test -x /sbin/install-info ; then \
+       if test -e "${ALL_ARGS[$((NUM_ARGS-1))]}" ; then \
+           /sbin/install-info "${ALL_ARGS[@]}" \
+       fi \
+    fi ; 
+
+%install_info_delete(:-:) \
+    ALL_ARGS=(%{**}) \
+    NUM_ARGS=${#ALL_ARGS[@]} \
+    if test -x /sbin/install-info ; then \
+       if ! test -e "${ALL_ARGS[$((NUM_ARGS-1))]}" ; then \
+           /sbin/install-info --quiet --delete "${ALL_ARGS[@]}" \
+       fi ; \
+    fi ; 
+
+# find-supplements.ksyms parses this macro directly out of the spec file:
+%supplements_kernel_module() \
+    %{expand:%(if ! rpm -q kernel-syms > /dev/null; then echo "%fail Please add the kernel-syms package to BuildRequires"; fi)}
+
+%tizen_version 100
+
+%do_profiling 1
+%cflags_profile_generate -fprofile-generate
+%cflags_profile_feedback -fprofile-use
+
+
+# Template for lang sub-package.
+%lang_package(n:) \
+%package %{-n:-n %{-n*}-}lang \
+Summary: Languages for package %{name} \
+Group: System/Localization \
+Requires: %{-n:%{-n*}}%{!-n:%{name}} = %{version} \
+Provides: %{-n:%{-n*}}%{!-n:%{name}}-lang-all = %{version} \
+Supplements: packageand(bundle-lang-other:%{-n:%{-n*}}%{!-n:%{name}}) \
+BuildArch: noarch \
+%description %{-n:-n %{-n*}-}lang \
+Provides translations to the package %{name}
+
+
+
+# Tizen
+#
+%configure \
+  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
+  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
+  FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
+  ./configure --build=%{_build} --host=%{_host} \\\
+        --target=%{_target_platform} \\\
+        --program-prefix=%{?_program_prefix} \\\
+        --prefix=%{_prefix} \\\
+        --exec-prefix=%{_exec_prefix} \\\
+        --bindir=%{_bindir} \\\
+        --sbindir=%{_sbindir} \\\
+        --sysconfdir=%{_sysconfdir} \\\
+        --datadir=%{_datadir} \\\
+        --includedir=%{_includedir} \\\
+        --libdir=%{_libdir} \\\
+        --libexecdir=%{_libexecdir} \\\
+        --localstatedir=%{_localstatedir} \\\
+        --sharedstatedir=%{_sharedstatedir} \\\
+        --mandir=%{_mandir} \\\
+        --infodir=%{_infodir}
+
+
+%reconfigure \
+  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
+  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
+  FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
+  autoreconf -v --install --force || exit 1 \
+  ./configure --build=%{_build} --host=%{_host} \\\
+        --target=%{_target_platform} \\\
+        --program-prefix=%{?_program_prefix} \\\
+        --prefix=%{_prefix} \\\
+        --exec-prefix=%{_exec_prefix} \\\
+        --bindir=%{_bindir} \\\
+        --sbindir=%{_sbindir} \\\
+        --sysconfdir=%{_sysconfdir} \\\
+        --datadir=%{_datadir} \\\
+        --includedir=%{_includedir} \\\
+        --libdir=%{_libdir} \\\
+        --libexecdir=%{_libexecdir} \\\
+        --localstatedir=%{_localstatedir} \\\
+        --sharedstatedir=%{_sharedstatedir} \\\
+        --mandir=%{_mandir} \\\
+        --infodir=%{_infodir}
+
+%autogen \
+  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
+  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
+  FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
+  ./autogen.sh --build=%{_build} --host=%{_host} \\\
+        --target=%{_target_platform} \\\
+        --program-prefix=%{?_program_prefix} \\\
+        --prefix=%{_prefix} \\\
+        --exec-prefix=%{_exec_prefix} \\\
+        --bindir=%{_bindir} \\\
+        --sbindir=%{_sbindir} \\\
+        --sysconfdir=%{_sysconfdir} \\\
+        --datadir=%{_datadir} \\\
+        --includedir=%{_includedir} \\\
+        --libdir=%{_libdir} \\\
+        --libexecdir=%{_libexecdir} \\\
+        --localstatedir=%{_localstatedir} \\\
+        --sharedstatedir=%{_sharedstatedir} \\\
+        --mandir=%{_mandir} \\\
+        --infodir=%{_infodir}
+
+
+%makeinstall \
+  %{__make} \\\
+        prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
+        exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
+        bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
+        sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
+        sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
+        datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
+        includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
+        libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
+        libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
+        localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
+        sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
+        mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
+        infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
+  install
+
+
+%make_install \
+  %{__make} \\\
+        DESTDIR=%{?buildroot:%{buildroot}} \\\
+        INSTALL_ROOT=%{?buildroot:%{buildroot}} \\\
+  install \
+  rm -f %{?buildroot:%{buildroot}}%{_infodir}/dir \
+  find %{?buildroot:%{buildroot}} -regex ".*\\.la$" | xargs rm -f -- \
+  %{!?keepstatic:find %{?buildroot:%{buildroot}} -regex ".*\\.a$" | xargs rm -f --}
+
+%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
+        && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
+        [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-j$RPM_BUILD_NCPUS")
+
+
+%lang_package \
+%package locale \
+Summary: Translations and Locale for package %{name}\
+Group: Translations\
+AutoReqProv: 0\
+%description locale\
+This package provides translations for package %{name}.\
+%files locale -f %{name}.lang\
+%defattr(-,root,root,-)\
+%{nil}
+
+
+%docs_package \
+%package docs \
+Summary: Documentation for package %{name}\
+Group: Documentation\
+AutoReqProv: 0\
+%description docs\
+This package provides documentation for package %{name}.\
+%files docs -f documentation.list\
+%defattr(-,root,root,-)\
+%{nil}
+
+
+
+# Bad hack to set $LANG to C during all RPM builds
+%prep \
+%%prep\
+LANG=C\
+export LANG\
+unset DISPLAY\
+%{nil}
+
+%build %%build\
+LANG=C\
+export LANG\
+unset DISPLAY\
+CFLAGS="%optflags" ; export CFLAGS ; \
+CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
+FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
+LD_AS_NEEDED=1; export LD_AS_NEEDED ; \
+%{nil}
+
+%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
+%%install\
+LANG=C\
+export LANG\
+unset DISPLAY\
+rm -rf %{?buildroot:%{buildroot}} \
+mkdir -p %{?buildroot:%{buildroot}} \
+%{nil}
+
+
+%clean %%clean\
+rm -rf %{?buildroot:%{buildroot}} \
+%{nil}
+
+%find_lang      /usr/lib/rpm/find-lang.sh %{buildroot}
+%find_docs      /usr/lib/rpm/tizen/find-docs.sh %{buildroot}
+
+
+
+#==============================================================================
+# ---- default .desktop directories per the desktop-entry freedesktop.org spec
+
+%_desktopdir    %{_datadir}/applications
+
+#==============================================================================
+# ---- Generic auto req/prov filtering macros
+#
+# http://fedoraproject.org/wiki/PackagingDrafts/AutoProvidesAndRequiresFiltering
+
+# prevent anything matching from being scanned for provides
+%filter_provides_in(P) %{expand: \
+%global __filter_prov_cmd %{?__filter_prov_cmd} %{__grep} -v %{-P} '%*' | \
+}
+
+# prevent anything matching from being scanned for requires
+%filter_requires_in(P) %{expand: \
+%global __filter_req_cmd %{?__filter_req_cmd} %{__grep} -v %{-P} '%*' | \
+}
+
+# filter anything matching out of the provides stream
+%filter_from_provides() %{expand: \
+%global __filter_from_prov %{?__filter_from_prov} | %{__sed} -e '%*' \
+}
+
+# filter anything matching out of the requires stream
+%filter_from_requires() %{expand: \
+%global __filter_from_req %{?__filter_from_req} | %{__sed} -e '%*' \
+}
+
+# actually set up the filtering bits
+%filter_setup %{expand: \
+%global _use_internal_dependency_generator 0 \
+%global __deploop() while read FILE; do /usr/lib/rpm/rpmdeps -%{1} ${FILE}; done | /bin/sort -u \
+%global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}" \
+%global __find_requires /bin/sh -c "%{?__filter_req_cmd}  %{__deploop R} %{?__filter_from_req}" \
+}
+
+%remove_docs \
+  rm -rf %{?buildroot:%{buildroot}}%{_infodir} \
+  rm -rf %{?buildroot:%{buildroot}}%{_defaultdocdir} \
+  rm -rf %{?buildroot:%{buildroot}}%{_datadir}/doc/%{name} \
+  rm -rf %{?buildroot:%{buildroot}}%{_datadir}/doc/%{name}-%{version} \
+  rm -rf %{?buildroot:%{buildroot}}%{_datadir}/gtk-doc \
+  rm -rf %{?buildroot:%{buildroot}}%{_datadir}/doc \
+  rm -rf %{?buildroot:%{buildroot}}%{_datadir}/man \
+  find %{?buildroot:%{buildroot}} -regex ".*/man/man./.*\.[0-9]" | xargs rm -f -- \
+  find %{?buildroot:%{buildroot}} -regex ".*/man/../man./.*\.[0-9]" | xargs rm -f -- \
+  find %{?buildroot:%{buildroot}} -regex ".*/man/man./.*\.[0-9]pm" | xargs rm -f --
index f25385b..31c30bf 100644 (file)
@@ -34,15 +34,15 @@ License:        GPL-2.0+
 Group:          System/Packages
 Version:        4.10.1
 Release:        0
-Source0:         rpm-%{version}.tar.bz2
-Source1:       db-4.8.30.tar.bz2
+Source0:        rpm-%{version}.tar.bz2
+Source1:               db-4.8.30.tar.bz2
+Source2:       db-4.8.30-integration.dif
 Source4:        rpm-tizen_macros
 Source5:        rpmsort
 Source6:        symset-table
 Source8:        rpmconfigcheck
 Source13:      find-docs.sh
 Source22:      device-sec-policy
-Patch0:         db-4.8.30-integration.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 #
 # avoid bootstrapping problem
@@ -115,7 +115,7 @@ ln -s db-4.8.30 db
 chmod -R u+w db/*
 # will get linked from db3
 rm -f rpmdb/db.h
-%patch0 -p1
+patch -p0 < %{S:2}
 
 if [ -s /etc/rpm/tizen_macros ]; then
        cp -a /etc/rpm/tizen_macros %{SOURCE4}
diff --git a/packaging/rpmconfigcheck b/packaging/rpmconfigcheck
new file mode 100644 (file)
index 0000000..97bba74
--- /dev/null
@@ -0,0 +1,80 @@
+#! /bin/bash
+# Copyright (c) 2002 SuSE GmbH Nuernberg, Germany.
+#
+# Author: Michael Schroeder <feedback@suse.de>
+#
+# /etc/init.d/rpmconfigcheck
+# /usr/sbin/rcrpmconfigcheck
+#
+# Script to scan for unresolved .rpmnew, .rpmorig, and .rpmsave files
+#
+### BEGIN INIT INFO
+# Provides: rpmconfigcheck
+# Required-Start: $remote_fs
+# Required-Stop: $null
+# Default-Start: 2 3 5
+# Default-Stop:
+# Description: rpm config file scan
+### END INIT INFO
+
+. /etc/rc.status
+
+# First reset status of this service
+rc_reset
+
+configcheckfile=/var/adm/rpmconfigcheck
+packages=/var/lib/rpm/Packages
+
+test -z "$1" && set start
+
+case "$1" in
+    start|restart|try-restart|reload|force-reload)
+       if test -s $packages -a \( ! -e $configcheckfile -o -s $configcheckfile -o ! $packages -ot $configcheckfile \) ; then
+           echo -n "Searching for unresolved configuration files"
+           if test ! -e $configcheckfile -o ! $packages -ot $configcheckfile ; then
+               test -e $configcheckfile && mv -f $configcheckfile $configcheckfile.old
+               rpm -qalc | sort | perl -lne '-e "$_.rpmnew" and print "$_.rpmnew"; -e "$_.rpmorig" and print "$_.rpmorig"; -e "$_.rpmsave" and print "$_.rpmsave"' > $configcheckfile
+           else
+               mv -f $configcheckfile $configcheckfile.old
+               while read l; do
+                   test -e $l && echo $l
+               done < $configcheckfile.old > $configcheckfile
+               true
+           fi
+           rc_status -v
+           if test -s $configcheckfile; then
+               echo "Please check the following files (see /var/adm/rpmconfigcheck):"
+               sed -e 's/^/    /' < $configcheckfile
+               touch $configcheckfile.old
+               cat $configcheckfile $configcheckfile.old | sort | uniq -d > $configcheckfile.dup
+               cat $configcheckfile $configcheckfile.dup | sort | uniq -u > $configcheckfile.new
+               if test -s $configcheckfile.new ; then
+                   (
+                   echo "----------------------------------------------------------------------"
+                   echo "----------------------------------------------------------------------"
+                   echo "rpmconfigcheck"
+                   date
+                   echo "----------------------------------------"
+                   echo "This is a warning message."
+                   echo "rpmconfigcheck has found the following new unresolved config files"
+                   echo "(all files are listed in /var/adm/rpmconfigcheck):"
+                   cat $configcheckfile.new
+                   echo "----------------------------------------"
+                   ) >> /var/log/update-messages
+               fi
+           fi
+           rm -f $configcheckfile.old $configcheckfile.dup $configcheckfile.new
+       fi
+       ;;
+    stop)
+       ;;
+    status)
+       rc_failed 4
+       rc_status -v
+       ;;
+     *)
+       echo "Usage: $0 {start}"
+       exit 1
+       ;;
+esac
+rc_exit
diff --git a/packaging/rpmsort b/packaging/rpmsort
new file mode 100644 (file)
index 0000000..75629fc
--- /dev/null
@@ -0,0 +1,102 @@
+#! /usr/bin/perl -w
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+# USA.
+
+use Getopt::Long qw(:config gnu_getopt);
+
+sub do_rpm_cmp_versions {
+    my ($evr1, $evr2) = @_;
+
+    sub _rpm_cmp {
+       my ($s1, $s2) = @_;
+
+       return defined $s1 <=> defined $s2
+           unless defined $s1 && defined $s2;
+
+       my ($r, $x1, $x2);
+       do {
+           $s1 =~ s/^[^a-zA-Z0-9]+//;
+           $s2 =~ s/^[^a-zA-Z0-9]+//;
+           if ($s1 =~ /^\d/ || $s2 =~ /^\d/) {
+               $s1 =~ s/^(0*(\d*))//;  $x1 = $2;
+               return -1 if $1 eq '';
+               $s2 =~ s/^(0*(\d*))//;  $x2 = $2;
+               return 1 if $1 eq '';
+               $r = length $x1 <=> length $x2 || $x1 cmp $x2;
+           } else {
+               $s1 =~ s/^([a-zA-Z]*)//;  $x1 = $1;
+               $s2 =~ s/^([a-zA-Z]*)//;  $x2 = $1;
+               return 0
+                   if $x1 eq '' && $x2 eq '';
+               $r = $x1 cmp $x2;
+           }
+       } until $r;
+       return $r;
+    }
+
+    my ($e1, $v1, $r1) = $evr1 =~ /^(?:(\d*):)?(.*?)(?:-([^-]*))?$/;
+    my ($e2, $v2, $r2) = $evr2 =~ /^(?:(\d*):)?(.*?)(?:-([^-]*))?$/;
+    my $r = _rpm_cmp($e1 || 0, $e2 || 0);
+    $r = _rpm_cmp($v1, $v2)
+       unless $r;
+    $r = _rpm_cmp($r1, $r2)
+       unless $r;
+    return $r;
+}
+
+my $reorder = sub { return @_ };
+my $key = 0;
+my $test = 0;
+
+sub rpm_cmp_versions {
+       my ($evr1, $evr2) = @_;
+
+       chomp($evr1, $evr2);
+       my $res1 = do_rpm_cmp_versions($evr1, $evr2);
+       if ($test) {
+               open(my $fd, '-|', 'zypper', '--terse', 'versioncmp',
+                       $evr1, $evr2) or die "zypper: $!\n";
+               my $res2 = <$fd>;
+               close($fd) or die "zypper: $!\n";
+               chomp $res2;
+               if ($res1 != $res2) {
+                       my @operators = qw(< == >);
+                       my $op1 = $operators[$res1 + 1];
+                       my $op2 = $operators[$res2 + 1];
+
+                       print STDERR "BUG: $evr1 $op1 $evr2 vs. zypper: $evr1 $op2 $evr2\n";
+               }
+       }
+       return $res1;
+}
+
+GetOptions ("r|reverse"            => sub { $reorder = sub { return reverse @_ } },
+           "k|key=i"       => \$key,
+           "test"        => \$test)
+or do {
+    print STDERR "Usage $0 [-r, --reverse] [-k N, --key=N] [--test]\n";
+    exit 1;
+};
+
+if ($key == 0) {
+    # Sort by entire lines
+    map { print } &$reorder(sort { rpm_cmp_versions($a, $b) } <>);
+} else {
+    # Sort by field $key
+    my @data = map { [(split)[$key-1], $_] } <>;
+    map { print } &$reorder(map { $_->[1] }
+        sort { rpm_cmp_versions($a->[0], $b->[0]) } @data);
+}
diff --git a/packaging/symset-table b/packaging/symset-table
new file mode 100644 (file)
index 0000000..c94a61c
--- /dev/null
@@ -0,0 +1,35 @@
+#! /bin/sh
+
+# Create a table of all symbol sets defined in all /boot/symsets*.tar.gz
+# files.
+#
+# Format:
+#   kernelrelease/modver/symbol <tab> symset <tab> symset_hash
+#
+# This table is needed for computing the appropriate Requires: tags for
+# kernel module packages.
+
+tmpdir=$(mktemp -t -d ${0##*/}.XXXXXX)
+trap "cd / ; rm -rf $tmpdir" EXIT
+cd $tmpdir
+
+shopt -s nullglob
+for symsets in /boot/symsets-*.tar.gz; do
+    zcat $symsets \
+    | tar xf -
+done
+
+for symsets in *; do
+    krel=${symsets#symsets-}
+    for symset in $symsets/*; do
+       class=${symset##*/} ; class=${class%.*}
+       hash=${symset##*.}
+       awk '
+       BEGIN { FS = "\t" ; OFS = "\t" }
+       { sub(/0x0*/, "", $1)
+         print krel "/" $1 "/" $2, class, hash }
+       ' krel="$krel" class="$class" hash="$hash" $symset
+    done
+done
+
+# vim:shiftwidth=4 softtabstop=4