-
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 d4tools and d4binding #48077
update d4tools and d4binding #48077
Changes from all commits
8f2ec10
44c6ba1
6cc327a
0a488a1
6650695
6755d94
2d51e68
1934ecd
387ff98
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 | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,63 @@ | ||||||||||||||||||||||||||||||||||
#!/bin/bash | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
if [ "${DOCS_RS}" = "1" ] | ||||||||||||||||||||||||||||||||||
then | ||||||||||||||||||||||||||||||||||
exit 0 | ||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
set -ex | ||||||||||||||||||||||||||||||||||
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 Enhance shell script safety settings. Consider adding additional safety flags to prevent common shell script issues: -set -ex
+set -euxo pipefail This change will:
📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
pushd ${OUT_DIR} | ||||||||||||||||||||||||||||||||||
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. Validate required environment variables. The script assumes OUT_DIR is set but doesn't validate it. Add validation to prevent unclear errors: +if [ -z "${OUT_DIR}" ]; then
+ echo "ERROR: OUT_DIR environment variable is not set"
+ exit 1
+fi
+
pushd ${OUT_DIR} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
HTSLIB_VERSION=${1} | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
rm -rf ${OUT_DIR}/htslib | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
git clone -b ${HTSLIB_VERSION} http://github.com/samtools/htslib.git | ||||||||||||||||||||||||||||||||||
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. Use HTTPS instead of HTTP for git clone. Using HTTP for git operations is less secure. Switch to HTTPS: -git clone -b ${HTSLIB_VERSION} http://github.com/samtools/htslib.git
+git clone -b ${HTSLIB_VERSION} https://github.com/samtools/htslib.git 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
cd htslib | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
cat > config.h << CONFIG_H | ||||||||||||||||||||||||||||||||||
#define HAVE_LIBBZ2 1 | ||||||||||||||||||||||||||||||||||
#define HAVE_DRAND48 1 | ||||||||||||||||||||||||||||||||||
CONFIG_H | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
perl -i -pe 's/hfile_libcurl\.o//g' Makefile | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
function is_musl() { | ||||||||||||||||||||||||||||||||||
if [ ! -z $(echo $TARGET | grep musl) ]; then | ||||||||||||||||||||||||||||||||||
return 0 | ||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||
return 1 | ||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
Comment on lines
+27
to
+33
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. Fix shell quoting in musl detection. The current implementation is vulnerable to word splitting. Quote the grep result: function is_musl() {
- if [ ! -z $(echo $TARGET | grep musl) ]; then
+ if [ ! -z "$(echo "$TARGET" | grep musl)" ]; then
return 0
else
return 1
fi
} 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Shellcheck
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
is_musl && perl -i -pe 's/gcc/musl-gcc/g' Makefile | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
if [ "x${ZLIB_SRC}" != "x" ] | ||||||||||||||||||||||||||||||||||
then | ||||||||||||||||||||||||||||||||||
tar xz ${ZLIB_SRC} | ||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||
curl -L 'http://github.com/madler/zlib/archive/refs/tags/v1.2.11.tar.gz' | tar xz | ||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||
Comment on lines
+38
to
+43
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. Enhance download safety for zlib. The current implementation lacks important safety measures: else
- curl -L 'http://github.com/madler/zlib/archive/refs/tags/v1.2.11.tar.gz' | tar xz
+ ZLIB_SHA256="629380c90a77892b5c0119a3be631f21e391faa5e93c7b5a5e2ad35d84f7f178"
+ curl --retry 3 --retry-delay 3 -L 'https://github.com/madler/zlib/archive/refs/tags/v1.2.11.tar.gz' -o zlib.tar.gz
+ echo "${ZLIB_SHA256} zlib.tar.gz" | sha256sum -c
+ tar xzf zlib.tar.gz
+ rm zlib.tar.gz
fi Changes:
📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
cd zlib-1.2.11 | ||||||||||||||||||||||||||||||||||
is_musl && CC=musl-gcc ./configure || ./configure | ||||||||||||||||||||||||||||||||||
make libz.a | ||||||||||||||||||||||||||||||||||
cp libz.a .. | ||||||||||||||||||||||||||||||||||
cd .. | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
#The original file in the repo is lacking -L in the curl command so it doen't work | ||||||||||||||||||||||||||||||||||
curl -L http://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz | tar xz | ||||||||||||||||||||||||||||||||||
cd bzip2-1.0.8 | ||||||||||||||||||||||||||||||||||
Comment on lines
+50
to
+52
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. Fix typo in comment and enhance bzip2 download safety. The comment has a typo and the download lacks safety measures: -#The original file in the repo is lacking -L in the curl command so it doen't work
-curl -L http://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz | tar xz
+# The original file in the repo is lacking -L in the curl command so it doesn't work
+BZIP2_SHA256="ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269"
+curl --retry 3 --retry-delay 3 -L 'https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz' -o bzip2.tar.gz
+echo "${BZIP2_SHA256} bzip2.tar.gz" | sha256sum -c
+tar xzf bzip2.tar.gz
+rm bzip2.tar.gz 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
is_musl && perl -i -pe 's/gcc/musl-gcc/g' Makefile | ||||||||||||||||||||||||||||||||||
is_musl || perl -i -pe 's/CFLAGS=/CFLAGS=-fPIC /g' Makefile | ||||||||||||||||||||||||||||||||||
make | ||||||||||||||||||||||||||||||||||
cp libbz2.a .. | ||||||||||||||||||||||||||||||||||
cd .. | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
perl -i -pe 's/CPPFLAGS =/CPPFLAGS = -Izlib-1.2.11 -Ibzip2-1.0.8/g' Makefile | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
is_musl || perl -i -pe 's/CFLAGS *=/CFLAGS = -fPIC/g' Makefile | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
make -j8 lib-static | ||||||||||||||||||||||||||||||||||
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 parallel compilation. Instead of hardcoding -make -j8 lib-static
+nproc_bin="$(command -v nproc)"
+if [ -n "$nproc_bin" ]; then
+ make -j"$($nproc_bin)" lib-static
+else
+ make -j8 lib-static
+fi 📝 Committable suggestion
Suggested change
|
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
Enhance robustness of the build_htslib.sh copy operation.
The current copy operation lacks error handling and directory verification. Consider adding these safety checks to prevent build failures.
Here's a more robust implementation:
📝 Committable suggestion