Skip to content

Commit a408dc0

Browse files
committed
fixup
# Conflicts: # codeserver/ubi9-python-3.11/nginx/root/usr/share/container-scripts/nginx/common.sh # tests/test_main.py
1 parent de9747c commit a408dc0

File tree

4 files changed

+40
-31
lines changed
  • codeserver/ubi9-python-3.12/nginx/root/usr/share/container-scripts/nginx
  • rstudio
    • c9s-python-3.11/nginx/root/usr/share/container-scripts/nginx
    • rhel9-python-3.11/nginx/root/usr/share/container-scripts/nginx
  • tests

4 files changed

+40
-31
lines changed
Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

33
# get_matched_files finds file for image extending
4-
get_matched_files() {
4+
function get_matched_files() {
5+
local custom_dir default_dir
56
custom_dir="$1"
67
default_dir="$2"
78
files_matched="$3"
@@ -12,17 +13,19 @@ get_matched_files() {
1213
# process_extending_files process extending files in $1 and $2 directories
1314
# - source all *.sh files
1415
# (if there are files with same name source only file from $1)
15-
process_extending_files() {
16+
function process_extending_files() {
17+
local custom_dir default_dir
1618
custom_dir=$1
1719
default_dir=$2
18-
get_matched_files "$custom_dir" "$default_dir" '*.sh' | sort -u | while read -r filename; do
19-
if [ "$filename" ]; then
20-
echo "=> sourcing $filename ..."
21-
if [ -f "$custom_dir/$filename" ]; then
22-
. "$custom_dir/$filename"
23-
elif [ -f "$default_dir/$filename" ]; then
24-
. "$default_dir/$filename"
20+
while read -r filename ; do
21+
if [ "$filename" ]; then
22+
echo "=> sourcing $filename ..."
23+
# custom file has precedence
24+
if [ -f "$custom_dir/$filename" ]; then
25+
source "$custom_dir/$filename"
26+
elif [ -f "$default_dir/$filename" ]; then
27+
source "$default_dir/$filename"
28+
fi
2529
fi
26-
fi
27-
done
28-
}
30+
done <<<"$(get_matched_files "$custom_dir" "$default_dir" '*.sh' | sort -u)"
31+
}

rstudio/c9s-python-3.11/nginx/root/usr/share/container-scripts/nginx/common.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

33
# get_matched_files finds file for image extending
44
function get_matched_files() {
@@ -17,15 +17,15 @@ function process_extending_files() {
1717
local custom_dir default_dir
1818
custom_dir=$1
1919
default_dir=$2
20-
while read filename ; do
21-
if [ $filename ]; then
20+
while read -r filename ; do
21+
if [ "$filename" ]; then
2222
echo "=> sourcing $filename ..."
23-
# Custom file is prefered
24-
if [ -f $custom_dir/$filename ]; then
25-
source $custom_dir/$filename
26-
elif [ -f $default_dir/$filename ]; then
27-
source $default_dir/$filename
23+
# custom file has precedence
24+
if [ -f "$custom_dir/$filename" ]; then
25+
source "$custom_dir/$filename"
26+
elif [ -f "$default_dir/$filename" ]; then
27+
source "$default_dir/$filename"
2828
fi
2929
fi
3030
done <<<"$(get_matched_files "$custom_dir" "$default_dir" '*.sh' | sort -u)"
31-
}
31+
}

rstudio/rhel9-python-3.11/nginx/root/usr/share/container-scripts/nginx/common.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

33
# get_matched_files finds file for image extending
44
function get_matched_files() {
@@ -17,15 +17,15 @@ function process_extending_files() {
1717
local custom_dir default_dir
1818
custom_dir=$1
1919
default_dir=$2
20-
while read filename ; do
21-
if [ $filename ]; then
20+
while read -r filename ; do
21+
if [ "$filename" ]; then
2222
echo "=> sourcing $filename ..."
23-
# Custom file is prefered
24-
if [ -f $custom_dir/$filename ]; then
25-
source $custom_dir/$filename
26-
elif [ -f $default_dir/$filename ]; then
27-
source $default_dir/$filename
23+
# custom file has precedence
24+
if [ -f "$custom_dir/$filename" ]; then
25+
source "$custom_dir/$filename"
26+
elif [ -f "$default_dir/$filename" ]; then
27+
source "$default_dir/$filename"
2828
fi
2929
fi
3030
done <<<"$(get_matched_files "$custom_dir" "$default_dir" '*.sh' | sort -u)"
31-
}
31+
}

tests/test_main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,17 @@ def test_files_that_should_be_same_are_same(subtests: pytest_subtests.plugin.Sub
322322
"ROCm de-vendor script": [
323323
PROJECT_ROOT / "jupyter/rocm/pytorch/ubi9-python-3.12/de-vendor-torch.sh",
324324
PROJECT_ROOT / "runtimes/rocm-pytorch/ubi9-python-3.12/de-vendor-torch.sh",
325+
],
326+
"nginx/common.sh": [
327+
PROJECT_ROOT / "codeserver/ubi9-python-3.12/nginx/root/usr/share/container-scripts/nginx/common.sh",
328+
PROJECT_ROOT / "rstudio/c9s-python-3.11/nginx/root/usr/share/container-scripts/nginx/common.sh",
329+
PROJECT_ROOT / "rstudio/rhel9-python-3.11/nginx/root/usr/share/container-scripts/nginx/common.sh",
325330
]
326331
}
327332
for group_name, (first_file, *rest) in file_groups.items():
328333
with subtests.test(msg=f"Checking {group_name}"):
329334
for file in rest:
335+
# file.write_text(first_file.read_text())
330336
assert first_file.read_text() == file.read_text(), f"The files {first_file} and {file} do not match"
331337

332338

0 commit comments

Comments
 (0)