aboutsummaryrefslogtreecommitdiff
path: root/tools/cpmutil.sh
diff options
context:
space:
mode:
authorcrueter <crueter@eden-emu.dev>2026-07-06 23:11:39 +0200
committercrueter <crueter@eden-emu.dev>2026-07-06 23:11:39 +0200
commit66b073ab8d427d8fc06ffd715151f372cdde818c (patch)
tree667e34c22f542d809a069738bd762a23786814c7 /tools/cpmutil.sh
parent4c65780f11511b20c2e0288a287faace16516d38 (diff)
[cmake] CPMUtil rewrite of the day number 852 (#4130)
Composite PR for several changes to CPMUtil, most notably: - https://git.crueter.xyz/CMake/CPMUtil/pulls/19 - https://git.crueter.xyz/CMake/CPMUtil/pulls/22 - https://git.crueter.xyz/CMake/CPMUtil/pulls/24 - https://git.crueter.xyz/CMake/CPMUtil/pulls/25 These contain a lot of changes that generally simplify control flow and improve ease-of-use. Read those descriptions and patchsets for more info. Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4130 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Diffstat (limited to 'tools/cpmutil.sh')
-rwxr-xr-xtools/cpmutil.sh53
1 files changed, 37 insertions, 16 deletions
diff --git a/tools/cpmutil.sh b/tools/cpmutil.sh
index 6c18e6999b..b1edbbde4b 100755
--- a/tools/cpmutil.sh
+++ b/tools/cpmutil.sh
@@ -7,8 +7,7 @@
ROOTDIR=$(CDPATH='' cd -- "$(dirname -- "$0")/cpm" && pwd)
SCRIPTS="$ROOTDIR"
-
-. "$SCRIPTS"/common.sh
+CMAKE="$ROOTDIR/cmake"
RETURN=0
@@ -26,33 +25,55 @@ General command-line utility for CPMUtil operations.
Commands:
package Run operations on a package or packages
format Format cpmfile
+ ls List all packages in the cpmfile
update Update CPMUtil and its tooling
migrate Convert submodules to a basic cpmfile
Package commands:
- hash Verify the hash of a package, and update it if needed
- update Check for updates for a package
- fetch Fetch a package and place it in the cache
- add Add a new package
- rm Remove a package
- version Change the version of a package
- which Check if a package is defined
- download Get the download URL for a package
- dir Get the local directory for a package
- reset Reset a fetched package to its original state
- patch Create an in-tree patch based on local modifications
+ hash Verify the hash of a package, and update it if needed
+ update Check for updates for a package
+ fetch Fetch a package and place it in the cache
+ add Add a new package
+ rm Remove a package
+ version Change the version of a package
+ which Check if a package is defined
+ url Get the download URL for a package
+ dir Get the local directory for a package
+ reset Reset a fetched package to its original state
+ patch Create an in-tree patch based on local modifications
EOF
exit $RETURN
}
-export ROOTDIR
+export ROOTDIR CMAKE SCRIPTS
while :; do
case "$1" in
- format | update | migrate)
- "$SCRIPTS/$1".sh
+ format | update)
+ cmake -P "$CMAKE/$1".cmake
+ break
+ ;;
+ ls)
+ shift
+ print_usage=false
+ filtered=""
+ for arg in "$@"; do
+ case "$arg" in
+ -h | --help) print_usage=true ;;
+ -n) ;;
+ *) filtered="$filtered $arg" ;;
+ esac
+ done
+ cmake_defines=""
+ $print_usage && cmake_defines="-DPRINT_USAGE=TRUE"
+ # shellcheck disable=SC2086
+ cmake $cmake_defines -P "$CMAKE/ls.cmake" -- $filtered
+ break
+ ;;
+ migrate)
+ "$SCRIPTS"/migrate.sh
break
;;
package)