Hi Jürgen, On Wed, Feb 29, 2012 at 03:32:30PM +0100, Jürgen Schmidt wrote: > Hi, > > i have changed the about dialog box a little bit and would like to > get your feedback. > > I added a new key in the version.ini/versionrc > > Revision=<svn_revison_number> > Any opinions?
Getting the revision does not work with a Git repo on Fedora 16 and
Ubuntu 10.04.3 LTS.
On these distros, subversion output when there is no subversion repo
does not match what the code in sub DetectRevisionId expects, it
outputs:
svn: '.' is not a working copy
It looks like checking for the program output may be error prone (it
would be better to check the exit code, different subversion versions
may output different things, even localized text).
Another issue is the path to the repo: now it is determined by
File::Spec->catfile($ENV{'SRC_ROOT'}, File::Spec->updir())
Moving one dir. up trunk/main will only work if you checked trunk
instead of separated repos.
So moving one dir. up can be avoided: both svn and git work in
subdirectories inside the repo; I've tested with:
export SRC_ROOT=/mnt/build/aoo/trunk/main/instsetoo_native/prj
and it works with the attached print-sv-rev-pl, both with git and svn,
even invoking just
SvnRevision::DetectRevisionId($ENV{'SRC_ROOT'})
Another issue: if the revision is not detected for some reason (like the
error above, or the developer is working with the source distribution
- it has the repo folders stripped), the about dlg should not show an
empty " - Rev. ", the string length should be checked before.
Patch is attached, I won't commit it as it needs further changes.
Regards
--
Ariel Constenla-Haile
La Plata, Argentina
print-svn-rev.pl
Description: Perl program
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 4c30718..7f60800 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -190,17 +190,23 @@ AboutDialog::AboutDialog( Window* pParent, const ResId&
rId ) :
aNewFont.SetSize( aSmaller );
aBuildData.SetFont( aNewFont );
- String sRevision( utl::Bootstrap::getRevisionInfo() );
-
String aBuildString(aDevVersionStr);
- aBuildString += (DEFINE_CONST_UNICODE(" - Rev. "));
- aBuildString += sRevision;
+ String sRevision( utl::Bootstrap::getRevisionInfo() );
+ if ( sRevision.Len() > 0 )
+ {
+ aBuildString += (DEFINE_CONST_UNICODE(" - Rev. "));
+ aBuildString += sRevision;
+ }
#ifdef BUILD_VER_STRING
#define _STRINGIFY(x) #x
#define STRINGIFY(x) _STRINGIFY(x)
- aBuildString += '\n';
- aBuildString += ( DEFINE_CONST_UNICODE( STRINGIFY( BUILD_VER_STRING ) )
);
+ String sBuildVer( DEFINE_CONST_UNICODE( STRINGIFY( BUILD_VER_STRING ) ) );
+ if ( sBuildVer.Len() > 0 )
+ {
+ aBuildString += '\n';
+ aBuildString += sBuildVer;
+ }
#endif
aBuildData.SetText( aBuildString );
aBuildData.Show();
diff --git a/solenv/bin/modules/SvnRevision.pm
b/solenv/bin/modules/SvnRevision.pm
index f8ff553..8bdce71 100644
--- a/solenv/bin/modules/SvnRevision.pm
+++ b/solenv/bin/modules/SvnRevision.pm
@@ -59,7 +59,7 @@ sub DetectRevisionId ($)
open my $proc, "cd $path && svn info 2>\&1 |";
while (<$proc>)
{
- if (/svn: E155007:/)
+ if (/svn: E155007:/ || /svn: '.' is not a working copy/)
{
# Not in an SVN repository.
$id = DetectRevisionIdFromGit($path);
diff --git a/solenv/bin/modules/installer/scriptitems.pm
b/solenv/bin/modules/installer/scriptitems.pm
index deba95a..c22b1fb 100644
--- a/solenv/bin/modules/installer/scriptitems.pm
+++ b/solenv/bin/modules/installer/scriptitems.pm
@@ -33,7 +33,6 @@ use installer::pathanalyzer;
use installer::remover;
use installer::systemactions;
-use File::Spec;
use SvnRevision;
################################################################
@@ -852,7 +851,7 @@ sub replace_setup_variables
if ( $hashref->{'USERDIRPRODUCTVERSION'} ) { $userdirproductversion =
$hashref->{'USERDIRPRODUCTVERSION'}; }
my $productkey = $productname . " " . $productversion;
- my $scsrevision =
SvnRevision::DetectRevisionId(File::Spec->catfile($ENV{'SRC_ROOT'},
File::Spec->updir()));
+ my $scsrevision = SvnRevision::DetectRevisionId( $ENV{'SRC_ROOT'} );
# string $buildid, which is used to replace the setup variable <buildid>
pgptN7zuabU5r.pgp
Description: PGP signature
