#!/bin/sh ############################################################################# ## ## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ## ## This file is part of the Qt Enterprise Embedded Scripts of the Qt ## framework. ## ## $QT_BEGIN_LICENSE$ ## Commercial License Usage Only ## Licensees holding valid commercial Qt license agreements with Digia ## with an appropriate addendum covering the Qt Enterprise Embedded Scripts, ## may use this file in accordance with the terms contained in said license ## agreement. ## ## For further information use the contact form at ## http://qt.digia.com/contact-us. ## ## ## $QT_END_LICENSE$ ## ############################################################################# set -e usage() { echo "Usage: $(basename $0) COMMAND [ARGS]" echo echo "Initialize build environment:" echo " $(basename $0) init --device [--reference ]" echo "Initialize local mirror:" echo " $(basename $0) mirror" echo "List available devices:" echo " $(basename $0) list-devices" } while test -n "$1"; do case "$1" in "help" | "--help" | "-h") usage exit 0 ;; "--reference" | "-r") shift REFERENCE=$1 ;; "--device" | "-d") shift DEVICE=$1 ;; *) if [ -n "$COMMAND" ]; then echo "Unknown argument: $1" usage exit 1 fi COMMAND=$1 ;; esac shift done if [ -z "${COMMAND}" ]; then usage exit 1 fi DIR=$(readlink -f $(dirname $0)) if [ -n "${REFERENCE}" ]; then REFERENCE="--reference $(readlink -f ${REFERENCE})" fi get_repo() { REPO="./repo" if [ -n "$(command -v repo)" ]; then REPO="repo" elif [ ! -x "./repo" ]; then curl -s https://storage.googleapis.com/git-repo-downloads/repo > "./repo" chmod +x ./repo fi } get_groups() { case ${DEVICE} in apalis-imx6) GROUPS="toradex" ;; imx53qsb|imx6qsabresd|nitrogen6x) GROUPS="fsl" ;; beagleboard|am335x-evm) GROUPS="ti" ;; beaglebone) GROUPS="bbb" ;; raspberrypi) GROUPS="rpi" ;; emulator) GROUPS="emulator" ;; *) echo "Unknown device configuration, no matching repo group defined" exit 1 ;; esac GROUPS="${GROUPS} default" } list_devices() { echo "Available device configurations:" for device in $(ls $DIR/conf/distro/include/*.conf); do echo " $(basename ${device%%.*})" done } mirror() { mkdir -p .repo/manifests cp ${DIR}/scripts/manifest.xml .repo/manifests/ MANIFEST="manifest.xml" ${REPO} init -u https://gerrit.googlesource.com/git-repo -m ${MANIFEST} -g all --mirror ${REPO} sync } init() { if [ -z "${DEVICE}" ]; then echo "device not defined" usage exit 1 fi get_groups mkdir -p .repo/manifests cp ${DIR}/scripts/manifest*.xml .repo/manifests if [ -f .repo/manifests/manifest_${DEVICE}.xml ]; then MANIFEST="manifest_${DEVICE}.xml" else MANIFEST="manifest.xml" fi ${REPO} init -u https://gerrit.googlesource.com/git-repo -m ${MANIFEST} -g "${GROUPS}" ${REFERENCE} ${REPO} sync if [ ! -e "sources/meta-b2qt" ]; then ln -s ${DIR} sources/meta-b2qt fi cp ${DIR}/scripts/setup_environment.sh . } get_repo case "$COMMAND" in "init") init ;; "mirror") mirror ;; "list-devices") list_devices ;; *) echo "Unknown command" usage exit 1 ;; esac