Commit 363814ec authored by David Skoland's avatar David Skoland
Browse files

Merge branch 'master' of git.qt.io:vohilshe/minicoin

parents 596db47a a75b1ce8
......@@ -39,22 +39,28 @@ def azure_setup(box, machine)
if status != 0
$AZURE_PROFILE = {}
$AZURE_CREDENTIALS = {}
puts "Azure CLI installed, but failed to get azure account information."
puts "Make sure you are logged in with 'az login'"
STDERR.puts "Azure CLI installed, but failed to get azure account information."
STDERR.puts "Make sure you are logged in with 'az login'"
next
end
$AZURE_PROFILE = JSON.parse(stdout)
stdout, stderr, status = Open3.capture3('az ad sp show --id "http://minicoin"')
if status != 0
stdout, stderr, status = Open3.capture3("az ad sp create-for-rbac --name 'http://minicoin'")
stdout, stderr, status = Open3.capture3("az ad sp credential reset --name 'http://minicoin' --password #{pwd}")
unless stderr.start_with?("Please ensure you have network connection")
stdout, stderr, status = Open3.capture3("az ad sp create-for-rbac --name 'http://minicoin'")
stdout, stderr, status = Open3.capture3("az ad sp credential reset --name 'http://minicoin' --password #{pwd}")
if status != 0
STDERR.puts "Failed to generate azure account credentials"
end
end
end
if status != 0
raise "Failed to generate azure account credentials"
if status == 0
$AZURE_CREDENTIALS = JSON.parse(stdout)
end
$AZURE_CREDENTIALS = JSON.parse(stdout)
end
next if $AZURE_CREDENTIALS.nil?
override.ssh.private_key_path = "~/.ssh/id_rsa"
if machine["os"] == "windows"
......
......@@ -27,7 +27,7 @@ def merge_yaml(first, second)
if first.is_a?(Hash)
if second.is_a?(Array)
puts "Can't insert array #{second} into hash #{first}"
STDERR.puts "Can't insert array #{second} into hash #{first}"
return first
end
if second.is_a?(Hash)
......@@ -46,7 +46,7 @@ def merge_yaml(first, second)
end
return result;
end
puts "Can't insert value #{second} into hash #{first}"
STDERR.puts "Can't insert value #{second} into hash #{first}"
return first
end
......@@ -124,7 +124,7 @@ def load_includes(yaml, basedir)
yaml[section] = merge_yaml(yaml[section], data) unless section == "includes"
end
rescue => error
puts "Error loading file #{include_file}: #{error}"
STDERR.puts "Error loading file #{include_file}: #{error}"
end
end
end
......
......@@ -5,7 +5,7 @@ def fetch_file(uri, local)
downloader = Vagrant::Util::Downloader.new(uri, local)
downloader.download!
rescue => error
puts "Error downloading #{uri}: #{error}"
STDERR.puts "Error downloading #{uri}: #{error}"
return false
end
end
......@@ -40,7 +40,7 @@ def insert_disk(box, disk_filename, role_params)
end
end
if !File.file?("#{disk_cache}/#{disk_archive}")
puts "Failed to download '#{disk_archive}' from any of #{disk_urls}"
STDERR.puts "Failed to download '#{disk_archive}' from any of #{disk_urls}"
else
puts "Extracting '#{disk_archive}'"
begin
......@@ -52,7 +52,7 @@ def insert_disk(box, disk_filename, role_params)
end
end
if !File.file?("#{disk_cache}/#{disk_file}")
puts "==> Disk file '#{disk_file}' not available"
STDERR.puts "==> Disk file '#{disk_file}' not available"
return false
end
......@@ -155,7 +155,7 @@ def add_role(box, role, name)
if value.is_a?(String)
new_value = expand_env(value, box)
if new_value.nil?
puts "==> #{name}: Unexpanded environment variable in '#{value}' - skipping role '#{role}'"
STDERR.puts "==> #{name}: Unexpanded environment variable in '#{value}' - skipping role '#{role}'"
return
end
role_params[key] = new_value
......@@ -164,7 +164,7 @@ def add_role(box, role, name)
value.each do |entry|
new_entry = expand_env(entry, box)
if new_entry.nil?
puts "==> #{name}: Unexpanded environment variable in '#{entry}' - skipping role '#{role}'"
STDERR.puts "==> #{name}: Unexpanded environment variable in '#{entry}' - skipping role '#{role}'"
return
end
array << new_entry
......@@ -177,7 +177,7 @@ def add_role(box, role, name)
new_key = expand_env(k, nil)
new_value = expand_env(v, box)
if new_key.nil? || new_value.nil?
puts "==> #{name}: Unexpanded environment variable in '#{value}' - skipping role '#{role}'"
STDERR.puts "==> #{name}: Unexpanded environment variable in '#{value}' - skipping role '#{role}'"
return
end
new_hash[new_key] = new_value
......@@ -237,7 +237,7 @@ def add_role(box, role, name)
if ["up", "provision", "reload", "validate"].include? ARGV[0]
activity = true
if !insert_disk(box, "#{role_path}/disk.yml", role_params)
puts "==> #{name}: Attaching disk failed for role '#{role}'"
STDERR.puts "==> #{name}: Attaching disk failed for role '#{role}'"
end
end
elsif File.file?("#{role_path}/Dockerfile")
......@@ -272,7 +272,7 @@ def add_role(box, role, name)
eval("#{role}_provision(box, name, role_params)")
activity = true
rescue => error
puts "==> #{name}: Error with #{role} role: #{error}"
STDERR.puts "==> #{name}: Error with #{role} role: #{error}"
end
end
......@@ -351,6 +351,6 @@ def add_role(box, role, name)
code: post_provision
end
if ! activity
puts "==> #{name}: Provisioning script for role #{role} at '#{provisioning_file}' not found!"
STDERR.puts "==> #{name}: Provisioning script for role #{role} at '#{provisioning_file}' not found!"
end
end
......@@ -173,7 +173,7 @@ def share_folders(box, machine, shares)
end
guest = expand_env(guest, box)
if guest.nil? || host.nil?
puts "==> #{machine['name']}: Unexpanded environment variable in '#{share}' - skipping share"
STDERR.puts "==> #{machine['name']}: Unexpanded environment variable in '#{share}' - skipping share"
next
end
exp_shares << { host => guest }
......
......@@ -87,7 +87,7 @@ def virtualbox_setup(box, machine)
trigger.name = "Workaround for VirtualBox bug"
trigger.ruby do |env, machine|
if File.directory?(vboxdir)
puts "#{vboxdir} still exists, deleting!"
STDERR.puts "#{vboxdir} still exists, deleting!"
require 'fileutils'
FileUtils.remove_dir(vboxdir, true)
end
......
......@@ -3,7 +3,13 @@ cd $(dirname "$0")
rm -rf coin
git clone --single-branch --branch dev --depth 1 git://code.qt.io/qt/qt5.git
if [[ ! -z $COIN_ROOT ]]
then
cp -r $COIN_ROOT coin
else
echo "COIN_ROOT not set, cloning from upstream"
git clone --single-branch --branch dev --depth 1 git://code.qt.io/qt/qt5.git
mv qt5/coin coin
rm -rf qt5
mv qt5/coin coin
rm -rf qt5
fi
@echo off
setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
set CURDIR=%CD%
set ARGS=%*
set POSITIONAL=
setlocal ENABLEDELAYEDEXPANSION
call C:\minicoin\util\parse-opts.cmd %*
call :parseargs %ARGS%
if errorlevel 1 exit /b
set ARGS=%POSITIONAL%
call :go
cd %CURDIR%
exit /b
:parseargs
if /i "%~1" == "" exit /b
if /i "%~1" == "--coin-root" (
set COINROOT=%~2
shift
) else if /i "%~1" == "--template" (
set TEMPLATE=%~2
shift
) else (
set POSITIONAL=!POSITIONAL! %~1
2>NUL cd /minicoin/roles/coin-node/coin/provisioning
if errorlevel 1 (
>&2 echo Can't find coin provisioning scripts
exit 1 /b
)
:loopargs
shift
goto :parseargs
REM End of parameter parsing
:go
echo Provisioning from '%COINROOT%' using template '%TEMPLATE%'
echo Provisioning with template '!PARAM_template!'
cd !PARAM_template!
2>NUL cd %COINROOT%/Provisioning
if errorlevel 1 (
echo '%COINROOT%/provisioning' does not exist
exit /b
>&2 echo Can't find coin template '!PARAM_template!'
exit 2 /b
)
2>NUL cd %TEMPLATE%
if errorlevel 1 (
echo No coin template '%TEMPLATE%'
exit /b
)
FOR /f %%s in ('dir *.ps1 /B /O:N') do set "PSSCRIPTS=!PSSCRIPTS! %%s"
FOR /f %%s in ('dir *.ps1 /B /O:N') do set PSSCRIPTS=!PSSCRIPTS! %%s
if defined PARAM_runlist (
set RUNLIST=!PARAM_runlist!
) else (
set RUNLIST=
)
if defined PARAM_skiplist (
set SKIPLIST=!PARAM_skiplist!
) else (
set SKIPLIST=qnx_700 install_telegraf install-mcuxpresso install-virtualbox emsdk squish squish-coco
)
FOR %%s IN (%PSSCRIPTS%) DO (
echo ++ Executing '%%s %ARGS%'
powershell -File "%%s" %ARGS%
)
\ No newline at end of file
set "step=%%s"
set "step=!step:*-=!"
set "step=!step:.ps1=!"
set skip=
for %%a IN (%SKIPLIST%) DO (
if %%a==!step! set skip=1
)
for %%a IN (%RUNLIST%) DO (
if %%a==!step! set skip=
)
if defined skip (
echo -- Skipping '%%s'
) else (
echo ++ Executing '%%s'
powershell -File "%%s" %ARGS%
)
)
......@@ -19,20 +19,42 @@ fi
SCRIPTS=( *.sh )
[ -z ${ROLES[@]} ] && ROLES=( apt gcc libclang sccache fbx install-cmake cmake version )
echo "Executing provisioning for '${ROLES[@]}'"
RUNLIST=${PARAM_runlist[@]}
SKIPLIST=${PARAM_skiplist[@]}
[[ -z "$RUNLIST" ]] && RUNLIST=(
enable-repos
apt zypperpackages install-packages
cmake install-cmake
)
[[ -z "$SKIPLIST" ]] && SKIPLIST=(
install_telegraf
systemsetup
emsdk
qemu install_QemuGA
qnx660 qnx700
squish squish-coco
yocto yocto_ssh_configurations
android_linux openssl_for_android_linux
docker fix_msns_docker_resolution
)
for script in ${SCRIPTS[@]}; do
[ -e "$script" ] || continue
step=$(echo ${script} | sed -e "s/^[0-9][0-9]-//" -e "s/\\.sh//")
if [[ " ${ROLES[@]} " =~ " ${step} " ]]
then
[ -e "$script" ] || continue
step=$(echo ${script} | sed -e "s/^[0-9][0-9]-//" -e "s/\\.sh//")
skip=0
[[ " ${SKIPLIST[@]} " =~ " ${step} " ]] && skip=1
[[ " ${RUNLIST[@]} " =~ " ${step} " ]] && skip=0
if [[ $skip -gt 0 ]]
then
echo "-- Skipping '$script'"
continue
fi
echo "++ Executing '$script'"
su vagrant -c "bash ./$script" || true
else
echo "-- Skipping '$script'"
fi
done
su vagrant -c "bash -c \"[ -f ~/.bash_profile ] && echo '. ~/.profile' >> ~/.bash_profile\""
su vagrant -c "bash -c \"[ -f ~/.bash_profile ] && echo '. ~/.profile' >> ~/.bash_profile\" || true"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment