diff -Nurb firmware-tools-2.1.1/aclocal.m4 firmware-tools-2.1.5/aclocal.m4 --- firmware-tools-2.1.1/aclocal.m4 2008-03-17 11:45:21.000000000 +0530 +++ firmware-tools-2.1.5/aclocal.m4 2008-12-15 23:05:22.000000000 +0530 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10 -*- Autoconf -*- +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file 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. @@ -11,12 +11,15 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_if(m4_PACKAGE_VERSION, [2.61],, -[m4_fatal([this file was generated for autoconf 2.61. -You have another version of autoconf. If you want to use that, -you should regenerate the build system entirely.], [63])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.61],, +[m4_warning([this file was generated for autoconf 2.61. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) -# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -31,7 +34,7 @@ [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10], [], +m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -47,8 +50,10 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10])dnl -_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -141,13 +146,13 @@ # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2008 Free Software Foundation, Inc. # # This file 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. -# serial 12 +# serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -252,16 +257,17 @@ # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. +_am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in - $1 | $1:* ) + $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # @@ -691,7 +697,7 @@ # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- -# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) diff -Nurb firmware-tools-2.1.1/ChangeLog firmware-tools-2.1.5/ChangeLog --- firmware-tools-2.1.1/ChangeLog 2008-03-17 11:45:27.000000000 +0530 +++ firmware-tools-2.1.5/ChangeLog 2008-12-15 23:05:27.000000000 +0530 @@ -1,3 +1,135 @@ +commit d99d5a07af459a8a2fe04b87ea93e9ba3500192c +Author: Michael E Brown +Date: Fri Dec 12 16:47:13 2008 -0600 + + update build infrastructure to match libsmbios release. + +commit d76f9e2a23282e785ade2b10ee9bd2122656b5b6 +Author: Michael E Brown +Date: Thu Sep 11 17:18:30 2008 -0500 + + add direct build support for osb upload + +commit 78d924238e84ae1a851ac20de451f8592423261b +Author: Michael E Brown +Date: Thu Sep 11 17:18:03 2008 -0500 + + fixup suse build timestamp problem and suse rpmlint problem. + +commit 91aec81b65dc4d5707a3a2c10391ab0623cbe7aa +Author: Michael E Brown +Date: Thu Sep 11 16:30:34 2008 -0500 + + fix rpmlint complaints about non-executable scripts. These files dont need #!/usr/bin/python, since they are not executed + +commit be8a3c3a83a72eebf15caaa3678958181164b469 +Author: Michael E Brown +Date: Thu Sep 11 13:47:51 2008 -0500 + + no longer use mock infrastructure to push rpms. + +commit 014e791c92c8ce2828eb59e04c82f1d9c652ef23 +Author: Michael E Brown +Date: Thu Sep 11 13:29:07 2008 -0500 + + version bump + +commit fa612b12a0a25697cf1eb8fb55a2f2481f7f4eab +Author: Michael E Brown +Date: Thu Sep 11 13:28:59 2008 -0500 + + SUSE does not have noarch python pkgs, dont build noarch on suse. + +commit 76c91f383653eaf25dcf141ec4affe4d9f58d776 +Author: Michael E Brown +Date: Wed Aug 27 09:34:03 2008 -0500 + + non-interactive force remove of old files. + +commit b3690fb76ff7d54e67b05fee57be721cae5c3472 +Author: Michael E Brown +Date: Wed Aug 27 09:29:13 2008 -0500 + + update meta data from updated spec file as part of upload. + +commit 3341c1c37cc2fa7ce5492f91108075ac82759d7c +Author: Michael E Brown +Date: Tue Aug 26 18:03:19 2008 -0500 + + bugfix updates for Makefile-std + +commit 96ef7523dd75c234f0537943654b2f8f044c47d4 +Author: Michael E Brown +Date: Tue Aug 19 17:33:47 2008 -0500 + + add script to upload to opensuse build service + +commit 17c47ebe3fb2a5c1837d0f7284dc4086ee0b1112 +Author: Michael E Brown +Date: Tue Aug 19 17:33:33 2008 -0500 + + add SPECFILE variable to shorted a couple of statements + +commit 55d9db0eda9afbba53cc8cfbf03af2f95d4bfabd +Author: Michael E Brown +Date: Mon Aug 18 17:35:31 2008 -0500 + + allow rpm build from git-generated archive. + +commit 92c7ab7b8b6c2a628fcb47d749a53667c00c89c1 +Author: Michael E Brown +Date: Mon Aug 18 16:58:03 2008 -0500 + + more Makefile-std standardizations. + +commit bee206f50c0b8c22448b0420ff03c3b8e8a207ee +Author: Michael E Brown +Date: Mon Aug 18 16:54:37 2008 -0500 + + start trying to standardize Makefile-std + +commit 9329893d78d130f6cc47f8de2ea2d3b654f118f3 +Author: Michael E Brown +Date: Wed Aug 13 16:45:39 2008 -0500 + + fixup mock configs for recent cleanups. + +commit 6ddba88ea3622f941a9e38032a267ac8b2f16b1a +Author: Michael E Brown +Date: Wed Aug 13 13:57:37 2008 -0500 + + fixup opensuse config names. + +commit 20c3331389e3997be58a0fb616378d979d8b0297 +Author: Michael E Brown +Date: Wed Aug 13 13:44:17 2008 -0500 + + fix license tags + +commit 013a78c573d684e053da50990872cc0387c3d29c +Merge: 941cfc9... acb3d2f... +Author: Michael E Brown +Date: Wed Aug 13 13:17:10 2008 -0500 + + Merge branch 'master' of ssh://michael_e_brown@mock.linuxdev.us.dell.com/var/ftp/pub/Applications/git/firmware-tools + + * 'master' of ssh://michael_e_brown@mock.linuxdev.us.dell.com/var/ftp/pub/Applications/git/firmware-tools: + re-enable opensuse builds. + version bump + version bump + +commit 941cfc93fe0e2f45dbce85b7af6c2cf5d4b382ab +Author: Michael E Brown +Date: Wed Aug 13 13:13:26 2008 -0500 + + update to build for f9 + +commit 4cdb2c179492c8099fcac5f949339860ae0fffcd +Author: Michael E Brown +Date: Tue Mar 18 17:42:44 2008 -0500 + + split button label text + commit acb3d2f150af24fdf228af7f6b6e606a8079814e Author: Michael E Brown Date: Mon Mar 17 01:14:47 2008 -0500 diff -Nurb firmware-tools-2.1.1/configure firmware-tools-2.1.5/configure --- firmware-tools-2.1.1/configure 2008-03-17 11:45:24.000000000 +0530 +++ firmware-tools-2.1.5/configure 2008-12-15 23:05:24.000000000 +0530 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for firmware-tools 2.1.1. +# Generated by GNU Autoconf 2.61 for firmware-tools unconfigured-version. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -572,8 +572,8 @@ # Identity of this package. PACKAGE_NAME='firmware-tools' PACKAGE_TARNAME='firmware-tools' -PACKAGE_VERSION='2.1.1' -PACKAGE_STRING='firmware-tools 2.1.1' +PACKAGE_VERSION='unconfigured-version' +PACKAGE_STRING='firmware-tools unconfigured-version' PACKAGE_BUGREPORT='' ac_subst_vars='SHELL @@ -647,7 +647,11 @@ pkgpythondir pyexecdir pkgpyexecdir -RELEASE_NAME RELEASE_MAJOR RELEASE_MINOR RELEASE_SUBLEVEL RELEASE_EXTRALEVEL RELEASE_RPM_EXTRALEVEL +RELEASE_MAJOR +RELEASE_MINOR +RELEASE_MICRO +RELEASE_EXTRA +RELEASE_RPM_EXTRA LIBOBJS LTLIBOBJS' ac_subst_files='' @@ -1156,7 +1160,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures firmware-tools 2.1.1 to adapt to many kinds of systems. +\`configure' configures firmware-tools unconfigured-version to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1222,7 +1226,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of firmware-tools 2.1.1:";; + short | recursive ) echo "Configuration of firmware-tools unconfigured-version:";; esac cat <<\_ACEOF @@ -1292,7 +1296,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -firmware-tools configure 2.1.1 +firmware-tools configure unconfigured-version generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1306,7 +1310,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by firmware-tools $as_me 2.1.1, which was +It was created by firmware-tools $as_me unconfigured-version, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1660,11 +1664,10 @@ -temp_RELEASE_NAME=firmware-tools -temp_RELEASE_MAJOR=2 -temp_RELEASE_MINOR=1 -temp_RELEASE_SUBLEVEL=1 -temp_RELEASE_EXTRALEVEL= +test -n "$RELEASE_MAJOR" || RELEASE_MAJOR=2 +test -n "$RELEASE_MINOR" || RELEASE_MINOR=1 +test -n "$RELEASE_MICRO" || RELEASE_MICRO=5 +test -n "$RELEASE_EXTRA" || RELEASE_EXTRA= #################################### @@ -2005,7 +2008,7 @@ # Define the identity of the package. PACKAGE='firmware-tools' - VERSION='2.1.1' + VERSION='unconfigured-version' # Some tools Automake needs. @@ -2470,45 +2473,19 @@ # Checks for library functions. -# update 'real' variables from the temp variable names. -# do this at the end of the file so that they A) are not overwitten by other -# autoconf stuff, and B) so that user can override on cmdline -for i in RELEASE_NAME RELEASE_MAJOR RELEASE_MINOR RELEASE_SUBLEVEL RELEASE_EXTRALEVEL -do - varname=temp_$i - if test -z "${!i}"; then - eval $i=${!varname}; export $i - fi -done - -if test -z "$RELEASE_RPM_EXTRALEVEL"; then - if test -z "$RELEASE_EXTRALEVEL"; then - RELEASE_RPM_EXTRALEVEL=%{nil} +if test -z "$RELEASE_RPM_EXTRA"; then + if test -z "$RELEASE_EXTRA"; then + RELEASE_RPM_EXTRA=%{nil} else - RELEASE_RPM_EXTRALEVEL=$RELEASE_EXTRALEVEL + RELEASE_RPM_EXTRA=$RELEASE_EXTRA fi fi -PACKAGE=$RELEASE_NAME -PACKAGE_VERSION=`echo ${RELEASE_MAJOR}.${RELEASE_MINOR}.${RELEASE_SUBLEVEL}${RELEASE_EXTRALEVEL}` -PACKAGE_STRING=`echo ${RELEASE_NAME} ${RELEASE_MAJOR}.${RELEASE_MINOR}.${RELEASE_SUBLEVEL}${RELEASE_EXTRALEVEL}` -VERSION=$PACKAGE_VERSION -cat confdefs.h | - grep -v 'define PACKAGE_VERSION ' | - grep -v 'define PACKAGE_STRING ' > confdefs.new -mv confdefs.new confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF -# this is used by the autobuilder hook to determine the version we built -echo "PACKAGE_NAME='$PACKAGE_NAME'" > version -echo "PACKAGE_VERSION='$PACKAGE_VERSION'" >> version -echo "PACKAGE_STRING='$PACKAGE_STRING'" >> version + # firmware-tools oddity: package name cannot contain '-', so we have to fix it pkgpythondir=\${pythondir}/firmwaretools @@ -2950,7 +2927,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by firmware-tools $as_me 2.1.1, which was +This file was extended by firmware-tools $as_me unconfigured-version, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -2993,7 +2970,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -firmware-tools config.status 2.1.1 +firmware-tools config.status unconfigured-version configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -3226,17 +3203,16 @@ pkgpythondir!$pkgpythondir$ac_delim pyexecdir!$pyexecdir$ac_delim pkgpyexecdir!$pkgpyexecdir$ac_delim -RELEASE_NAME!$RELEASE_NAME$ac_delim RELEASE_MAJOR!$RELEASE_MAJOR$ac_delim RELEASE_MINOR!$RELEASE_MINOR$ac_delim -RELEASE_SUBLEVEL!$RELEASE_SUBLEVEL$ac_delim -RELEASE_EXTRALEVEL!$RELEASE_EXTRALEVEL$ac_delim -RELEASE_RPM_EXTRALEVEL!$RELEASE_RPM_EXTRALEVEL$ac_delim +RELEASE_MICRO!$RELEASE_MICRO$ac_delim +RELEASE_EXTRA!$RELEASE_EXTRA$ac_delim +RELEASE_RPM_EXTRA!$RELEASE_RPM_EXTRA$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 79; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 78; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff -Nurb firmware-tools-2.1.1/configure.ac firmware-tools-2.1.5/configure.ac --- firmware-tools-2.1.1/configure.ac 2008-03-17 11:44:36.000000000 +0530 +++ firmware-tools-2.1.5/configure.ac 2008-12-15 23:05:16.000000000 +0530 @@ -4,13 +4,12 @@ #################################### # change version here. -AC_INIT([firmware-tools],[2.1.1]) +AC_INIT([firmware-tools],[unconfigured-version]) -temp_RELEASE_NAME=firmware-tools -temp_RELEASE_MAJOR=2 -temp_RELEASE_MINOR=1 -temp_RELEASE_SUBLEVEL=1 -temp_RELEASE_EXTRALEVEL= +test -n "$RELEASE_MAJOR" || RELEASE_MAJOR=2 +test -n "$RELEASE_MINOR" || RELEASE_MINOR=1 +test -n "$RELEASE_MICRO" || RELEASE_MICRO=5 +test -n "$RELEASE_EXTRA" || RELEASE_EXTRA= #################################### AC_PREREQ(2.61) @@ -30,45 +29,19 @@ # Checks for library functions. -# update 'real' variables from the temp variable names. -# do this at the end of the file so that they A) are not overwitten by other -# autoconf stuff, and B) so that user can override on cmdline -for i in RELEASE_NAME RELEASE_MAJOR RELEASE_MINOR RELEASE_SUBLEVEL RELEASE_EXTRALEVEL -do - varname=temp_$i - if test -z "${!i}"; then - eval $i=${!varname}; export $i - fi -done - -if test -z "$RELEASE_RPM_EXTRALEVEL"; then - if test -z "$RELEASE_EXTRALEVEL"; then - RELEASE_RPM_EXTRALEVEL=%{nil} +if test -z "$RELEASE_RPM_EXTRA"; then + if test -z "$RELEASE_EXTRA"; then + RELEASE_RPM_EXTRA=%{nil} else - RELEASE_RPM_EXTRALEVEL=$RELEASE_EXTRALEVEL + RELEASE_RPM_EXTRA=$RELEASE_EXTRA fi fi -PACKAGE=$RELEASE_NAME -PACKAGE_VERSION=[`echo ${RELEASE_MAJOR}.${RELEASE_MINOR}.${RELEASE_SUBLEVEL}${RELEASE_EXTRALEVEL}`] -PACKAGE_STRING=[`echo ${RELEASE_NAME} ${RELEASE_MAJOR}.${RELEASE_MINOR}.${RELEASE_SUBLEVEL}${RELEASE_EXTRALEVEL}`] -VERSION=$PACKAGE_VERSION - -cat confdefs.h | - grep -v 'define PACKAGE_VERSION ' | - grep -v 'define PACKAGE_STRING ' > confdefs.new -mv confdefs.new confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -AC_SUBST([RELEASE_NAME RELEASE_MAJOR RELEASE_MINOR RELEASE_SUBLEVEL RELEASE_EXTRALEVEL RELEASE_RPM_EXTRALEVEL]) - -# this is used by the autobuilder hook to determine the version we built -echo "PACKAGE_NAME='$PACKAGE_NAME'" > version -echo "PACKAGE_VERSION='$PACKAGE_VERSION'" >> version -echo "PACKAGE_STRING='$PACKAGE_STRING'" >> version +AC_SUBST([RELEASE_MAJOR]) +AC_SUBST([RELEASE_MINOR]) +AC_SUBST([RELEASE_MICRO]) +AC_SUBST([RELEASE_EXTRA]) +AC_SUBST([RELEASE_RPM_EXTRA]) # firmware-tools oddity: package name cannot contain '-', so we have to fix it pkgpythondir=\${pythondir}/firmwaretools diff -Nurb firmware-tools-2.1.1/debian/changelog firmware-tools-2.1.5/debian/changelog --- firmware-tools-2.1.1/debian/changelog 2009-01-27 16:14:09.000000000 +0530 +++ firmware-tools-2.1.5/debian/changelog 2009-01-27 19:26:38.000000000 +0530 @@ -1,3 +1,10 @@ +firmware-tools (2.1.5-0ubuntu1) jaunty; urgency=low + + * New Upstream release. LP: #321866 + * Bumped standards-version to 3.8.0 with no changes. + + -- Bhavani Shankar Tue, 27 Jan 2009 19:24:56 +0530 + firmware-tools (2.1.1-0ubuntu1) hardy; urgency=low * New upstream version: diff -Nurb firmware-tools-2.1.1/debian/control firmware-tools-2.1.5/debian/control --- firmware-tools-2.1.1/debian/control 2009-01-27 16:14:09.000000000 +0530 +++ firmware-tools-2.1.5/debian/control 2009-01-27 16:18:08.000000000 +0530 @@ -5,7 +5,7 @@ XSBC-Original-Maintainer: Michael Brown Build-Depends: debhelper (>= 5), cdbs (>= 0.4.49) Build-Depends-Indep: python-support (>= 0.5.3) -Standards-Version: 3.7.3 +Standards-Version: 3.8.0 Homepage: http://linux.dell.com Package: firmware-tools diff -Nurb firmware-tools-2.1.1/firmwaretools/generated/__init__.py firmware-tools-2.1.5/firmwaretools/generated/__init__.py --- firmware-tools-2.1.1/firmwaretools/generated/__init__.py 1970-01-01 05:30:00.000000000 +0530 +++ firmware-tools-2.1.5/firmwaretools/generated/__init__.py 2008-12-15 23:05:26.000000000 +0530 @@ -0,0 +1,293 @@ +# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:tw=0 + +# 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 Library 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. + + +""" +Firmware-tools: update infrastructure for firmware +""" + +import ConfigParser +import fcntl +import glob +import logging +import logging.config +import os +import sys + +from trace_decorator import decorate, traceLog, getLog +import errors +import repository + +#import config +import plugins + +def mkselfrelpath(*args): + return os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), *args)) + +# these are replaced by autotools when installed. +__VERSION__="2.1.5" +SYSCONFDIR="/usr/local/etc" +PYTHONDIR="/usr/local/lib/python2.5/site-packages" +PKGPYTHONDIR="/usr/local/lib/python2.5/site-packages/firmwaretools" +PKGDATADIR="/usr/local/share/firmware-tools" +DATADIR="/usr/local/share" +PKGCONFDIR="/usr/local/etc/firmware/" +# end build system subs + +PID_FILE = '/var/run/ft.pid' + +class confObj(object): + def __getattribute__(self, name): + return object.__getattribute__(self, name.lower()) + def __setattr__(self, name, value): + object.__setattr__(self, name.lower(), value) + +decorate(traceLog()) +def callCB(cb, *args, **kargs): + if cb is None: return + try: + return cb(*args, **kargs) + except TypeError: + pass + +class Callback(object): + def __init__(self): + pass + + def __call__(self, *args, **kargs): + func = getattr(self, kargs.get("what", "UNKNOWN"), None) + if func is not None: + return func(*args, **kargs) + +class FtBase(object): + """This is a primary structure and base class. It houses the objects and + methods needed to perform most things . It is almost an abstract + class in that you will need to add your own class above it for most + real use.""" + + def __init__(self): + self.logger = getLog() + self.verbose_logger = getLog(prefix="verbose.") + + self.cmdargs = [] + self.cb = None + + self._conf = None + self._repo = None + self._systemInventory = None + self._vendorId = None + self._systemId = None + + self.verbosity = 0 + self.trace = 0 + self.loggingConfig = os.path.join(PKGCONFDIR, "firmware.conf") + + # Start with plugins disabled + self.disablePlugins() + + def _getConfig(self, cfgFiles=None, pluginTypes=(plugins.TYPE_CORE, plugins.TYPE_INVENTORY,), optparser=None, disabledPlugins=None): + if self._conf is not None: + return self._conf + + if cfgFiles is None: + cfgFiles = [os.path.join(PKGCONFDIR, "firmware.conf"),] + + if disabledPlugins is None: + disabledPlugins = [] + + self.conf = confObj() + + self.setupLogging(self.loggingConfig, self.verbosity, self.trace) + + self.setConfFromIni(cfgFiles) + + self.conf.uid = os.geteuid() + + self.doPluginSetup(optparser, pluginTypes, disabledPlugins) + + return self._conf + + + def setupLogging(self, configFile, verbosity=1, trace=0): + # set up logging + logging.config.fileConfig(configFile) + root_log = logging.getLogger() + ft_log = logging.getLogger("firmwaretools") + ft_verbose_log = logging.getLogger("verbose") + ft_trace_log = logging.getLogger("trace") + + ft_log.propagate = 0 + ft_trace_log.propagate = 0 + ft_verbose_log.propagate = 0 + + if verbosity >= 1: + ft_log.propagate = 1 + if verbosity >= 2: + ft_verbose_log.propagate = 1 + if verbosity >= 3: + for hdlr in root_log.handlers: + hdlr.setLevel(logging.DEBUG) + if trace: + ft_trace_log.propagate = 1 + + decorate(traceLog()) + def setConfFromIni(self, cfgFiles): + defaults = { + "sysconfdir": SYSCONFDIR, + "pythondir": PYTHONDIR, + "datadir": DATADIR, + "pkgpythondir": PKGPYTHONDIR, + "pkgdatadir": PKGDATADIR, + "pkgconfdir": PKGCONFDIR, + } + self._ini = ConfigParser.SafeConfigParser(defaults) + for i in cfgFiles: + self._ini.read(i) + + mapping = { + # conf.WHAT : (iniSection, iniOption, default) + "storageTopdir": ('main', 'storage_topdir', "%s/firmware" % DATADIR), + "pluginSearchPath": ('main', 'plugin_search_path', os.path.join(PKGDATADIR, "plugins")), + "pluginConfDir": ('main', 'plugin_config_dir', os.path.join(PKGCONFDIR, "firmware.d")), + "rpmMode": ('main', 'rpm_mode', "manual"), + } + for key, val in mapping.items(): + if self._ini.has_option( val[0], val[1] ): + setattr(self.conf, key, self._ini.get(val[0], val[1])) + else: + setattr(self.conf, key, val[2]) + + # read plugin configs + for i in glob.glob( "%s/*.conf" % self.conf.pluginConfDir ): + self._ini.read(i) + + decorate(traceLog()) + def listPluginsFromIni(self): + return [x[len("plugin:"):] for x in self._ini.sections() if x.startswith("plugin:")] + + decorate(traceLog()) + def getPluginConfFromIni(self, plugin): + section = "plugin:%s" % plugin + conf = confObj() + + conf.module = None + conf.enabled = False + conf.search = None + + for i in self._ini.options(section): + setattr(conf, i, self._ini.get(section, i)) + + #required ("enabled", "module"): + if getattr(conf, "module", None) is None: + conf.enabled = False + + return conf + + # called early so no tracing. + def disablePlugins(self): + '''Disable plugins + ''' + self.plugins = plugins.DummyPlugins() + + decorate(traceLog()) + def doPluginSetup(self, optparser=None, pluginTypes=None, disabledPlugins=None): + if isinstance(self.plugins, plugins.Plugins): + raise RuntimeError("plugins already initialised") + + self.plugins = plugins.Plugins(self, optparser, pluginTypes, disabledPlugins) + + decorate(traceLog()) + def _getRepo(self): + if self._repo is not None: + return self._repo + + self._repo = repository.Repository( self.conf.storageTopdir ) + return self._repo + + decorate(traceLog()) + def _getInventory(self): + if self._systemInventory is not None: + return self._systemInventory + + self._systemInventory = repository.SystemInventory() + self.plugins.run("preinventory", inventory=self._systemInventory) + self.plugins.run("inventory", inventory=self._systemInventory) + self.plugins.run("postinventory", inventory=self._systemInventory) + return self._systemInventory + + decorate(traceLog()) + def calculateUpgradeList(self, cb=None): + saveCb = self.cb + self.cb = cb + try: + for candidate in self.repo.iterPackages(cb=cb): + self.systemInventory.addAvailablePackage(candidate) + + self.systemInventory.calculateUpgradeList(cb) + finally: + self.cb = saveCb + + return self.systemInventory + + # properties so they auto-create themselves with defaults + repo = property(fget=lambda self: self._getRepo(), + fset=lambda self, value: setattr(self, "_repo", value)) + conf = property(fget=lambda self: self._getConfig(), + fset=lambda self, value: setattr(self, "_conf", value), + fdel=lambda self: setattr(self, "_conf", None)) + systemInventory = property( + fget=lambda self: self._getInventory(), + fset=lambda self, value: setattr(self, "_systemInventory", value), + fdel=lambda self: setattr(self, "_systemInventory", None)) + + decorate(traceLog()) + def lock(self): + if self.conf.uid == 0: + self.runLock = open(PID_FILE, "a+") + try: + fcntl.lockf(self.runLock.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB) + except IOError, e: + raise errors.LockError, "unable to obtain exclusive lock." + + decorate(traceLog()) + def unlock(self): + if self.conf.uid == 0: + fcntl.lockf(self.runLock.fileno(), fcntl.LOCK_UN) + os.unlink(PID_FILE) + + decorate(traceLog()) + def setSystemId(self, vendorId, systemId): + if not (vendorId and systemId): + raise RuntimeError("Need non-null, non-zero, id for vendor and system id.") + self._vendorId = vendorId + self._systemId = systemId + + decorate(traceLog()) + def getSystemId(self): + return (self._vendorId, self._systemId) + + decorate(traceLog()) + def yieldInventory(self, cb=None): + saveCb = self.cb + try: + self.cb = cb + for dev in self.systemInventory.iterDevices(): + yield dev + except: + self.cb = saveCb + raise + + diff -Nurb firmware-tools-2.1.1/firmwaretools/i18n.py firmware-tools-2.1.5/firmwaretools/i18n.py --- firmware-tools-2.1.1/firmwaretools/i18n.py 2008-02-19 03:59:44.000000000 +0530 +++ firmware-tools-2.1.5/firmwaretools/i18n.py 2008-12-15 23:02:06.000000000 +0530 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:tw=0 """i18n abstraction License: GPL diff -Nurb firmware-tools-2.1.1/firmwaretools/__init__.py firmware-tools-2.1.5/firmwaretools/__init__.py --- firmware-tools-2.1.1/firmwaretools/__init__.py 2008-03-12 21:16:10.000000000 +0530 +++ firmware-tools-2.1.5/firmwaretools/__init__.py 2008-12-15 23:02:06.000000000 +0530 @@ -1,4 +1,5 @@ -#!/usr/bin/python -tt +# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:tw=0 + # 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 diff -Nurb firmware-tools-2.1.1/ft-cli/cli.py firmware-tools-2.1.5/ft-cli/cli.py --- firmware-tools-2.1.1/ft-cli/cli.py 2008-03-17 10:47:15.000000000 +0530 +++ firmware-tools-2.1.5/ft-cli/cli.py 2008-12-15 23:02:06.000000000 +0530 @@ -1,4 +1,5 @@ -#!/usr/bin/python -t +# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:tw=0 + # 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 diff -Nurb firmware-tools-2.1.1/ft-cli/ftcommands.py firmware-tools-2.1.5/ft-cli/ftcommands.py --- firmware-tools-2.1.1/ft-cli/ftcommands.py 2008-02-19 03:59:44.000000000 +0530 +++ firmware-tools-2.1.5/ft-cli/ftcommands.py 2008-12-15 23:02:06.000000000 +0530 @@ -1,4 +1,5 @@ -#!/usr/bin/python -t +# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:tw=0 + # 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 diff -Nurb firmware-tools-2.1.1/ft-cli/ftmain.py firmware-tools-2.1.5/ft-cli/ftmain.py --- firmware-tools-2.1.1/ft-cli/ftmain.py 2008-03-12 21:16:10.000000000 +0530 +++ firmware-tools-2.1.5/ft-cli/ftmain.py 2008-12-15 23:02:06.000000000 +0530 @@ -1,4 +1,5 @@ -#!/usr/bin/python -t +# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:tw=0 + # 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 diff -Nurb firmware-tools-2.1.1/ft-cli/plugins/bootstrap_cmd.py firmware-tools-2.1.5/ft-cli/plugins/bootstrap_cmd.py --- firmware-tools-2.1.1/ft-cli/plugins/bootstrap_cmd.py 2008-03-12 21:16:10.000000000 +0530 +++ firmware-tools-2.1.5/ft-cli/plugins/bootstrap_cmd.py 2008-12-15 23:02:06.000000000 +0530 @@ -1,4 +1,5 @@ -#!/usr/bin/python -t +# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:tw=0 + # 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 diff -Nurb firmware-tools-2.1.1/ft-cli/plugins/inventory_cmd.py firmware-tools-2.1.5/ft-cli/plugins/inventory_cmd.py --- firmware-tools-2.1.1/ft-cli/plugins/inventory_cmd.py 2008-03-17 10:47:15.000000000 +0530 +++ firmware-tools-2.1.5/ft-cli/plugins/inventory_cmd.py 2008-12-15 23:02:06.000000000 +0530 @@ -1,4 +1,5 @@ -#!/usr/bin/python -t +# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:tw=0 + # 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 diff -Nurb firmware-tools-2.1.1/ft-cli/plugins/listplugins_cmd.py firmware-tools-2.1.5/ft-cli/plugins/listplugins_cmd.py --- firmware-tools-2.1.1/ft-cli/plugins/listplugins_cmd.py 2008-02-19 03:59:45.000000000 +0530 +++ firmware-tools-2.1.5/ft-cli/plugins/listplugins_cmd.py 2008-12-15 23:02:06.000000000 +0530 @@ -1,4 +1,5 @@ -#!/usr/bin/python -t +# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:tw=0 + # 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 diff -Nurb firmware-tools-2.1.1/ft-cli/plugins/update_cmd.py firmware-tools-2.1.5/ft-cli/plugins/update_cmd.py --- firmware-tools-2.1.1/ft-cli/plugins/update_cmd.py 2008-03-17 10:47:15.000000000 +0530 +++ firmware-tools-2.1.5/ft-cli/plugins/update_cmd.py 2008-12-15 23:02:06.000000000 +0530 @@ -1,4 +1,5 @@ -#!/usr/bin/python -t +# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:tw=0 + # 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 diff -Nurb firmware-tools-2.1.1/glade/inventory_firmware_gui.glade firmware-tools-2.1.5/glade/inventory_firmware_gui.glade --- firmware-tools-2.1.1/glade/inventory_firmware_gui.glade 2008-03-17 10:47:15.000000000 +0530 +++ firmware-tools-2.1.5/glade/inventory_firmware_gui.glade 2008-08-14 21:26:24.000000000 +0530 @@ -362,7 +362,8 @@ True - Show Unknown + Show +Unknown True gtk-find True diff -Nurb firmware-tools-2.1.1/Makefile.am firmware-tools-2.1.5/Makefile.am --- firmware-tools-2.1.1/Makefile.am 2008-03-12 21:16:10.000000000 +0530 +++ firmware-tools-2.1.5/Makefile.am 2008-12-15 23:05:16.000000000 +0530 @@ -17,7 +17,6 @@ nodist_pkgdata_DATA = glade/inventory_firmware_gui.glade pkgpython_PYTHON = \ - firmwaretools/__init__.py \ firmwaretools/bootstrap_pci.py \ firmwaretools/dep_parser.py \ firmwaretools/errors.py \ @@ -32,7 +31,8 @@ firmwaretools/repository.py \ firmwaretools/trace_decorator.py \ firmwaretools/peak_util_decorators.py \ - firmwaretools/compat_subprocess.py + firmwaretools/compat_subprocess.py \ + firmwaretools/generated/__init__.py clidir = $(datadir)/$(PACKAGE) cli_PYTHON = \ @@ -48,7 +48,25 @@ ft-cli/plugins/listplugins_cmd.py \ ft-cli/plugins/update_cmd.py -REPLACE_VARS_ON_INSTALL= \ +__VERSION__=$(VERSION) +PYTHONDIR=$(pythondir) +PKGDATADIR=$(pkgdatadir) +PKGGLADEDIR=$(pkgdatadir) +SYSCONFDIR=$(sysconfdir) +PKGPYTHONDIR=$(pkgpythondir) +DATADIR=$(datadir) +PKGCONFDIR=$(pkgconfdir) +REPLACE_VARS+= __VERSION__ PYTHONDIR PKGDATADIR PKGGLADEDIR SYSCONFDIR PKGPYTHONDIR DATADIR PKGCONFDIR +DATA_HOOK_REPLACE += \ $(sbindir)/firmwaretool \ - $(sbindir)/inventory_firmware_gui \ - $(pkgpythondir)/__init__.py + $(sbindir)/inventory_firmware_gui + +EXTRA_DIST += firmwaretools/__init__.py +DISTCLEANFILES += firmwaretools/generated/__init__.py +firmwaretools/generated/__init__.py: firmwaretools/__init__.py configure Makefile config.status + mkdir -p $$(dirname $@) ||: + cp $< $@ + for var in $(REPLACE_VARS) ;\ + do \ + perl -p -i -e "s|^$$var\s*=.*|$$var=\"$${!var}\"|" $@;\ + done diff -Nurb firmware-tools-2.1.1/Makefile.in firmware-tools-2.1.5/Makefile.in --- firmware-tools-2.1.1/Makefile.in 2008-03-17 11:45:23.000000000 +0530 +++ firmware-tools-2.1.5/Makefile.in 2008-12-15 23:05:23.000000000 +0530 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 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. @@ -60,13 +60,6 @@ SCRIPTS = $(dist_sbin_SCRIPTS) SOURCES = DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -80,11 +73,6 @@ nodist_pkgconfDATA_INSTALL = $(INSTALL_DATA) nodist_pkgdataDATA_INSTALL = $(INSTALL_DATA) DATA = $(nodist_pkgconf_DATA) $(nodist_pkgdata_DATA) -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -118,22 +106,30 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -PACKAGE = $(RELEASE_NAME) +PACKAGE = $(PACKAGE_NAME) PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ +# note that we add a "-" here. normal package_string has a space. +PACKAGE_STRING = $(PACKAGE)-$(VERSION) PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION = $(VERSION) PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ +RELEASE_EXTRA = @RELEASE_EXTRA@ +RELEASE_MAJOR = @RELEASE_MAJOR@ +RELEASE_MICRO = @RELEASE_MICRO@ +RELEASE_MINOR = @RELEASE_MINOR@ +RELEASE_RPM_EXTRA = @RELEASE_RPM_EXTRA@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -VERSION = $(RELEASE_VERSION) + +# override built-in defs which end up wrong +VERSION = $(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_MICRO)$(RELEASE_EXTRA) abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -176,42 +172,44 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = subdir-objects -SUBDIRS = - -# dont move these 5 lines, as this is how we override the autoconf version and package name -RELEASE_NAME = @RELEASE_NAME@ -RELEASE_MAJOR = @RELEASE_MAJOR@ -RELEASE_MINOR = @RELEASE_MINOR@ -RELEASE_SUBLEVEL = @RELEASE_SUBLEVEL@ -RELEASE_EXTRALEVEL = @RELEASE_EXTRALEVEL@ -RELEASE_VERSION = $(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)$(RELEASE_EXTRALEVEL) -RELEASE_STRING = $(RELEASE_NAME)-$(RELEASE_VERSION) -CLEANFILES = $(RELEASE_NAME)-*.tar.gz $(RELEASE_NAME)-*.tar.bz2 \ - $(RELEASE_NAME)-*.rpm _buildtemp version $(EXTRA_PROGRAMS) \ +CLEANFILES = $(PACKAGE_NAME)-*.tar.gz $(PACKAGE_NAME)-*.tar.bz2 \ + $(PACKAGE_NAME)-*.rpm _buildtemp version $(EXTRA_PROGRAMS) \ *.pyc */*.pyc */*/*.pyc */*/*/*.pyc pkg/$(PACKAGE).spec -DISTCLEANFILES = *~ +DISTCLEANFILES = *~ firmwaretools/generated/__init__.py EXTRA_DIST = etc doc glade test yum-plugin COPYING-GPL COPYING-OSL \ - COPYING.LIB + COPYING.LIB firmwaretools/__init__.py +REPLACE_VARS = GETTEXT_PACKAGE PACKAGE_VERSION PACKAGE localedir \ + libdir libexecdir datadir sysconfdir pythondir pkgpythondir \ + pkgdatadir pkgconfdir pkggladedir pkglibexecdir __VERSION__ \ + PYTHONDIR PKGDATADIR PKGGLADEDIR SYSCONFDIR PKGPYTHONDIR \ + DATADIR PKGCONFDIR +DATA_HOOK_REPLACE = $(sbindir)/firmwaretool \ + $(sbindir)/inventory_firmware_gui +EXEC_HOOK_REPLACE = + +# set default project. can be overridden on cmdline with 'make -e ...' +PROJECT = home:$(USER) TOPDIR := $(shell cd $(top_builddir);pwd) BUILDDIR = $(TOPDIR)/_rpmbuild RPMDIR = $(TOPDIR) SOURCEDIR = $(TOPDIR) +SPECFILE = $(TOPDIR)/pkg/$(PACKAGE_NAME).spec SPECDIR = $(TOPDIR)/pkg SRCRPMDIR = $(TOPDIR) -RPM_DEFINES = --define "_topdir $(TOPDIR)" \ +AM_RPM_DEFINES = --define "_topdir $(TOPDIR)" \ --define "_builddir $(BUILDDIR)" \ --define "_rpmdir $(RPMDIR)" \ --define "_sourcedir $(SOURCEDIR)" \ --define "_specdir $(SPECDIR)" \ - --define "_srcrpmdir $(SRCRPMDIR)" + --define "_srcrpmdir $(SRCRPMDIR)" \ + $(RPM_DEFINES) # This updates the debian version information, similar to how specfile for RPM # is updated. It has to be manually invoked becuase it wont work for rpm builds. CHANGELOG = pkg/debian/changelog CHANGELOG_TEXT = "Placeholder changelog entry. Please update this for release." -TARBALL = $(RELEASE_STRING).tar.gz +TARBALL = $(PACKAGE_STRING).tar.gz pkgconfdir = $(sysconfdir)/firmware/ nodist_pkgconf_DATA = etc/firmware/firmware.conf TESTS = test/testAll.py @@ -222,7 +220,6 @@ nodist_pkgdata_DATA = glade/inventory_firmware_gui.glade pkgpython_PYTHON = \ - firmwaretools/__init__.py \ firmwaretools/bootstrap_pci.py \ firmwaretools/dep_parser.py \ firmwaretools/errors.py \ @@ -237,7 +234,8 @@ firmwaretools/repository.py \ firmwaretools/trace_decorator.py \ firmwaretools/peak_util_decorators.py \ - firmwaretools/compat_subprocess.py + firmwaretools/compat_subprocess.py \ + firmwaretools/generated/__init__.py clidir = $(datadir)/$(PACKAGE) cli_PYTHON = \ @@ -253,12 +251,15 @@ ft-cli/plugins/listplugins_cmd.py \ ft-cli/plugins/update_cmd.py -REPLACE_VARS_ON_INSTALL = \ - $(sbindir)/firmwaretool \ - $(sbindir)/inventory_firmware_gui \ - $(pkgpythondir)/__init__.py - -all: all-recursive +__VERSION__ = $(VERSION) +PYTHONDIR = $(pythondir) +PKGDATADIR = $(pkgdatadir) +PKGGLADEDIR = $(pkgdatadir) +SYSCONFDIR = $(sysconfdir) +PKGPYTHONDIR = $(pkgpythondir) +DATADIR = $(datadir) +PKGCONFDIR = $(pkgconfdir) +all: all-am .SUFFIXES: am--refresh: @@ -433,137 +434,12 @@ echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \ done - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique tags: TAGS +TAGS: -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here +CTAGS: -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ @@ -666,23 +542,6 @@ || exit 1; \ fi; \ done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - distdir) \ - || exit 1; \ - fi; \ - done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ @@ -696,6 +555,10 @@ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) @@ -722,6 +585,8 @@ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ @@ -783,22 +648,21 @@ check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(nodist_check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-recursive +check: check-am all-am: Makefile $(SCRIPTS) $(DATA) -installdirs: installdirs-recursive -installdirs-am: +installdirs: for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(clidir)" "$(DESTDIR)$(pkgpythondir)" "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(pkgconfdir)" "$(DESTDIR)$(pkgdatadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive +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-recursive +installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ @@ -816,22 +680,22 @@ 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-recursive +clean: clean-am clean-am: clean-generic mostlyclean-am -distclean: distclean-recursive +distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags +distclean-am: clean-am distclean-generic -dvi: dvi-recursive +dvi: dvi-am dvi-am: -html: html-recursive +html: html-am -info: info-recursive +info: info-am info-am: @@ -841,39 +705,39 @@ @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook -install-dvi: install-dvi-recursive +install-dvi: install-dvi-am install-exec-am: install-dist_sbinSCRIPTS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook -install-html: install-html-recursive +install-html: install-html-am -install-info: install-info-recursive +install-info: install-info-am install-man: -install-pdf: install-pdf-recursive +install-pdf: install-pdf-am -install-ps: install-ps-recursive +install-ps: install-ps-am installcheck-am: -maintainer-clean: maintainer-clean-recursive +maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic -mostlyclean: mostlyclean-recursive +mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic -pdf: pdf-recursive +pdf: pdf-am pdf-am: -ps: ps-recursive +ps: ps-am ps-am: @@ -881,104 +745,117 @@ uninstall-nodist_pkgconfDATA uninstall-nodist_pkgdataDATA \ uninstall-pkgpythonPYTHON uninstall-pluginPYTHON -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ - install-data-am install-exec-am install-strip +.MAKE: install-am install-data-am install-exec-am install-strip -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-TESTS check-am clean \ - clean-generic ctags ctags-recursive dist dist-all dist-bzip2 \ - dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ - distclean-generic distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am html html-am info info-am \ - install install-am install-cliPYTHON install-data \ - install-data-am install-data-hook install-dist_sbinSCRIPTS \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-exec-hook install-html install-html-am install-info \ - install-info-am install-man install-nodist_pkgconfDATA \ +.PHONY: all all-am am--refresh check check-TESTS check-am clean \ + clean-generic dist dist-all dist-bzip2 dist-gzip dist-lzma \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distcleancheck distdir distuninstallcheck \ + dvi dvi-am html html-am info info-am install install-am \ + install-cliPYTHON install-data install-data-am \ + install-data-hook install-dist_sbinSCRIPTS install-dvi \ + install-dvi-am install-exec install-exec-am install-exec-hook \ + install-html install-html-am install-info install-info-am \ + install-man install-nodist_pkgconfDATA \ install-nodist_pkgdataDATA install-pdf install-pdf-am \ install-pkgpythonPYTHON install-pluginPYTHON install-ps \ install-ps-am install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-cliPYTHON uninstall-dist_sbinSCRIPTS \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ + uninstall-am uninstall-cliPYTHON uninstall-dist_sbinSCRIPTS \ uninstall-nodist_pkgconfDATA uninstall-nodist_pkgdataDATA \ uninstall-pkgpythonPYTHON uninstall-pluginPYTHON -dist: ChangeLog AUTHORS +.PHONY: git-tag +git-tag: + git tag -u libsmbios -m "tag for official release: libsmbios $(PACKAGE_STRING)" v$(PACKAGE_VERSION) + +.PHONY: get-version +get-version: + @echo PACKAGE_STRING=$(PACKAGE_STRING) + @echo PACKAGE_VERSION=$(PACKAGE_VERSION) + @echo PACKAGE=$(PACKAGE) + ChangeLog: (GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2) AUTHORS: (GIT_DIR=$(top_srcdir)/.git git-log | grep ^Author | sort |uniq > .authors.tmp && mv .authors.tmp AUTHORS; rm -f .authors.tmp) || (touch AUTHORS; echo 'git directory not found: installing possibly empty AUTHORS.' >&2) - +export $(REPLACE_VARS) install-data-hook: - for i in $(REPLACE_VARS_ON_INSTALL); do \ + for i in $(DATA_HOOK_REPLACE); do \ file=$(DESTDIR)/$$i ;\ - perl -p -i -e 's|^__VERSION__\s*=.*|__VERSION__="$(RELEASE_VERSION)"|' $$file ;\ - perl -p -i -e 's|^LIBDIR\s*=.*|LIBDIR="$(libdir)"|' $$file ;\ - perl -p -i -e 's|^DATADIR\s*=.*|DATADIR="$(datadir)"|' $$file ;\ - perl -p -i -e 's|^SYSCONFDIR\s*=.*|SYSCONFDIR="$(sysconfdir)"|' $$file ;\ - perl -p -i -e 's|^PYTHONDIR\s*=.*|PYTHONDIR="$(pythondir)"|' $$file ;\ - perl -p -i -e 's|^PKGPYTHONDIR\s*=.*|PKGPYTHONDIR="$(pkgpythondir)"|' $$file ;\ - perl -p -i -e 's|^PKGDATADIR\s*=.*|PKGDATADIR="$(pkgdatadir)"|' $$file ;\ - perl -p -i -e 's|^PKGCONFDIR\s*=.*|PKGCONFDIR="$(pkgconfdir)/"|' $$file ;\ - perl -p -i -e 's|^PKGGLADEDIR\s*=.*|PKGGLADEDIR="$(pkgdatadir)"|' $$file ;\ + for var in $(REPLACE_VARS) ;\ + do \ + perl -p -i -e "s|^$$var\s*=.*|$$var=\"$${!var}\"|" $$file;\ + done ;\ done - install-exec-hook: - for i in $(REPLACE_VARS_ON_INSTALL); do \ + for i in $(EXEC_HOOK_REPLACE); do \ file=$(DESTDIR)/$$i ;\ - perl -p -i -e 's|^__VERSION__\s*=.*|__VERSION__="$(RELEASE_VERSION)"|' $$file ;\ - perl -p -i -e 's|^LIBDIR\s*=.*|LIBDIR="$(libdir)"|' $$file ;\ - perl -p -i -e 's|^LIBEXECDIR\s*=.*|LIBEXECDIR="$(libexecdir)"|' $$file ;\ - perl -p -i -e 's|^DATADIR\s*=.*|DATADIR="$(datadir)"|' $$file ;\ - perl -p -i -e 's|^SYSCONFDIR\s*=.*|SYSCONFDIR="$(sysconfdir)"|' $$file ;\ - perl -p -i -e 's|^PYTHONDIR\s*=.*|PYTHONDIR="$(pythondir)"|' $$file ;\ - perl -p -i -e 's|^PKGPYTHONDIR\s*=.*|PKGPYTHONDIR="$(pkgpythondir)"|' $$file ;\ - perl -p -i -e 's|^PKGDATADIR\s*=.*|PKGDATADIR="$(pkgdatadir)"|' $$file ;\ - perl -p -i -e 's|^PKGCONFDIR\s*=.*|PKGCONFDIR="$(pkgconfdir)"|' $$file ;\ - perl -p -i -e 's|^PKGGLADEDIR\s*=.*|PKGGLADEDIR="$(pkgdatadir)"|' $$file ;\ - done + for var in $(REPLACE_VARS) ;\ + do \ + perl -p -i -e "s|^$$var\s*=.*|$$var=\"$${!var}\"|" $$file;\ + done ;\ + done + +.PHONY: upload_buildservice +upload_buildservice: dist + [ -n "$(PROJECT)" ] || (echo "Must specify PROJECT"; exit 1) + osc co $(PROJECT) $(PACKAGE) + rm -f $(PROJECT)/$(PACKAGE)/*.tar.gz + rm -f $(PROJECT)/$(PACKAGE)/*.spec + cp ${PACKAGE}*.tar.gz $(PROJECT)/$(PACKAGE) + cp */${PACKAGE}.spec $(PROJECT)/$(PACKAGE) + cd $(PROJECT)/$(PACKAGE); osc addremove + cd $(PROJECT)/$(PACKAGE); yes | osc updatepacmetafromspec + cd $(PROJECT)/$(PACKAGE); osc ci -m "scripted source update" .PHONY: rpm srpm rpm: dist mkdir -p $(BUILDDIR) - rpmbuild $(RPM_DEFINES) -ba --nodeps pkg/$(PACKAGE_NAME).spec + rpmbuild $(AM_RPM_DEFINES) -ba --nodeps $(SPECFILE) rm -rf $(BUILDDIR) srpm: dist mkdir -p $(BUILDDIR) - rpmbuild $(RPM_DEFINES) -bs --nodeps pkg/$(PACKAGE_NAME).spec + rpmbuild $(AM_RPM_DEFINES) -bs --nodeps $(SPECFILE) rm -rf $(BUILDDIR) changelog: $(CHANGELOG) .PHONY: $(CHANGELOG) $(CHANGELOG): version.mk - cd pkg/ && fakeroot debchange -v $(RELEASE_VERSION)-$(DEB_RELEASE) $(CHANGELOG_TEXT) + cd pkg/ && fakeroot debchange -v $(PACKAGE_VERSION)-$(DEB_RELEASE) $(CHANGELOG_TEXT) debmagic: [ -n "$$DEB_TMP_BUILDDIR" ] || (echo "Must set DEB_TMP_BUILDDIR=/tmp/... for deb and sdeb targets"; exit 1) [ -n "$$DIST" ] || (echo "Must set DIST={gutsy,hardy,sid,...} for deb and sdeb targets"; exit 1) [ -n "$$DIST" ] || echo "Remember to set DISTTAG='~gutsy1' for deb and sdeb targets for backports" mkdir -p dist/$(DIST) - cp $(TARBALL) $(DEB_TMP_BUILDDIR)/$(RELEASE_NAME)_$(RELEASE_VERSION).orig.tar.gz + cp $(TARBALL) $(DEB_TMP_BUILDDIR)/$(PACKAGE_NAME)_$(PACKAGE_VERSION).orig.tar.gz tar -C $(DEB_TMP_BUILDDIR) -xzf $(TARBALL) - cp -ar pkg/debian $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING)/debian - chmod +x $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING)/debian/rules - sed -e "s/#DISTTAG#/$(DISTTAG)/g" -e "s/#DIST#/$(DIST)/g" $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING)/debian/changelog.in > $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING)/debian/changelog - rm $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING)/debian/changelog.in - cd $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING) ; \ + cp -ar pkg/debian $(DEB_TMP_BUILDDIR)/$(PACKAGE_STRING)/debian + chmod +x $(DEB_TMP_BUILDDIR)/$(PACKAGE_STRING)/debian/rules + sed -e "s/#DISTTAG#/$(DISTTAG)/g" -e "s/#DIST#/$(DIST)/g" $(DEB_TMP_BUILDDIR)/$(PACKAGE_STRING)/debian/changelog.in > $(DEB_TMP_BUILDDIR)/$(PACKAGE_STRING)/debian/changelog + rm $(DEB_TMP_BUILDDIR)/$(PACKAGE_STRING)/debian/changelog.in + cd $(DEB_TMP_BUILDDIR)/$(PACKAGE_STRING) ; \ ./configure ; \ pdebuild --use-pdebuild-internal --buildresult $(TOPDIR)/dist/$(DIST) ; \ dpkg-buildpackage -D -S -sa -rfakeroot ; \ - mv ../$(RELEASE_NAME)_* $(TOPDIR)/dist/$(DIST) ; \ + mv ../$(PACKAGE_NAME)_* $(TOPDIR)/dist/$(DIST) ; \ cd - debs: tmp_dir=`mktemp -d /tmp/firmware-tools.XXXXXXXX` ; \ make debmagic DEB_TMP_BUILDDIR=$${tmp_dir} DIST=$(DIST) DISTTAG=$(DISTTAG) ; \ rm -rf $${tmp_dir} +firmwaretools/generated/__init__.py: firmwaretools/__init__.py configure Makefile config.status + mkdir -p $$(dirname $@) ||: + cp $< $@ + for var in $(REPLACE_VARS) ;\ + do \ + perl -p -i -e "s|^$$var\s*=.*|$$var=\"$${!var}\"|" $@;\ + done # 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 -Nurb firmware-tools-2.1.1/Makefile-std firmware-tools-2.1.5/Makefile-std --- firmware-tools-2.1.1/Makefile-std 2008-02-19 03:59:44.000000000 +0530 +++ firmware-tools-2.1.5/Makefile-std 2008-12-15 23:05:16.000000000 +0530 @@ -2,22 +2,20 @@ # This is a template of all of the 'Standard' stuff that we use in all our # projects. -AUTOMAKE_OPTIONS = subdir-objects -SUBDIRS = -# dont move these 5 lines, as this is how we override the autoconf version and package name -RELEASE_NAME=@RELEASE_NAME@ RELEASE_MAJOR=@RELEASE_MAJOR@ RELEASE_MINOR=@RELEASE_MINOR@ -RELEASE_SUBLEVEL=@RELEASE_SUBLEVEL@ -RELEASE_EXTRALEVEL=@RELEASE_EXTRALEVEL@ +RELEASE_MICRO=@RELEASE_MICRO@ +RELEASE_EXTRA=@RELEASE_EXTRA@ -RELEASE_VERSION = $(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)$(RELEASE_EXTRALEVEL) -RELEASE_STRING = $(RELEASE_NAME)-$(RELEASE_VERSION) -VERSION = $(RELEASE_VERSION) -PACKAGE = $(RELEASE_NAME) +# override built-in defs which end up wrong +VERSION = $(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_MICRO)$(RELEASE_EXTRA) +# note that we add a "-" here. normal package_string has a space. +PACKAGE_STRING = $(PACKAGE)-$(VERSION) +PACKAGE_VERSION = $(VERSION) +PACKAGE = $(PACKAGE_NAME) -CLEANFILES=$(RELEASE_NAME)-*.tar.gz $(RELEASE_NAME)-*.tar.bz2 $(RELEASE_NAME)-*.rpm _buildtemp version +CLEANFILES=$(PACKAGE_NAME)-*.tar.gz $(PACKAGE_NAME)-*.tar.bz2 $(PACKAGE_NAME)-*.rpm _buildtemp version DISTCLEANFILES=*~ EXTRA_DIST = @@ -27,65 +25,85 @@ CLEANFILES += *.pyc */*.pyc */*/*.pyc */*/*/*.pyc CLEANFILES += pkg/$(PACKAGE).spec -dist: ChangeLog AUTHORS +.PHONY: git-tag +git-tag: + git tag -u libsmbios -m "tag for official release: libsmbios $(PACKAGE_STRING)" v$(PACKAGE_VERSION) + +.PHONY: get-version +get-version: + @echo PACKAGE_STRING=$(PACKAGE_STRING) + @echo PACKAGE_VERSION=$(PACKAGE_VERSION) + @echo PACKAGE=$(PACKAGE) + ChangeLog: (GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2) AUTHORS: (GIT_DIR=$(top_srcdir)/.git git-log | grep ^Author | sort |uniq > .authors.tmp && mv .authors.tmp AUTHORS; rm -f .authors.tmp) || (touch AUTHORS; echo 'git directory not found: installing possibly empty AUTHORS.' >&2) +REPLACE_VARS=GETTEXT_PACKAGE PACKAGE_VERSION PACKAGE localedir libdir libexecdir datadir sysconfdir pythondir pkgpythondir pkgdatadir pkgconfdir pkggladedir pkglibexecdir +export $(REPLACE_VARS) + +DATA_HOOK_REPLACE= install-data-hook: - for i in $(REPLACE_VARS_ON_INSTALL); do \ + for i in $(DATA_HOOK_REPLACE); do \ file=$(DESTDIR)/$$i ;\ - perl -p -i -e 's|^__VERSION__\s*=.*|__VERSION__="$(RELEASE_VERSION)"|' $$file ;\ - perl -p -i -e 's|^LIBDIR\s*=.*|LIBDIR="$(libdir)"|' $$file ;\ - perl -p -i -e 's|^DATADIR\s*=.*|DATADIR="$(datadir)"|' $$file ;\ - perl -p -i -e 's|^SYSCONFDIR\s*=.*|SYSCONFDIR="$(sysconfdir)"|' $$file ;\ - perl -p -i -e 's|^PYTHONDIR\s*=.*|PYTHONDIR="$(pythondir)"|' $$file ;\ - perl -p -i -e 's|^PKGPYTHONDIR\s*=.*|PKGPYTHONDIR="$(pkgpythondir)"|' $$file ;\ - perl -p -i -e 's|^PKGDATADIR\s*=.*|PKGDATADIR="$(pkgdatadir)"|' $$file ;\ - perl -p -i -e 's|^PKGCONFDIR\s*=.*|PKGCONFDIR="$(pkgconfdir)/"|' $$file ;\ - perl -p -i -e 's|^PKGGLADEDIR\s*=.*|PKGGLADEDIR="$(pkgdatadir)"|' $$file ;\ + for var in $(REPLACE_VARS) ;\ + do \ + perl -p -i -e "s|^$$var\s*=.*|$$var=\"$${!var}\"|" $$file;\ + done ;\ done +EXEC_HOOK_REPLACE= install-exec-hook: - for i in $(REPLACE_VARS_ON_INSTALL); do \ + for i in $(EXEC_HOOK_REPLACE); do \ file=$(DESTDIR)/$$i ;\ - perl -p -i -e 's|^__VERSION__\s*=.*|__VERSION__="$(RELEASE_VERSION)"|' $$file ;\ - perl -p -i -e 's|^LIBDIR\s*=.*|LIBDIR="$(libdir)"|' $$file ;\ - perl -p -i -e 's|^LIBEXECDIR\s*=.*|LIBEXECDIR="$(libexecdir)"|' $$file ;\ - perl -p -i -e 's|^DATADIR\s*=.*|DATADIR="$(datadir)"|' $$file ;\ - perl -p -i -e 's|^SYSCONFDIR\s*=.*|SYSCONFDIR="$(sysconfdir)"|' $$file ;\ - perl -p -i -e 's|^PYTHONDIR\s*=.*|PYTHONDIR="$(pythondir)"|' $$file ;\ - perl -p -i -e 's|^PKGPYTHONDIR\s*=.*|PKGPYTHONDIR="$(pkgpythondir)"|' $$file ;\ - perl -p -i -e 's|^PKGDATADIR\s*=.*|PKGDATADIR="$(pkgdatadir)"|' $$file ;\ - perl -p -i -e 's|^PKGCONFDIR\s*=.*|PKGCONFDIR="$(pkgconfdir)"|' $$file ;\ - perl -p -i -e 's|^PKGGLADEDIR\s*=.*|PKGGLADEDIR="$(pkgdatadir)"|' $$file ;\ + for var in $(REPLACE_VARS) ;\ + do \ + perl -p -i -e "s|^$$var\s*=.*|$$var=\"$${!var}\"|" $$file;\ + done ;\ done +# set default project. can be overridden on cmdline with 'make -e ...' +PROJECT=home:$(USER) + +.PHONY: upload_buildservice +upload_buildservice: dist + [ -n "$(PROJECT)" ] || (echo "Must specify PROJECT"; exit 1) + osc co $(PROJECT) $(PACKAGE) + rm -f $(PROJECT)/$(PACKAGE)/*.tar.gz + rm -f $(PROJECT)/$(PACKAGE)/*.spec + cp ${PACKAGE}*.tar.gz $(PROJECT)/$(PACKAGE) + cp */${PACKAGE}.spec $(PROJECT)/$(PACKAGE) + cd $(PROJECT)/$(PACKAGE); osc addremove + cd $(PROJECT)/$(PACKAGE); yes | osc updatepacmetafromspec + cd $(PROJECT)/$(PACKAGE); osc ci -m "scripted source update" + TOPDIR := $(shell cd $(top_builddir);pwd) BUILDDIR = $(TOPDIR)/_rpmbuild RPMDIR = $(TOPDIR) SOURCEDIR = $(TOPDIR) +SPECFILE= $(TOPDIR)/pkg/$(PACKAGE_NAME).spec SPECDIR = $(TOPDIR)/pkg SRCRPMDIR = $(TOPDIR) -RPM_DEFINES = --define "_topdir $(TOPDIR)" \ +AM_RPM_DEFINES = --define "_topdir $(TOPDIR)" \ --define "_builddir $(BUILDDIR)" \ --define "_rpmdir $(RPMDIR)" \ --define "_sourcedir $(SOURCEDIR)" \ --define "_specdir $(SPECDIR)" \ - --define "_srcrpmdir $(SRCRPMDIR)" + --define "_srcrpmdir $(SRCRPMDIR)" \ + $(RPM_DEFINES) .PHONY: rpm srpm rpm: dist mkdir -p $(BUILDDIR) - rpmbuild $(RPM_DEFINES) -ba --nodeps pkg/$(PACKAGE_NAME).spec + rpmbuild $(AM_RPM_DEFINES) -ba --nodeps $(SPECFILE) rm -rf $(BUILDDIR) srpm: dist mkdir -p $(BUILDDIR) - rpmbuild $(RPM_DEFINES) -bs --nodeps pkg/$(PACKAGE_NAME).spec + rpmbuild $(AM_RPM_DEFINES) -bs --nodeps $(SPECFILE) rm -rf $(BUILDDIR) # This updates the debian version information, similar to how specfile for RPM @@ -95,26 +113,26 @@ changelog: $(CHANGELOG) .PHONY: $(CHANGELOG) $(CHANGELOG): version.mk - cd pkg/ && fakeroot debchange -v $(RELEASE_VERSION)-$(DEB_RELEASE) $(CHANGELOG_TEXT) + cd pkg/ && fakeroot debchange -v $(PACKAGE_VERSION)-$(DEB_RELEASE) $(CHANGELOG_TEXT) -TARBALL=$(RELEASE_STRING).tar.gz +TARBALL=$(PACKAGE_STRING).tar.gz debmagic: [ -n "$$DEB_TMP_BUILDDIR" ] || (echo "Must set DEB_TMP_BUILDDIR=/tmp/... for deb and sdeb targets"; exit 1) [ -n "$$DIST" ] || (echo "Must set DIST={gutsy,hardy,sid,...} for deb and sdeb targets"; exit 1) [ -n "$$DIST" ] || echo "Remember to set DISTTAG='~gutsy1' for deb and sdeb targets for backports" mkdir -p dist/$(DIST) - cp $(TARBALL) $(DEB_TMP_BUILDDIR)/$(RELEASE_NAME)_$(RELEASE_VERSION).orig.tar.gz + cp $(TARBALL) $(DEB_TMP_BUILDDIR)/$(PACKAGE_NAME)_$(PACKAGE_VERSION).orig.tar.gz tar -C $(DEB_TMP_BUILDDIR) -xzf $(TARBALL) - cp -ar pkg/debian $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING)/debian - chmod +x $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING)/debian/rules - sed -e "s/#DISTTAG#/$(DISTTAG)/g" -e "s/#DIST#/$(DIST)/g" $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING)/debian/changelog.in > $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING)/debian/changelog - rm $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING)/debian/changelog.in - cd $(DEB_TMP_BUILDDIR)/$(RELEASE_STRING) ; \ + cp -ar pkg/debian $(DEB_TMP_BUILDDIR)/$(PACKAGE_STRING)/debian + chmod +x $(DEB_TMP_BUILDDIR)/$(PACKAGE_STRING)/debian/rules + sed -e "s/#DISTTAG#/$(DISTTAG)/g" -e "s/#DIST#/$(DIST)/g" $(DEB_TMP_BUILDDIR)/$(PACKAGE_STRING)/debian/changelog.in > $(DEB_TMP_BUILDDIR)/$(PACKAGE_STRING)/debian/changelog + rm $(DEB_TMP_BUILDDIR)/$(PACKAGE_STRING)/debian/changelog.in + cd $(DEB_TMP_BUILDDIR)/$(PACKAGE_STRING) ; \ ./configure ; \ pdebuild --use-pdebuild-internal --buildresult $(TOPDIR)/dist/$(DIST) ; \ dpkg-buildpackage -D -S -sa -rfakeroot ; \ - mv ../$(RELEASE_NAME)_* $(TOPDIR)/dist/$(DIST) ; \ + mv ../$(PACKAGE_NAME)_* $(TOPDIR)/dist/$(DIST) ; \ cd - debs: diff -Nurb firmware-tools-2.1.1/pkg/firmware-tools.spec.in firmware-tools-2.1.5/pkg/firmware-tools.spec.in --- firmware-tools-2.1.1/pkg/firmware-tools.spec.in 2008-03-12 22:36:36.000000000 +0530 +++ firmware-tools-2.1.5/pkg/firmware-tools.spec.in 2008-12-15 23:05:16.000000000 +0530 @@ -2,10 +2,9 @@ %define major @RELEASE_MAJOR@ %define minor @RELEASE_MINOR@ -%define sub @RELEASE_SUBLEVEL@ -%define extralevel @RELEASE_RPM_EXTRALEVEL@ -%define release_name firmware-tools -%define release_version %{major}.%{minor}.%{sub}%{extralevel} +%define micro @RELEASE_MICRO@ +%define extra @RELEASE_RPM_EXTRA@ +%define release_version %{major}.%{minor}.%{micro}%{extra} %define rpm_release 1 # per fedora python packaging guidelines @@ -17,15 +16,18 @@ Summary: Scripts and tools to manage firmware and BIOS updates Group: Applications/System -# License is actually GPL/OSL dual license (GPL Compatible), but rpmlint complains -License: GPLv2+ or OSL +License: GPLv2+ or OSL 2.1 URL: http://linux.dell.com/libsmbios/download/ Source0: http://linux.dell.com/libsmbios/download/%{name}/%{name}-%{version}/%{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +# SUSE doesnt have noarch python, so for SUSE, always build arch-dependent +%if ! 0%{?suse_version} BuildArch: noarch +%endif BuildRequires: python-devel, rpm-python -Requires: rpm-python +Requires: rpm-python, pciutils Provides: firmware_inventory(pci) = 0:%{release_version} # packages that dont conform to latest ABI @@ -45,14 +47,27 @@ %build -%configure +# this line lets us build an RPM directly from a git tarball +[ -e ./configure ] || ./autogen.sh + +# fix problems when buildsystem time is out of sync. ./configure will +# fail if newly created files are older than the packaged files. +# this should normally be a no-op on proper buildsystems. +touch configure +find . -type f -newer configure -print0 | xargs -r0 touch + +%configure RELEASE_MAJOR=%{major} RELEASE_MINOR=%{minor} RELEASE_MICRO=%{micro} RELEASE_EXTRA=%{extra} make -e %{?_smp_mflags} %check make -e %{?_smp_mflags} check %install +# Fedora Packaging guidelines rm -rf $RPM_BUILD_ROOT +# SUSE Packaging rpmlint +mkdir $RPM_BUILD_ROOT + make install DESTDIR=%{buildroot} INSTALL="%{__install} -p" mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/firmware/firmware.d/ @@ -65,11 +80,6 @@ ln -s firmwaretool $RPM_BUILD_ROOT/%{_sbindir}/update_firmware ln -s %{_sbindir}/firmwaretool $RPM_BUILD_ROOT/%{_bindir}/update_firmware -%if "%{enable_yum_plugins}" != "1" -rm -rf $RPM_BUILD_ROOT/usr/lib/yum-plugins -rm -rf $RPM_BUILD_ROOT/etc/yum/pluginconf.d -%endif - %clean rm -rf $RPM_BUILD_ROOT @@ -87,11 +97,6 @@ %config(noreplace) %{_sysconfdir}/firmware/firmware.conf %{_datadir}/firmware/ -%if "%{enable_yum_plugins}" == "1" -%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/* -%{_exec_prefix}/lib/yum-plugins/* -%endif - %changelog * Thu Aug 23 2007 Michael E Brown - 1.5.6-1 diff -Nurb firmware-tools-2.1.1/pkg/install-sh firmware-tools-2.1.5/pkg/install-sh --- firmware-tools-2.1.1/pkg/install-sh 2008-03-17 11:45:23.000000000 +0530 +++ firmware-tools-2.1.5/pkg/install-sh 2008-12-15 23:05:23.000000000 +0530 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2006-10-14.15 +scriptversion=2006-12-25.00 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -48,7 +48,7 @@ # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" +doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else @@ -58,34 +58,49 @@ # Put in absolute file names if you don't have them in your path; # or use environment vars. -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' -posix_glob= posix_mkdir= # Desired mode of installed file. mode=0755 +chgrpcmd= chmodcmd=$chmodprog chowncmd= -chgrpcmd= -stripcmd= +mvcmd=$mvprog rmcmd="$rmprog -f" -mvcmd="$mvprog" +stripcmd= + src= dst= dir_arg= -dstarg= +dst_arg= + +copy_on_change=false no_target_directory= -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... @@ -95,65 +110,55 @@ In the 4th, create DIRECTORIES. Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG " while test $# -ne 0; do case $1 in - -c) shift - continue;; + -c) ;; - -d) dir_arg=true - shift - continue;; + -C) copy_on_change=true;; + + -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; + shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 - shift - shift case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac - continue;; + shift;; -o) chowncmd="$chownprog $2" - shift - shift - continue;; + shift;; - -s) stripcmd=$stripprog - shift - continue;; + -s) stripcmd=$stripprog;; - -t) dstarg=$2 - shift - shift - continue;; + -t) dst_arg=$2 + shift;; - -T) no_target_directory=true - shift - continue;; + -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; @@ -165,21 +170,22 @@ *) break;; esac + shift done -if test $# -ne 0 && test -z "$dir_arg$dstarg"; then +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do - if test -n "$dstarg"; then + if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" + set fnord "$@" "$dst_arg" shift # fnord fi shift # arg - dstarg=$arg + dst_arg=$arg done fi @@ -224,7 +230,7 @@ do # Protect names starting with `-'. case $src in - -*) src=./$src ;; + -*) src=./$src;; esac if test -n "$dir_arg"; then @@ -242,22 +248,22 @@ exit 1 fi - if test -z "$dstarg"; then + if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi - dst=$dstarg + dst=$dst_arg # Protect names starting with `-'. case $dst in - -*) dst=./$dst ;; + -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 + echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst @@ -378,26 +384,19 @@ # directory the slow way, step by step, checking for races as we go. case $dstdir in - /*) prefix=/ ;; - -*) prefix=./ ;; - *) prefix= ;; + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; esac - case $posix_glob in - '') - if (set -f) 2>/dev/null; then - posix_glob=true - else - posix_glob=false - fi ;; - esac + eval "$initialize_posix_glob" oIFS=$IFS IFS=/ - $posix_glob && set -f + $posix_glob set -f set fnord $dstdir shift - $posix_glob && set +f + $posix_glob set +f IFS=$oIFS prefixes= @@ -459,41 +458,54 @@ # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ - || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. - + { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { - if test -f "$dst"; then - $doit $rmcmd -f "$dst" 2>/dev/null \ - || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ - && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ - || { - echo "$0: cannot unlink or rename $dst" >&2 + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } - else - : - fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } - } || exit 1 + fi || exit 1 trap '' 0 fi