Skip to content
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

Rework libarrow activate.sh with finer-grained checks and logging #1065

Merged
merged 32 commits into from
May 31, 2023
Merged
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fee5aca
Add more checks in activate.sh
maresb May 29, 2023
42b6815
Fix unconventional naming regarding symlink/target
maresb May 29, 2023
71694c2
Create temporary symlink and replace existing
maresb May 29, 2023
e24eec2
Switch back to `ln -sf`
maresb May 30, 2023
3fe7e28
Lint activate.sh
maresb May 30, 2023
ed98a2e
Add logging to libarrow activate.sh
maresb May 30, 2023
d3ba180
Make GDB_PREFIX private
maresb May 30, 2023
c366891
Make PLACEHOLDER private
maresb May 30, 2023
365579c
Make WRAPPER_DIR private
maresb May 30, 2023
f96f083
Remove redundant comments
maresb May 30, 2023
dc8caff
Verify wrapper directory just before creating link
maresb May 30, 2023
284d8cb
Report failed link creation as an error
maresb May 30, 2023
ae2979b
Make symlink private
maresb May 30, 2023
6e6a86a
Make target private
maresb May 30, 2023
d8fa4f8
Replace redundant permissions check with error message
maresb May 30, 2023
68ce9f3
Reformat logging message
maresb May 30, 2023
df04965
Add comment indicating side-effect of conditional
maresb May 30, 2023
ba87d0e
Fix logging activation variable name
maresb May 30, 2023
baaeaf0
Update recipe/activate.sh
maresb May 30, 2023
1410c3a
Fix confusing logger message
maresb May 30, 2023
95fcda5
Further cleanup of log message
maresb May 30, 2023
49d0624
Alphabetically sort variables during unset
maresb May 30, 2023
92bb926
Fix variable names
maresb May 30, 2023
e4153dd
Handle multiline inputs to logging command
maresb May 30, 2023
a63dbba
Force logging
maresb May 30, 2023
a213c9e
Clean up log formatting
maresb May 30, 2023
9519229
Fix variable names
maresb May 30, 2023
e4d8bfc
Fix potential logging compatibility issues
maresb May 30, 2023
fa50b74
Revert "Force logging"
maresb May 30, 2023
ef99615
Correct variable name in comment
maresb May 30, 2023
24f9013
Bump build number
maresb May 30, 2023
f1dcd33
retrigger CI
h-vetinari May 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions recipe/activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,29 @@ if [ ! -w "$WRAPPER_DIR" ]; then
return
fi

# there's only one lib in that folder, but the libname changes
# Everything that follows amounts to very carefully creating the
# symlink if need be.

# there's only one lib in the placeholder folder, but the libname changes
# based on the version so use a loop instead of hardcoding it.
for f in "$GDB_PREFIX/$PLACEHOLDER/lib/"*.py; do
if [ ! -e "$f" ]; then
for target in "$GDB_PREFIX/$PLACEHOLDER/lib/"*.py; do
if [ ! -e "$target" ]; then
# If the file doesn't exist, skip this iteration of the loop.
# (This happens when no files are found, in which case the
# loop runs with f equal to the pattern itself.)
continue
fi
target="$WRAPPER_DIR/$(basename "$f")"
# We have write permissions to WRAPPER_DIR but not necessarily target.
# Thus it's safest to delete the target in case it already exists.
rm -f "$target"
ln -s "$f" "$WRAPPER_DIR/$(basename "$f")"
symlink="$WRAPPER_DIR/$(basename "$target")"
# Check if symbolic link already exists and points to correct file
if [ -L "$symlink" ] && [ "$(readlink "$symlink")" = "$target" ]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the most important part. Covers every activation after the link is created

# Stop if it does
continue
fi
# We have write permissions to WRAPPER_DIR but not necessarily the symlink.
# Thus rather than editing the symlink, we should create a temporary symlink
# and then move it into place.
temp_symlink="$(mktemp --tmpdir gdb-symlink-for-arrow-cpp-XXXXX)"
h-vetinari marked this conversation as resolved.
Show resolved Hide resolved
ln -sf "$target" "$temp_symlink"
mv "$temp_symlink" "$symlink"
done

h-vetinari marked this conversation as resolved.
Show resolved Hide resolved