Skip to content

Commit

Permalink
Merge branch 'master' of ssh://deng.git.sourceforge.net/gitroot/deng/…
Browse files Browse the repository at this point in the history
…deng
  • Loading branch information
danij-deng committed Jan 15, 2012
2 parents 813a395 + 8fd36a7 commit 8b5f07c
Show file tree
Hide file tree
Showing 22 changed files with 554 additions and 389 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ macx_release_build
server-runtime
client-runtime
Zcustom.conf
.web.manifest
108 changes: 106 additions & 2 deletions distrib/autobuild.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#!/usr/bin/python
# coding=utf-8

# Script for managing automated build events.
#
# Script for performing automated build events.
# http://dengine.net/dew/index.php?title=Automated_build_system
#
# The Build Pilot (pilot.py) is responsible for task distribution
# and management.

import sys
import os
import subprocess
import shutil
import time
import string
import glob
import builder
import pickle
import zipfile
from builder.git import *
from builder.utils import *

Expand Down Expand Up @@ -246,6 +252,101 @@ def dir_cleanup():
print 'Cleanup done.'


def system_command(cmd):
result = subprocess.call(cmd, shell=True)
if result != 0:
raise Exception("Error from " + cmd)


def generate_apidoc():
"""Run Doxygen to generate all API documentation."""
os.chdir(os.path.join(builder.config.DISTRIB_DIR, '../doomsday/engine'))
git_pull()

print "\n-=-=- PUBLIC API DOCS -=-=-"
system_command('doxygen api.doxy >/dev/null')

print "\n-=-=- INTERNAL WIN32 DOCS -=-=-"
system_command('doxygen engine-win32.doxy >/dev/null')

print "\n-=-=- INTERNAL MAC/UNIX DOCS -=-=-"
system_command('doxygen engine-mac.doxy >/dev/null')

print "\n-=-=- JDOOM DOCS -=-=-"
os.chdir(os.path.join(builder.config.DISTRIB_DIR, '../doomsday/plugins/jdoom'))
system_command('doxygen jdoom.doxy >/dev/null')

print "\n-=-=- JHERETIC DOCS -=-=-"
os.chdir(os.path.join(builder.config.DISTRIB_DIR, '../doomsday/plugins/jheretic'))
system_command('doxygen jheretic.doxy >/dev/null')

print "\n-=-=- JHEXEN DOCS -=-=-"
os.chdir(os.path.join(builder.config.DISTRIB_DIR, '../doomsday/plugins/jhexen'))
system_command('doxygen jhexen.doxy >/dev/null')


def web_path():
return os.path.join(builder.config.DISTRIB_DIR, '..', 'web')


def web_manifest_filename():
return os.path.join(builder.config.DISTRIB_DIR, '..', '.web.manifest')


def web_save(state):
pickle.dump(state, file(web_manifest_filename(), 'wb'), pickle.HIGHEST_PROTOCOL)


def web_init():
print 'Initializing web update manifest.'
web_save(DirState(web_path()))


def web_update():
print 'Checking for web file changes...'
git_pull()

oldState = pickle.load(file(web_manifest_filename(), 'rb'))
state = DirState(web_path())
updated = state.list_new_files(oldState)
removed = state.list_removed(oldState)

# Save the updated state.
web_save(state)

# Is there anything to do?
if not updated and not removed[0] and not removed[1]:
print 'Everything up-to-date.'
return

# Compile the update package.
print 'Updated:', updated
print 'Removed:', removed
arcFn = os.path.join(builder.config.DISTRIB_DIR, '..',
'web_update_%s.zip' % time.strftime('%Y%m%d-%H%M%S'))
arc = zipfile.ZipFile(arcFn, 'w')
for up in updated:
arc.write(os.path.join(web_path(), up), 'updated/' + up)
if removed[0] or removed[1]:
tmpFn = '_removed.tmp'
tmp = file(tmpFn, 'wt')
for n in removed[0]:
print >> tmp, 'rm', n
for d in removed[1]:
print >> tmp, 'rmdir', d
tmp.close()
arc.write(tmpFn, 'removed.txt')
os.remove(tmpFn)
arc.close()

# Deliver the update to the website.
print 'Delivering', arcFn
system_command('scp %s dengine@dengine.net:www/incoming/' % arcFn)

