Create tds 15.1 build job
This commit is contained in:
1 parent
6a1166ce64
commit
6e5f5c77bb
2 files changed
+69
-76
No files matched your search
+16
-58
@@ -1,11 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# $Id: make_rpm.py 1382 2023-10-09 04:11:49Z fritsche_h $
|
||||
# $HeadURL: svn://192.168.133.21/admin/rpmbuild/make_rpm.py $
|
||||
# $Author: fritsche_h $
|
||||
# Created by Christian Ehrlicher, SLSE, 20013-02-19
|
||||
#
|
||||
|
||||
import datetime
|
||||
import getopt
|
||||
@@ -32,8 +25,7 @@ class build(object):
|
||||
self.version_min = 1
|
||||
self.version_rev = 0
|
||||
self.cmake_version_prefix = "TDS"
|
||||
self.source_dir_rel = "TDS-Source"
|
||||
self.svn_fullpath = None
|
||||
self.source_dir_rel = "tds"
|
||||
|
||||
self.buildtype = os.getenv( "CMAKE_BUILD_TYPE" )
|
||||
if self.buildtype == None or self.buildtype == "":
|
||||
@@ -55,29 +47,12 @@ class build(object):
|
||||
print(" Using extfw dir: %s" % self.extfw_dir)
|
||||
print(" Using buildtype: %s" % self.buildtype)
|
||||
print(" Project name: %s" % self.project_name)
|
||||
print(" SVN Path: %s" % self.svn_fullpath)
|
||||
print(" Version: %s.%s-%s" % ( self.version_maj, self.version_min, self.version_rev ))
|
||||
print(" Jenkins build number: %s" % os.getenv( "BUILD_NUMBER" ))
|
||||
print(" GitLab-CI build number: %s" % os.getenv( "BUILD_NUMBER" ))
|
||||
print(" Date: %s" % self.version_date)
|
||||
print("")
|
||||
time.sleep(2)
|
||||
|
||||
# does a svn export, returns True when it's a checkout or False when it's an update
|
||||
def svn_export( self, svn_path, dest_dir, svn_revision = "HEAD", svn_user = None, svn_passwd = None ):
|
||||
|
||||
removeDirectory( dest_dir )
|
||||
|
||||
info( "--------------------------------" )
|
||||
info( "Exporting %s to %s" % ( svn_path, dest_dir ) )
|
||||
info( "--------------------------------" )
|
||||
|
||||
command = "svn export -r %s %s %s" % ( svn_revision, svn_path, dest_dir )
|
||||
if svn_user:
|
||||
command += "--username %s " % svn_user
|
||||
if svn_passwd:
|
||||
command += "--password %s " % svn_passwd
|
||||
os.system( command ) and die( "while svn export. cmd: %s" % command )
|
||||
|
||||
def version_str( self ):
|
||||
return "%s.%s" % ( self.version_maj, self.version_min )
|
||||
|
||||
@@ -93,7 +68,7 @@ class build(object):
|
||||
debug( "specname: %s" % os.path.join( specdir, specname ) )
|
||||
if os.path.exists( os.path.join( specdir, specname ) ):
|
||||
return specname
|
||||
specname = 'lts.spec'
|
||||
specname = 'lts' + os.getenv( "BULD_VERSION" ) + '.spec'
|
||||
debug( "specname: %s" % os.path.join( specdir, specname ) )
|
||||
if os.path.exists( os.path.join( specdir, specname ) ):
|
||||
return specname
|
||||
@@ -107,7 +82,7 @@ class build(object):
|
||||
return specname
|
||||
die( 'Unable to find a valid spec file in %s' % specdir )
|
||||
|
||||
def copy_spec( self, svn_fullpath, dest_dir, spec_fullpath ):
|
||||
def copy_spec( self, dest_dir, spec_fullpath ):
|
||||
# copy spec to build
|
||||
f = open( spec_fullpath, 'r' )
|
||||
content = f.read()
|
||||
@@ -127,6 +102,7 @@ class build(object):
|
||||
cmake_flags += '-D%s_VERSION_DATE:STRING="%s" ' % (self.cmake_version_prefix, self.version_date)
|
||||
cmake_flags += '-D_pname:STRING="%s" ' % (self.project_name)
|
||||
|
||||
|
||||
jenkins_build_number = os.getenv( "BUILD_NUMBER" )
|
||||
if jenkins_build_number != None:
|
||||
cmake_flags += '-DJENKINS_BUILD_NUMBER:STRING="%s" '% (jenkins_build_number)
|
||||
@@ -144,7 +120,7 @@ class build(object):
|
||||
content = content.replace( "@OS_SYSTEM@", getOS_Name() )
|
||||
content = content.replace( "@PACKAGER@", getpass.getuser() )
|
||||
content = content.replace( "@VERSION@", self.version_str() )
|
||||
content = content.replace( "@RELEASE@", self.version_rev )
|
||||
content = content.replace( "@RELEASE@", str(self.version_rev) )
|
||||
content = content.replace( "@SOURCE_DIR_REL@", self.source_dir_rel )
|
||||
content = content.replace( "@SOURCES@", self.xzfilename() )
|
||||
content = content.replace( "@APPLICATION@", self.repository )
|
||||
@@ -153,6 +129,7 @@ class build(object):
|
||||
if not os.path.exists( dest_dir ):
|
||||
os.makedirs( dest_dir )
|
||||
f = open( os.path.join( dest_dir, os.path.split( spec_fullpath )[1] ), 'w' )
|
||||
|
||||
f.write( content )
|
||||
f.close()
|
||||
|
||||
@@ -212,15 +189,14 @@ def main():
|
||||
b = build()
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "b:c:f:o:p:r:v:s:",
|
||||
["base_dir=", "cmake_build_flags=", "cmake_version_prefix=", "filelist=", "output_dir=", "project_name=", "repository", "version=", "svn_path="])
|
||||
opts, args = getopt.getopt(sys.argv[1:], "b:c:f:o:p:r:v:",
|
||||
["base_dir=", "cmake_build_flags=", "cmake_version_prefix=", "filelist=", "output_dir=", "project_name=", "repository=", "version="])
|
||||
except getopt.GetoptError as err:
|
||||
print >> sys.stderr, err
|
||||
usage()
|
||||
sys.exit(2)
|
||||
|
||||
rpm_filelist = None
|
||||
svn_path = "trunk"
|
||||
b.repository = "TDS"
|
||||
for o, a in opts:
|
||||
if o == "--cmake_build_flags":
|
||||
@@ -245,46 +221,28 @@ def main():
|
||||
b.version_min = version[1]
|
||||
except:
|
||||
die( "Invalid version format (maj.min): %s" % a )
|
||||
if o in ("-s", "--svn_path"):
|
||||
svn_path = a
|
||||
|
||||
b.source_dir_rel = b.repository + "-source"
|
||||
|
||||
svn_destdir = os.path.join( "/tmp", b.source_dir_rel )
|
||||
|
||||
svn_server = "slssvn"
|
||||
if svn_path.startswith('svn://'):
|
||||
b.svn_fullpath = svn_path
|
||||
else:
|
||||
b.svn_fullpath = "svn://%s/%s/%s/" % ( svn_server, b.repository, svn_path )
|
||||
|
||||
# b.check_rpm("ctc_EXTFW_%s" % os_str)
|
||||
|
||||
b.version_rev = getSvn_Release( b.svn_fullpath )
|
||||
b.version_date = getSvn_Date( b.svn_fullpath )
|
||||
b.version_date = os.getenv( "VERSION_DATE" )
|
||||
b.init()
|
||||
b.printOptions()
|
||||
|
||||
rpmbase_dir = os.path.join( os.getenv( "HOME" ), 'rpmbuild' )
|
||||
rpmbase_dir = '/shd/CTC/TOOLS/rpmbuild'
|
||||
project_base_dir = '/builds/projects-domain-live/tds'
|
||||
|
||||
specdir = os.path.join( rpmbase_dir, "SPECS" )
|
||||
if not os.path.exists(specdir):
|
||||
os.makedirs(specdir)
|
||||
|
||||
b.svn_export( b.svn_fullpath, svn_destdir )
|
||||
b.clean_lts_cc_conf(svn_destdir + '/Lts/Projects')
|
||||
specname = b.specname( os.path.join( svn_destdir, "specs" ) )
|
||||
b.copy_spec( b.svn_fullpath,
|
||||
specdir,
|
||||
os.path.join( svn_destdir, "specs", specname ) )
|
||||
b.clean_lts_cc_conf(os.path.join(project_base_dir, 'Lts', 'Projects'))
|
||||
specname = b.specname(os.path.join(project_base_dir, 'specs'))
|
||||
b.copy_spec( specdir, os.path.join(project_base_dir, "specs", specname ))
|
||||
|
||||
full_version = "%s.%s-%s" % ( b.version_maj, b.version_min, b.version_rev )
|
||||
b.printOptions()
|
||||
|
||||
b.pack_sources( svn_destdir, os.path.join( rpmbase_dir, "SOURCES" ) )
|
||||
removeDirectory( svn_destdir )
|
||||
b.pack_sources( project_base_dir, os.path.join( rpmbase_dir, "SOURCES" ) )
|
||||
exec_rpmbuild( specdir, specname )
|
||||
|
||||
# move rpms to FOO-1.2-345
|
||||
dstdir = os.path.join( b.output_dir, "%s-%s-%s" % ( b.project_name, b.repository, full_version ) )
|
||||
filter = re.compile( "^.*%s\..*\.rpm$" % full_version )
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# $Id: make_rpm15.4.py 1382 2023-10-09 04:11:49Z fritsche_h $
|
||||
# $HeadURL: svn://192.168.133.21/admin/rpmbuild/make_rpm15.4.py $
|
||||
# $Id: make_rpm.py 1382 2023-10-09 04:11:49Z fritsche_h $
|
||||
# $HeadURL: svn://192.168.133.21/admin/rpmbuild/make_rpm.py $
|
||||
# $Author: fritsche_h $
|
||||
# Created by Christian Ehrlicher, SLSE, 20013-02-19
|
||||
#
|
||||
@@ -32,7 +32,8 @@ class build(object):
|
||||
self.version_min = 1
|
||||
self.version_rev = 0
|
||||
self.cmake_version_prefix = "TDS"
|
||||
self.source_dir_rel = "tds"
|
||||
self.source_dir_rel = "TDS-Source"
|
||||
self.svn_fullpath = None
|
||||
|
||||
self.buildtype = os.getenv( "CMAKE_BUILD_TYPE" )
|
||||
if self.buildtype == None or self.buildtype == "":
|
||||
@@ -54,12 +55,29 @@ class build(object):
|
||||
print(" Using extfw dir: %s" % self.extfw_dir)
|
||||
print(" Using buildtype: %s" % self.buildtype)
|
||||
print(" Project name: %s" % self.project_name)
|
||||
print(" SVN Path: %s" % self.svn_fullpath)
|
||||
print(" Version: %s.%s-%s" % ( self.version_maj, self.version_min, self.version_rev ))
|
||||
print(" GitLab-CI build number: %s" % os.getenv( "BUILD_NUMBER" ))
|
||||
print(" Jenkins build number: %s" % os.getenv( "BUILD_NUMBER" ))
|
||||
print(" Date: %s" % self.version_date)
|
||||
print("")
|
||||
time.sleep(2)
|
||||
|
||||
# does a svn export, returns True when it's a checkout or False when it's an update
|
||||
def svn_export( self, svn_path, dest_dir, svn_revision = "HEAD", svn_user = None, svn_passwd = None ):
|
||||
|
||||
removeDirectory( dest_dir )
|
||||
|
||||
info( "--------------------------------" )
|
||||
info( "Exporting %s to %s" % ( svn_path, dest_dir ) )
|
||||
info( "--------------------------------" )
|
||||
|
||||
command = "svn export -r %s %s %s" % ( svn_revision, svn_path, dest_dir )
|
||||
if svn_user:
|
||||
command += "--username %s " % svn_user
|
||||
if svn_passwd:
|
||||
command += "--password %s " % svn_passwd
|
||||
os.system( command ) and die( "while svn export. cmd: %s" % command )
|
||||
|
||||
def version_str( self ):
|
||||
return "%s.%s" % ( self.version_maj, self.version_min )
|
||||
|
||||
@@ -75,7 +93,7 @@ class build(object):
|
||||
debug( "specname: %s" % os.path.join( specdir, specname ) )
|
||||
if os.path.exists( os.path.join( specdir, specname ) ):
|
||||
return specname
|
||||
specname = 'lts15.4.spec'
|
||||
specname = 'lts.spec'
|
||||
debug( "specname: %s" % os.path.join( specdir, specname ) )
|
||||
if os.path.exists( os.path.join( specdir, specname ) ):
|
||||
return specname
|
||||
@@ -89,7 +107,7 @@ class build(object):
|
||||
return specname
|
||||
die( 'Unable to find a valid spec file in %s' % specdir )
|
||||
|
||||
def copy_spec( self, dest_dir, spec_fullpath ):
|
||||
def copy_spec( self, svn_fullpath, dest_dir, spec_fullpath ):
|
||||
# copy spec to build
|
||||
f = open( spec_fullpath, 'r' )
|
||||
content = f.read()
|
||||
@@ -109,7 +127,6 @@ class build(object):
|
||||
cmake_flags += '-D%s_VERSION_DATE:STRING="%s" ' % (self.cmake_version_prefix, self.version_date)
|
||||
cmake_flags += '-D_pname:STRING="%s" ' % (self.project_name)
|
||||
|
||||
|
||||
jenkins_build_number = os.getenv( "BUILD_NUMBER" )
|
||||
if jenkins_build_number != None:
|
||||
cmake_flags += '-DJENKINS_BUILD_NUMBER:STRING="%s" '% (jenkins_build_number)
|
||||
@@ -127,7 +144,7 @@ class build(object):
|
||||
content = content.replace( "@OS_SYSTEM@", getOS_Name() )
|
||||
content = content.replace( "@PACKAGER@", getpass.getuser() )
|
||||
content = content.replace( "@VERSION@", self.version_str() )
|
||||
content = content.replace( "@RELEASE@", str(self.version_rev) )
|
||||
content = content.replace( "@RELEASE@", self.version_rev )
|
||||
content = content.replace( "@SOURCE_DIR_REL@", self.source_dir_rel )
|
||||
content = content.replace( "@SOURCES@", self.xzfilename() )
|
||||
content = content.replace( "@APPLICATION@", self.repository )
|
||||
@@ -136,7 +153,6 @@ class build(object):
|
||||
if not os.path.exists( dest_dir ):
|
||||
os.makedirs( dest_dir )
|
||||
f = open( os.path.join( dest_dir, os.path.split( spec_fullpath )[1] ), 'w' )
|
||||
|
||||
f.write( content )
|
||||
f.close()
|
||||
|
||||
@@ -196,14 +212,15 @@ def main():
|
||||
b = build()
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "b:c:f:o:p:r:v:",
|
||||
["base_dir=", "cmake_build_flags=", "cmake_version_prefix=", "filelist=", "output_dir=", "project_name=", "repository=", "version="])
|
||||
opts, args = getopt.getopt(sys.argv[1:], "b:c:f:o:p:r:v:s:",
|
||||
["base_dir=", "cmake_build_flags=", "cmake_version_prefix=", "filelist=", "output_dir=", "project_name=", "repository", "version=", "svn_path="])
|
||||
except getopt.GetoptError as err:
|
||||
print >> sys.stderr, err
|
||||
usage()
|
||||
sys.exit(2)
|
||||
|
||||
rpm_filelist = None
|
||||
svn_path = "trunk"
|
||||
b.repository = "TDS"
|
||||
for o, a in opts:
|
||||
if o == "--cmake_build_flags":
|
||||
@@ -228,28 +245,46 @@ def main():
|
||||
b.version_min = version[1]
|
||||
except:
|
||||
die( "Invalid version format (maj.min): %s" % a )
|
||||
if o in ("-s", "--svn_path"):
|
||||
svn_path = a
|
||||
|
||||
b.source_dir_rel = b.repository + "-source"
|
||||
|
||||
svn_destdir = os.path.join( "/tmp", b.source_dir_rel )
|
||||
|
||||
svn_server = "slssvn"
|
||||
if svn_path.startswith('svn://'):
|
||||
b.svn_fullpath = svn_path
|
||||
else:
|
||||
b.svn_fullpath = "svn://%s/%s/%s/" % ( svn_server, b.repository, svn_path )
|
||||
|
||||
# b.check_rpm("ctc_EXTFW_%s" % os_str)
|
||||
|
||||
b.version_date = os.getenv( "VERSION_DATE" )
|
||||
b.version_rev = getSvn_Release( b.svn_fullpath )
|
||||
b.version_date = getSvn_Date( b.svn_fullpath )
|
||||
b.init()
|
||||
b.printOptions()
|
||||
|
||||
rpmbase_dir = '/shd/CTC/TOOLS/rpmbuild'
|
||||
project_base_dir = '/builds/projects-domain-live/tds'
|
||||
rpmbase_dir = os.path.join( os.getenv( "HOME" ), 'rpmbuild' )
|
||||
|
||||
specdir = os.path.join( rpmbase_dir, "SPECS" )
|
||||
if not os.path.exists(specdir):
|
||||
os.makedirs(specdir)
|
||||
b.clean_lts_cc_conf(os.path.join(project_base_dir, 'Lts', 'Projects'))
|
||||
specname = b.specname(os.path.join(project_base_dir, 'specs'))
|
||||
b.copy_spec( specdir, os.path.join(project_base_dir, "specs", specname ))
|
||||
|
||||
b.svn_export( b.svn_fullpath, svn_destdir )
|
||||
b.clean_lts_cc_conf(svn_destdir + '/Lts/Projects')
|
||||
specname = b.specname( os.path.join( svn_destdir, "specs" ) )
|
||||
b.copy_spec( b.svn_fullpath,
|
||||
specdir,
|
||||
os.path.join( svn_destdir, "specs", specname ) )
|
||||
|
||||
full_version = "%s.%s-%s" % ( b.version_maj, b.version_min, b.version_rev )
|
||||
b.printOptions()
|
||||
|
||||
b.pack_sources( project_base_dir, os.path.join( rpmbase_dir, "SOURCES" ) )
|
||||
b.pack_sources( svn_destdir, os.path.join( rpmbase_dir, "SOURCES" ) )
|
||||
removeDirectory( svn_destdir )
|
||||
exec_rpmbuild( specdir, specname )
|
||||
|
||||
# move rpms to FOO-1.2-345
|
||||
dstdir = os.path.join( b.output_dir, "%s-%s-%s" % ( b.project_name, b.repository, full_version ) )
|
||||
filter = re.compile( "^.*%s\..*\.rpm$" % full_version )
|
||||
Reference in new issue
Block a user