Skip to content

Commit 99cf753

Browse files
committed
firm up package defs; allow run under podman
1 parent cd9e1bb commit 99cf753

3 files changed

Lines changed: 33 additions & 15 deletions

File tree

irods/test/harness/000_install-irods.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:18.04
1+
FROM ubuntu:20.04
22
COPY install.sh /
33
ARG irods_package_version
44
ENV IRODS_PACKAGE_VERSION "$irods_package_version"

irods/test/harness/docker_container_driver.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,30 +79,32 @@ ORIGINAL_SCRIPT_RELATIVE_TO_ROOT=$(realpath --relative-to $reporoot "$original_t
7979
echo "ORIGINAL_SCRIPT_RELATIVE_TO_ROOT=[$ORIGINAL_SCRIPT_RELATIVE_TO_ROOT]"
8080
INNER_MOUNT=/prc
8181

82+
: ${DOCKER:=docker}
83+
8284
# Start the container.
8385
echo image="[$image]"
84-
CONTAINER=$(docker run -d -v $reporoot:$INNER_MOUNT:ro --rm $image)
86+
CONTAINER=$($DOCKER run -d -v $reporoot:$INNER_MOUNT:ro --rm $image)
8587

8688
# Wait for iRODS and database to start up.
8789
TIME0=$(date +%s)
8890
while :; do
8991
[ `date +%s` -gt $((TIME0 + 30)) ] && { echo >&2 "Waited too long for DB and iRODS to start"; exit 124; }
9092
sleep 1
91-
docker exec $CONTAINER grep '(0)' /tmp/irods_status 2>/dev/null >/dev/null
93+
$DOCKER exec $CONTAINER grep '(0)' /tmp/irods_status 2>/dev/null >/dev/null
9294
[ $? -ne 0 ] && { echo -n . >&2; continue; }
9395
break
9496
done
9597

96-
docker exec ${RUN_AS_USER:+"-u$RUN_AS_USER"} \
97-
${WORKDIR:+"-w$WORKDIR"} \
98-
-e "ORIGINAL_SCRIPT_RELATIVE_TO_ROOT=$ORIGINAL_SCRIPT_RELATIVE_TO_ROOT" \
99-
$CONTAINER \
100-
$INNER_MOUNT/$(realpath --relative-to $reporoot "$testscript_abspath") \
101-
$arglist
98+
$DOCKER exec ${RUN_AS_USER:+"-u$RUN_AS_USER"} \
99+
${WORKDIR:+"-w$WORKDIR"} \
100+
-e "ORIGINAL_SCRIPT_RELATIVE_TO_ROOT=$ORIGINAL_SCRIPT_RELATIVE_TO_ROOT" \
101+
$CONTAINER \
102+
$INNER_MOUNT/$(realpath --relative-to $reporoot "$testscript_abspath") \
103+
$arglist
102104
STATUS=$?
103105

104106
if [ $((0+KILL_TEST_CONTAINER)) -ne 0 ]; then
105-
echo >&2 'Killed:' $(docker stop --time=0 $CONTAINER)
107+
echo >&2 'Killed:' $($DOCKER stop --time=0 $CONTAINER)
106108
fi
107109

108110
[ -n "$ECHO_CONTAINER" ] && echo $CONTAINER

irods/test/harness/install.sh

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,25 @@ add_package_repo()
1616
sudo apt update
1717
}
1818

19-
DIST_NAME=$(lsb_release -sc)
20-
19+
DIST_NAME=$(grep '^VERSION_CODENAME=' /etc/os-release|sed 's/.*=//')
2120
: ${IRODS_VSN:=4.3.1-0~$DIST_NAME}
2221

22+
# Expand a spec of the leading version tuple eg. 4.3.4 out to the full name of
23+
# the most recent matching version of the package
24+
25+
irods_package_vsn() {
26+
apt list -a irods-server 2>/dev/null|awk '{print $2}'|grep '\w'|sort|\
27+
grep "$(perl -e 'print quotemeta($ARGV[0])' "$IRODS_PACKAGE_VERSION")"|tail -1
28+
}
29+
30+
# Report irods server version installed, or failing that, the requested version.
31+
32+
irods_vsn() {
33+
local V=$(dpkg -l irods-server 2>/dev/null|grep '^ii\s'|awk '{print $3}')
34+
V=
35+
echo "${V:-$IRODS_VSN}"
36+
}
37+
2338
while [[ "$1" = -* ]]; do
2439
ARG="$1"
2540
shift
@@ -101,14 +116,15 @@ ________"
101116
;;
102117

103118
4)
104-
sudo apt install -y irods-{dev,runtime}${IRODS_PACKAGE_VERSION:+"=$IRODS_PACKAGE_VERSION"}
119+
IRODS_TO_INSTALL=`irods_package_version`
120+
sudo apt install -y irods-{dev,runtime}${IRODS_TO_INSTALL=:+"=$IRODS_TO_INSTALL="}
105121
if [[ $with_opts != *\ basic\ * ]]; then
106-
sudo apt install -y irods-{icommands,server,database-plugin-postgres}${IRODS_PACKAGE_VERSION:+"=$IRODS_PACKAGE_VERSION"}
122+
sudo apt install -y irods-{icommands,server,database-plugin-postgres}${IRODS_TO_INSTALL=:+"=$IRODS_TO_INSTALL="}
107123
fi
108124
;;
109125

110126
5)
111-
if [ ! "$IRODS_VSN" '<' "4.3" ]; then
127+
if [ ! `irods_vsn` '<' "4.3" ]; then
112128
PYTHON=python3
113129
else
114130
PYTHON=python2

0 commit comments

Comments
 (0)