[buildd-tools-devel] Bug#675349: The problematic file

Raphael Hertzog hertzog at debian.org
Thu May 31 13:16:39 UTC 2012


Attached is the obsolete file (as requested by Roger on IRC).

-- 
Raphaël Hertzog ◈ Debian Developer

Get the Debian Administrator's Handbook:
→ http://debian-handbook.info/get/
-------------- next part --------------
#!/bin/bash
# vim:set et ts=4 sw=4:
# Copyright © 2010 Marc Brockschmidt <he at debian.org>
# Copyright © 2010 Andreas Barth <aba at not.so.argh.org>
# Copyright © 2010 Philipp Kern <pkern at debian.org>
#
# buildd is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# buildd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see
# <http://www.gnu.org/licenses/>.
#
#####################################################################

set -e

if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
    . "$CHROOT_SCRIPT_CONFIG"
elif [ "$2" = "ok" ]; then
    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
    exit 1
fi

VERBOSE=""
if [ "$AUTH_VERBOSITY" = "verbose" ]; then
	  VERBOSE="--verbose"
fi

if [ -f /etc/schroot/conf.buildd ]; then
    . /etc/schroot/conf.buildd
fi

function domirror() {
    for SUITE in ${SUITES:-SUITE}; do
        echo deb $1     | sed -e "s,COMPONENT,${COMPONTENT},"     -e "s,SUITE,${SUITE}," >> $2
        echo deb-src $1 | sed -e "s,COMPONENT,${COMPONTENT_SRC}," -e "s,SUITE,${SUITE}," >> $2
    done
}

