[-]
[+]
|
Changed |
_service:gitpkg:sdk-setup.changes
|
|
[-]
[+]
|
Changed |
_service:gitpkg:sdk-setup.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<services>
<service name="gitpkg">
<param name="repo">lbt/sdk-setup</param>
- <param name="tag">51974a225e1a78742a1534cbe14bfe68f8040cec</param>
+ <param name="tag">829a24e0c758e9ddd16bf47382e1d266b9817acf</param>
<param name="service">github</param>
</service>
</services>
|
[-]
[+]
|
Changed |
_service:gitpkg:_src
^
|
@@ -1 +1 @@
-git:sdk-setup.tgz:0.34
+git:sdk-setup.tgz:0.36
|
[-]
[+]
|
Changed |
_service:gitpkg:sdk-setup.tgz/modes/sdk-install/fs_rules.lua
^
|
@@ -17,12 +17,6 @@
var_tmp_dir_dest = session_dir .. "/var/tmp"
end
-test_first_target_then_host_default_is_target = {
- { if_exists_then_map_to = target_root, protection = readonly_fs_always },
- { if_exists_then_map_to = "/", protection = readonly_fs_always },
- { map_to = target_root, protection = readonly_fs_always }
-}
-
test_first_usr_bin_default_is_bin__replace = {
{ if_exists_then_replace_by = target_root.."/usr/bin", protection = readonly_fs_always },
{ replace_by = target_root.."/bin", protection = readonly_fs_always }
@@ -250,11 +244,6 @@
{path = "/usr/lib/rpm/rpmdeps", func_class = FUNC_CLASS_EXEC,
actions=accelerated_program_actions},
- -- gdb wants to have access to our dynamic linker also,
- -- /usr/lib/libsb2/wrappers/*, etc.
- {dir = "/usr/lib/libsb2", use_orig_path = true,
- protection = readonly_fs_always},
-
{dir = "/usr", map_to = target_root,
protection = readonly_fs_if_not_root}
}
@@ -396,16 +385,6 @@
{dir = sbox_dir .. "/share/scratchbox2",
use_orig_path = true},
- -- The real sbox_dir.."/lib/libsb2" must be available:
- --
- -- When libsb2 is installed to target we don't want to map
- -- the path where it is found. For example gdb needs access
- -- to the library and dynamic linker, and these may be in
- -- target_root, or under sbox_dir.."/lib/libsb2", or
- -- under ~/.scratchbox2.
- {dir = sbox_dir .. "/lib/libsb2",
- actions = test_first_target_then_host_default_is_target},
-
-- -----------------------------------------------
-- home directories:
{dir = "/home", rules = emulate_mode_rules_home},
|
[-]
[+]
|
Changed |
_service:gitpkg:sdk-setup.tgz/src/mb2
^
|
@@ -27,6 +27,7 @@
# POSSIBILITY OF SUCH DAMAGE.
buildroot=$(pwd)/myroot
+DEVICES_XML=/etc/mersdk/share/devices.xml
usage() {
cat <<EOF
@@ -36,13 +37,27 @@
Typically called from QtCreator to perform qmake/make phases of a project.
Note that any other build steps in the .spec file will also be run.
- <specfile> will be looked for in the current rpm/ dir. If there is more than one it must be provided.
+ <specfile> will be looked for in the current rpm/ dir. If there is
+ more than one it must be provided.
+
+ $ME is aware of spectacle and will update the spec file if there is
+ an obvious yaml file which is newer.
$ME qmake [<args>] : runs qmake in the 'build' phase
+ Note that this also verifies target
+ build dependencies are up to date
+
$ME make [<args>] : run make in the 'build' phase
$ME install [<args>] : runs the 'install' phase to install to $buildroot
$ME rpm [<args>] : runs the install & rpm-creation phases
+
+ -t | --target : specify the sb2 target to use
+ -d | --device : specify the device
+ -p | --projectdir : when running shadow build/deploy from another dir
+ -s | --specfile : if the specfile is not in rpm/*.spec
+
+
EOF
}
@@ -61,12 +76,55 @@
yaml=$(dirname $spec)/$(basename $spec .spec).yaml
[[ -f $yaml ]] || return # User has decided not to use yaml
if [[ $yaml -nt $spec ]]; then # -nt is newer than
- (cd $(dirname $spec); specify -n -N $spec)
+ (cd $(dirname $spec); specify -n -N $yaml)
fi
}
+verify_target_dependencies() {
+ grep BuildRequires "$spec" | sed -e '/^#.*$/d' | cut -d: -f2 | tr ',' ' ' | xargs --no-run-if-empty sb2 -t "$target" -m sdk-install -R zypper in
+}
+
+# Helper to read XML
+read_dom () {
+ local IFS=\>
+ read -d \< ENTITY CONTENT
+ local RET=$?
+ TAG_NAME=${ENTITY%% *}
+ ATTRIBUTES=${ENTITY#* }
+ return $RET
+}
+
+# This slurps the XML and converts tags like <subnet> to $device_subnet
+# Also sets device_name and device_type from the attributes
+get_device() {
+ local FOUND=
+ while read_dom; do
+ case $TAG_NAME in
+ device )
+ [[ $FOUND ]] && break # found - and we're on the next
+ # <device> so we're done
+ eval local $ATTRIBUTES
+ device_name=$name
+ device_type=$type
+ ;;
+ mac|index|subnet|ip|sshkeypath )
+ eval device_$TAG_NAME="$CONTENT"
+ ;;
+ esac
+ [[ $device_name == $1 ]] && FOUND=1
+ done
+ [[ $FOUND ]] && return 0
+ return 1
+}
+
+ssh_device() {
+ deviceuser=user
+ ssh -i $keypath $deviceuser@$deviceIP $@
+}
run_qmake() {
+ # This is a good time to verify the target dependencies as per mb
+ verify_target_dependencies
eval sb2 -t $target rpmbuild --build-in-place \
--dobuild \
--define \"qtc_builddir $(pwd) \" \
@@ -103,6 +161,23 @@
$spec
}
+run_deploy() {
+ while [[ $1 ]]; do
+ case "$1" in
+ "--zypper" ) shift
+ rpm="$1"; shift
+ [[ -f $rpm ]] || fatal "$rpm doesn't exist"
+ ;;
+ "--rsync" ) shift
+ ;;
+ esac
+ done
+}
+
+run_gdb() {
+ ssh_device gdb "$@"
+}
+
ME=$(basename $0)
target=""
@@ -110,17 +185,18 @@
while [[ $1 ]]; do
case "$1" in
- "-t" | "--target")
- shift
- target="$1"
+ "-t" | "--target") shift
+ target="$1"; shift
[[ -d ~/.scratchbox2/$target ]] || fatal "$target is an invalid sb2 target"
- shift
;;
- "-s" )
- shift
- spec="$1"
+ "-p" | "--projectdir") shift
+ projdir="$1"; shift
+ pkgdir=$projdir/rpm
+ [[ -d $projdir ]] || fatal "$projdir is not a directory"
+ ;;
+ "-s" | "--specfile" ) shift
+ spec="$1"; shift
[[ -f $spec ]] || fatal "$spec doesn't exist"
- shift
;;
qmake | make | install | rpm)
cmd=run_$1
|
[-]
[+]
|
Changed |
_service:gitpkg:sdk-setup.tgz/src/sdk-info
^
|
@@ -37,42 +37,11 @@
Use "right-ctrl F2" to get a console login prompt.
- Your VM SDK IP address is: $IP
-
This VM should be accessible using the mer-qt-creator-rsa key
ssh -p 2222 -i ~/.ssh/mer-qt-creator-rsa root@localhost
- Mounting shared folders....
EOF
-fail=
-if VBoxControl -nologo sharedfolder list | grep ' home$' > /dev/null 2>&1 ; then
- mount -tvboxsf -o"rw,exec,uid=1001,gid=1001,dev,ttl=200,fmode=700,dmode=700" home /home/mersdk || fail=1
-else
- echo ' Failed to mount shared folder "home"'
- fail=1
-fi
-if VBoxControl -nologo sharedfolder list | grep ' ssh$' > /dev/null 2>&1 ; then
- mount -tvboxsf -o"rw,exec,uid=0,gid=0,dev,fmode=555,dmode=555" ssh /etc/ssh/authorized_keys || fail=1
-else
- echo ' Failed to mount shared folder "ssh" - ssh will not work, use console login as root'
- fail=1
-fi
-if VBoxControl -nologo sharedfolder list | grep ' targets$' > /dev/null 2>&1 ; then
- mount -tvboxsf -o"rw,exec,uid=1001,gid=1001,dev,ttl=200" targets /host_targets || fail=1
-else
- echo ' Failed to mount shared folder "targets"'
- fail=1
-fi
-
-if [[ $fail ]]; then
- VBoxControl -nologo sharedfolder list
- echo " Please see https://wiki.merproject.org/wiki/Platform_SDK_on_VirtualBox"
- echo " for instructions on setting up"
-else
- echo " mounted home and targets succesfully"
-fi
-
/bin/echo -en '\033]R'
|
[-]
[+]
|
Changed |
_service:gitpkg:sdk-setup.tgz/src/sdk-manage
^
|
@@ -12,7 +12,7 @@
usage()
{
cat <<EOF
- usage (keep the arguments order):
+ usage (keep the arguments order):
$0 --toolchain --list
$0 --toolchain --install <arch>
@@ -29,8 +29,12 @@
$0 --devel --install <target> <devel package list>
$0 --devel --remove <target> <devel package list>
+ $0 --srcdir --add <N>
+ $0 --srcdir --remove <N>
+
$0 --sdk --version
$0 --sdk --upgrade
+ $0 --sdk --status
This is the Mer SDK VM manager
For information see https://wiki.merproject.org/wiki/Platform_SDK_on_VirtualBox
@@ -63,7 +67,7 @@
get_toolchains() {
zypper search -t pattern Mer-SB2-* | grep Mer-SB2 | while IFS='| ' read installed pkg dummy; do
echo "${pkg},${installed}"
- done
+ done
return ${PIPESTATUS[0]}
}
@@ -107,13 +111,11 @@
get_toolchains
return $?
;;
- --install )
- shift
+ --install ) shift
install_toolchain "$@"
return $?
;;
- --remove )
- shift
+ --remove ) shift
remove_toolchain "$@"
return $?
;;
@@ -151,7 +153,7 @@
if [[ ${pkg%-devel} != ${pkg} ]]; then
echo "${pkg},${installed}"
fi
- done
+ done
return ${PIPESTATUS[0]}
}
@@ -161,15 +163,13 @@
fi
case "$1" in
- --list )
- shift
+ --list ) shift
target=${1:-}
assert_target_and_setup
get_develpkgs $target
return $?
;;
- --install )
- shift
+ --install ) shift
target=${1:-}
assert_target_and_setup
shift
@@ -177,8 +177,7 @@
synchronise_target $target
return $?
;;
- --remove )
- shift
+ --remove ) shift
target=${1:-}
assert_target_and_setup
shift
@@ -278,11 +277,11 @@
mkdir -p $host_targets/$target
cd $mer_targets/$target
-
+
echo
echo Unpacking target
tar xf "$local_file"
-
+
if [ $? -ne 0 ]; then
if [ "$( df --sync / | tr -s ' ' | tail -n 1 | cut -d ' ' -f 4 )" -lt 10000 ]; then
echo "Not enough disk space to unpack target image"
@@ -359,28 +358,23 @@
--list )
get_targets
;;
- --install )
- shift
+ --install ) shift
assert_target_name_valid "${1:-}"
install_target "$@"
;;
- --remove )
- shift
+ --remove ) shift
assert_target_name_valid "${1:-}"
remove_target "$@"
;;
- --sync )
- shift
+ --sync ) shift
assert_target_name_valid "${1:-}"
synchronise_target "$@"
;;
- --import )
- shift
+ --import ) shift
assert_target_name_valid "${1:-}"
import_target "$@"
;;
- --refresh )
- shift
+ --refresh ) shift
target="${1:-}"
assert_target_and_setup
t_zypper --non-interactive refresh
@@ -395,6 +389,52 @@
################################################################
# SDK
+manage_srcdir() {
+ if ! [[ $1 ]]; then
+ usage --exit
+ fi
+
+ case "$1" in
+ --add ) shift
+ if ! [[ $1 =~ ^[0-9]{1,2}$ ]]; then
+ echo "Invalid index $1 : allowed 1-99"; exit 1
+ fi
+ cat <<EOF > "/etc/systemd/system/home-src$1.mount"
+[Unit]
+Description=SDK Engine Source mapping
+
+[Mount]
+What=src$1
+Where=/home/src$1
+Type=vboxsf
+Options=rw,exec,uid=0,gid=0,dev,fmode=555,dmode=555
+DirectoryMode=755
+TimeoutSec=10
+
+[Install]
+WantedBy=sysinit.target
+
+EOF
+ systemctl --quiet enable home-src$1.mount
+ systemctl start home-src$1.mount
+ ;;
+ --remove ) shift
+ systemctl --quiet disable home-src$1.mount
+ systemctl stop home-src$1.mount
+ systemctl reset-failed home-src$1.mount
+ rm -f "/etc/systemd/system/home_src$1.mount"
+ systemctl daemon-reload
+ ;;
+ * )
+ echo "$1 not recognised"
+ usage --exit
+ ;;
+ esac
+}
+
+################################################################
+# SDK
+
get_sdk_version() {
sdk-version
}
@@ -403,6 +443,24 @@
sdk-version --latest --go
}
+sdk_status() {
+ systemctl --failed
+ ERR=$?
+ if VBoxControl -nologo sharedfolder list | grep ' home$' > /dev/null 2>&1 ; then
+ echo "'home' shared folder is missing"
+ ERR=1
+ fi
+ if VBoxControl -nologo sharedfolder list | grep ' config$' > /dev/null 2>&1 ; then
+ echo "'config' shared folder is missing"
+ ERR=1
+ fi
|
[-]
[+]
|
Added |
_service:gitpkg:sdk-setup.tgz/systemd/etc-mersdk-share.mount
^
|
@@ -0,0 +1,15 @@
+[Unit]
+Description=Build Engine/QtCreator shared configuration
+Before=sshd.service sdk-webapp.service
+RequiredBy=sshd.service
+
+[Mount]
+What=config
+Where=/etc/mersdk/share
+Type=vboxsf
+Options=rw,exec,uid=0,gid=0,dev,fmode=555,dmode=555
+DirectoryMode=755
+TimeoutSec=10
+
+[Install]
+WantedBy=sysinit.target
|
[-]
[+]
|
Added |
_service:gitpkg:sdk-setup.tgz/systemd/home-mersdk.mount
^
|
@@ -0,0 +1,13 @@
+[Unit]
+Description=Home for QtCreator
+
+[Mount]
+What=home
+Where=/home/mersdk
+Type=vboxsf
+Options=rw,exec,uid=1001,gid=1001,dev,ttl=200,fmode=700,dmode=700
+DirectoryMode=755
+TimeoutSec=10
+
+[Install]
+WantedBy=sysinit.target
|
[-]
[+]
|
Changed |
_service:gitpkg:sdk-setup.tgz/systemd/information.service
^
|
@@ -4,6 +4,7 @@
[Unit]
Description=SDK Information
Documentation=http://wiki.merproject.org/Platform_SDK
+WantedBy=multi-user.target
After=systemd-user-sessions.service plymouth-quit-wait.service multi-user.target network.target
[Service]
@@ -14,4 +15,3 @@
StandardInput=tty-force
StandardOutput=tty-force
StandardError=inherit
-
|
[-]
[+]
|
Changed |
_service:gitpkg:sdk-setup.tgz/systemd/sdk-enginelan.service
^
|
@@ -4,7 +4,8 @@
[Unit]
Description=SDK Engine LAN
Documentation=https://wiki.merproject.org/wiki/SDK_on_VirtualBox/Design
-After=host_targets.mount connman.service
+WantedBy=multi-user.target
+After=etc-mersdk-share.mount connman.service
[Service]
Type=oneshot
|
[-]
[+]
|
Changed |
_service:gitpkg:sdk-setup.yaml
^
|
@@ -1,7 +1,7 @@
Name: sdk-setup
Summary: SDK setup packages for Mer SDK
Description: Scripts, configurations and utilities to build Mer SDK and variants
-Version: 0.34
+Version: 0.36
Release: 1
Group: System/Base
License: GPL
@@ -9,6 +9,7 @@
URL: https://github.com/mer-tools/sdk-setup
Sources:
- sdk-setup.tgz
+BuildRequires: systemd
Configure: none
Builder: none
SetupOptions: -q -n src
@@ -44,9 +45,12 @@
- '%{_bindir}/sdk-version'
- '%{_bindir}/sdk-info'
- '%{_bindir}/sdk-setup-enginelan'
- - '%{_sysconfdir}/systemd/system/information.service'
- - '%{_sysconfdir}/systemd/system/sdk-enginelan.service'
- - '%{_sysconfdir}/systemd/system/default.target'
+ - '%{_unitdir}/information.service'
+ - '%{_unitdir}/sdk-enginelan.service'
+ - '%{_unitdir}/host_targets.mount'
+ - '%{_unitdir}/home-mersdk.mount'
+ - '%{_unitdir}/etc-mersdk.mount'
+ - '%{_unitdir}/default.target'
- '%{_sysconfdir}/mer-sdk-vbox'
- Name: sdk-sb2-config
AsWholeName: true
|