waf: Remove debuild, build with dpkg-buildpackage

Call dpkg-buildpackage to build the packages

WAF no prints an error when ./waf deb is being called so users know
they have to use dpkg-buildpackage

Before calling dpkg-buildpackage maven has to be called to install the
JAR dependencies!
This commit is contained in:
Wido den Hollander 2012-09-07 13:59:01 +02:00 committed by Alex Huang
parent 3b951894cb
commit f2416367e2

109
wscript
View File

@ -108,24 +108,6 @@ def getrpmdeps():
deps.add("ant")
return deps
def getdebdeps():
def debdeps(fileset):
for f in fileset:
lines = file(f).readlines()
lines = [ x[len("Build-Depends: "):] for x in lines if x.startswith("Build-Depends") ]
for l in lines:
deps = [ x.strip() for x in l.split(",") ]
for d in deps:
if "%s-"%APPNAME in d: continue
yield d
yield "build-essential"
yield "devscripts"
yield "debhelper"
deps = set(debdeps(["debian/control"]))
deps.add("ant")
return deps
# CENTOS does not have this -- we have to put this here
try:
from subprocess import check_call as _check_call
@ -602,6 +584,10 @@ def bindist(ctx):
z.close()
_chdir(cwd)
@throws_command_errors
def deb(context):
raise Utils.WafError("Debian packages are no longer build with waf. Use dpkg-buildpackage instead.")
@throws_command_errors
def rpm(context):
buildnumber = Utils.getbuildnumber()
@ -647,74 +633,6 @@ def rpm(context):
installrpmdeps(context)
dorpm()
@throws_command_errors
def deb(context):
buildnumber = Utils.getbuildnumber()
if buildnumber: buildnumber = ["--set-envvar=BUILDNUMBER=%s"%buildnumber]
else: buildnumber = []
if Options.options.VERNUM:
VERSION = Options.options.VERNUM
else:
VERSION = SHORTVERSION
version = ["--set-envvar=PACKAGEVERSION=%s"%VERSION]
if Options.options.PRERELEASE:
if not buildnumber:
raise Utils.WafError("Please specify a build number to go along with --prerelease")
# version/release numbers are read by dpkg-buildpackage from line 1 of debian/changelog
# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
tempchangelog = """%s (%s-~%s%s) unstable; urgency=low
* Automatic prerelease build
-- Automated build system <noreply@cloud.com> %s"""%(
APPNAME,
VERSION,
Utils.getbuildnumber(),
Options.options.PRERELEASE,
email.Utils.formatdate(time.time())
)
else:
tempchangelog = """%s (%s-1) stable; urgency=low
* Automatic release build
-- Automated build system <noreply@cloud.com> %s"""%(
APPNAME,
VERSION,
email.Utils.formatdate(time.time())
)
# FIXME wrap the source tarball in POSIX locking!
if not Options.options.blddir: outputdir = _join(context.curdir,blddir,"debbuild")
else: outputdir = _join(_abspath(Options.options.blddir),"debbuild")
Utils.pprint("GREEN","Building DEBs")
tarball = Scripting.dist('', VERSION)
srcdir = "%s/%s-%s"%(outputdir,APPNAME,VERSION)
if _exists(srcdir): shutil.rmtree(srcdir)
mkdir_p(outputdir)
f = tarfile.open(tarball,'r:bz2')
f.extractall(path=outputdir)
if tempchangelog:
f = file(_join(srcdir,"debian","changelog"),"w")
f.write(tempchangelog)
f.flush()
f.close()
checkdeps = lambda: c(["dpkg-checkbuilddeps"],srcdir)
dodeb = lambda: c(["debuild",'-e','WAFCACHE','--no-lintian', '--no-tgz-check']+buildnumber+version+["-us","-uc"],srcdir)
try: checkdeps()
except (CalledProcessError,OSError),e:
Utils.pprint("YELLOW","Dependencies might be missing. Trying to auto-install them...")
installdebdeps(context)
dodeb()
def uninstallrpms(context):
"""uninstalls any Cloud Stack RPMs on this system"""
Utils.pprint("GREEN","Uninstalling any installed RPMs")
@ -722,21 +640,10 @@ def uninstallrpms(context):
Utils.pprint("BLUE",cmd)
system(cmd)
def uninstalldebs(context):
"""uninstalls any Cloud Stack DEBs on this system"""
Utils.pprint("GREEN","Uninstalling any installed DEBs")
cmd = "dpkg -l '%s-*' | grep ^i | awk '{ print $2 } ' | xargs aptitude purge -y"%APPNAME
Utils.pprint("BLUE",cmd)
system(cmd)
def viewrpmdeps(context):
"""shows all the necessary dependencies to build the RPM packages of the stack"""
for dep in getrpmdeps(): print dep
def viewdebdeps(context):
"""shows all the necessary dependencies to build the DEB packages of the stack"""
for dep in getdebdeps(): print dep
@throws_command_errors
def installrpmdeps(context):
"""installs all the necessary dependencies to build the RPM packages of the stack"""
@ -745,14 +652,6 @@ def installrpmdeps(context):
Utils.pprint("BLUE"," ".join(runnable))
_check_call(runnable)
@throws_command_errors
def installdebdeps(context):
"""installs all the necessary dependencies to build the DEB packages of the stack"""
runnable = ["sudo","aptitude","install","-y"]+list( [ x.split()[0] for x in getdebdeps() ] )
Utils.pprint("GREEN","Installing DEB build dependencies")
Utils.pprint("BLUE"," ".join(runnable))
_check_call(runnable)
@throws_command_errors
def deploydb(ctx,virttech=None):
if not virttech: raise Utils.WafError('use deploydb_xenserver, deploydb_vmware or deploydb_kvm rather than deploydb')