# No need to keep a local copy.
os.remove(arcFn)


def show_help():
"""Prints a description of each command."""
for cmd in sorted_commands():
Expand All @@ -271,6 +372,9 @@ def sorted_commands():
'xmlfeed': update_xml_feed,
'purge': purge_obsolete,
'cleanup': dir_cleanup,
'apidoc': generate_apidoc,
'web_init': web_init,
'web_update': web_update,
'help': show_help
}

Expand Down
54 changes: 54 additions & 0 deletions distrib/builder/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,60 @@
import build_number
import config

def omit_path(path, omitted):
if path.startswith(omitted):
path = path[len(omitted):]
if path[0] == '/': path = path[1:]
return path


class FileState:
def __init__(self, isDir, mtime):
if isDir:
self.type = 'dir'
else:
self.type = 'file'
self.mtime = int(mtime)

def __repr__(self):
return "(%s, %i)" % (self.type, self.mtime)


class DirState:
def __init__(self, path=None):
self.files = {} # path -> FileState
if path:
self.update(path, path)

def update(self, path, omitted=None):
for name in os.listdir(path):
if name[0] == '.': continue
fullPath = os.path.join(path, name)
self.files[omit_path(fullPath, omitted)] = \
FileState(os.path.isdir(fullPath), os.stat(fullPath).st_mtime)
if os.path.isdir(fullPath):
self.update(fullPath, omitted)

def list_new_files(self, oldState):
new = []
for path in self.files:
if self.files[path].type == 'dir': continue
if path not in oldState.files or self.files[path].mtime > oldState.files[path].mtime:
new.append(path)
return new

def list_removed(self, oldState):
"""Returns a tuple: (list of removed files, list of removed dirs)"""
rmFiles = []
rmDirs = []
for oldPath in oldState.files:
if oldPath not in self.files:
if oldState.files[oldPath].type == 'dir':
rmDirs.append(oldPath)
else:
rmFiles.append(oldPath)
return (rmFiles, rmDirs)


def sys_id():
return "%s-%s" % (sys.platform, platform.architecture()[0])
Expand Down
58 changes: 29 additions & 29 deletions distrib/pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# coding=utf-8
#
# The Doomsday Build Pilot
# (c) 2011 Jaakko Keränen <jaakko.keranen@iki.fi>
# (c) 2011-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -23,6 +23,9 @@
## tasks for the builder client systems. It listens on a TCP port for incoming
## queries and actions. On the clients the pilot is run periodically by cron,
## and any new tasks are carried out.
##
## The pilot's responsibility is distributed task management; the autobuild
## script carries out the actual tasks.

import sys
import os
Expand Down Expand Up @@ -78,6 +81,9 @@ def main():
finally:
endPilotInstance()

def msg(s):
print >> sys.stderr, s


def isServer():
return 'server' in sys.argv
Expand Down Expand Up @@ -120,15 +126,25 @@ def pidFileName():
return 'client.pid'


def isStale(fn):
"""Files are considered stale after some time has passed."""
age = time.time() - os.stat(fn).st_ctime
if age > 4*60*60:
msg(fn + ' is stale, ignoring it.')
return True
return False


def startNewPilotInstance():
"""A new pilot instance can only be started if one is not already running
on the system. If an existing instance is detected, this one will quit
immediately."""
# Check for an existing pid file.
pid = os.path.join(homeDir(), pidFileName())
if os.path.exists(pid):
# Cannot start right now -- will be retried later.
sys.exit(0)
if not isStale(pid):
# Cannot start right now -- will be retried later.
sys.exit(0)
print >> file(pid, 'w'), str(os.getpid())


Expand Down Expand Up @@ -181,7 +197,7 @@ def handle(self):
raise Exception("Requests must be of type 'dict'")
self.doRequest()
except Exception, x:
print 'Request failed:', x
msg('Request failed: ' + str(x))
response = { 'result': 'error', 'error': str(x) }
self.respond(response)

Expand Down Expand Up @@ -267,53 +283,37 @@ def doTask(task):
return True

if task == 'tag_build':
print "TASK: TAG NEW BUILD"
msg("TAG NEW BUILD")
return autobuild('create')

elif task == 'deb_changes':
print "TASK: UPDATE .DEB CHANGELOG"
msg("UPDATE .DEB CHANGELOG")
return autobuild('debchanges')

