def build_occplug(): header("BUILDING OCCPLUG") config.refresh() config.rebase('TEMP', '@TEMP_ROOT@/occPlug') remove_dir(config.get('TEMP')) src_ext = '/tools/occplug' dist_ext = '/distribution/deb-pkg' #srcpath = concat([config.get('TEMP'), '/src', src_ext]) #mkdir(srcpath) #distpath = concat([config.get('TEMP'), '/src', dist_ext]) #mkdir(distpath) config.set('OCCPLUG_DISTRIBUTION', concat([config.get('SVN'), dist_ext])) #config.rebase('SOURCE_OCCPLUG', srcpath) make_destdirs() remove_dir(concat([config.get('TEMP'), '/', config.get('PACKAGE_NAME')])) # remove_and_create_dir(config.get('TEMP')) # remove_and_create_dir(config.get('DEST_OCCPLUG')) print 'SOURCE OCCPLUG: %s' % config.get('SOURCE_OCCPLUG') #checkout_to(concat([config.get('SVN_TRUNK'), src_ext]), config.get('SOURCE_OCCPLUG')) #checkout_to(concat([config.get('SVN_TRUNK'), dist_ext]), distpath) zipfile = 'ErrorList-1.9-bin.zip' jarfile = 'ErrorList.jar' with pushd(): cd(config.get('SOURCE_OCCPLUG')) cmd(build_command(['wget', config.get('ERRORLIST_URL')])) unzip_file_into_dir(zipfile, config.get('DEST_OCCPLUG_JARS')) # Move the ErrorList straight to the destination; we can build against it there. #cmd(build_command(['mv', jarfile, config.get('DEST_OCCPLUG')])) cmd( build_command([ 'ant', '-Djedit.install.dir=/usr/share/jedit', concat(['-Dinstall.dir=', config.get('DEST_OCCPLUG_JARS')]), concat(['-Dbuild.dir=', config.get('TEMP')]), concat(['-lib ', config.get('DEST_OCCPLUG_JARS')]) ])) # Insert the ubuntu.props file into the .jar with pushd(): cd(config.get('OCCPLUG_DISTRIBUTION')) cmd( build_command([ 'jar -uf', concat([config.get('DEST_OCCPLUG_JARS'), '/', 'OccPlug.jar']), 'ubuntu.props' ])) config.set('BUILD_ARCHITECTURE', 'all')
def build_occplug(): header("BUILDING OCCPLUG") config.refresh() config.rebase('TEMP', '@TEMP_ROOT@/occPlug') remove_dir(config.get('TEMP')) src_ext = '/tools/occplug' dist_ext = '/distribution/deb-pkg' #srcpath = concat([config.get('TEMP'), '/src', src_ext]) #mkdir(srcpath) #distpath = concat([config.get('TEMP'), '/src', dist_ext]) #mkdir(distpath) config.set('OCCPLUG_DISTRIBUTION', concat([config.get('SVN'), dist_ext])) #config.rebase('SOURCE_OCCPLUG', srcpath) make_destdirs() remove_dir(concat([config.get('TEMP'), '/', config.get('PACKAGE_NAME')])) # remove_and_create_dir(config.get('TEMP')) # remove_and_create_dir(config.get('DEST_OCCPLUG')) print 'SOURCE OCCPLUG: %s' % config.get('SOURCE_OCCPLUG') #checkout_to(concat([config.get('SVN_TRUNK'), src_ext]), config.get('SOURCE_OCCPLUG')) #checkout_to(concat([config.get('SVN_TRUNK'), dist_ext]), distpath) zipfile = 'ErrorList-1.9-bin.zip' jarfile = 'ErrorList.jar' with pushd(): cd(config.get('SOURCE_OCCPLUG')) cmd(build_command(['wget', config.get('ERRORLIST_URL')])) unzip_file_into_dir(zipfile, config.get('DEST_OCCPLUG_JARS')) # Move the ErrorList straight to the destination; we can build against it there. #cmd(build_command(['mv', jarfile, config.get('DEST_OCCPLUG')])) cmd(build_command(['ant', '-Djedit.install.dir=/usr/share/jedit', concat(['-Dinstall.dir=', config.get('DEST_OCCPLUG_JARS')]), concat(['-Dbuild.dir=', config.get('TEMP')]), concat(['-lib ', config.get('DEST_OCCPLUG_JARS')]) ])) # Insert the ubuntu.props file into the .jar with pushd(): cd(config.get('OCCPLUG_DISTRIBUTION')) cmd(build_command([ 'jar -uf', concat([config.get('DEST_OCCPLUG_JARS'), '/', 'OccPlug.jar']), 'ubuntu.props' ])) config.set('BUILD_ARCHITECTURE', 'all')
def dependencies(): config.rebase('DEPENDS', config.get(concat([config.get('TOOLCHAIN'), '-', config.get('TARGET'), '-', config.get('WRAPPER'), '-deps']))) header("DEPS NOW: %s" % config.get('DEPENDS'))
def dependencies(): config.rebase( 'DEPENDS', config.get( concat([ config.get('TOOLCHAIN'), '-', config.get('TARGET'), '-', config.get('WRAPPER'), '-deps' ]))) header("DEPS NOW: %s" % config.get('DEPENDS'))
def build_native_tvm(): header("SETTING NATIVE TVM BUILD OPTIONS") config.rebase('TOOLCHAIN', 'tvm') config.rebase('TARGET', 'posix') config.rebase('WRAPPER', 'posix') config.set('PACKAGE_DESCRIPTION', 'occam-pi on the Transterpreter for POSIX platforms.')
def build_native_kroc(): header("SETTING NATIVE BUILD OPTIONS") config.rebase('TOOLCHAIN', 'kroc') config.rebase('TARGET', 'posix') config.rebase('WRAPPER', 'posix') config.set('PACKAGE_DESCRIPTION', 'A native occam-pi for POSIX platforms.')
def build_avr(): header("SETTING AVR BUILD OPTIONS") config.rebase('TOOLCHAIN', 'tvm') config.rebase('TARGET', 'avr') config.rebase('WRAPPER', 'arduino') config.set('PACKAGE_DESCRIPTION', 'occam for the AVR/Arduino.')
def with_lib_path(path): header('SETTING LIB PATH TO %s' % path) config.rebase('SVN', path)
def build_arch(arch): header("SETTING BUILD ARCH TO %s" % arch) config.rebase('BUILD_ARCHITECTURE', arch)
def ubuntu_version(name): header("UPLOADING UBUNTU VERSION: %s" % name) config.rebase('UVN', name)
def upload(): header("UPLOADING FILES") print("VERSION: %s" % config.get('UVN')) if config.get('UVN') == 'NO_NAME': header("SET UBUNTU VERSION WITH --ubuntu-version") sys.exit() with pushd(): root = config.get('TEMP_ROOT') # Remove old packages with pushd(): cd(root) remove_dir('PACKAGES') cd(root) mkdir('PACKAGES/binary') config.rebase('VERSION', getUTC()) config.refresh() header("SHIPPING VERSION: %s" % config.get('VERSION')) header("PACKAGING AVR") build_avr() build() dependencies() copy_arduino_config() copy_arduino_build() deb() header("PACKAGING NATIVE KROC") build_native_kroc() dependencies() copy_native_build() deb() header("PACKAGING NATIVE TVM") build_native_tvm() dependencies() copy_native_tvm_build() deb() header("PACKAGING META") meta_deb() arch = config.get('BUILD_ARCHITECTURE') header("PACKAGING OCCPLUG") build_occplug() occplug_deb() config.rebase('BUILD_ARCHITECTURE', arch) META = concat([ 'occam-pi', '_', config.get('VERSION'), '_', config.get('BUILD_ARCHITECTURE'), '.deb' ]) KROC = concat([ config.get('STEM'), '-kroc-posix-posix', '_', config.get('VERSION'), '_', config.get('BUILD_ARCHITECTURE'), '.deb' ]) TVM = concat([ config.get('STEM'), '-tvm-posix-posix', '_', config.get('VERSION'), '_', config.get('BUILD_ARCHITECTURE'), '.deb' ]) AVR = concat([ config.get('STEM'), '-tvm-avr-arduino', '_', config.get('VERSION'), '_', config.get('BUILD_ARCHITECTURE'), '.deb' ]) PLUG = concat([ config.get('STEM'), '-occplug', '_', config.get('VERSION'), '_', 'all', '.deb' ]) with pushd(): cd(root) copy_files(META, '.', 'PACKAGES/binary') with pushd(): cd(root + '/kroc-posix-posix') copy_files(KROC, '.', '../PACKAGES/binary') with pushd(): cd(root + '/tvm-posix-posix') copy_files(TVM, '.', '../PACKAGES/binary') with pushd(): cd(root + '/tvm-avr-arduino') copy_files(AVR, '.', '../PACKAGES/binary') with pushd(): cd(root + '/occPlug') copy_files(PLUG, '.', '../PACKAGES/binary') with pushd(): cd(root + '/PACKAGES') cmd( build_command([ 'dpkg-scanpackages', 'binary', '/dev/null', '|', 'gzip', '-9c', '>', 'binary/Packages.gz' ])) with pushd(): cd(root + '/PACKAGES/binary')
def with_temp_dir(path): config.refresh() header('SETTING TEMP DIR TO %s/%s' % (path, config.get('BUILD_ARCHITECTURE'))) config.rebase('TEMP_ROOT', '%s/%s' % (path, config.get('BUILD_ARCHITECTURE')))
def upload(): header("UPLOADING FILES") print("VERSION: %s" % config.get('UVN')) if config.get('UVN') == 'NO_NAME': header("SET UBUNTU VERSION WITH --ubuntu-version") sys.exit() with pushd(): root = config.get('TEMP_ROOT') # Remove old packages with pushd(): cd(root) remove_dir('PACKAGES') cd(root) mkdir('PACKAGES/binary') config.rebase('VERSION', getUTC()) config.refresh() header("SHIPPING VERSION: %s" % config.get('VERSION')) header("PACKAGING AVR") build_avr() build() dependencies() copy_arduino_config() copy_arduino_build() deb() header("PACKAGING NATIVE KROC") build_native_kroc() dependencies() copy_native_build() deb() header("PACKAGING NATIVE TVM") build_native_tvm() dependencies() copy_native_tvm_build() deb() header("PACKAGING META") meta_deb() arch = config.get('BUILD_ARCHITECTURE') header("PACKAGING OCCPLUG") build_occplug() occplug_deb() config.rebase('BUILD_ARCHITECTURE', arch) META = concat(['occam-pi', '_', config.get('VERSION'), '_', config.get('BUILD_ARCHITECTURE'), '.deb']) KROC = concat([config.get('STEM'), '-kroc-posix-posix', '_', config.get('VERSION'), '_', config.get('BUILD_ARCHITECTURE'), '.deb']) TVM = concat([config.get('STEM'), '-tvm-posix-posix', '_', config.get('VERSION'), '_', config.get('BUILD_ARCHITECTURE'), '.deb']) AVR = concat([config.get('STEM'), '-tvm-avr-arduino', '_', config.get('VERSION'), '_', config.get('BUILD_ARCHITECTURE'), '.deb']) PLUG = concat([config.get('STEM'), '-occplug', '_', config.get('VERSION'), '_', 'all', '.deb']) with pushd(): cd(root) copy_files(META, '.', 'PACKAGES/binary') with pushd(): cd(root + '/kroc-posix-posix') copy_files(KROC, '.', '../PACKAGES/binary') with pushd(): cd(root + '/tvm-posix-posix') copy_files(TVM, '.', '../PACKAGES/binary') with pushd(): cd(root + '/tvm-avr-arduino') copy_files(AVR, '.', '../PACKAGES/binary') with pushd(): cd(root + '/occPlug') copy_files(PLUG, '.', '../PACKAGES/binary') with pushd(): cd(root + '/PACKAGES') cmd(build_command(['dpkg-scanpackages', 'binary', '/dev/null', '|', 'gzip', '-9c', '>', 'binary/Packages.gz'])) with pushd(): cd(root + '/PACKAGES/binary')