#!/bin/sh ############################################################################ ## ## Copyright (C) 2019 The Qt Company Ltd. ## Contact: https://www.qt.io/licensing/ ## ## This file is part of the Boot to Qt meta layer. ## ## $QT_BEGIN_LICENSE:GPL$ ## Commercial License Usage ## Licensees holding valid commercial Qt licenses may use this file in ## accordance with the commercial license agreement provided with the ## Software or, alternatively, in accordance with the terms contained in ## a written agreement between you and The Qt Company. For licensing terms ## and conditions see https://www.qt.io/terms-conditions. For further ## information use the contact form at https://www.qt.io/contact-us. ## ## GNU General Public License Usage ## Alternatively, this file may be used under the terms of the GNU ## General Public License version 3 or (at your option) any later version ## approved by the KDE Free Qt Foundation. The licenses are as published by ## the Free Software Foundation and appearing in the file LICENSE.GPL3 ## included in the packaging of this file. Please review the following ## information to ensure the GNU General Public License requirements will ## be met: https://www.gnu.org/licenses/gpl-3.0.html. ## ## $QT_END_LICENSE$ ## ############################################################################ set -e usage() { echo "Usage: $(basename $0) COMMAND [ARGS]" echo echo "Initialize build environment:" echo " $(basename $0) init [--manifest ] [--manifest-dir ]" echo " [--reference ] [--internal]" echo " --manifest : name of the manifest to be used for initialization" echo " --manifest-dir : path to a directory containing repo manifest file(s)" echo " --reference : path to local mirror, initialized previously with 'repo init --mirror'" echo " --internal: fetch internal repositories, available only inside The Qt Company network." } while test -n "$1"; do case "$1" in "help" | "--help" | "-h") usage exit 0 ;; "--reference" | "-r") shift REFERENCE=$1 ;; "--device" | "-d") shift # ignored ;; "--repo-url") shift REPO_URL="--repo-url $1" ;; "--manifest") shift MANIFEST=$1 ;; "--manifest-dir") shift MANIFEST_DIR="$(readlink -f $1)" ;; "--internal") PROJECT_GROUPS="all" ;; *) 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=$(dirname $(readlink -f $0)) if [ -n "${REFERENCE}" ]; then REFERENCE="--reference $(readlink -f ${REFERENCE})" fi if [ -z "${REPO_URL}" ]; then REPO_URL="--repo-url https://github.com/theqtcompany/git-repo" fi PROJECT_GROUPS=${PROJECT_GROUPS:-default} MANIFEST=${MANIFEST:-manifest.xml} MANIFEST_DIR=${MANIFEST_DIR:-${DIR}/scripts} 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 } init() { mkdir -p .repo/manifests cp ${MANIFEST_DIR}/${MANIFEST} .repo/manifests/default.xml ${REPO} init ${REPO_URL} -u ${PWD}/.repo/repo -b default -g "${PROJECT_GROUPS}" ${REFERENCE} ${REPO} sync --optimized-fetch if [ ! -e "sources/meta-boot2qt" ]; then ln -s ${DIR} sources/meta-boot2qt fi if [ ! -e "setup-environment.sh" ]; then ln -s ${DIR}/scripts/setup-environment.sh setup-environment.sh fi ln -sfn meta-boot2qt/meta-boot2qt-distro/conf sources/templates # handle lfs repos which need manual lfs pull LFS_REPOS=$(grep filter=lfs -l sources/*/.gitattributes 2>/dev/null || true) for repo in ${LFS_REPOS}; do ( cd $(dirname ${repo}); git lfs pull ) done } get_repo case "$COMMAND" in "init") init ;; "mirror") mirror ;; *) echo "Unknown command" usage exit 1 ;; esac