Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[unitree/cross] Enable to share single docker image with multiple users #1868

Merged
merged 16 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions jsk_unitree_robot/cross/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ user:
install:
./install.sh

compress:
./compress.sh

clean:
rm -fr ${TARGET_MACHINE}_ws_*

Expand Down
17 changes: 13 additions & 4 deletions jsk_unitree_robot/cross/build_ros1.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

IMAGE_NAME="${IMAGE_NAME:-ros1-unitree}"
TARGET_MACHINE="${TARGET_MACHINE:-arm64v8}"
HOST_INSTALL_ROOT="${BASE_ROOT:-${PWD}}/"${TARGET_MACHINE}_System
INSTALL_ROOT=System
Expand Down Expand Up @@ -31,9 +32,12 @@ mkdir -p ${SOURCE_ROOT}/src
mkdir -p ${HOST_INSTALL_ROOT}/ros1_inst

if [ ${UPDATE_SOURCE_ROOT} -eq 1 ]; then
vcs import --force --retry 10 --shallow ${SOURCE_ROOT}/src < repos/catkin_virtualenv.repos
vcs import --force --retry 10 --shallow ${SOURCE_ROOT}/src < repos/roseus_no_window.repos
for dir in euslisp jskeus; do ls ${SOURCE_ROOT}/src/$dir/patches/; rsync -avz ${SOURCE_ROOT}/src/$dir/patches/ ${SOURCE_ROOT}/src/$dir; done
sed -i s@:{version}@0.0.0@ ${SOURCE_ROOT}/src/euslisp/package.xml ${SOURCE_ROOT}/src/jskeus/package.xml
# linux can use sed -i'.bak' and latest mac also supports same syntax.
# https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux/14813278#14813278
sed -i.bak s@:{version}@0.0.0@ ${SOURCE_ROOT}/src/euslisp/package.xml ${SOURCE_ROOT}/src/jskeus/package.xml
fi
wget https://patch-diff.githubusercontent.com/raw/PR2/pr2_mechanism/pull/346.diff -O ${SOURCE_ROOT}/pr2_mechanism-346.diff

Expand All @@ -47,14 +51,16 @@ DIAGNOSTIC_AGGREGATOR="diagnostic_aggregator" # jsk_XXX_startup usually depends
PR2EUS="pr2eus"

docker run -it --rm \
-u $(id -u $USER) \
-e HOST_UID=$(id -u) -e HOST_GID=$(id -g) \
-e INSTALL_ROOT=${INSTALL_ROOT} \
-e MAKEFLAGS=${MAKEFLAGS} \
-v ${HOST_INSTALL_ROOT}/ros1_dependencies:/opt/jsk/${INSTALL_ROOT}/ros1_dependencies:ro \
-v ${HOST_INSTALL_ROOT}/ros1_dependencies_setup.bash:/opt/jsk/${INSTALL_ROOT}/ros1_dependencies_setup.bash:ro \
-v ${PWD}/startup_scripts/usercustomize.py:/home/user/.local/lib/python2.7/site-packages/usercustomize.py:ro \
-v ${PWD}/startup_scripts/usercustomize.py:/home/user/.local/lib/python3.6/site-packages/usercustomize.py:ro \
-v ${HOST_INSTALL_ROOT}/ros1_inst:/opt/jsk/${INSTALL_ROOT}/ros1_inst:rw \
-v ${PWD}/${SOURCE_ROOT}:/home/user/${SOURCE_ROOT}:rw \
ros1-unitree:${TARGET_MACHINE} \
${IMAGE_NAME}:${TARGET_MACHINE} \
bash -c "\
source /opt/jsk/System/ros1_dependencies_setup.bash && \
source /opt/ros/melodic/setup.bash && \
Expand All @@ -70,4 +76,7 @@ docker run -it --rm \
-DEUSLISP_WITHOUT_DISPLAY=TRUE -DDISABLE_DOCUMENTATION=1 \
" 2>&1 | tee ${TARGET_MACHINE}_build_ros1.log

cp ${PWD}/startup_scripts/system_setup.bash ${HOST_INSTALL_ROOT}/
for file in system_setup.bash usercustomize.py; do
[ -d ${HOST_INSTALL_ROOT}/$file ] && rmdir ${HOST_INSTALL_ROOT}/$file
cp ${PWD}/startup_scripts/$file ${HOST_INSTALL_ROOT}/
done
8 changes: 5 additions & 3 deletions jsk_unitree_robot/cross/build_ros1_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

