def METHOD_NAME(builddir, xml, noccache):
    distname = xml.prj.text('suite')
    pbuilderrc_fname = os.path.join(builddir, "pbuilderrc")
    fp = open(pbuilderrc_fname, "w")
    fp.write('#!/bin/sh\n')
    fp.write('set -e\n')
    fp.write(f'MIRRORSITE="{xml.get_primary_mirror(False)}"\n')
    fp.write(f'OTHERMIRROR="deb http://127.0.0.1:8080{builddir}/repo {distname} main"\n')
    fp.write(f'BASETGZ="{os.path.join(builddir, "pbuilder", "base.tgz")}"\n')
    fp.write(f'DISTRIBUTION="{distname}"\n')
    fp.write(f'BUILDRESULT="{os.path.join(builddir, "pbuilder", "result")}"\n')
    fp.write(f'APTCACHE="{os.path.join(builddir, "pbuilder", "aptcache")}"\n')
    fp.write(f'HOOKDIR="{os.path.join(builddir, "pbuilder", "hooks.d")}"\n')
    fp.write('PATH="/usr/share/elbe/qemu-elbe:$PATH"\n')
    if xml.text("project/arch", key="arch") != 'amd64':
        fp.write(f'ARCHITECTURE="{xml.text("project/buildimage/arch", key="arch")}"\n')
        fp.write('DEBOOTSTRAP="qemu-debootstrap"\n')
        fp.write('DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" '
                 '"--arch=$ARCHITECTURE")\n')
    if xml.prj.has('noauth'):
        fp.write(
            'DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--no-check-gpg")\n')
        fp.write("""for i in "${!DEBOOTSTRAPOPTS[@]}"; do if [[ ${DEBOOTSTRAPOPTS[i]} == "--force-check-gpg" ]]; then unset 'DEBOOTSTRAPOPTS[i]'; break; fi done\n""")
        fp.write('export ALLOWUNTRUSTED="yes"\n')
    # aptitude segfaults with armhf changeroots, great! :)
    # link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=834990
    fp.write('PBUILDERSATISFYDEPENDSCMD='
             '/usr/lib/pbuilder/pbuilder-satisfydepends-experimental\n')
    if not noccache:
        fp.write(f'export CCACHE_DIR="{builddir}/ccache"\n')
        fp.write('export PATH="/usr/lib/ccache:${PATH}"\n')
        fp.write('EXTRAPACKAGES=ccache\n')
        fp.write(f'export CCACHE_CONFIGPATH="{builddir}/ccache/ccache.conf"\n')
        fp.write('BINDMOUNTS="${CCACHE_DIR}"')
    fp.close()