13
0

more attempts to make svn_revision.h work for all

git-svn-id: svn://localhost/ardour2/trunk@1136 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2006-11-16 19:51:35 +00:00
parent 0d035c70f2
commit e15ca20204

View File

@ -238,12 +238,7 @@ def fetch_svn_revision (path):
cmd += " | awk '/^Revision:/ { print $2}'" cmd += " | awk '/^Revision:/ { print $2}'"
return commands.getoutput (cmd) return commands.getoutput (cmd)
def recreate_stored_revision(target = None, source = None, env = None): def create_master_stored_revision (target = None, source = None, env = None):
os.unlink ('svn_revision.h')
print "===========> Forcing recreation of svn_revision.h"
create_stored_revision ()
def create_stored_revision(target = None, source = None, env = None):
if os.path.exists('.svn'): if os.path.exists('.svn'):
rev = fetch_svn_revision ('.'); rev = fetch_svn_revision ('.');
try: try:
@ -251,28 +246,21 @@ def create_stored_revision(target = None, source = None, env = None):
text += "#define __ardour_svn_revision_h__\n" text += "#define __ardour_svn_revision_h__\n"
text += "static const char* ardour_svn_revision = \"" + rev + "\";\n"; text += "static const char* ardour_svn_revision = \"" + rev + "\";\n";
text += "#endif\n" text += "#endif\n"
print '============> writing svn revision info to svn_revision.h\n' print '============> writing svn revision info to saved_svn_revision.h\n'
o = file ('svn_revision.h', 'w') o = file ('saved_svn_revision.h', 'w')
o.write (text) o.write (text)
o.close () o.close ()
except IOError: except IOError:
print "Could not open svn_revision.h for writing\n" print "Could not open saved.h for writing\n"
sys.exit (-1) sys.exit (-1)
else: else:
if os.path.exists ('svn_revision.h') == False: print "You cannot use \"scons revision\" on without using a checked out"
print "\n\nYou are missing svn_revision.h, which should have been included." print "copy of the Ardour source code repository"
print "This is caused either by a packaging error, " sys.exit (-1)
print " or a configuration error with your system."
print "Please report this issue to the ardour-dev mailing list."
print "(See http://ardour.org/support for details)\n\n"
sys.exit (-1)
# def create_stored_revision (target = None, source = None, env = None):
# if it exists, do not remove it shutil.copy ('saved_svn_revision.h', target[0].path)
#
Precious('svn_revision.h')
# #
# A generic builder for version.cc files # A generic builder for version.cc files
# #
@ -969,14 +957,9 @@ env = conf.Finish()
rcbuild = env.SubstInFile ('ardour.rc','ardour.rc.in', SUBST_DICT = subst_dict) rcbuild = env.SubstInFile ('ardour.rc','ardour.rc.in', SUBST_DICT = subst_dict)
# svn_revision_h = env.Command ('svn_revision.h', [], create_stored_revision)
# making this into an Alias directly prevents scons from understanding how to build
# svn_revision.h
#
the_revision = env.Command ('svn_revision.h', [], create_stored_revision) env.Alias('revision', env.Command ('saved_svn_revision.h', '.svn/entries', create_master_stored_revision))
env.Alias('revision', the_revision)
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour_system.rc')) env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour_system.rc'))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.rc')) env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.rc'))
@ -1019,7 +1002,7 @@ env.Alias ('srctar', srcdist)
# #
env.AddPreAction (env['DISTTREE'], Action ('rm -rf ' + str (File (env['DISTTREE'])))) env.AddPreAction (env['DISTTREE'], Action ('rm -rf ' + str (File (env['DISTTREE']))))
env.AddPreAction (srcdist, Action (recreate_stored_revision)) env.AddPreAction (srcdist, Action (create_master_stored_revision))
env.AddPostAction (srcdist, Action ('rm -rf ' + str (File (env['DISTTREE'])))) env.AddPostAction (srcdist, Action ('rm -rf ' + str (File (env['DISTTREE']))))
# #