if [ "$1" = "setup-start" ] || [ "$1" = "setup-recover" ]; then
    if [ -n "${SUITE_BASE}" ] && [ "${SUITE_BASE}" != "etch" ] && [ -f /etc/schroot/conf.buildd ]; then
        APT_LIST="${CHROOT_PATH}/etc/apt/sources.buildd.list"
        APT_CONF="${CHROOT_PATH}/etc/apt/apt.conf.d/99buildd.conf"
        APT_KEYS=""
        APT_KEY_PACKAGES=""
        rm -f "${APT_LIST}" "${APT_CONF}"
        if [ "${SUITE_BASE}" = 'lenny' ]; then
            APT_CONF="${CHROOT_PATH}/etc/apt/apt.conf"
            if [ -f ${APT_CONF} ]; then
                mv ${APT_CONF} ${APT_CONF}.PREBUILDD
            fi
        fi

        COMPONTENT="main contrib"
        COMPONTENT_SRC="main contrib non-free"

        if [ "${SUITE_VARIANT}" = 'proposed-updates' ]; then
            SUITES="${SUITE_BASE} ${SUITE_BASE}-proposed-updates"
            [ -n "${debian_mirror}" ] && domirror "${debian_mirror} SUITE COMPONENT" ${APT_LIST}
            domirror "http://ftp.debian.org/debian SUITE COMPONENT" ${APT_LIST}
            [ "${debian_incoming}" != 'no' ] && domirror "http://incoming.debian.org/debian SUITE COMPONENT" ${APT_LIST}

        elif [ "${SUITE_VARIANT}" = 'security' ]; then
            SUITES="${SUITE_BASE}"
            [ -n "${debian_mirror}" ] && domirror "${debian_mirror} ${SUITE_BASE} COMPONENT" ${APT_LIST}
            domirror "http://ftp.debian.org/debian ${SUITE_BASE} COMPONENT" ${APT_LIST}
            [ -n "${security_mirror}" ] && domirror "${security_mirror} ${SUITE_BASE} COMPONENT" ${APT_LIST}
            domirror "http://security-master.debian.org/debian-security ${SUITE_BASE}/updates COMPONENT" ${APT_LIST}
            domirror "http://security-master.debian.org/buildd ${SUITE_BASE}/" ${APT_LIST}

        elif [ "${SUITE_VARIANT}" = 'volatile' ]; then
            SUITES="${SUITE_BASE} ${SUITE_BASE}-proposed-updates"
            [ -n "${debian_mirror}" ] && domirror "${debian_mirror} SUITE COMPONENT" ${APT_LIST}
            domirror "http://ftp.debian.org/debian SUITE COMPONENT" ${APT_LIST}
            [ -n "${volatile_mirror}" ] && domirror "${volatile_mirror} SUITE/volatile COMPONENT" ${APT_LIST}
            domirror "http://volatile.debian.org/debian-volatile SUITE/volatile COMPONENT" ${APT_LIST}

        elif [ "${SUITE_VARIANT%%-sloppy}" = 'backports' ]; then
            SUITES="${SUITE_BASE} ${SUITE_BASE}-proposed-updates"
            [ -n "${debian_mirror}" ] && domirror "${debian_mirror} SUITE COMPONENT" ${APT_LIST}
            domirror "http://ftp.debian.org/debian SUITE COMPONENT" ${APT_LIST}
            SUITES="${SUITE_BASE}"
            [ -n "${backports_mirror}" ] && domirror "${backports_mirror} SUITE-backports COMPONENT" ${APT_LIST}
            domirror "http://backports-master.debian.org/debian-backports/ SUITE-backports COMPONENT" ${APT_LIST}
            domirror "http://backports-master.debian.org/buildd/${SUITE_BASE}-backports /" ${APT_LIST}
            if [ "$(echo ${SUITE_VARIANT} | cut -d - -f 2)" = "sloppy" ]; then
                [ -n "${backports_mirror}" ] && domirror "${backports_mirror} SUITE-backports-sloppy COMPONENT" ${APT_LIST}
                domirror "http://backports-master.debian.org/debian-backports/ SUITE-backports-sloppy COMPONENT" ${APT_LIST}
                domirror "http://backports-master.debian.org/buildd/${SUITE_BASE}-backports-sloppy /" ${APT_LIST}
            fi
            APT_KEYS="${APT_KEYS} backports.org"

        elif [ "${SUITE_VARIANT}" = 'edu' ]; then
            SUITES="${SUITE_BASE} ${SUITE_BASE}-proposed-updates"
            [ -n "${debian_mirror}" ] && domirror "${debian_mirror} SUITE COMPONENT" ${APT_LIST}
            domirror "http://ftp.debian.org/debian SUITE COMPONENT" ${APT_LIST}
            SUITES="${SUITE_BASE} ${SUITE_BASE}-test"
            [ -n "${edu_mirror}" ] && domirror "${edu_mirror} SUITE local" ${APT_LIST}
            domirror "http://ftp.skolelinux.no/skolelinux/ SUITE local" ${APT_LIST}
            APT_KEY_PACKAGES="${APT_KEY_PACKAGES} debian-edu-archive-keyring"

        elif [ "${SUITE_BASE}" = 'sid' ]; then
            SUITES="unstable"
            if [ "${SUITE_VARIANT}" = "experimental" ]; then
                SUITES="unstable experimental"
            fi
            [ -n "${debian_mirror}" ] && domirror "${debian_mirror} SUITE COMPONENT" ${APT_LIST}
            if [ "${debian_incoming}" != 'no' ]; then
                domirror "http://incoming.debian.org/debian SUITE COMPONENT" ${APT_LIST}
                domirror "http://incoming.debian.org/buildd-SUITE /" ${APT_LIST}
            fi

        else
            echo "ERROR: cannot adjust sources.list: ${SUITE_BASE}/${SUITE_VARIANT} unknown - exiting"
            exit 1

        fi
        echo 'Acquire::PDiffs "false";' >> ${APT_CONF}
        echo 'APT::Install-Recommends 0;' >> ${APT_CONF}
        echo 'Dir::Etc::SourceList "sources.buildd.list";' >> ${APT_CONF}

        if [ "${SUITE_VARIANT}" = 'security' ]; then
            echo 'APT::Get::AllowUnauthenticated 1;' >> ${APT_CONF}
        fi

        if [ -n "${APT_KEYS}" ]; then
            for KEY in ${APT_KEYS}; do
                if [ -f /usr/share/buildd/${KEY}.asc ]; then
                    chroot ${CHROOT_PATH} apt-key add - < /usr/share/buildd/${KEY}.asc >&2
                else
                    echo W: should add apt key ${KEY} but not found >&2
                fi
            done
            for PKG in ${APT_KEY_PACKAGES}; do
                chroot ${CHROOT_PATH} apt-get install -y $PKG
            done
        fi
    else
	if [ -n "$SUITE_VARIANT" ]; then
		SOURCES_FILE_NAME="${SUITE_BASE}-${SUITE_VARIANT}.sources"
		SOURCES_FILE_PATH="/etc/schroot/buildd.d/${SOURCES_FILE_NAME}"
                APT_LIST_AUTO="${CHROOT_PATH}/etc/apt/sources.list.d/auto.list"

		if [ -f "$SOURCES_FILE_PATH" ]; then
			if [ "$SUITE_BASE" = "etch" ]; then
				cp $VERBOSE ${CHROOT_PATH}/etc/apt/sources.list ${CHROOT_PATH}/etc/apt/sources.list.backup
				if [ ! -z "$VERBOSE" ]; then
					echo cat '<'${SOURCES_FILE_PATH} '>>'"${CHROOT_PATH}/etc/apt/sources.list"
				fi
				cat <${SOURCES_FILE_PATH} >>"${CHROOT_PATH}/etc/apt/sources.list"
			else
				cp $VERBOSE ${SOURCES_FILE_PATH} "${CHROOT_PATH}/etc/apt/sources.list.d/${SOURCES_FILE_NAME}.list"
			fi
                elif [ ${SUITE_VARIANT} = 'security' ]; then
                    if [ "$SUITE_BASE" = "etch" ]; then
	            		cp $VERBOSE ${CHROOT_PATH}/etc/apt/sources.list ${CHROOT_PATH}/etc/apt/sources.list.backup
                        APT_LIST_AUTO=${CHROOT_PATH}/etc/apt/sources.list
                    else
                        : > ${APT_LIST_AUTO}
                    fi
                    if [ -n "${security_mirror}" ]; then
                        echo deb ${security_mirror} ${SUITE_BASE}/updates main contrib >> ${APT_LIST_AUTO}
                        echo deb-src ${security_mirror} ${SUITE_BASE}/updates main contrib >> ${APT_LIST_AUTO}
                    fi
                    echo deb http://security-master.debian.org/debian-security ${SUITE_BASE}/updates main contrib >> ${APT_LIST_AUTO}
                    echo deb-src http://security-master.debian.org/debian-security ${SUITE_BASE}/updates main contrib >> ${APT_LIST_AUTO}
                    echo deb http://security-master.debian.org/buildd ${SUITE_BASE}/ >> ${APT_LIST_AUTO}
                    echo deb-src http://security-master.debian.org/buildd ${SUITE_BASE}/ >> ${APT_LIST_AUTO}
                elif [ ${SUITE_VARIANT} = 'volatile' ]; then
                    if [ "$SUITE_BASE" = "etch" ]; then
			            cp $VERBOSE ${CHROOT_PATH}/etc/apt/sources.list ${CHROOT_PATH}/etc/apt/sources.list.backup
                        APT_LIST_AUTO=${CHROOT_PATH}/etc/apt/sources.list
                    else
                        : > ${APT_LIST_AUTO}
                    fi
                    if [ -n "${volatile_mirror}" ]; then
                        echo deb ${volatile_mirror} ${SUITE_BASE}-proposed-updates/volatile main contrib non-free >> ${APT_LIST_AUTO}
                        echo deb ${volatile_mirror} ${SUITE_BASE}/volatile main contrib non-free >> ${APT_LIST_AUTO}
                        echo deb-src ${volatile_mirror} ${SUITE_BASE}-proposed-updates/volatile main contrib non-free >> ${APT_LIST_AUTO}
                        echo deb-src ${volatile_mirror} ${SUITE_BASE}/volatile main contrib non-free >> ${APT_LIST_AUTO}
                    fi
                    echo deb http://volatile.debian.net/debian-volatile ${SUITE_BASE}-proposed-updates/volatile main contrib non-free >> ${APT_LIST_AUTO}
                    echo deb http://volatile.debian.net/debian-volatile ${SUITE_BASE}/volatile main contrib non-free >> ${APT_LIST_AUTO}
                    echo deb-src http://volatile.debian.net/debian-volatile ${SUITE_BASE}-proposed-updates/volatile main contrib non-free >> ${APT_LIST_AUTO}
                    echo deb-src http://volatile.debian.net/debian-volatile ${SUITE_BASE}/volatile main contrib non-free >> ${APT_LIST_AUTO}
                elif [ ${SUITE_VARIANT%%-sloppy} = 'backports' ]; then
                    if [ "$SUITE_BASE" = "etch" ]; then
			            cp $VERBOSE ${CHROOT_PATH}/etc/apt/sources.list ${CHROOT_PATH}/etc/apt/sources.list.backup
                        APT_LIST_AUTO=${CHROOT_PATH}/etc/apt/sources.list
                    else
                        : > ${APT_LIST_AUTO}
                    fi
                    if [ -n "${backports_mirror}" ]; then
                        echo deb ${backports_mirror} ${SUITE_BASE}-backports main contrib non-free >> ${APT_LIST_AUTO}
                        echo deb-src ${backports_mirror} ${SUITE_BASE}-backports main contrib non-free >> ${APT_LIST_AUTO}
                    fi
                    echo deb http://backports-master.debian.org/debian-backports/ ${SUITE_BASE}-backports main contrib non-free >> ${APT_LIST_AUTO}
                    echo deb-src http://backports-master.debian.org/debian-backports/ ${SUITE_BASE}-backports main contrib non-free >> ${APT_LIST_AUTO}
                    echo deb http://backports-master.debian.org/buildd/${SUITE_BASE}-backports / >> ${APT_LIST_AUTO}
                    echo deb-src http://backports-master.debian.org/buildd/${SUITE_BASE}-backports / >> ${APT_LIST_AUTO}
                    if [ "$(echo ${SUITE_VARIANT} | cut -d - -f 2)" = "sloppy" ]; then
                        if [ -n "${backports_mirror}" ]; then
                            echo deb ${backports_mirror} ${SUITE_BASE}-backports-sloppy main contrib non-free >> ${APT_LIST_AUTO}
                            echo deb-src ${backports_mirror} ${SUITE_BASE}-backports-sloppy main contrib non-free >> ${APT_LIST_AUTO}
                        fi
                        echo deb http://backports-master.debian.org/debian-backports/ ${SUITE_BASE}-backports-sloppy main contrib non-free >> ${APT_LIST_AUTO}
                        echo deb-src http://backports-master.debian.org/debian-backports/ ${SUITE_BASE}-backports-sloppy main contrib non-free >> ${APT_LIST_AUTO}
                        echo deb http://backports-master.debian.org/buildd/${SUITE_BASE}-backports-sloppy / >> ${APT_LIST_AUTO}
                        echo deb-src http://backports-master.debian.org/buildd/${SUITE_BASE}-backports-sloppy / >> ${APT_LIST_AUTO}
                    fi
                elif [ ${SUITE_VARIANT} = 'experimental' ]; then
                    : > ${APT_LIST_AUTO}
                    if [ -n "${debian_mirror}" ]; then
                        echo deb ${debian_mirror} experimental main contrib non-free >> ${APT_LIST_AUTO}
                        echo deb-src ${debian_mirror} experimental main contrib non-free >> ${APT_LIST_AUTO}
                    fi
                    echo deb     http://ftp.debian.org/debian experimental main contrib non-free >> ${APT_LIST_AUTO}
                    echo deb-src http://ftp.debian.org/debian experimental main contrib non-free >> ${APT_LIST_AUTO}
                    echo deb     http://incoming.debian.org/buildd-experimental / >> ${APT_LIST_AUTO}
                    echo deb-src http://incoming.debian.org/buildd-experimental / >> ${APT_LIST_AUTO}
		fi
	fi
    fi
