summaryrefslogtreecommitdiff
path: root/acprep
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-11 14:45:14 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-11 14:45:14 -0500
commita034435c4287aba7fd32ed63a745e560350c924a (patch)
treef0acb080410a32c215c2c1938811cc14d512b580 /acprep
parent5ffa987daf4d97c52066e4c28733d826d3726297 (diff)
parentf0f1b0cdfa3a0a73695eda52b25de71bd40adc5a (diff)
downloadfork-ledger-a034435c4287aba7fd32ed63a745e560350c924a.tar.gz
fork-ledger-a034435c4287aba7fd32ed63a745e560350c924a.tar.bz2
fork-ledger-a034435c4287aba7fd32ed63a745e560350c924a.zip
Merge branch 'next'
Diffstat (limited to 'acprep')
-rwxr-xr-xacprep25
1 files changed, 15 insertions, 10 deletions
diff --git a/acprep b/acprep
index 055d2306..245f16a1 100755
--- a/acprep
+++ b/acprep
@@ -255,6 +255,9 @@ class PrepareBuild(CommandLineApp):
op.add_option('', '--no-patch', action='store_true', dest='no_patch',
default=False,
help='Do not patch the Makefile for prettier output')
+ op.add_option('', '--no-git', action='store_true', dest='no_git',
+ default=False,
+ help='Do not call out to Git; useful for offline builds')
op.add_option('', '--output', metavar='DIR', action="callback",
callback=self.option_output,
help='Build in the specified directory')
@@ -382,9 +385,12 @@ class PrepareBuild(CommandLineApp):
sys.exit(1)
return dirname
+ def git_working_tree(self):
+ return exists('.git') and isdir('.git') and not self.options.no_git
+
def current_version(self):
if not self.current_ver:
- if exists('.git') and isdir('.git'):
+ if self.git_working_tree():
#date = self.get_stdout('git', 'log', '--format=%ci', '-1', 'HEAD')
#date = re.sub(" [-+][0-9][0-9][0-9][0-9]$", "", date)
#when = datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
@@ -394,7 +400,7 @@ class PrepareBuild(CommandLineApp):
tag = self.get_stdout('git', 'describe', '--all', '--long')
self.current_ver = re.sub('heads/', '', tag)
else:
- self.current_ver = "unknown"
+ self.current_ver = "no-git"
return self.current_ver
def need_to_prepare_autotools(self):
@@ -522,17 +528,15 @@ class PrepareBuild(CommandLineApp):
def phase_submodule(self, *args):
self.log.info('Executing phase: submodule')
- if exists('.git') and isdir('.git'):
+ if self.git_working_tree():
self.execute('git', 'submodule', 'init')
self.execute('git', 'submodule', 'update')
def phase_pull(self, *args):
self.log.info('Executing phase: pull')
- if not exists('.git') and not isdir('.git'):
- self.log.error("This is not a Git clone.")
- sys.exit(1)
- self.execute('git', 'pull')
- self.phase_submodule()
+ if self.git_working_tree():
+ self.execute('git', 'pull')
+ self.phase_submodule()
#########################################################################
# Automatic installation of build dependencies #
@@ -653,7 +657,7 @@ class PrepareBuild(CommandLineApp):
self.log.error('Failed to locate the Boost sources')
sys.exit(1)
- if not exists('cppunit'):
+ if not exists('cppunit') and self.git_working_tree():
self.execute('git', 'clone', 'git://github.com/jwiegley/cppunit.git')
if not exists('cppunit'):
@@ -1239,7 +1243,8 @@ class PrepareBuild(CommandLineApp):
def phase_gitclean(self, *args):
self.log.info('Executing phase: gitclean')
- self.execute('git', 'clean', '-dfx')
+ if self.git_working_tree():
+ self.execute('git', 'clean', '-dfx')
#########################################################################
# Packaging phases #