IMAGE_NAME="${IMAGE_NAME:-ros1-unitree}"
k-okada marked this conversation as resolved.
Show resolved Hide resolved
TARGET_MACHINE="${TARGET_MACHINE:-arm64v8}"
HOST_INSTALL_ROOT="${BASE_ROOT:-${PWD}}/"${TARGET_MACHINE}_System
INSTALL_ROOT=System
Expand Down Expand Up @@ -27,23 +28,24 @@ mkdir -p ${HOST_INSTALL_ROOT}/Python
cp repos/go1_requirements.txt ${SOURCE_ROOT}/go1_requirements.txt

docker run -it --rm \
-u $(id -u $USER) \
-e HOST_UID=$(id -u) -e HOST_GID=$(id -g) \
-e INSTALL_ROOT=${INSTALL_ROOT} \
-e MAKEFLAGS=${MAKEFLAGS} \
-v ${PWD}/ros1_dependencies_build_scripts:/home/user/ros1_dependencies_build_scripts:ro \
-v ${PWD}/${SOURCE_ROOT}:/home/user/ros1_dependencies_sources:rw \
-v ${HOST_INSTALL_ROOT}/ros1_dependencies:/opt/jsk//${INSTALL_ROOT}/ros1_dependencies:rw \
-v ${HOST_INSTALL_ROOT}/Python:/opt/jsk/${INSTALL_ROOT}/Python:rw \
ros1-unitree:${TARGET_MACHINE} \
${IMAGE_NAME}:${TARGET_MACHINE} \
bash -c "\
set -xeuf -o pipefail && \
cd /home/user/ros1_dependencies_sources && \
vcs import --skip-existing --retry 10 --shallow src < ros1_dependencies.repos && \
for script_file in \$(ls /home/user/ros1_dependencies_build_scripts/|sort); do
[ -e /home/user/ros1_dependencies_sources/\$script_file.installed ] && continue;
/home/user/ros1_dependencies_build_scripts/\$script_file || exit 1;
touch /home/user/ros1_dependencies_sources/\$script_file.installed;
done && \
pip install -U --user pip && \
export PYTHONPATH=\"/opt/jsk/System/ros1_dependencies/lib/python2.7/site-packages\" && \
export PKG_CONFIG_PATH=\"/opt/jsk/${INSTALL_ROOT}/ros1_dependencies/lib/pkgconfig\" && \
~/.local/bin/pip install --prefix=/opt/jsk/${INSTALL_ROOT}/Python -r /home/user/ros1_dependencies_sources/go1_requirements.txt \
" 2>&1 | tee ${TARGET_MACHINE}_build_ros1_dependencies.log
9 changes: 6 additions & 3 deletions jsk_unitree_robot/cross/build_user.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

IMAGE_NAME="${IMAGE_NAME:-ros1-unitree}"
TARGET_MACHINE="${TARGET_MACHINE:-arm64v8}"
HOST_INSTALL_ROOT="${BASE_ROOT:-${PWD}}/"${TARGET_MACHINE}_System
INSTALL_ROOT=System
Expand Down Expand Up @@ -39,20 +40,22 @@ done

# check if /proc/sys/fs/binfmt_misc/qemu-* is updated
# See https://github.com/k-okada/jsk_robot/issues/61
docker run -it --rm ros1-unitree:${TARGET_MACHINE} bash -c 'exit' || docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run -it --rm -e HOST_UID=$(id -u) -e HOST_GID=$(id -g) ${IMAGE_NAME}:${TARGET_MACHINE} bash -c 'exit' || docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

# run on docker
docker run -it --rm \
-u $(id -u $USER) \
-e HOST_UID=$(id -u) -e HOST_GID=$(id -g) \
-e INSTALL_ROOT=${INSTALL_ROOT} \
-v ${HOST_INSTALL_ROOT}/ros1_dependencies:/opt/jsk/${INSTALL_ROOT}/ros1_dependencies:ro \
-v ${HOST_INSTALL_ROOT}/Python:/opt/jsk/${INSTALL_ROOT}/Python:ro \
-v ${HOST_INSTALL_ROOT}/ros1_inst:/opt/jsk/${INSTALL_ROOT}/ros1_inst:ro \
-v ${HOST_INSTALL_ROOT}/ros1_dependencies_setup.bash:/opt/jsk/${INSTALL_ROOT}/ros1_dependencies_setup.bash:ro \
-v ${HOST_INSTALL_ROOT}/system_setup.bash:/opt/jsk/${INSTALL_ROOT}/system_setup.bash:ro \
-v ${PWD}/startup_scripts/usercustomize.py:/home/user/.local/lib/python2.7/site-packages/usercustomize.py:ro \
-v ${PWD}/startup_scripts/usercustomize.py:/home/user/.local/lib/python3.6/site-packages/usercustomize.py:ro \
-v ${PWD}/${SOURCE_ROOT}:/opt/jsk/User:rw \
-v ${PWD}/rosinstall_generator_unreleased.py:/home/user/rosinstall_generator_unreleased.py:ro \
ros1-unitree:${TARGET_MACHINE} \
${IMAGE_NAME}:${TARGET_MACHINE} \
bash -c "\
source /opt/jsk/System/system_setup.bash && \
env && \
Expand Down
29 changes: 29 additions & 0 deletions jsk_unitree_robot/cross/compress.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

if [ -e "arm64v8_User" ]; then
if [ -e "arm64v8_User.tgz" ]; then
echo "WARNING: Compressed arm64v8_User.tgz is found."
read -p "WARNING: Are you sure to continue [y/N] ? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]; then
tar -zcvf arm64v8_User.tgz arm64v8_User
fi
else
tar -zcvf arm64v8_User.tgz arm64v8_User
fi
fi

