Hello community,

here is the log from the commit of package smartmontools for openSUSE:Factory 
checked in at 2013-12-08 19:49:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/smartmontools (Old)
 and      /work/SRC/openSUSE:Factory/.smartmontools.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "smartmontools"

Changes:
--------
--- /work/SRC/openSUSE:Factory/smartmontools/smartmontools.changes      
2013-08-01 06:56:56.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.smartmontools.new/smartmontools.changes 
2013-12-08 19:49:44.000000000 +0100
@@ -1,0 +2,11 @@
+Thu Dec  5 18:52:44 UTC 2013 - [email protected]
+
+- Add supplementary drivedb.h update script
+  (smartmontools-drivedb_h-update.sh, bnc#851276).
+- Skip drivedb.h verification by rpm -V (bnc#851276).
+- Implement intelligent drivedb.h update not overwriting newer
+  drivedb.h releases.
+- Update smartmontools-drivedb.h to the latest version from the
+  upstream branch trunk.
+
+-------------------------------------------------------------------

New:
----
  smartmontools-drivedb.h
  smartmontools-drivedb_h-update.sh

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ smartmontools.spec ++++++
--- /var/tmp/diff_new_pack.NYesyX/_old  2013-12-08 19:49:45.000000000 +0100
+++ /var/tmp/diff_new_pack.NYesyX/_new  2013-12-08 19:49:45.000000000 +0100
@@ -17,6 +17,18 @@
 
 
 Name:           smartmontools
+# Important: When doing a version update that changes DRIVEDB_BRANCH
+# in smartmontools-drivedb_h-update.sh, you have to check,
+# that the packaged drivedb.h has a higher svn release number than any
+# version that exist in older svn branches. If not, you have
+# to implement special case in the %%post section.
+# Numbers in quotes are release numbers on 2013-12-04.
+# 
http://sourceforge.net/p/smartmontools/code/HEAD/tree/branches/RELEASE_5_39_DRIVEDB/smartmontools/drivedb.h#l61
 (3412)
+# 
http://sourceforge.net/p/smartmontools/code/HEAD/tree/branches/RELEASE_5_40_DRIVEDB/smartmontools/drivedb.h#l78
 (3850)
+# 
http://sourceforge.net/p/smartmontools/code/HEAD/tree/branches/RELEASE_5_41_DRIVEDB/smartmontools/drivedb.h#l78
 (3850)
+# 
http://sourceforge.net/p/smartmontools/code/HEAD/tree/branches/RELEASE_5_43_DRIVEDB/smartmontools/drivedb.h#l78
 (3850)
+# 
http://sourceforge.net/p/smartmontools/code/HEAD/tree/branches/RELEASE_6_0_DRIVEDB/smartmontools/drivedb.h#l78
 (3850)
+# 
http://sourceforge.net/p/smartmontools/code/HEAD/tree/trunk/smartmontools/drivedb.h#l78
 (3856)
 Version:        6.2
 Release:        0
 Source:         
http://sourceforge.net/projects/smartmontools/files/smartmontools/%{version}/%{name}-%{version}.tar.gz
@@ -24,7 +36,12 @@
 Source2:        smartmontools.sysconfig
 Source3:        %{name}-rpmlintrc
 Source4:        %{name}.keyring
+# SOURCE-FEATURE-OPENSUSE smartmontools.generate_smartd_opts.in 
[email protected] -- sysconfig support for systemd.
 Source5:        %{name}.generate_smartd_opts.in
+# SOURCE-FEATURE-SLE smartmontools-drivedb_h-update.sh bnc851276 
[email protected] -- Supplementary script to update drivedb.h.
+Source6:        smartmontools-drivedb_h-update.sh
+# SOURCE-FEATURE-UPSTREAM smartmontools-drivedb.h bnc851276 [email protected] -- 
Update of drivedb.h.
+Source7:        smartmontools-drivedb.h
 # PATCH-FEATURE-UNITEDLINUX smartmontools-default-enabled.patch 
[email protected] -- Enable smartd by default.
 Patch1:         smartmontools-default-enabled.patch
 # PATCH-FEATURE-OPENSUSE smartmontools-removable.patch [email protected] -- Skip 
removable devices. (bnc#308557) Report raw temperature.
@@ -79,6 +96,7 @@
 %endif
 %setup -q
 cp -a %{SOURCE2} %{SOURCE5} .
+cp -a %{SOURCE7} drivedb.h
 %patch1
 %patch4
 %patch8 -p1
@@ -127,12 +145,30 @@
 cp smartd.service %{buildroot}/%{_unitdir}
 # INSTALL file is intended only for packagers.
 rm %{buildroot}%{_defaultdocdir}/%{name}/INSTALL
+# Check syntax of drivedb.h that may come from a later snapshot (code from 
update-smart-drivedb)
+if ./smartctl -B drivedb.h -P showall >/dev/null; then :; else
+  echo "drivedb.h.error: rejected by smartctl, probably no longer compatible" 
>&2
+  exit 1
+fi
+# Intelligent drivedb.h update, part 0.
+# Check that drivedb.h has well formed svn RELEASE. We will need it for the 
intelligent update.
+DRIVEDB_H_RELEASE_CHECK="$(sed -n 's/^.*$Id: drivedb.h \([0-9][0-9]*\) 
.*$/\1/p' <%{buildroot}%{_datadir}/smartmontools/drivedb.h)"
+# Fail if the file has broken release number.
+test "$DRIVEDB_H_RELEASE_CHECK" -ge 0
 
 %clean
 rm -rf %{buildroot}
 
 %pre 
 %service_add_pre smartd.service
+# Intelligent drivedb.h update, part 1.
+# Save installed drivedb.h. Maybe the sysadmin called update-smart-drivedb,
+# and the installed drivedb.h may be even newer than the new packaged one.
+if test -f %{_datadir}/smartmontools/drivedb.h ; then
+    # Be on safe side, remove any potential drivedb.h.rpmsave.
+    rm -f %{_datadir}/smartmontools/drivedb.h.rpmsave
+    ln %{_datadir}/smartmontools/drivedb.h 
%{_datadir}/smartmontools/drivedb.h.rpmsave
+fi
 
 %post
 # First prepare sysconfig.
@@ -144,6 +180,24 @@
 %endif
 # No start by default here.. belongs to -presets packages
 %service_add_post smartd.service
+# Intelligent drivedb.h update, part 2.
+# Now we have the old system drivedb.h and the new packaged drivedb.h.
+if test -f %{_datadir}/smartmontools/drivedb.h.rpmsave ; then
+    # Compare their release numbers.
+    DRIVEDB_H_RELEASE_RPM="$(sed -n 's/^.*$Id: drivedb.h \([0-9][0-9]*\) 
.*$/\1/p' <%{_datadir}/smartmontools/drivedb.h)"
+    DRIVEDB_H_RELEASE_SAVED="$(sed -n 's/^.*$Id: drivedb.h \([0-9][0-9]*\) 
.*$/\1/p' <%{_datadir}/smartmontools/drivedb.h.rpmsave)"
+    # File has broken release number. Skip the update.
+    # Note: The SAVED release number may be broken. The test syntax must cover 
it.
+    if test "$DRIVEDB_H_RELEASE_RPM" -lt "$DRIVEDB_H_RELEASE_SAVED" ; then
+       mv %{_datadir}/smartmontools/drivedb.h.rpmsave 
%{_datadir}/smartmontools/drivedb.h
+    else
+       # Saved file is older or equal, or saved file has broken release number.
+       rm %{_datadir}/smartmontools/drivedb.h.rpmsave
+       # We returned to the vanilla packages, remove files created by 
update-smart-drivedb.
+       rm -f %{_datadir}/smartmontools/drivedb.h.old 
%{_datadir}/smartmontools/drivedb.h.lastcheck
+
+    fi
+fi
 
 %preun
 %service_del_preun smartd.service
@@ -154,7 +208,8 @@
 %files
 %defattr(-, root, root)
 %doc %{_docdir}/%{name}
-%{_datadir}/smartmontools
+%dir %{_datadir}/smartmontools
+%verify(not md5 size mtime) %{_datadir}/smartmontools/drivedb.h
 %doc %{_mandir}/man*/*
 %dir %{_localstatedir}/lib/smartmontools
 %if 0%{?suse_version} > 1140


++++++ smartmontools-drivedb.h ++++++
++++ 3655 lines (skipped)

++++++ smartmontools-drivedb_h-update.sh ++++++
#!/bin/bash

set -o errexit

VERSION=`sed -n 's/^Version:[[:space:]]*//p' <smartmontools.spec`

rm -rf smartmontools-drivedb_h-update.tmp
mkdir smartmontools-drivedb_h-update.tmp
cd smartmontools-drivedb_h-update.tmp

# Cut and paste from configure.in:
# ---------------
# Create drivedb.h update branch name from version: 5.41[.X] -> 
RELEASE_5_41_DRIVEDB
DRIVEDB_BRANCH=`echo $VERSION | sed 's,^\([0-9]*\.[0-9]*\)\..*$,\1,' \
                | sed -n 
's,^\([0-9][0-9]*\)\.\([0-9][0-9]*\)$,RELEASE_\1_\2_DRIVEDB,p'`
# ---------------
if test -z "$DRIVEDB_BRANCH"; then
        echo "Unable to create DRIVEDB_BRANCH from VERSION=$VERSION."
fi

echo "Updating drivedb.h for branch $DRIVEDB_BRANCH."

tar -zxf ../smartmontools-$VERSION.tar.gz 
smartmontools-$VERSION/update-smart-drivedb.in

sed "
        /^PACKAGE=/i rm update-smart-drivedb-wd
        s:@PACKAGE@:smartmontools:g
        s:@VERSION@:version:g
        s:@DRIVEDB_BRANCH@:$DRIVEDB_BRANCH:g
        s:^DEST=.*$:DEST=smartmontools-drivedb.h:
        s:@drivedbdir@:.:g
        s:@os_dltools@:curl wget lynx:g
        s:exit 0:rm -f \"\$DEST.lastcheck\" ; exit 0:
        # Verification of the downloaded drivedb.h has to be done by the 
packaged smartctl. Skip it on the host system, and run it as part of %build 
stage.
        /# Check syntax/,/Keep old file if identical/d
        " <smartmontools-$VERSION/update-smart-drivedb.in 
>../update-smart-drivedb-wd
cd ..
rm -r smartmontools-drivedb_h-update.tmp
source ./update-smart-drivedb-wd
rm -f "$DEST.lastcheck"
rm -f "$DEST.old"

BRANCHNAME=${location#branches/}
osc vc -m "Update smartmontools-drivedb.h to the latest version from the
  upstream branch $BRANCHNAME."
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to