def update_changes(debChanges=False): """Generates the list of commits for the latest build.""" git_pull() toTag = todays_build_tag() import build_version build_version.find_version(quiet=True) # Let's find the previous event of this version. fromTag = find_previous_tag(toTag, build_version.DOOMSDAY_VERSION_FULL_PLAIN) if fromTag is None or toTag is None: # Range not defined. return print 'Changes for range', fromTag, '..', toTag changes = builder.Changes(fromTag, toTag) if debChanges: # Only update the Debian changelog. changes.generate('deb') # Also update the doomsday-fmod changelog (just version number). os.chdir(os.path.join(builder.config.DISTRIB_DIR, 'dsfmod')) fmodVer = build_version.parse_cmake_for_version( '../../doomsday/cmake/Version.cmake') debVer = "%s.%s.%s-%s" % (fmodVer[0], fmodVer[1], fmodVer[2], todays_build_tag()) print "Marking new FMOD version:", debVer msg = 'New release: Doomsday Engine build %i.' % builder.Event( ).number() os.system( 'rm -f debian/changelog && dch --check-dirname-level 0 --create --package doomsday-fmod -v %s "%s"' % (debVer, msg)) os.system('dch --release ""') else: # Save version information. print >> file(builder.Event(toTag).file_path('version.txt'), 'wt'), \ build_version.DOOMSDAY_VERSION_FULL print >> file(builder.Event(toTag).file_path('releaseType.txt'), 'wt'), \ build_version.DOOMSDAY_RELEASE_TYPE changes.generate('html') changes.generate('xml')
def update_changes(debChanges=False): """Generates the list of commits for the latest build.""" git_pull() toTag = todays_build_tag() import build_version # Look up the relevant version. event = builder.Event(toTag) refVersion = event.version() # Let's find the previous event of this version. fromTag = find_previous_tag(toTag, refVersion) if fromTag is None or toTag is None: # Range not defined. return print 'Changes for range', fromTag, '..', toTag changes = builder.Changes(fromTag, toTag) if debChanges: # Only update the Debian changelog. changes.generate('deb') # Also update the doomsday-fmod changelog (just version number). os.chdir(os.path.join(builder.config.DISTRIB_DIR, 'dsfmod')) fmodVer = build_version.parse_cmake_for_version( '../../doomsday/cmake/Version.cmake') debVer = "%s.%s.%s-%s" % (fmodVer[0], fmodVer[1], fmodVer[2], todays_build_tag()) print "Marking new FMOD version:", debVer msg = 'New release: Doomsday Engine build %i.' % builder.Event( ).number() os.system( 'rm -f debian/changelog && dch --check-dirname-level 0 --create --package doomsday-fmod -v %s "%s"' % (debVer, msg)) os.system('dch --release ""') else: changes.generate('html') changes.generate('xml')
def sign_packages(): """Sign all packages in the latest build.""" ev = builder.Event(latestAvailable=True) print "Signing build %i." % ev.number() for fn in os.listdir(ev.path()): if fn.endswith('.exe') or fn.endswith('.dmg') or fn.endswith('.deb'): # Make a signature for this. os.system("gpg --output %s -ba %s" % (ev.file_path(fn) + '.sig', ev.file_path(fn)))
def write_index_html(tag): ev = builder.Event(tag) f = file(ev.file_path('index.html'), 'wt') print >> f, "<html>" print >> f, "<head><title>Build %i</title></head>" % ev.number() print >> f, "<body>" print >> f, "<h1>Build %i</h1>" % ev.number() print >> f, ev.html_description(False) print >> f, "</body>" print >> f, "</html>"
def generate_wiki(): """Automatically generate wiki pages.""" git_pull() sys.path += ['/Users/jaakko/Scripts'] import dew dew.login() # Today's event data. ev = builder.Event(latestAvailable=True) if ev.release_type() == 'stable': dew.submitPage('Latest Doomsday release', '#REDIRECT [[Doomsday version %s]]' % ev.version()) dew.logout()
def create_build_event(): """Creates and tags a new build for with today's number.""" print 'Creating a new build event.' git_pull() # Identifier/tag for today's build. todaysBuild = todays_build_tag() # Tag the source with the build identifier. git_tag(todaysBuild) # Prepare the build directory. ev = builder.Event(todaysBuild) ev.clean() update_changes()
def todays_platform_release(): """Build today's release for the current platform.""" print "Building today's build." ev = builder.Event() git_pull() git_checkout(ev.tag() + builder.config.TAG_MODIFIER) # We'll copy the new files to the build dir. os.chdir(builder.config.DISTRIB_DIR) oldFiles = DirState('releases', subdirs=False) try: print 'platform_release.py...' run_python2("platform_release.py > %s 2> %s" % \ ('buildlog.txt', 'builderrors.txt')) except Exception, x: print 'Error during platform_release:', x
def todays_platform_release(): """Build today's release for the current platform.""" print("Building today's build.") ev = builder.Event() git_pull() git_checkout(ev.tag() + builder.config.TAG_MODIFIER) # We'll copy the new files to the build dir. os.chdir(builder.config.DISTRIB_DIR) oldFiles = DirState('releases', subdirs=False) try: print('platform_release.py...') run_python3("platform_release.py > %s 2> %s" % \ ('buildlog.txt', 'builderrors.txt')) except Exception as x: print('Error during platform_release:', x) for n in DirState('releases', subdirs=False).list_new_files(oldFiles): # Copy any new files. remote_copy(os.path.join('releases', n), ev.file_path(n)) if builder.config.APT_REPO_DIR: # Copy also to the appropriate apt directory. arch = 'i386' if '_amd64' in n: arch = 'amd64' remote_copy(os.path.join('releases', n), os.path.join(builder.config.APT_REPO_DIR, builder.config.APT_DIST + \ '/main/binary-%s' % arch, n)) # Also the build logs. remote_copy('buildlog.txt', ev.file_path('doomsday-out-%s.txt' % sys_id())) remote_copy('builderrors.txt', ev.file_path('doomsday-err-%s.txt' % sys_id())) #if 'linux' in sys_id(): # remote_copy('dsfmod/fmod-out-%s.txt' % sys_id(), ev.file_path('fmod-out-%s.txt' % sys_id())) # remote_copy('dsfmod/fmod-err-%s.txt' % sys_id(), ev.file_path('fmod-err-%s.txt' % sys_id())) git_checkout(builder.config.BRANCH)
def create_build_event(): """Creates and tags a new build for with today's number.""" print 'Creating a new build event.' git_pull() # Identifier/tag for today's build. todaysBuild = todays_build_tag() # Tag the source with the build identifier. git_tag(todaysBuild) # Prepare the build directory. ev = builder.Event(todaysBuild) ev.clean() # Save the version number and release type. import build_version build_version.find_version(quiet=True) print >> file(ev.file_path('version.txt'), 'wt'), \ build_version.DOOMSDAY_VERSION_FULL print >> file(ev.file_path('releaseType.txt'), 'wt'), \ build_version.DOOMSDAY_RELEASE_TYPE update_changes()
def build_source_package(): """Builds the source tarball and a Debian source package.""" update_debian_changelog() git_pull() ev = builder.Event(latestAvailable=True) print "Creating source tarball for build %i." % ev.number() # Check distribution. system_command( "lsb_release -a | perl -n -e 'm/Codename:\s(.+)/ && print $1' > /tmp/distroname" ) hostDistro = file('/tmp/distroname', 'rt').read() distros = ['xenial', 'bionic'] for distro in distros: os.chdir(os.path.join(builder.config.DISTRIB_DIR)) remkdir('srcwork') os.chdir('srcwork') pkgName = 'doomsday' if ev.release_type() == 'stable': print 'Stable packages will be prepared' system_command('deng_package_source.sh stable %i %s' % (ev.number(), ev.version_base())) pkgName += '-stable' else: system_command('deng_package_source.sh unstable %i %s' % (ev.number(), ev.version_base())) for fn in os.listdir('.'): if fn[:9] == 'doomsday-' and fn[ -7:] == '.tar.gz' and ev.version_base() in fn: remote_copy(fn, ev.file_path(fn)) break # Create a source Debian package and upload it to Launchpad. pkgVer = '%s.%i+%s' % (ev.version_base(), ev.number(), distro) pkgDir = pkgName + '-%s' % pkgVer print "Extracting", fn system_command('tar xzf %s' % fn) print "Renaming", fn[:-7], 'to', pkgDir + '.orig' os.rename(fn[:-7], pkgDir + '.orig') origName = pkgName + '_%s' % ev.version_base() + '.orig.tar.gz' print "Symlink to", origName system_command('ln %s %s' % (fn, origName)) print "Extracting", fn system_command('tar xzf %s' % fn) print "Renaming", fn[:-7], 'to', pkgDir os.rename(fn[:-7], pkgDir) os.chdir(pkgDir) system_command('echo "" | dh_make --yes -s -c gpl2 --file ../%s' % fn) os.chdir('debian') for fn in os.listdir('.'): if fn[-3:].lower() == '.ex': os.remove(fn) os.remove('README.Debian') os.remove('README.source') def gen_changelog(src, dst, extraSub=''): system_command( "sed 's/%s-build%i/%s/;%s' %s > %s" % (ev.version_base(), ev.number(), pkgVer, extraSub, src, dst)) # Figure out the name of the distribution. dsub = '' if distro != hostDistro: dsub = 's/) %s;/) %s;/' % (hostDistro, distro) if pkgName != 'doomsday': if dsub: dsub += ';' dsub += 's/^doomsday /%s /' % pkgName gen_changelog('../../../debian/changelog', 'changelog', dsub) system_command( "sed 's/${Arch}/i386 amd64/;s/${Package}/%s/' ../../../debian/control.template > control" % pkgName) system_command( "sed 's/`..\/build_number.py --print`/%i/;s/..\/..\/doomsday/..\/doomsday/;s/APPNAME := doomsday/APPNAME := %s/' ../../../debian/rules > rules" % (ev.number(), pkgName)) os.chdir('..') system_command('debuild -S') os.chdir('..') system_command('dput ppa:sjke/doomsday %s_%s_source.changes' % (pkgName, pkgVer))
def publish_packages(): """Publish all packages to SourceForge.""" ev = builder.Event(latestAvailable=True) print "Publishing build %i." % ev.number() system_command('deng_copy_build_to_sourceforge.sh "%s"' % ev.path())
def write_report_html(tag): ev = builder.Event(tag) write_html_page(ev.file_path('index.html'), 'Build %i' % ev.number(), ev.html_description(False))
def build_source_package(): """Builds the source tarball and a Debian source package.""" update_debian_changelog() git_pull() ev = builder.Event(latestAvailable=True) print("Creating source tarball for build %i." % ev.number()) # Check distribution. system_command( "lsb_release -a | perl -n -e 'm/Codename:\s(.+)/ && print $1' > /tmp/distroname" ) hostDistro = open('/tmp/distroname', 'rt').read() # Two of the most recent LTS releases, and the very latest release. # - bionic: 18.04 LTS # - focal: 20.04 LTS # - groovy: latest distros = ['bionic', 'focal', 'groovy'] for distro in distros: for pkgName in ['doomsday', 'doomsday-server']: isServerOnly = pkgName.endswith('-server') os.chdir(os.path.join(builder.config.DISTRIB_DIR)) remkdir('srcwork') os.chdir('srcwork') if ev.release_type() == 'stable': print('Stable packages will be prepared') system_command('deng_package_source.sh stable %i %s' % (ev.number(), ev.version_base())) pkgName += '-stable' else: system_command('deng_package_source.sh unstable %i %s' % (ev.number(), ev.version_base())) for fn in os.listdir('.'): if fn[:9] == 'doomsday-' and fn[ -7:] == '.tar.gz' and ev.version_base() in fn: remote_copy(fn, ev.file_path(fn)) break # Create a source Debian package and upload it to Launchpad. pkgVer = '%s.%i+%s' % (ev.version_base(), ev.number(), distro) pkgDir = pkgName + '-%s' % pkgVer print("Extracting", fn) system_command('tar xzf %s' % fn) print("Renaming", fn[:-7], 'to', pkgDir + '.orig') os.rename(fn[:-7], pkgDir + '.orig') print("Renamed.") origName = pkgName + '_%s' % ev.version_base() + '.orig.tar.gz' print("Symlink to", origName) system_command('ln -s %s %s' % (fn, origName)) print("Extracting", fn) system_command('tar xzf %s' % fn) print("Renaming", fn[:-7], 'to', pkgDir) os.rename(fn[:-7], pkgDir) print("Renamed.") os.chdir(pkgDir) #system_command('echo "" | dh_make --yes -s -c gpl2 --file ../%s' % fn) os.chdir('debian') for fn in os.listdir('.'): if fn[-3:].lower() == '.ex': os.remove(fn) #os.remove('README.Debian') #os.remove('README.source') def gen_changelog(src, dst, extraSub=''): system_command("sed 's/%s-build%i/%s/;%s' %s > %s" % (ev.version_base(), ev.number(), pkgVer, extraSub, src, dst)) # Figure out the name of the distribution. dsub = '' if distro != hostDistro: dsub = 's/) %s;/) %s;/' % (hostDistro, distro) if pkgName != 'doomsday': if dsub: dsub += ';' dsub += 's/^doomsday /%s /' % pkgName dengDir = builder.config.DOOMSDAY_DIR gen_changelog(os.path.join(dengDir, 'debian/changelog'), 'changelog', dsub) control = open( os.path.join(dengDir, 'doomsday/build/debian/control')).read() control = control.replace('${Arch}', 'i386 amd64') control = control.replace('${Package}', pkgName) control = control.replace('${DEBFULLNAME}', os.getenv('DEBFULLNAME')) control = control.replace('${DEBEMAIL}', os.getenv('DEBEMAIL')) extraCMakeOptions = "" if isServerOnly: for guiDep in [ 'libsdl2-dev', 'libsdl2-mixer-dev', 'libxrandr-dev', 'libxxf86vm-dev', 'libqt5opengl5-dev', 'libqt5x11extras5-dev', 'libfluidsynth-dev' ]: control = control.replace(guiDep + ', ', '') control = control.replace( 'port with enhanced graphics', 'port with enhanced graphics (server only)') extraCMakeOptions = 's/COTIRE=OFF/COTIRE=OFF -DDENG_ENABLE_GUI=OFF/' open('control', 'w').write(control) system_command( "sed 's/${BuildNumber}/%i/;s/..\/..\/doomsday/..\/doomsday/;" "s/APPNAME := doomsday/APPNAME := %s/;%s' " "%s/doomsday/build/debian/rules > rules" % (ev.number(), pkgName, extraCMakeOptions, dengDir)) os.chdir('..') system_command('debuild -S') os.chdir('..') system_command('dput ppa:sjke/doomsday %s_%s_source.changes' % (pkgName, pkgVer))