elif [ "$1" = "setup-stop" ]; then
    if [ -n "${SUITE_BASE}" ] && [ "${SUITE_BASE}" != "etch" ] && [ -f /etc/schroot/conf.buildd ]; then
        APT_LIST="${CHROOT_PATH}/etc/apt/sources.buildd.list"
        APT_CONF="${CHROOT_PATH}/etc/apt/apt.conf.d/99buildd.conf"
        rm -f "${APT_LIST}" "${APT_CONF}"
        if [ "${SUITE_BASE}" = 'lenny' ]; then
            APT_CONF="${CHROOT_PATH}/etc/apt/apt.conf"
            rm -f ${APT_CONF}
            if [ -f ${APT_CONF}.PREBUILDD ]; then
                mv ${APT_CONF}.PREBUILDD ${APT_CONF}
            fi
        fi
    else
	if [ -n "$SUITE_VARIANT" ]; then
		SOURCES_FILE_NAME="${SUITE_BASE}-${SUITE_VARIANT}.sources"
		SOURCES_FILE_PATH="/etc/schroot/buildd.d/${SOURCES_FILE_NAME}"

		if [ -f "$SOURCES_FILE_PATH" ]; then
			if [ "$SUITE_BASE" = "etch" ]; then
				cp $VERBOSE ${CHROOT_PATH}/etc/apt/sources.list.backup ${CHROOT_PATH}/etc/apt/sources.list
			else
				rm -f $VERBOSE "${CHROOT_PATH}/etc/apt/sources.list.d/${SOURCES_FILE_NAME}.list"
			fi
                elif [ ${SUITE_VARIANT} = 'security' ] || [ ${SUITE_VARIANT} = 'volatile' ] || [ ${SUITE_VARIANT} = 'backports' ] || [ ${SUITE_VARIANT} = 'experimental' ] ; then
			if [ "$SUITE_BASE" = "etch" ]; then
				cp $VERBOSE ${CHROOT_PATH}/etc/apt/sources.list.backup ${CHROOT_PATH}/etc/apt/sources.list
			else
				rm -f $VERBOSE "${CHROOT_PATH}/etc/apt/sources.list.d/auto.list"
			fi
		fi
	fi
    fi
fi


More information about the Buildd-tools-devel mailing list