-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·82 lines (70 loc) · 1.99 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·82 lines (70 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
set -euo pipefail
# Default paths
readonly BUILD_DIR="./build"
readonly QIHE_STORAGE_DIR="./qihe-storage"
# Helper function to display usage
usage() {
echo "Usage: $0 [--prefix <dir> | --qihe [<dir>]]"
echo " --prefix [<dir>] Copy compiled .qh files to the specified directory."
echo " --qihe [<dir>] Copy compiled .qh files to the qihe repository. Default: ../qihe."
exit 1
}
# Ensure the build directory exists
if [[ ! -d "$BUILD_DIR" ]]; then
echo "Error: Build directory ($BUILD_DIR) not found!" >&2
exit 1
fi
# Parse arguments
TARGET_DIR=""
QIHE_MODE=false
DEFAULT_QIHE_DIR="../qihe"
QIHE_DIR=""
while [[ $# -gt 0 ]]; do
case "$1" in
--prefix)
shift
TARGET_DIR="$1"
;;
--qihe)
QIHE_MODE=true
QIHE_DIR="${2:-$DEFAULT_QIHE_DIR}"
TARGET_DIR="$QIHE_DIR/platform/src/test/resources/testcases/evaluation/qihe-benchmark"
shift || true
;;
*)
usage
;;
esac
shift || true
done
if $QIHE_MODE; then
if [[ ! -d "$QIHE_DIR" ]]; then
echo "Error: Qihe directory ($QIHE_DIR) not found!" >&2
exit 1
fi
fi
if [[ -z "$TARGET_DIR" ]]; then
echo "Error: No target directory specified. Please specify --prefix or --qihe" >&2
usage
fi
mkdir -p "$TARGET_DIR"
# Copy .qh files while preserving directory structure
qh_files=$(find "$BUILD_DIR" \( -name "*.qh" -o -name "*.bin" \) -type f)
if [[ -z "$qh_files" ]]; then
echo "Error: No .qh or .bin files found in $BUILD_DIR!" >&2
exit 1
fi
for file in $qh_files; do
relative_path="${file#$BUILD_DIR/}"
target_path="$TARGET_DIR/$relative_path"
mkdir -p "$(dirname "$target_path")"
cp "$file" "$target_path"
echo "Copied: $file -> $target_path"
done
# Special handling for Qihe mode
if $QIHE_MODE; then
echo "Qihe mode: Copied Qihe IR files to the Qihe repository at $TARGET_DIR"
else
echo "Success: Copied Qihe IR files to $TARGET_DIR"
fi