mor

Cross platform dependency manager

commit dbe051c6a936acc3954ad17ff0bbe54cd4718c54
parent 330754bcad946266e637dfee9a4aa79807787612
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 12 Oct 2024 18:05:21 +0530

Fix key traversal fail for a @target

Update requirements.ini to add more test cases
2 files changed, 17 insertions(+), 10 deletions(-)
M
mor.cmd
|
12
+++++-------
M
requirements.ini
|
15
++++++++++++---
diff --git a/mor.cmd b/mor.cmd
@@ -81,29 +81,27 @@ setlocal EnableDelayedExpansion
 	set wsections=![#%section%[/]!
 :MOR_PARSE_TARGET_START
 	for /f "usebackq tokens=1* delims= " %%a in ('!wsections!') do (
-		set [%%a[ 2>NUL >NULL
+		set [%%a[ 2>NUL >NUL
 		if ERRORLEVEL 1 (
 			echo ^> Cannot find target '%%~a'
 			exit /b 1
 		)
+
 		for /f "usebackq tokens=1,2,3* delims=[]=" %%e in (`set  [%%a[`) do (
 			if "%%~f"=="%~2-%~3" (
 				if not defined %%~f_done (
 					set %%~f_done=1
 					call :prime_download %%e %%~f %%~g || goto :eof
+					exit /b 0
 				)
 			)
 		)
 
-		for /f "usebackq tokens=1,2,3* delims=[]=" %%e in (`set  [%%a[`) do (
-			if not defined %%~f_done (
-				echo ^> Cannot find key '%%~f'
-				exit /b 1
-			)
-		)
 		set wsections=%%b
 		if not [%%b] == [] goto :MOR_PARSE_TARGET_START
 	)
+	echo ^> Cannot find key '%~2-%~3'
+	exit /b 1
 endlocal DisableDelayedExpansion
 goto :eof
 
diff --git a/requirements.ini b/requirements.ini
@@ -5,13 +5,22 @@ mor=https://github.com
 [#lib]
 /=testing secondtest
 
+[#wickedlib]
+/=testing secondtest
+
 [#badlib]
-/=precompiled newli
+/=precompiled testing
 
 [@lib]
 test1=0.1
 test2=0.3
 
+
+[@wickedlib]
+test1=0.1
+test2=0.3
+test3=0.3
+
 [@badlib]
 test1=0.1
 test2=0.3

@@ -28,5 +37,5 @@ test2-0.3=https://getsh.org/bharatvaj/pubkey.asc
 test1-0.2=https://getsh.org/index.html
 test1-45=https://google.com/
 
-[newli]
-test3-0.1=https://yahoo.com/something 32239423
+[curlfail]
+test3-0.1=https://getsh.org/something 32239423