Skip to content

Commit

Permalink
updated packaging script/git integration
Browse files Browse the repository at this point in the history
  • Loading branch information
barbibulle committed Jan 24, 2015
1 parent b8cbb24 commit 15c8db1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
26 changes: 10 additions & 16 deletions Scripts/ExportSourceTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
# GetSdkRevision
#############################################################
def GetSdkRevision():
cmd = 'git status --porcelain -b'
lines = os.popen(cmd).readlines()
if not lines[0].startswith('## master'):
print 'ERROR: not on master branch'
return None
if len(lines) > 1:
print 'ERROR: git status not empty'
print ''.join(lines)
return None

cmd = 'git tag --contains HEAD'
tags = os.popen(cmd).readlines()
if len(tags) != 1:
Expand All @@ -33,29 +43,13 @@ def GetVersion():
return m.group(1) + '-' + m.group(2) + '-' + m.group(3)
return '0-0-0'

#############################################################
# CheckGitStatus
#############################################################
def CheckGitStatus():
cmd = 'git status --porcelain -b'
lines = os.popen(cmd).readlines()
if not lines[0].startswith('## master'):
print 'ERROR: not on master branch'
sys.exit(1)
if len(lines) > 1:
print 'ERROR: git status not empty'
print ''.join(lines)
sys.exit(1)

#############################################################
# Main
#############################################################
script_dir = os.path.abspath(os.path.dirname(__file__))
BENTO4_HOME = os.path.join(script_dir,'..')
BENTO4_VERSION = GetVersion()

CheckGitStatus()

SDK_REVISION = GetSdkRevision()
if SDK_REVISION == None:
sys.exit(1)
Expand Down
25 changes: 22 additions & 3 deletions Scripts/SdkPackager.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,26 @@ def GetVersion():
# GetSdkRevision
#############################################################
def GetSdkRevision():
cmd = 'git rev-list HEAD --count'
revision = 0
return os.popen(cmd).readlines()[0].strip()
cmd = 'git status --porcelain -b'
lines = os.popen(cmd).readlines()
if not lines[0].startswith('## master'):
print 'ERROR: not on master branch'
return None
if len(lines) > 1:
print 'ERROR: git status not empty'
print ''.join(lines)
return None

cmd = 'git tag --contains HEAD'
tags = os.popen(cmd).readlines()
if len(tags) != 1:
print 'ERROR: expected exactly one tag for HEAD, found', len(tags), ':', tags
return None
version = tags[0].strip()
sep = version.find('-')
if sep < 0:
print 'ERROR: unrecognized version string format:', version
return version[sep+1:]

#############################################################
# File Copy
Expand Down Expand Up @@ -150,6 +167,8 @@ def ZipIt(basename, dir) :

# compute paths
SDK_REVISION = GetSdkRevision()
if SDK_REVISION is None:
sys.exit(1)
SDK_NAME='Bento4-SDK-'+BENTO4_VERSION+'-'+SDK_REVISION+'.'+SDK_TARGET
SDK_BUILD_ROOT=BENTO4_HOME+'/SDK'
SDK_ROOT=SDK_BUILD_ROOT+'/'+SDK_NAME
Expand Down

0 comments on commit 15c8db1

Please sign in to comment.