123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- #!/bin/bash
- SCRIPT_DIR=$(cd $(dirname $0); pwd)
- set -e
- usage()
- {
- cat << EOF
- usage: $0 options
- This script will create Qt Tizen repository for Qt online installer
- OPTIONS:
- -h Show this message
- -i DIR Path to install directory
- -c c1,c2,c3 component names for tizen installer
- -r r1,r2,r3 relative directories name e.g. tizen_x86 (Qt will be installed under /path/to/qt/install/dir/QtVersion/RELATIVE_DIR)
- -o DIR output repository dir
- example:
- $0 -i /path/to/target/install/dir -c qt.tools.qtcreator.tizen,qt.54.tizen_x86 -r Tools,tizen_x86 -o /path/to/repository/dir/which/will/be/created/or/updated
- EOF
- }
- installPath=""
- componentNames=""
- relativeDirs=""
- outputDir=""
- while getopts ":hi:c:r:o:" opt; do
- case $opt in
- h)
- usage
- exit
- ;;
- i)
- installPath="$OPTARG"
- ;;
- c)
- componentNames="$OPTARG"
- ;;
- r)
- relativeDirs="$OPTARG"
- ;;
- o)
- outputDir="$OPTARG"
- ;;
- ?)
- echo "Invalid option: -$OPTARG"
- usage
- exit
- ;;
- esac
- done
- doExit=""
- if [ "$installPath" = "" ]; then
- echo "No install path set. Provide install path with -i parameter"
- doExit="1"
- fi
- if [ "$componentNames" = "" ]; then
- echo "No component names set. Provide component names with -c parameter"
- doExit="1"
- fi
- if [ "$relativeDirs" = "" ]; then
- echo "No reative dirs set. Provide relative dirs with -r parameter"
- doExit="1"
- fi
- if [ "$outputDir" = "" ]; then
- echo "No output dir set. Provide output dir with -o parameter"
- doExit="1"
- fi
- if [ "$doExit" = "1" ]; then
- exit 1
- fi
- tmpComponentDir=$(mktemp -d)
- function createComponent() {
- if [ "$2" != "qt.tools.qtcreator.tizen" ]; then
- targetDir=$($1/bin/qmake -query QT_VERSION | grep -o "^[0-9]\+\.[0-9]\+")
- else
- targetDir=""
- fi
- installDir=$1
- relativeDir=$(basename $installDir)
- componentName=$2
- tmpComponentPartDir="$tmpComponentDir/$componentName"
- mkdir -p $tmpComponentPartDir/data $tmpComponentPartDir/meta
- export PATH=~/Qt/QtIFW-1.5.0/bin/:$PATH
- mkdir -p $tmpComponentPartDir/data/$targetDir/$relativeDir
- cp -r $installDir/* $tmpComponentPartDir/data/$targetDir/$relativeDir
- echo "archiving $componentName"
- archivegen $tmpComponentPartDir/data/$componentName.7z $tmpComponentPartDir/data/${targetDir:-$relativeDir}
- displayName=$(echo $componentName | grep -oi "tizen.*" | tr '_' ' ' )
- displayName=${displayName^}
- releaseDate=$(date "+%Y-%m-%d")
- if [ "$2" = "qt.tools.qtcreator.tizen" ]; then
- cat $SCRIPT_DIR/../common/qtrepositoryfiles/package-qtcreator.xml | sed "s/@ComponentName@/$componentName/g" \
- | sed "s/@ReleaseDate@/$releaseDate/g" \
- > $tmpComponentPartDir/meta/package.xml
- else
- relativePath="/$targetDir/$relativeDir"
- cat $SCRIPT_DIR/../common/qtrepositoryfiles/package-qt.xml | sed "s/@ComponentName@/$componentName/g" \
- | sed "s/@DisplayName@/$displayName/g" \
- | sed "s/@ReleaseDate@/$releaseDate/g" \
- > $tmpComponentPartDir/meta/package.xml
- cat $SCRIPT_DIR/../common/qtrepositoryfiles/installscript-qt.qs | sed "s#@RelativePath@#$relativePath#g" \
- | sed "s/@DisplayName@/$displayName/g" \
- > $tmpComponentPartDir/meta/installscript.qs
- fi
- rm -rf $tmpComponentPartDir/data/${targetDir:-$relativeDir}
- }
- echo "Generating repositories"
- componentNamesArray=($(echo $componentNames | tr ',' ' '))
- relativeDirsArray=($(echo $relativeDirs | tr ',' ' '))
- for index in ${!componentNamesArray[*]}
- do
- createComponent $installPath/${relativeDirsArray[index]} ${componentNamesArray[index]}
- done
- repogen -v -p $tmpComponentDir -i $componentNames --update $outputDir
- echo repository created in $outputDir
|