Skip to content

Commit 41dbb08

Browse files
committed
fix(ci): errors in Provides-Dist injector
1 parent 49b4f1b commit 41dbb08

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ci/scripts/patch_artifacts_if_distribution_name_is_altered.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
#!/bin/bash
2+
set -e
3+
set -o pipefail
24

35
artifacts=$*
46
injection_string="Provides-Dist: appmap"
57
if [ -n "$artifacts" ] && [ -n "$DISTRIBUTION_NAME" ] && [ "$DISTRIBUTION_NAME" != "appmap" ]; then
68
echo "Altered distribution name detected, injecting '$injection_string' into artifacts: $artifacts"
79
for artifact in $artifacts ; do
810
TMP=$(mktemp -d)
9-
ARTIFACT_PATH="$artifact"
11+
ARTIFACT_PATH="$(realpath ${artifact})"
1012
if [[ $artifact == *.whl ]]; then
1113
unzip -q "$ARTIFACT_PATH" -d "$TMP"
1214
DISTINFO=$(find "$TMP" -type d -name "*.dist-info")
1315
echo "$injection_string" >> "$DISTINFO/METADATA"
1416
(cd "$TMP" && zip -qr "$ARTIFACT_PATH" .)
1517
else
1618
tar -xzf "$ARTIFACT_PATH" -C "$TMP"
17-
PKGDIR=$(find "$TMP" -maxdepth 1 -type d -name "*")
18-
echo "Provides-Dist: appmap" >> "$PKGDIR/PKG-INFO"
19+
PKGDIR=$(find "$TMP" -maxdepth 1 -type d -name "*.egg-info" -o -name "*" -type d | grep -v "^\.$")
20+
echo "$injection_string" >> "$PKGDIR/PKG-INFO"
1921
(cd "$TMP" && tar -czf "$ARTIFACT_PATH" .)
2022
fi
2123
echo "($injection_string): patched $ARTIFACT_PATH"

0 commit comments

Comments
 (0)