mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-23 16:23:07 +00:00
nix: nimble path script remove excluded nim packages
This commit is contained in:
parent
4d735b3bc3
commit
c9b43db409
@ -62,6 +62,7 @@ in stdenv.mkDerivation rec {
|
||||
ANDROID_NDK_HOME="${pkgs.androidPkgs.ndk}";
|
||||
NIMFLAGS = "-d:disableMarchNative -d:git_revision_override=${revision}";
|
||||
XDG_CACHE_HOME = "/tmp";
|
||||
EXCLUDED_NIM_PACKAGES="vendor/nim-dnsdisc/vendor";
|
||||
|
||||
makeFlags = targets ++ [
|
||||
"V=${toString verbosity}"
|
||||
|
||||
@ -6,17 +6,38 @@ output_file="submodule_paths.txt"
|
||||
# Ensure the output file is empty before we start
|
||||
> "$output_file"
|
||||
|
||||
# Convert EXCLUDED_NIM_PACKAGES to an array (splitting by ':')
|
||||
IFS=':' read -ra EXCLUDED_PATTERNS <<< "$EXCLUDED_NIM_PACKAGES"
|
||||
|
||||
# Function to check if a path should be excluded
|
||||
should_exclude() {
|
||||
local path="$1"
|
||||
for pattern in "${EXCLUDED_PATTERNS[@]}"; do
|
||||
if [[ "$path" == *"$pattern"* ]]; then
|
||||
return 0 # Exclude this path
|
||||
fi
|
||||
done
|
||||
return 1 # Keep this path
|
||||
}
|
||||
|
||||
# Find all .gitmodules files and process them
|
||||
find . -name .gitmodules | while read -r gitmodules_file; do
|
||||
# Get the absolute directory path containing the .gitmodules file
|
||||
module_dir=$(dirname "$(realpath "$gitmodules_file")")
|
||||
|
||||
|
||||
# Extract paths from the .gitmodules file
|
||||
while IFS= read -r line; do
|
||||
if [[ $line =~ path[[:space:]]*=[[:space:]]*(.*) ]]; then
|
||||
submodule_path="${BASH_REMATCH[1]}"
|
||||
abs_path="$module_dir/$submodule_path"
|
||||
|
||||
# Skip paths that match exclusion patterns
|
||||
if should_exclude "$abs_path"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Write the absolute path of the submodule to the output file
|
||||
echo "$module_dir/$submodule_path" >> "$output_file"
|
||||
echo "$abs_path" >> "$output_file"
|
||||
fi
|
||||
done < "$gitmodules_file"
|
||||
done
|
||||
@ -24,7 +45,7 @@ done
|
||||
echo "Submodule paths collected in $output_file"
|
||||
|
||||
# Base directory for nimble packages
|
||||
nimble_pkgs_dir="./vendor/.nimble/pkgs"
|
||||
nimble_pkgs_dir="./vendor/.nimble/pkgs2"
|
||||
|
||||
# Ensure the base directory exists
|
||||
mkdir -p "$nimble_pkgs_dir"
|
||||
@ -33,15 +54,14 @@ mkdir -p "$nimble_pkgs_dir"
|
||||
while IFS= read -r submodule_path; do
|
||||
# Extract the submodule name (last part of the path)
|
||||
submodule_name=$(basename "$submodule_path")
|
||||
|
||||
|
||||
# Create the directory for the submodule
|
||||
submodule_dir="$nimble_pkgs_dir/${submodule_name}-#head"
|
||||
mkdir -p "$submodule_dir"
|
||||
|
||||
|
||||
# Create the .nimble-link file with the absolute path
|
||||
nimble_link_file="$submodule_dir/${submodule_name}.nimble-link"
|
||||
echo "$submodule_path" > "$nimble_link_file"
|
||||
echo "$submodule_path" >> "$nimble_link_file"
|
||||
done < "$output_file"
|
||||
|
||||
echo "Nimble packages prepared in $nimble_pkgs_dir"
|
||||
echo "Nimble packages prepared in $nimble_pkgs_dir"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user