elif task == 'build':
print "TASK: BUILD RELEASE"
msg("BUILD RELEASE")
return autobuild('platform_release')

elif task == 'publish':
print "TASK: PUBLISH"
msg("PUBLISH")
systemCommand('deng_copy_build_to_sourceforge.sh')

elif task == 'apt_refresh':
print "TASK: APT REPOSITORY REFRESH"
msg("APT REPOSITORY REFRESH")
return autobuild('apt')

elif task == 'update_feed':
print "TASK: UPDATE FEED"
msg("UPDATE FEED")
autobuild('feed')
autobuild('xmlfeed')

elif task == 'purge':
print "TASK: PURGE"
msg("PURGE")
return autobuild('purge')

elif task == 'generate_apidoc':
print "TASK: GENERATE API DOCUMENTATION"
os.chdir(os.path.join(pilotcfg.DISTRIB_DIR, '../doomsday/engine'))
systemCommand('git pull')
print "\nPUBLIC API DOCS"
systemCommand('doxygen api.doxy >/dev/null')
print "\nINTERNAL WIN32 DOCS"
systemCommand('doxygen engine-win32.doxy >/dev/null')
print "\nINTERNAL MAC/UNIX DOCS"
systemCommand('doxygen engine-mac.doxy >/dev/null')
print "\nJDOOM DOCS"
os.chdir(os.path.join(pilotcfg.DISTRIB_DIR, '../doomsday/plugins/jdoom'))
systemCommand('doxygen jdoom.doxy >/dev/null')
print "\nJHERETIC DOCS"
os.chdir(os.path.join(pilotcfg.DISTRIB_DIR, '../doomsday/plugins/jheretic'))
systemCommand('doxygen jheretic.doxy >/dev/null')
print "\nJHEXEN DOCS"
os.chdir(os.path.join(pilotcfg.DISTRIB_DIR, '../doomsday/plugins/jhexen'))
systemCommand('doxygen jhexen.doxy >/dev/null')
msg("GENERATE API DOCUMENTATION")
return autobuild('apidoc')

return True

Expand Down
18 changes: 12 additions & 6 deletions doomsday/engine/api/dd_infine.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,24 @@ typedef ident_t finaleid_t;
* @ingroup infine apiFlags
*/
///@{
#define FF_LOCAL 0x1 /// Local scripts are executed client-side.
#define FF_LOCAL 0x1 ///< Local scripts are executed client-side.
///@}

/**
* Execute a set of Finale commands.
* @param script One or more commands to be executed.
* @param flags @ref finaleFlags.
* @param setupCmds One or more commands to be executed immediately during
* finale setup. Can be used to configure the default page
* state.
* @param script One or more commands to be executed.
* @param flags @ref finaleFlags.
*/
finaleid_t FI_Execute2(const char* script, int flags, const char* setupCmds);

/**
* Execute a set of Finale commands.
* @param script One or more commands to be executed.
* @param flags @ref finaleFlags.
* @param setupCmds One or more commands to be executed immediately during
* finale setup. Can be used to configure the default page
* state.
*/
finaleid_t FI_Execute(const char* script, int flags);

/**
Expand Down
6 changes: 2 additions & 4 deletions doomsday/engine/api/dd_share.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ extern "C" {
#include "dd_gl.h"
#include "dd_ui.h"
#include "dd_infine.h"
#include "../portable/include/p_think.h"
#include "../portable/include/def_share.h"
#include "def_share.h"
#include "thinker.h"

/** @file
* @todo dd_version.h is not officially a public header file!
* @todo def_share.h is not officially a public header file!
* @todo p_think.h is not officially a public header file!
*/

//------------------------------------------------------------------------
Expand Down
5 changes: 0 additions & 5 deletions doomsday/engine/api/dd_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,6 @@ typedef enum {

#define VALID_RESOURCE_CLASS(n) ((n) >= RESOURCECLASS_FIRST && (n) < RESOURCECLASS_COUNT)

typedef struct trigger_s {
timespan_t duration;
timespan_t accum;
} trigger_t;

#ifndef __BYTEBOOL__
#define __BYTEBOOL__
# ifdef __cplusplus
Expand Down

0 comments on commit 8b5f07c

Please sign in to comment.