if [ -e "arm64v8_System" ]; then
if [ -e "arm64v8_System.tgz" ]; then
echo "WARNING: Compressed arm64v8_System.tgz is found."
read -p "WARNING: Are you sure to continue [y/N] ? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]; then
chmod 644 arm64v8_System/ros1_inst/share/pr2eus/*.l
tar -zcvf arm64v8_System.tgz arm64v8_System
fi
else
chmod 644 arm64v8_System/ros1_inst/share/pr2eus/*.l
tar -zcvf arm64v8_System.tgz arm64v8_System
fi
fi
13 changes: 6 additions & 7 deletions jsk_unitree_robot/cross/docker/Dockerfile_ros1
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,18 @@ RUN git clone https://github.com/k-okada/rosinstall_generator /tmp/rosinstall_ge
RUN pip install /tmp/rosinstall_generator
RUN apt install -y python3-vcstool
#
# Setup Users
# add tool for users
#
ARG UID=1000
RUN apt-get install -y sudo
RUN useradd --uid $UID -ms /bin/bash -G sudo user
RUN newgrp
RUN echo user:user | chpasswd
#
# Remove packages is not found on 161
#
RUN dpkg -r --force-depends cython gir1.2-gstreamer-1.0 libtinyxml-dev python-attr python-autobahn python-automat python-cbor python-concurrent.futures python-constantly python-constantly python-incremental python-lz4 python-nacl python-pyasn1 python-pyasn1-modules python-qrcode python-service-identity python-snappy python-trie python-trollius python-twisted-bin python-twisted-core python-twisted python-txaio python-ubjson python-u-msgpack python-wsaccel python-zope.interface
#
# Add cython, which we need to compile packages with catkin_virtualenv, not sure why 1049-cython works...
RUN (cd /tmp; apt download cython && dpkg --force-depends -i cython_*.deb)
#
#
WORKDIR /home/user
USER user
ADD entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
24 changes: 24 additions & 0 deletions jsk_unitree_robot/cross/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

function fail {
printf '\033[31m%s\033[0m\n' "$1" >&2 ## Send message to stderr.
exit "${2-1}" ## Return a code specified by $2, or 1 by default.
}
[ -z "${HOST_UID}" ] && fail "ERROR: HOST_UID is requried, add '-e HOST_UID=$(id -u)' to your docker commandline option"
[ -z "${HOST_GID}" ] && fail "ERROR: HOST_GID is requried, add '-e HOST_GID=$(id -g)' to your docker commandline option"

# create user with same UID as the host user
# -g The numerical value of the group's ID.
groupadd -g $HOST_GID user
# -u The numerical value of the user's ID.
# -o Allow the creation of a user account with a duplicate (non-unique) UID.
# -m Create the user's home directory if it does not exist.
# -g The group name or number of the user's initial login group.
# -s The name of the user's login shell.
useradd -u $HOST_UID -o -m -g $HOST_GID -s /usr/bin user -G sudo
echo user:user | chpasswd
export HOME=/home/user
chown $HOST_UID:$HOST_GID $HOME
cd $HOME

runuser -u user -- "$@"
18 changes: 13 additions & 5 deletions jsk_unitree_robot/cross/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ function copy_data () {
fi

# Check if robot is reachable
reachability=$(LANG=C ping -c4 ${hostname} 2>/dev/null | awk '/---/,0' | grep -Po '[0-9]{1,3}(?=% packet loss)')
# Use perl instead of `grep -Po '[0-9]{1,3}(?=% packet loss)'` for Mac environment.
# See https://stackoverflow.com/questions/16658333/grep-p-no-longer-works-how-can-i-rewrite-my-searches/16658690#16658690
reachability=$(LANG=C ping -c4 ${hostname} 2>/dev/null | awk '/---/,0' | perl -nle'print $& while m{[0-9]{1,3}(?=% packet loss)}g')
if [ -z "$reachability" ] || [ "$reachability" == 100 ]; then
echo "ERROR: ${hostname} unreachable" 1>&2
exit 2
Expand All @@ -64,6 +66,12 @@ function copy_data () {
ssh-keygen -f "${HOME}/.ssh/known_hosts" -R "${hostname}" || echo "OK"
sshpass -p $PASS ssh -o StrictHostKeyChecking=no ${user}@${hostname} exit

if [[ "${TARGET_DIRECTORY}" == "System" ]]; then
sshpass -p 123 scp ${TARGET_MACHINE}_${TARGET_DIRECTORY}/usercustomize.py ${user}@${hostname}:/tmp/usercustomize.py
sshpass -p $PASS ssh -t ${user}@${hostname} "mkdir -p ~/.local/lib/python2.7/site-packages/; cp -f /tmp/usercustomize.py .local/lib/python2.7/site-packages/"
sshpass -p $PASS ssh -t ${user}@${hostname} "mkdir -p ~/.local/lib/python3.6/site-packages/; cp -f /tmp/usercustomize.py .local/lib/python3.6/site-packages/"
fi

# cehck disk space
echo "Copy ${TARGET_MACHINE}_${TARGET_DIRECTORY} ...."
echo "==="
Expand Down Expand Up @@ -108,15 +116,15 @@ function copy_data () {

# update udev
# respeaker_ros
sshpass -p $PASS ssh -t ${user}@${hostname} "source /opt/jsk/User/user_setup.bash; sudo cp -f \$(rospack find respeaker_ros)/config/60-respeaker.rules /etc/udev/rules.d/60-respeaker.rules"
sshpass -p $PASS ssh -t ${user}@${hostname} "source /opt/jsk/User/user_setup.bash; echo $PASS | sudo cp -f \$(rospack find respeaker_ros)/config/60-respeaker.rules /etc/udev/rules.d/60-respeaker.rules"
#
sshpass -p $PASS ssh -t ${user}@${hostname} "ls -al /etc/udev/rules.d/; sudo systemctl restart udev"
sshpass -p $PASS ssh -t ${user}@${hostname} "ls -al /etc/udev/rules.d/; echo $PASS | sudo systemctl restart udev"
fi

# enable Internet with USB LTE module
if [[ "${hostname}" == "192.168.123.161" ]]; then
sshpass -p $PASS ssh -t ${user}@${hostname} "source /opt/jsk/User/user_setup.bash; sudo cp -f \$(rospack find jsk_unitree_startup)/config/dhcpcd.conf /etc/dhcpcd.conf"
sshpass -p $PASS ssh -t ${user}@${hostname} "sudo systemctl restart dhcpcd"
sshpass -p $PASS ssh -t ${user}@${hostname} "export PATH=\$PATH:/sbin; source /opt/jsk/User/user_setup.bash; echo $PASS | sudo cp -f \$(rospack find jsk_unitree_startup)/config/dhcpcd.conf /etc/dhcpcd.conf"
sshpass -p $PASS ssh -t ${user}@${hostname} "echo $PASS | sudo systemctl restart dhcpcd"
fi
set +x
}
Expand Down
3 changes: 2 additions & 1 deletion jsk_unitree_robot/cross/prepare_requirements_ros1.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

IMAGE_NAME="${IMAGE_NAME:-ros1-unitree}"
TARGET_MACHINE="${TARGET_MACHINE:-arm64v8}"
HOST_INSTALL_ROOT="${BASE_ROOT:-${PWD}}/"System
INSTALL_ROOT=System
Expand All @@ -14,4 +15,4 @@ if [ -e /proc/sys/fs/binfmt_misc/qemu-aarch64 ] && [ ! "$(docker images -q mult
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
fi

docker buildx build $@ --progress plain -t ros1-unitree:${TARGET_MACHINE} --build-arg TARGET_MACHINE=${TARGET_MACHINE} --build-arg UID=$(id -u $USER) -f docker/Dockerfile_ros1 docker/ 2>&1 | tee ${TARGET_MACHINE}_prepare_requirements_ros1.log
docker buildx build $@ --progress plain -t ${IMAGE_NAME}:${TARGET_MACHINE} --build-arg TARGET_MACHINE=${TARGET_MACHINE} --build-arg UID=$(id -u $USER) -f docker/Dockerfile_ros1 docker/ 2>&1 | tee ${TARGET_MACHINE}_prepare_requirements_ros1.log
18 changes: 18 additions & 0 deletions jsk_unitree_robot/cross/repos/catkin_virtualenv.repos
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repositories:
catkin_virtualenv:
type: git
url: https://github.com/locusrobotics/catkin_virtualenv
version: 0.9.0
#
# 0.9.0 contains following two patches, but not release on ROS1
# catkin_virtualenv depends on python3-rospkg-modules (and others). It is installed in build_ros1_dependencies.sh
#
# At current, if we do a catkin build with CATKIN_ENABLE_TESTING=FALSE,
# we get the error 'Unknown CMake command "catkin_run_tests_target"'
# when calling catkin_generate_virtualenv. The following PR fixes this error.
# https://github.com/locusrobotics/catkin_virtualenv/pull/89
#
# Some python environments may not have ensurepip installed.
# Also, some users may not be able to use sudo apt install to install python3-venv (sudo command), etc.
# The following PR will enable catkin_virtualenv in environments without ensurepip by doing get-pip.py within venv.
# https://github.com/locusrobotics/catkin_virtualenv/pull/90
30 changes: 30 additions & 0 deletions jsk_unitree_robot/cross/repos/ros1_dependencies.repos
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,33 @@ repositories:
type: tar
url: http://archive.ubuntu.com/ubuntu/pool/universe/libc/libccd/libccd_2.0-1.debian.tar.xz
# fcl depends on ccd
virtualenv:
type: tar
url: http://archive.ubuntu.com/ubuntu/ubuntu/pool/universe/p/python-virtualenv/python-virtualenv_15.1.0+ds.orig.tar.gz
virtualenv/debian:
type: tar
url: http://archive.ubuntu.com/ubuntu/ubuntu/pool/universe/p/python-virtualenv/python-virtualenv_15.1.0+ds-1.1.debian.tar.xz
python3-pyparsing:
type: tar
url: http://archive.ubuntu.com/ubuntu/pool/main/p/pyparsing/pyparsing_2.2.0+dfsg1.orig.tar.gz
python3-pyparsing/debian:
type: tar
url: http://archive.ubuntu.com/ubuntu/pool/main/p/pyparsing/pyparsing_2.2.0+dfsg1-2.debian.tar.xz
python3-catkin-pkg-modules:
type: tar
url: http://packages.ros.org/ros/ubuntu/pool/main/p/python3-catkin-pkg-modules/python3-catkin-pkg-modules_0.5.2.orig.tar.gz
python3-catkin-pkg-modules/debian:
type: tar
url: http://packages.ros.org/ros/ubuntu/pool/main/p/python3-catkin-pkg-modules/python3-catkin-pkg-modules_0.5.2-1.debian.tar.xz
python3-rospkg-modules:
type: tar
url: http://packages.ros.org/ros/ubuntu/pool/main/p/python3-rospkg-modules/python3-rospkg-modules_1.5.0.orig.tar.gz
python3-rospkg-modules/debian:
type: tar
url: http://packages.ros.org/ros/ubuntu/pool/main/p/python3-rospkg-modules/python3-rospkg-modules_1.5.0-1.debian.tar.xz
cython:
type: tar
url: http://archive.ubuntu.com/ubuntu/ubuntu/pool/universe/c/cython/cython_0.26.1.orig.tar.gz
cython/debian:
type: tar
url: http://archive.ubuntu.com/ubuntu/ubuntu/pool/universe/c/cython/cython_0.26.1-0.4.debian.tar.xz
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -xeuf -o pipefail

DEBIAN_DIR=/home/user/ros1_dependencies_sources/src/virtualenv/debian/debian
SOURCE_DIR=/home/user/ros1_dependencies_sources/src/virtualenv/virtualenv-15.1.0

cd ${DEBIAN_DIR}/patches
for patch_file in $(grep -v ^# series); do
OUT="$(patch -p1 --forward --directory ${SOURCE_DIR} < ${patch_file} | tee /dev/tty)" || echo "${OUT}" | grep "Skipping patch" -q || (echo "$OUT" && false) || echo "OK"
done

cd ${SOURCE_DIR}

mkdir -p /opt/jsk/${INSTALL_ROOT}/ros1_dependencies/lib/python3.6/site-packages/
SKIP_PYTHON_SCRIPTS=1 \
PYTHONPATH="/opt/jsk/${INSTALL_ROOT}/ros1_dependencies/lib/python3.6/site-packages" \
python3 \
setup.py install \
--force --root=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies \
--no-compile -O0 --single-version-externally-managed --prefix=./
# --prefix /opt/jsk/${INSTALL_ROOT}/ros1_dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -xeuf -o pipefail

DEBIAN_DIR=/home/user/ros1_dependencies_sources/src/python3-pyparsing/debian/debian
SOURCE_DIR=/home/user/ros1_dependencies_sources/src/python3-pyparsing/pyparsing-2.2.0+dfsg1

# cd ${DEBIAN_DIR}/patches
# for patch_file in $(grep -v ^# series); do
# OUT="$(patch -p1 --forward --directory ${SOURCE_DIR} < ${patch_file} | tee /dev/tty)" || echo "${OUT}" | grep "Skipping patch" -q || (echo "$OUT" && false) || echo "OK"
# done

cd ${SOURCE_DIR}

mkdir -p /opt/jsk/${INSTALL_ROOT}/ros1_dependencies/lib/python3.6/site-packages/
SKIP_PYTHON_SCRIPTS=1 \
PYTHONPATH="/opt/jsk/${INSTALL_ROOT}/ros1_dependencies/lib/python3.6/site-packages" \
python3 \
setup.py install \
--force --root=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies \
--no-compile -O0 --single-version-externally-managed --prefix=./
# --prefix /opt/jsk/${INSTALL_ROOT}/ros1_dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -xeuf -o pipefail

DEBIAN_DIR=/home/user/ros1_dependencies_sources/src/python3-catkin-pkg-modules/debian/debian
SOURCE_DIR=/home/user/ros1_dependencies_sources/src/python3-catkin-pkg-modules/catkin_pkg_modules-0.5.2

# cd ${DEBIAN_DIR}/patches
# for patch_file in $(grep -v ^# series); do
# OUT="$(patch -p1 --forward --directory ${SOURCE_DIR} < ${patch_file} | tee /dev/tty)" || echo "${OUT}" | grep "Skipping patch" -q || (echo "$OUT" && false) || echo "OK"
# done

cd ${SOURCE_DIR}

mkdir -p /opt/jsk/${INSTALL_ROOT}/ros1_dependencies/lib/python3.6/site-packages/
SKIP_PYTHON_SCRIPTS=1 \
PYTHONPATH="/opt/jsk/${INSTALL_ROOT}/ros1_dependencies/lib/python3.6/site-packages" \
python3 \
setup.py install \
--force --root=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies \
--no-compile -O0 --single-version-externally-managed --prefix=./
# --prefix /opt/jsk/${INSTALL_ROOT}/ros1_dependencies
Loading
Loading