From 2919710a8285db02cea7caddac7ae79b1fb071fe Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 16 Jan 2010 21:06:54 -0500 Subject: [PATCH 1/4] Fix in acprep to the way Boost is found --- acprep | 81 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/acprep b/acprep index 20be2db4..83b0416e 100755 --- a/acprep +++ b/acprep @@ -811,8 +811,10 @@ class PrepareBuild(CommandLineApp): % (self.envvars['PYTHON_HOME'], self.envvars['PYTHON_VERSION'].strip()), '/opt/local/lib', + '%s/lib' % self.envvars['BOOST_HOME'], '/sw/lib']: - if exists(path) and isdir(path): + if exists(path) and isdir(path) and \ + path not in self.sys_library_dirs: self.log.info('Noticing library directory => ' + path) self.sys_library_dirs.append(path) @@ -1044,6 +1046,23 @@ class PrepareBuild(CommandLineApp): # The various build flavors # ######################################################################### + def check_for_boost(self, directory = '/opt/local', suffix = '', + boost_dirname = 'boost'): + if exists(join(directory, 'lib', 'libboost_regex' + suffix + '.a')): + self.envvars['BOOST_HOME'] = directory + self.envvars['BOOST_SUFFIX'] = suffix + include_directory = join(directory, 'include', boost_dirname) + if include_directory not in self.sys_include_dirs: + self.sys_include_dirs.append(include_directory) + library_directory = join(directory, 'lib') + if library_directory not in self.sys_library_dirs: + self.sys_library_dirs.append(library_directory) + self.inform_boost_location('is really located', + self.envvars['BOOST_SUFFIX']) + return True + else: + return False + def locate_darwin_libraries(self): if self.current_flavor == 'debug' or self.current_flavor == 'gcov': self.log.debug('We are using GLIBCXX_DEBUG, so setting up flags') @@ -1051,48 +1070,28 @@ class PrepareBuild(CommandLineApp): if self.options.use_glibcxx_debug: self.CPPFLAGS.append('-D_GLIBCXX_DEBUG=1') - if exists('/usr/local/lib/libboost_regex-xgcc44-sd-1_41.a'): - self.envvars['BOOST_HOME'] = '/usr/local' - self.envvars['BOOST_SUFFIX'] = '-xgcc44-sd-1_41' - self.sys_include_dirs.append('/usr/local/include/boost-1_41') - self.inform_boost_location('is really located', - self.envvars['BOOST_SUFFIX']) - - elif exists('/usr/local/lib/libboost_regex-xgcc44-d-1_41.a'): - self.envvars['BOOST_HOME'] = '/usr/local' - self.envvars['BOOST_SUFFIX'] = '-xgcc44-d-1_41' - self.sys_include_dirs.append('/usr/local/include/boost-1_41') - self.inform_boost_location('is really located', - self.envvars['BOOST_SUFFIX']) - - elif exists('/opt/local/lib/libboost_regex-d.a'): - self.envvars['BOOST_HOME'] = '/opt/local' - self.envvars['BOOST_SUFFIX'] = '-d' - self.sys_include_dirs.append('/opt/local/include/boost') - self.inform_boost_location('is really located', - self.envvars['BOOST_SUFFIX']) + if self.check_for_boost(directory = '/usr/local/stow/boost_1_41_0', + suffix = '-xgcc44-sd-1_41', + boost_dirname = 'boost-1_41'): + pass + elif self.check_for_boost(directory = '/usr/local/stow/boost_1_41_0', + suffix = '-xgcc44-d-1_41', + boost_dirname = 'boost-1_41'): + pass + elif self.check_for_boost(suffix = '-d'): + pass else: - if exists('/opt/local/lib/libboost_regex.a'): - self.envvars['BOOST_HOME'] = '/opt/local' - self.envvars['BOOST_SUFFIX'] = '' - self.sys_include_dirs.append('/opt/local/include/boost') - self.inform_boost_location('is really located', - self.envvars['BOOST_SUFFIX']) - - elif exists('/usr/local/lib/libboost_regex-xgcc44-s-1_41.a'): - self.envvars['BOOST_HOME'] = '/usr/local' - self.envvars['BOOST_SUFFIX'] = '-xgcc44-s-1_41' - self.sys_include_dirs.append('/usr/local/include/boost-1_41') - self.inform_boost_location('is really located', - self.envvars['BOOST_SUFFIX']) - - elif exists('/usr/local/lib/libboost_regex-xgcc44-1_41.a'): - self.envvars['BOOST_HOME'] = '/usr/local' - self.envvars['BOOST_SUFFIX'] = '-xgcc44-1_41' - self.sys_include_dirs.append('/usr/local/include/boost-1_41') - self.inform_boost_location('is really located', - self.envvars['BOOST_SUFFIX']) + if self.check_for_boost(): + pass + elif self.check_for_boost(directory = '/usr/local/stow/boost_1_41_0', + suffix = '-xgcc44-s-1_41', + boost_dirname = 'boost-1_41'): + pass + elif self.check_for_boost(directory = '/usr/local/stow/boost_1_41_0', + suffix = '-xgcc44-1_41', + boost_dirname = 'boost-1_41'): + pass def setup_flavor_default(self): pass From d176abf6254cd209d712009f3b3b807fbb6a0b12 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 16 Jan 2010 21:12:13 -0500 Subject: [PATCH 2/4] Fix for date parsing when no year is given --- src/times.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/times.cc b/src/times.cc index d4317509..7ea3ae32 100644 --- a/src/times.cc +++ b/src/times.cc @@ -224,7 +224,7 @@ namespace { when = date_t(year ? *year : CURRENT_DATE().year(), when.month(), when.day()); - if (when.month() > CURRENT_DATE().month()) + if (! year && when.month() > CURRENT_DATE().month()) when -= gregorian::years(1); } } From b3a3ecccf2e8ddaab79b58fb68b134a39d29c395 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 17 Jan 2010 16:50:20 -0500 Subject: [PATCH 3/4] Fixed the guard test for calling setup_for_johnw --- acprep | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/acprep b/acprep index 83b0416e..34a13693 100755 --- a/acprep +++ b/acprep @@ -863,7 +863,7 @@ class PrepareBuild(CommandLineApp): self.CXXFLAGS.append('-pthread') elif system == 'Darwin': - if exists('/Users/johnw/Dropbox/Accounts/ledger.dat'): + if exists('/Users/johnw/Projects/ledger/plan/TODO'): self.setup_for_johnw() self.locate_darwin_libraries() @@ -1065,9 +1065,8 @@ class PrepareBuild(CommandLineApp): def locate_darwin_libraries(self): if self.current_flavor == 'debug' or self.current_flavor == 'gcov': - self.log.debug('We are using GLIBCXX_DEBUG, so setting up flags') - if self.options.use_glibcxx_debug: + self.log.debug('We are using GLIBCXX_DEBUG, so setting up flags') self.CPPFLAGS.append('-D_GLIBCXX_DEBUG=1') if self.check_for_boost(directory = '/usr/local/stow/boost_1_41_0', From 67ce17e24959f55a4cd55857c7741d058397d758 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 18 Jan 2010 03:41:20 -0500 Subject: [PATCH 4/4] Guard against using an uninitialized value Fixes DDB54BB8-8C1C-4129-A137-07A38068F3BE --- src/item.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/item.cc b/src/item.cc index 99d1d835..f86b8ec8 100644 --- a/src/item.cc +++ b/src/item.cc @@ -437,9 +437,12 @@ void print_item(std::ostream& out, const item_t& item, const string& prefix) string item_context(const item_t& item, const string& desc) { + if (! item.pos) + return empty_string; + std::streamoff len = item.pos->end_pos - item.pos->beg_pos; if (! len) - return _(""); + return empty_string; assert(len > 0); assert(len < 2048);