def main(): if not e('${SKIP_CHECKOUT}'): cwd = os.getcwd() checkout_only = e('${CHECKOUT_ONLY}') checkout_exclude = e('${CHECKOUT_EXCLUDE}') if checkout_only: checkout_only = checkout_only.split(',') if checkout_exclude: checkout_exclude = checkout_exclude.split(',') for i in dsl['repos']: if checkout_only and i['name'] not in checkout_only: continue if checkout_exclude and i['name'] in checkout_exclude: continue info('Checkout: {0} -> {1} from {2}', i['name'], i['path'], i['url']) debug('Repository URL: {0}', i['url']) debug('Local branch: {0}', i['branch']) checkout_repo(cwd, i) generate_manifest() setfile('${BE_ROOT}/.pulled', e('${PRODUCT}')) return 0
def install_files(): info('Copying installer files') setfile('${INSTUFS_DESTDIR}/etc/avatar.conf', template('${BUILD_CONFIG}/templates/avatar.conf')) if e("${UNATTENDED_CONFIG}"): sh('cp ${UNATTENDED_CONFIG} ${INSTUFS_DESTDIR}/etc/install.conf') sh('cp ${BUILD_CONFIG}/templates/cdrom/rc.conf ${INSTUFS_DESTDIR}/etc/')
def create_aux_files(dsl, dest): for aux in dsl.aux_files: if not os.path.exists(aux.source): continue if aux.get('template'): f = template(aux.source) else: f = readfile(aux.source) name = aux.name setfile('${dest}/${name}', f)
def obtain_jail_name(): global jailname for i in string.ascii_lowercase: user = e('${SUDO_USER}') if user: i = e('${i}-${user}') if sh('jls -q -n -j j${i}-p', log="/dev/null", nofail=True) != 0: jailname = e('j${i}') setfile(e('${OBJDIR}/jailname'), jailname) return error('No jail names available')
def prepare_jail(): basepath = e('${POUDRIERE_ROOT}/etc/poudriere.d/jails/${jailname}') sh('mkdir -p ${basepath}') if e('${USE_ZFS}'): setfile(e('${basepath}/fs'), e('${ZPOOL}${ZROOTFS}/jail')) setfile(e('${basepath}/method'), 'git') setfile(e('${basepath}/mnt'), e('${JAIL_DESTDIR}')) setfile(e('${basepath}/version'), e('${FREEBSD_RELEASE_VERSION}')) setfile(e('${basepath}/arch'), e('${BUILD_ARCH}')) sh("jail -U root -c name=${jailname} path=${JAIL_DESTDIR} command=/sbin/ldconfig -m /lib /usr/lib /usr/lib/compat" )
def make_iso_image(): setfile('${ISO_DESTDIR}/boot/loader.conf', template('${BUILD_CONFIG}/templates/cdrom/loader.conf')) setfile('${ISO_DESTDIR}/.mount.conf', template('${BUILD_CONFIG}/templates/cdrom/mount.conf')) sh('cp ${WORLD_DESTDIR}/boot/loader ${ISO_DESTDIR}/boot/loader') sh('cp ${WORLD_DESTDIR}/boot/device.hints ${ISO_DESTDIR}/boot/device.hints' ) sh('cp -r ${WORLD_DESTDIR}/boot/lua ${ISO_DESTDIR}/boot/') sh('cp -R ${WORLD_DESTDIR}/boot/defaults ${ISO_DESTDIR}/boot/defaults') # New-style isoboot image sh('${BUILD_ROOT}/build/tools/make_iso_image.sh ${CDROM_LABEL} ${output} ${WORLD_DESTDIR} ${ISO_DESTDIR}' ) sha256(output)
def main(): if not e('${SKIP_CHECKOUT}'): cwd = os.getcwd() for i in dsl['repos']: if e('${CHECKOUT_ONLY}'): if i['name'] not in e('${CHECKOUT_ONLY}').split(','): continue info('Checkout: {0} -> {1}', i['name'], i['path']) debug('Repository URL: {0}', i['url']) debug('Local branch: {0}', i['branch']) checkout_repo(cwd, i) generate_manifest() setfile('${BE_ROOT}/.pulled', e('${PRODUCT}')) return 0
def prepare_jail(): basepath = e('${POUDRIERE_ROOT}/etc/poudriere.d/jails/${jailname}') sh('mkdir -p ${basepath}') setfile(e('${basepath}/method'), 'git') setfile(e('${basepath}/mnt'), e('${JAIL_DESTDIR}')) setfile(e('${basepath}/version'), e('${FREEBSD_RELEASE_VERSION}')) setfile(e('${basepath}/arch'), e('${BUILD_ARCH}')) sh("jail -U root -c name=${jailname} path=${JAIL_DESTDIR} command=/sbin/ldconfig -m /lib /usr/lib /usr/lib/compat")
def make_iso_image(): setfile('${ISO_DESTDIR}/boot/loader.conf', template('${BUILD_CONFIG}/templates/cdrom/loader.conf')) setfile('${ISO_DESTDIR}/.mount.conf', template('${BUILD_CONFIG}/templates/cdrom/mount.conf')) sh('cp ${WORLD_DESTDIR}/boot/loader ${ISO_DESTDIR}/boot/loader') sh('cp ${WORLD_DESTDIR}/boot/device.hints ${ISO_DESTDIR}/boot/device.hints' ) sh('cp ${WORLD_DESTDIR}/boot/*.4th ${ISO_DESTDIR}/boot') sh('cp ${WORLD_DESTDIR}/boot/loader.rc ${ISO_DESTDIR}/boot/loader.rc') sh('cp ${WORLD_DESTDIR}/boot/loader.rc.local ${ISO_DESTDIR}/boot/loader.rc.local' ) sh('cp ${WORLD_DESTDIR}/boot/menu.rc ${ISO_DESTDIR}/boot/menu.rc') sh('cp -R ${WORLD_DESTDIR}/boot/defaults ${ISO_DESTDIR}/boot/defaults') # New-style isoboot image output_nogrub = output.replace('.iso', '-NOGRUB.iso') sh('${BUILD_ROOT}/build/tools/make_iso_image.sh ${CDROM_LABEL} ${output_nogrub} ${WORLD_DESTDIR} ${ISO_DESTDIR}' ) sha256(output_nogrub) # Old-style GRUB image sh('mkdir -p ${ISO_DESTDIR}/boot/grub') setfile('${ISO_DESTDIR}/boot/grub/grub.cfg', template('${BUILD_CONFIG}/templates/cdrom/grub.cfg')) sh('grub-mkrescue --xorriso=${BUILD_ROOT}/build/tools/xorriso.sh -o ${output} ${ISO_DESTDIR} -- -volid ${CDROM_LABEL}' ) sha256(output)
def make_iso_image(): setfile('${ISO_DESTDIR}/boot/loader.conf', template('${BUILD_CONFIG}/templates/cdrom/loader.conf')) setfile('${ISO_DESTDIR}/boot/grub/grub.cfg', template('${BUILD_CONFIG}/templates/cdrom/grub.cfg')) setfile('${ISO_DESTDIR}/.mount.conf', template('${BUILD_CONFIG}/templates/cdrom/mount.conf')) sh('cp ${WORLD_DESTDIR}/boot/device.hints ${ISO_DESTDIR}/boot/device.hints') sh('grub-mkrescue -o ${output} ${ISO_DESTDIR} -- -volid ${CDROM_LABEL}') sha256(output)
def main(): sh('mkdir -p ${WORLD_DESTDIR}/conf/base/etc') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/etc/local') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/var') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/mnt') sh('touch ${WORLD_DESTDIR}/etc/diskless') sh('cp -a ${WORLD_DESTDIR}/etc/ ${WORLD_DESTDIR}/conf/base/etc') sh('cp -a ${WORLD_DESTDIR}/usr/local/etc/ ${WORLD_DESTDIR}/conf/base/etc/local' ) sh('rm -rf ${WORLD_DESTDIR}/usr/local/etc') sh('ln -s /etc/local ${WORLD_DESTDIR}/usr/local/etc') sh('cp -a ${WORLD_DESTDIR}/var/ ${WORLD_DESTDIR}/conf/base/var') setfile('${WORLD_DESTDIR}/conf/base/var/md_size', '') setfile('${WORLD_DESTDIR}/conf/base/etc/md_size', '65535') setfile('${WORLD_DESTDIR}/conf/base/mnt/md_size', '8192') # Symlink /tmp to /var/tmp sh('rm -rf ${WORLD_DESTDIR}/tmp') sh('ln -s /var/tmp ${WORLD_DESTDIR}/tmp') # Make sure .rnd points to tmpfs. # Some daemons starting at boot time will try to write that file # because of $HOME/.rnd is the default path and HOME=/ defined in /etc/rc # See #23304 sh('ln -s /var/tmp/.rnd ${WORLD_DESTDIR}/.rnd') sh('touch ${WORLD_DESTDIR}/conf/base/var/tmp/.rnd') sh('ln -s -f /usr/local/bin/ntfs-3g ${WORLD_DESTDIR}/sbin/mount_ntfs')
def main(): sh('mkdir -p ${WORLD_DESTDIR}/conf/base/etc') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/var') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/mnt') sh('touch ${WORLD_DESTDIR}/etc/diskless') sh('cp -a ${WORLD_DESTDIR}/etc/ ${WORLD_DESTDIR}/conf/base/etc') sh('cp -a ${WORLD_DESTDIR}/var/ ${WORLD_DESTDIR}/conf/base/var') setfile('${WORLD_DESTDIR}/conf/base/var/md_size', '') setfile('${WORLD_DESTDIR}/conf/base/etc/md_size', '65535') setfile('${WORLD_DESTDIR}/conf/base/mnt/md_size', '8192')
def create_poudriere_config(): sh('mkdir -p ${DISTFILES_CACHE}') setfile('${POUDRIERE_ROOT}/etc/poudriere.conf', template('${BUILD_CONFIG}/templates/poudriere.conf', { 'ports_repo': config['repos'].where(name='ports')['path'], 'ports_branch': config['repos'].where(name='ports')['branch'], })) tree = e('${POUDRIERE_ROOT}/etc/poudriere.d/ports/p') sh('mkdir -p', tree) setfile(pathjoin(tree, 'mnt'), e('${PORTS_OVERLAY}')) setfile(pathjoin(tree, 'method'), 'git')
def main(): sh('mkdir -p ${WORLD_DESTDIR}/conf/base/etc') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/var') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/mnt') sh('touch ${WORLD_DESTDIR}/etc/diskless') sh('cp -a ${WORLD_DESTDIR}/etc/ ${WORLD_DESTDIR}/conf/base/etc') sh('cp -a ${WORLD_DESTDIR}/var/ ${WORLD_DESTDIR}/conf/base/var') setfile('${WORLD_DESTDIR}/conf/base/var/md_size', '') setfile('${WORLD_DESTDIR}/conf/base/etc/md_size', '65535') setfile('${WORLD_DESTDIR}/conf/base/mnt/md_size', '8192') # Symlink /tmp to /var/tmp sh('rm -rf ${WORLD_DESTDIR}/tmp') sh('ln -s /var/tmp ${WORLD_DESTDIR}/tmp')
def main(): sh('mkdir -p ${WORLD_DESTDIR}/conf/base/etc') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/etc/local') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/var') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/mnt') sh('touch ${WORLD_DESTDIR}/etc/diskless') sh('cp -a ${WORLD_DESTDIR}/etc/ ${WORLD_DESTDIR}/conf/base/etc') sh('cp -a ${WORLD_DESTDIR}/usr/local/etc/ ${WORLD_DESTDIR}/conf/base/etc/local') sh('rm -rf ${WORLD_DESTDIR}/usr/local/etc') sh('ln -s /etc/local ${WORLD_DESTDIR}/usr/local/etc') sh('cp -a ${WORLD_DESTDIR}/var/ ${WORLD_DESTDIR}/conf/base/var') setfile('${WORLD_DESTDIR}/conf/base/var/md_size', '') setfile('${WORLD_DESTDIR}/conf/base/etc/md_size', '65535') setfile('${WORLD_DESTDIR}/conf/base/mnt/md_size', '8192') # Symlink /tmp to /var/tmp sh('rm -rf ${WORLD_DESTDIR}/tmp') sh('ln -s /var/tmp ${WORLD_DESTDIR}/tmp') sh('ln -s -f /data/zfs/zpool.cache ${WORLD_DESTDIR}/boot/zfs/zpool.cache') sh('ln -s -f /usr/local/bin/ntfs-3g ${WORLD_DESTDIR}/sbin/mount_ntfs')
def main(): sh('mkdir -p ${WORLD_DESTDIR}/conf/base/etc') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/etc/local') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/var') sh('mkdir -p ${WORLD_DESTDIR}/conf/base/mnt') sh('touch ${WORLD_DESTDIR}/etc/diskless') sh('cp -a ${WORLD_DESTDIR}/etc/ ${WORLD_DESTDIR}/conf/base/etc') sh('cp -a ${WORLD_DESTDIR}/usr/local/etc/ ${WORLD_DESTDIR}/conf/base/etc/local' ) sh('rm -rf ${WORLD_DESTDIR}/usr/local/etc') sh('ln -s /etc/local ${WORLD_DESTDIR}/usr/local/etc') sh('cp -a ${WORLD_DESTDIR}/var/ ${WORLD_DESTDIR}/conf/base/var') setfile('${WORLD_DESTDIR}/conf/base/var/md_size', '') setfile('${WORLD_DESTDIR}/conf/base/etc/md_size', '65535') setfile('${WORLD_DESTDIR}/conf/base/mnt/md_size', '8192') # Symlink /tmp to /var/tmp sh('rm -rf ${WORLD_DESTDIR}/tmp') sh('ln -s /var/tmp ${WORLD_DESTDIR}/tmp') sh('ln -s -f /data/zfs/zpool.cache ${WORLD_DESTDIR}/boot/zfs/zpool.cache') sh('ln -s -f /usr/local/bin/ntfs-3g ${WORLD_DESTDIR}/sbin/mount_ntfs')
def main(): rev = e('${GIT_REVISION}') revstr = e('(${rev})') if rev else '' setfile('${WORLD_DESTDIR}/etc/version', e('${PRODUCT}-${VERSION} ${revstr}'))
def install_files(): info('Copying installer files') setfile('${INSTUFS_DESTDIR}/etc/avatar.conf', template('${BUILD_CONFIG}/templates/avatar.conf'))
def create_make_conf(): makeconf = e('${POUDRIERE_ROOT}/etc/poudriere.d/make.conf') setfile(makeconf, template('${BUILD_CONFIG}/templates/poudriere-make.conf'))
def keep_wrkdirs(): if e('${SAVE_DEBUG}'): for p in glob('${PORTS_OVERLAY}/*/*'): if os.path.isdir(p): setfile('${p}/.keep', '')
def main(): setfile('${WORLD_DESTDIR}/etc/avatar.conf', template('${BUILD_CONFIG}/templates/avatar.conf'))
sh('git clone', '-b', repo['branch'], repo['url'], repo['path']) os.chdir(repo['path']) if e('${CHECKOUT_TAG}'): sh('git checkout ${CHECKOUT_TAG}') elif 'commit' in repo: sh('git checkout', repo['commit']) manifest[repo['url']] = sh_str("git rev-parse --short HEAD") def generate_manifest(): sh('rm -f ${BE_ROOT}/repo-manifest') for k, v in manifest.items(): appendfile('${BE_ROOT}/repo-manifest', e('${k} ${v}')) if __name__ == '__main__': if not e('${SKIP_CHECKOUT}'): for i in dsl['repos']: if e('${CHECKOUT_ONLY}'): if i['name'] not in e('${CHECKOUT_ONLY}').split(','): continue info('Checkout: {0} -> {1}', i['name'], i['path']) debug('Repository URL: {0}', i['url']) debug('Local branch: {0}', i['branch']) checkout_repo(i) generate_manifest() setfile('${BE_ROOT}/.pulled', e('${PRODUCT}'))
def main(name): setfile("${BUILD_ROOT}/.profile-setting", name) info("New selected profile: {0}", name)
def main(): setfile('${WORLD_DESTDIR}/etc/nsswitch.conf', template('${BUILD_CONFIG}/templates/nsswitch.conf'))