-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Update hmftools CHORD and CUPPA #52175
Changes from all commits
b473b1f
0259b87
fbfe1fa
791d442
f274a18
b5a96a6
622f116
32c5163
4193eb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,12 +1,17 @@ | ||||||||||||||
#!/bin/bash | ||||||||||||||
|
||||||||||||||
TGT="$PREFIX/share/$PKG_NAME-$PKG_VERSION-$PKG_BUILDNUM" | ||||||||||||||
[ -d "$TGT" ] || mkdir -p $TGT/{,chart/} | ||||||||||||||
[ -d "$TGT" ] || mkdir -p $TGT | ||||||||||||||
[ -d "${PREFIX}/bin" ] || mkdir -p "${PREFIX}/bin" | ||||||||||||||
|
||||||||||||||
cd "${SRC_DIR}" | ||||||||||||||
mv jar/cuppa*.jar $TGT/cuppa.jar | ||||||||||||||
${PYTHON} -m pip install --no-build-isolation --no-deps --no-cache-dir -vvv src/cuppa/src/main/python/pycuppa/ | ||||||||||||||
mv cuppa*.jar $TGT/cuppa.jar | ||||||||||||||
Comment on lines
7
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error handling for directory change operation The Apply this diff to add error handling: -cd "${SRC_DIR}"
+cd "${SRC_DIR}" || exit 1 Also, consider making the JAR file pattern more specific to avoid potential conflicts: -mv cuppa*.jar $TGT/cuppa.jar
+mv cuppa-*.jar $TGT/cuppa.jar 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Shellcheck[warning] 7-7: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. (SC2164) |
||||||||||||||
|
||||||||||||||
cp $RECIPE_DIR/cuppa.sh $TGT/cuppa | ||||||||||||||
ln -s $TGT/cuppa ${PREFIX}/bin/ | ||||||||||||||
chmod 0755 "${PREFIX}/bin/cuppa" | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling for chmod operation Critical operations like chmod should include error handling. Apply this diff: -chmod 0755 "${PREFIX}/bin/cuppa"
+chmod 0755 "${PREFIX}/bin/cuppa" || exit 1 📝 Committable suggestion
Suggested change
|
||||||||||||||
|
||||||||||||||
mkdir -p /tmp/cuppa_jar/ | ||||||||||||||
unzip -n $TGT/cuppa.jar -d /tmp/cuppa_jar/ | ||||||||||||||
${PYTHON} -m pip install --no-build-isolation --no-deps --no-cache-dir -vvv /tmp/cuppa_jar/pycuppa/ | ||||||||||||||
rm -r /tmp/cuppa_jar/ | ||||||||||||||
Comment on lines
+14
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Optimize file operations to avoid unnecessary moves The current implementation moves the JAR file to the target directory and then unzips it from there, which is inefficient. Apply this diff to optimize the operations: -mv cuppa*.jar $TGT/cuppa.jar
+TEMP_DIR=$(mktemp -d) || exit 1
+trap 'rm -rf "${TEMP_DIR}"' EXIT
-mkdir -p /tmp/cuppa_jar/
-unzip -n $TGT/cuppa.jar -d /tmp/cuppa_jar/
-${PYTHON} -m pip install --no-build-isolation --no-deps --no-cache-dir -vvv /tmp/cuppa_jar/pycuppa/
-rm -r /tmp/cuppa_jar/
+# First unzip and install from the source
+unzip -n cuppa-*.jar -d "${TEMP_DIR}" || exit 1
+${PYTHON} -m pip install --no-build-isolation --no-deps --no-cache-dir -vvv "${TEMP_DIR}/pycuppa/" || exit 1
+
+# Then move the JAR to final location
+mv cuppa-*.jar $TGT/cuppa.jar || exit 1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add proper quoting and error handling for directory creation
The directory creation commands should be properly quoted and include error handling to ensure script reliability.
Apply this diff:
📝 Committable suggestion