Skip to content
Snippets Groups Projects
Commit d1362c48 authored by chrfranke's avatar chrfranke
Browse files

Print SVN revision number instead of time in version info line.

Get SVN revision number from svn (if available) or guess from
Id strings. Rename generated file to svnversion.h.


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2837 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 212c81ea
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,10 @@ NOTES FOR FUTURE RELEASES: see TODO file.
<DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
[CF] Print SVN revision number instead of time in version info line.
Get SVN revision number from svn (if available) or guess from
Id strings. Rename generated file to svnversion.h.
[CF] Makefile.am: Modify generation of cvsversion.h for SVN.
[GP] Convert CVS repository to SVN.
......
Smartmontools installation instructions
=======================================
$Id: INSTALL,v 1.83 2009/01/12 22:55:02 dlukes Exp $
$Id$
Please also see the smartmontools home page:
http://smartmontools.sourceforge.net/
......@@ -264,9 +264,9 @@ Table of contents:
make CFLAGS='your options'
The first output line of smartctl and smartd provides information
about release number, last CVS checkin date/time, platform, and
package. The latter defaults to "(local build)" and can be changed
by the variable BUILD_INFO, for example:
about release number, last SVN checkin date and revison, platform,
and package. The latter defaults to "(local build)" and can be
changed by the variable BUILD_INFO, for example:
make BUILD_INFO='"(Debian 5.39-2)"'
[4] Guidelines for different Linux distributions
......@@ -495,8 +495,8 @@ To prepare os_win32 directory for MSVC8, use the following on Cygwin:
The MSVC8 project files (os_win32/smartmontools_vc8.sln,
os_win32/smart{ctl,d}_vc8.vcproj) are included in CVS (but not in
source tarball). The target config-vc8 from a Makefile configured
for MinGW creates os_win32/{config,cvsversion}_vc8.h from
./{config,cvsversion}.h. The configure skript must be run outside
for MinGW creates os_win32/{config,svnversion}_vc8.h from
./{config,svnversion}.h. The configure skript must be run outside
of the source directory to avoid inclusion of the original config.h.
Unlike MinGW, MSVC can also be used to build the syslog message file
......
......@@ -241,8 +241,7 @@ EXTRA_DIST = smartd.initd.in \
os_win32/installer.nsi \
$(docs_DATA)
CLEANFILES = cvsversion.h \
drivedb.h \
CLEANFILES = drivedb.h \
smartd.conf.5 \
smartd.conf.4 \
smartd.8 \
......@@ -256,27 +255,34 @@ CLEANFILES = cvsversion.h \
smartd.conf.5.html \
smartd.conf.5.txt \
smartd.initd \
svnversion.h \
SMART
if SMARTD_SUFFIX
CLEANFILES += smartd.conf$(smartd_suffix)
endif
CVSVERSION_DEPS = CHANGELOG Makefile
if IS_CVS_BUILD
# Rebuild cvsversion.h after cvs update or commit
CVSVERSION_DEPS += $(srcdir)/CVS/Entries
endif
utility.o: svnversion.h
utility.o: cvsversion.h
if IS_SVN_BUILD
# Get version info from SVN
svnversion.h: CHANGELOG Makefile $(srcdir)/.svn/entries
echo '/* svnversion.h. Generated by Makefile from svn info. */' > $@
chg="`(cd $(srcdir) && svn status -q 2>/dev/null | sed 's,^.*$$,+,;q')`" && \
(cd $(srcdir) && TZ= svn info 2>/dev/null ) \
| sed -n 'h;s,^.* Rev: *\([^ ]*\)$$,REV "\1'"$$chg"'",p;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p' \
| sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
else
cvsversion.h: $(CVSVERSION_DEPS)
echo '/* cvsversion.h. Generated by Makefile. */' > $@
# SVN not available, guess version info from $Id$ strings
svnversion.h: CHANGELOG Makefile
echo '/* svnversion.h. Generated by Makefile from Id strings. */' > $@
(cd $(srcdir) && cat Makefile.am configure.in smart*.in *.cpp *.h *.s) \
| sed -n 's,^.*\$$[I][d]: [^ ]* [^ ]* \(20[01][0-9][-/][01][0-9][-/][0-3][0-9] [0-9][0-9]:[0-9][0-9]\):[0-9][0-9][^$$]*\$$.*$$,\1,p' \
| sed 's,/,-,g' | sort -r \
| sed 's,^\(.*\)$$,#define SMARTMONTOOLS_CVS_DATE_TIME "\1",;1q' \
>> $@
| sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \
| sort -n -r \
| sed -n 'h;s,^\([^ ]*\) .*$$,REV "\1~",p;g;s,^[^ ]* \([^ ]*\) .*$$,DATE "\1",p;g;s,^[^ ]* [^ ]* \([^ ]*\)$$,TIME "\1",p;q' \
| sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
endif
# Drive Database
......@@ -399,10 +405,10 @@ endif
if OS_FREEBSD
.for file in $(man_MANS)
${file}: $(srcdir)/${file}.in Makefile cvsversion.h
${file}: $(srcdir)/${file}.in Makefile svnversion.h
sed "s|CURRENT_CVS_VERSION|$(releaseversion)|g; \
s|CURRENT_CVS_DATE|`sed -n 's,^[^"]*"\([^ ]*\) [^"]*".*$$,\1,p' cvsversion.h`|g; \
s|CURRENT_CVS_TIME|`sed -n 's,^[^"]*"[^ ]* \([^"]*\)".*$$,\1,p' cvsversion.h`|g; \
s|CURRENT_CVS_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g; \
s|CURRENT_CVS_TIME|`sed -n 's,^.*TIME[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g; \
s|/usr/local/share/man/|$(mandir)/|g; \
s|/usr/local/sbin/|$(sbindir)/|g; \
s|/usr/local/etc/rc\\.d/init.d/|$(initddir)/|g; \
......@@ -413,10 +419,10 @@ ${file}: $(srcdir)/${file}.in Makefile cvsversion.h
$(MAN_SAVESTATES) > $@
.endfor
else
smart%: $(srcdir)/smart%.in Makefile cvsversion.h
smart%: $(srcdir)/smart%.in Makefile svnversion.h
sed "s|CURRENT_CVS_VERSION|$(releaseversion)|g" $< | \
sed "s|CURRENT_CVS_DATE|`sed -n 's,^[^"]*"\([^ ]*\) [^"]*".*$$,\1,p' cvsversion.h`|g" | \
sed "s|CURRENT_CVS_TIME|`sed -n 's,^[^"]*"[^ ]* \([^"]*\)".*$$,\1,p' cvsversion.h`|g" | \
sed "s|CURRENT_CVS_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g" | \
sed "s|CURRENT_CVS_TIME|`sed -n 's,^.*TIME[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g" | \
sed "s|/usr/local/share/man/|$(mandir)/|g" | \
sed "s|/usr/local/sbin/|$(sbindir)/|g" | \
sed "s|/usr/local/etc/rc\\.d/init.d/|$(initddir)/|g" | \
......@@ -589,17 +595,17 @@ smartctl-nc.exe: smartctl.exe
mv -f $@.tmp $@
# Build {config,cvsversion}_vc8.h for MSVC8 from MinGW {config,cvsversion}.h
# Build {config,svnversion}_vc8.h for MSVC8 from MinGW {config,svnversion}.h
config-vc8: $(srcdir)/os_win32/config_vc8.h $(srcdir)/os_win32/cvsversion_vc8.h
config-vc8: $(srcdir)/os_win32/config_vc8.h $(srcdir)/os_win32/svnversion_vc8.h
$(srcdir)/os_win32/config_vc8.h: config.h
sed '1i/* config_vc8.h. Generated from config.h by Makefile. */' $< | \
sed 's,^#define HAVE_\(ATTR_PACKED\|INTTYPES_H\|STDINT_H\|STRINGS_H\|STRTOULL\|U*INT64_T\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */,' | \
sed 's,i.86-pc-mingw32,i686-pc-win32vc8,' > $@
$(srcdir)/os_win32/cvsversion_vc8.h: cvsversion.h
cp cvsversion.h $@
$(srcdir)/os_win32/svnversion_vc8.h: svnversion.h
cp svnversion.h $@
endif
......
#
# $Id: configure.in,v 1.148 2009/03/19 18:00:35 chrfranke Exp $
# $Id$
#
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
......@@ -7,7 +7,7 @@ AC_INIT(smartmontools, 5.39, smartmontools-support@lists.sourceforge.net)
AC_CONFIG_SRCDIR(smartctl.cpp)
smartmontools_configure_date=`date -u +"%Y/%m/%d %T %Z"`
smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.148 2009/03/19 18:00:35 chrfranke Exp $'`
smartmontools_cvs_tag=`echo '$Id$'`
smartmontools_release_date=2008/03/10
smartmontools_release_time="10:44:07 GMT"
......@@ -43,12 +43,17 @@ case "${host}" in
;;
esac
# Check for CVS.
AC_MSG_CHECKING([whether this is a build from CVS])
is_cvs_build=no
test -f "$srcdir/CVS/Entries" && is_cvs_build=yes
AM_CONDITIONAL(IS_CVS_BUILD, [test "$is_cvs_build" = "yes"])
AC_MSG_RESULT([$is_cvs_build])
# Check for SVN.
AC_MSG_CHECKING([whether this is a build from SVN])
is_svn_build=no
if test -f "$srcdir/.svn/entries"; then
is_svn_build=unknown
if (cd "$srcdir" && svn --version && svn info && svn status -q) >/dev/null 2>&1; then
is_svn_build=yes
fi
fi
AM_CONDITIONAL(IS_SVN_BUILD, [test "$is_svn_build" = "yes"])
AC_MSG_RESULT([$is_svn_build])
dnl Checks for libraries needed for name services (Solaris needs
dnl libnsl, might in the future also need libsocket)
......
......@@ -497,30 +497,6 @@
RelativePath="..\configure.in"
>
</File>
<File
RelativePath=".\cvsversion_vc8.h"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Copy $(InputPath) cvsversion.h"
CommandLine="copy $(InputPath) cvsversion.h&#x0D;&#x0A;"
Outputs="cvsversion.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Copy $(InputPath) cvsversion.h"
CommandLine="copy $(InputPath) cvsversion.h&#x0D;&#x0A;"
Outputs="cvsversion.h"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\dev_ata_cmd_set.cpp"
>
......@@ -1033,6 +1009,30 @@
RelativePath="..\smartd.initd.in"
>
</File>
<File
RelativePath=".\svnversion_vc8.h"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Copy $(InputPath) svnversion.h"
CommandLine="copy $(InputPath) svnversion.h&#x0D;&#x0A;"
Outputs="svnversion.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Copy $(InputPath) svnversion.h"
CommandLine="copy $(InputPath) svnversion.h&#x0D;&#x0A;"
Outputs="svnversion.h"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\TODO"
>
......
......@@ -417,30 +417,6 @@
RelativePath="..\configure.in"
>
</File>
<File
RelativePath=".\cvsversion_vc8.h"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Copy $(InputPath) cvsversion.h"
CommandLine="copy $(InputPath) cvsversion.h&#x0D;&#x0A;"
Outputs="cvsversion.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Copy $(InputPath) cvsversion.h"
CommandLine="copy $(InputPath) cvsversion.h&#x0D;&#x0A;"
Outputs="cvsversion.h"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\dev_ata_cmd_set.cpp"
>
......@@ -985,6 +961,30 @@
RelativePath="..\smartd.initd.in"
>
</File>
<File
RelativePath=".\svnversion_vc8.h"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Copy $(InputPath) svnversion.h"
CommandLine="copy $(InputPath) svnversion.h&#x0D;&#x0A;"
Outputs="svnversion.h"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Copy $(InputPath) svnversion.h"
CommandLine="copy $(InputPath) svnversion.h&#x0D;&#x0A;"
Outputs="svnversion.h"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\TODO"
>
......
......@@ -42,7 +42,7 @@
#include <stdexcept>
#include "config.h"
#include "cvsversion.h"
#include "svnversion.h"
#include "int64.h"
#include "utility.h"
......@@ -50,7 +50,7 @@
#include "dev_interface.h"
// Any local header files should be represented by a CVSIDX just below.
const char* utility_c_cvsid="$Id: utility.cpp,v 1.75 2009/02/09 21:57:37 chrfranke Exp $"
const char* utility_c_cvsid="$Id$"
CONFIG_H_CVSID INT64_H_CVSID UTILITY_H_CVSID;
const char * packet_types[] = {
......@@ -89,9 +89,10 @@ const char *format_version_info(const char *progname)
{
static char info[200];
snprintf(info, sizeof(info),
"%s %s %s [%s] %s\n"
"%s %s %s r%s [%s] %s\n"
"Copyright (C) 2002-9 by Bruce Allen, http://smartmontools.sourceforge.net\n",
progname, PACKAGE_VERSION, SMARTMONTOOLS_CVS_DATE_TIME, smi()->get_os_version_str(), BUILD_INFO
progname, PACKAGE_VERSION, SMARTMONTOOLS_SVN_DATE, SMARTMONTOOLS_SVN_REV,
smi()->get_os_version_str(), BUILD_INFO
);
return info;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment