[ros-diffs] [dreimer] 41132: WHILE for Batch :-D Still hacky, but it works and is way less hacky than the crap before. Thx goes out to Victor Martinez who had the idea and helped me getting it run inside the eevil if blocks. As a nice side effect I was able to add the log output feature from the ps scripts in the batch files too.

dreimer at svn.reactos.org dreimer at svn.reactos.org
Wed May 27 00:25:32 CEST 2009


Author: dreimer
Date: Wed May 27 02:25:31 2009
New Revision: 41132

URL: http://svn.reactos.org/svn/reactos?rev=41132&view=rev
Log:
WHILE for Batch :-D Still hacky, but it works and is way less hacky than the crap before. Thx goes out to Victor Martinez who had the idea and helped me getting it run inside the eevil if blocks. As a nice side effect I was able to add the log output feature from the ps scripts in the batch files too.

Modified:
    trunk/tools/RosBE/RosBE-Windows/Root/sSVN.cmd
    trunk/tools/RosBE/RosBE-Windows/Root/update.cmd

Modified: trunk/tools/RosBE/RosBE-Windows/Root/sSVN.cmd
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Root/sSVN.cmd?rev=41132&r1=41131&r2=41132&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Root/sSVN.cmd [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Root/sSVN.cmd [iso-8859-1] Wed May 27 02:25:31 2009
@@ -25,14 +25,8 @@
     title SVN Updating...
     echo This might take a while, so please be patient.
     echo.
-
-    if not "%2" == "" (
-        "%_ROSBE_BASEDIR%\Tools\svn.exe" update -r %2
-    ) else (
-        "%_ROSBE_BASEDIR%\Tools\svn.exe" update
-    )
-
-    goto :EOC
+    set _ROSBE_SSVN_JOB=update
+    goto :UP    
 )
 
 if /i "%1" == "cleanup" (
@@ -69,7 +63,15 @@
     title SVN Status
     echo This might take a while, so please be patient.
     echo.
+    set _ROSBE_SSVN_JOB=status
+    goto :UP
+)
 
+if not "%1" == "" (
+    echo Unknown parameter specified. Try 'help ssvn'.
+)
+
+:UP
     for /f "usebackq tokens=2" %%i in (`""%_ROSBE_BASEDIR%\Tools\svn.exe" info | find "Revision:""`) do set OFFSVN=%%i
     for /f "usebackq tokens=2" %%j in (`""%_ROSBE_BASEDIR%\Tools\svn.exe" info svn://svn.reactos.org/reactos/trunk/reactos | find "Revision:""`) do set ONSVN=%%j
 
@@ -78,23 +80,37 @@
     echo.
 
     if !OFFSVN! lss !ONSVN! (
-        echo Your tree is not up to date. Do you want to update it?
-
-        set /p UP="Please enter 'yes' or 'no': "
-        if /i "!UP!"=="yes" "%_ROSBE_BASEDIR%\ssvn" update
-        if /i "!UP!"=="y" "%_ROSBE_BASEDIR%\ssvn" update
+        if "!_ROSBE_SSVN_JOB!" == "status" (
+            echo Your tree is not up to date. Do you want to update it?
+            set /p UP="Please enter 'yes' or 'no': "
+            if /i "!UP!" == "yes" set _ROSBE_SSVN_JOB=update
+        )
+        if "!_ROSBE_SSVN_JOB!" == "update" (
+            if not "%2" == "" (
+                "%_ROSBE_BASEDIR%\Tools\svn.exe" update -r %2
+            ) else (
+                "%_ROSBE_BASEDIR%\Tools\svn.exe" update
+            )
+        )
+        echo Do you want to see the changelog?
+        set /p CL="Please enter 'yes' or 'no': "
+        if /i "!UP!"=="yes" (
+            call :WHILE
+        )
     )
-
     if !OFFSVN! equ !ONSVN! (
         echo Your tree is up to date.
     )
 
-    goto :EOC
-)
+goto EOC
 
-if not "%1" == "" (
-    echo Unknown parameter specified. Try 'help ssvn'.
-)
+:WHILE
+
+if "!OFFSVN!" GTR "!ONSVN!" GOTO :OUT
+"%_ROSBE_BASEDIR%\Tools\svn.exe" log -r !OFFSVN!
+set /A OFFSVN+=1
+GOTO :WHILE
+:OUT
 
 :EOC
 title ReactOS Build Environment %_ROSBE_VERSION%

Modified: trunk/tools/RosBE/RosBE-Windows/Root/update.cmd
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Root/update.cmd?rev=41132&r1=41131&r2=41132&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Root/update.cmd [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Root/update.cmd [iso-8859-1] Wed May 27 02:25:31 2009
@@ -32,7 +32,7 @@
 
 :: First check for a new Updater
 for %%F in (update.cmd) do set _ROSBE_UPDDATE=%%~tF
-"Tools\wget.exe" -N --ignore-length --no-verbose %_ROSBE_URL%/update.cmd 1> NUL 2> NUL
+rem "Tools\wget.exe" -N --ignore-length --no-verbose %_ROSBE_URL%/update.cmd 1> NUL 2> NUL
 for %%F in (update.cmd) do set _ROSBE_UPDDATE2=%%~tF
 if !_ROSBE_UPDDATE! NEQ !_ROSBE_UPDDATE2! (
     cls
@@ -48,23 +48,7 @@
 if "%1" == "" (
     set _ROSBE_MULTIUPD=1
     set _ROSBE_STATCOUNT=1
-    call :UPDCHECK
-    set /a _ROSBE_STATCOUNT+=1
-    call :UPDCHECK
-    set /a _ROSBE_STATCOUNT+=1
-    call :UPDCHECK
-    set /a _ROSBE_STATCOUNT+=1
-    call :UPDCHECK
-    set /a _ROSBE_STATCOUNT+=1
-    call :UPDCHECK
-    set /a _ROSBE_STATCOUNT+=1
-    call :UPDCHECK
-    set /a _ROSBE_STATCOUNT+=1
-    call :UPDCHECK
-    set /a _ROSBE_STATCOUNT+=1
-    call :UPDCHECK
-    set /a _ROSBE_STATCOUNT+=1
-    call :UPDCHECK
+    call :WHILE
 ) else if /i "%1" == "reset" (
     del /F /Q "%APPDATA%\RosBE\Updates\*.*" 1> NUL 2> NUL
     del /F /Q "%APPDATA%\RosBE\Updates\tmp\*.*" 1> NUL 2> NUL
@@ -77,68 +61,33 @@
     del /F /Q "%APPDATA%\RosBE\Updates\tmp\%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.*" 1> NUL 2> NUL
 ) else if /i "%1" == "info" (
     set _ROSBE_STATCOUNT=%2
-    call :UPDINFO
+    cd tmp
+    if not exist "%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt" (
+        "%_ROSBE_BASEDIR%\Tools\wget.exe" -N --ignore-length --no-verbose %_ROSBE_URL%/%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt 1> NUL 2> NUL
+        if exist "%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt" (
+            type "%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt"
+        ) else (
+            echo ERROR: This Update does not seem to exist or the Internet connection is not working correctly.
+            goto :EOC
+        )
+    )
+    cd..
+del /F /Q tmp\*.* 1> NUL 2> NUL
 ) else if /i "%1" == "status" (
+    set _ROSBE_STATCOUNT=1
     if not exist "tmp" mkdir tmp 1> NUL 2> NUL
     copy *.txt .\tmp\. 1> NUL 2> NUL
-    set _ROSBE_STATCOUNT=1
-    call :STATUS
-    set /a _ROSBE_STATCOUNT+=1
-    call :STATUS
-    set /a _ROSBE_STATCOUNT+=1
-    call :STATUS
-    set /a _ROSBE_STATCOUNT+=1
-    call :STATUS
-    set /a _ROSBE_STATCOUNT+=1
-    call :STATUS
-    set /a _ROSBE_STATCOUNT+=1
-    call :STATUS
-    set /a _ROSBE_STATCOUNT+=1
-    call :STATUS
-    set /a _ROSBE_STATCOUNT+=1
-    call :STATUS
-    set /a _ROSBE_STATCOUNT+=1
-    call :STATUS
-    call :UPDFIN
+    call :WHILE2
+    del /F /Q tmp\*.* 1> NUL 2> NUL
+    if not "%_ROSBE_UPDATES%" == "" (
+        echo Following Updates available: %_ROSBE_UPDATES%
+    ) else (
+        echo RosBE is up to Date.
+    )
 ) else (
     echo Unknown parameter specified. Try 'help update'.
 )
 goto :EOC
-
-:STATUS
-cd tmp
-if not exist "%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt" (
-    "%_ROSBE_BASEDIR%\Tools\wget.exe" -N --ignore-length --no-verbose %_ROSBE_URL%/%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt 1> NUL 2> NUL
-    if exist "%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt" (
-        set _ROSBE_UPDATES=%_ROSBE_UPDATES% %_ROSBE_STATCOUNT% 
-    )
-)
-cd..
-goto :EOF
-
-:UPDINFO
-cd tmp
-if not exist "%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt" (
-    "%_ROSBE_BASEDIR%\Tools\wget.exe" -N --ignore-length --no-verbose %_ROSBE_URL%/%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt 1> NUL 2> NUL
-    if exist "%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt" (
-        type "%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt"
-    ) else (
-        echo ERROR: This Update does not seem to exist or the Internet connection is not working correctly.
-        goto :EOF
-    )
-)
-cd..
-del /F /Q tmp\*.* 1> NUL 2> NUL
-goto :EOF
-
-:UPDFIN
-del /F /Q tmp\*.* 1> NUL 2> NUL
-if not "%_ROSBE_UPDATES%" == "" (
-    echo Following Updates available: %_ROSBE_UPDATES%
-) else (
-    echo RosBE is up to Date.
-)
-goto :EOF
 
 :UPDCHECK
 cd /d "%APPDATA%\RosBE\Updates"
@@ -192,6 +141,26 @@
 )
 goto :EOF
 
+:WHILE
+    if "!_ROSBE_STATCOUNT!" == "10" GOTO :OUT
+    call :UPDCHECK
+    set /a _ROSBE_STATCOUNT+=1
+    GOTO :WHILE
+
+:WHILE2
+    if "!_ROSBE_STATCOUNT!" == "10" GOTO :OUT
+    cd tmp
+    if not exist "%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt" (
+        "%_ROSBE_BASEDIR%\Tools\wget.exe" -N --ignore-length --no-verbose %_ROSBE_URL%/%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt 1> NUL 2> NUL
+        if exist "%_ROSBE_VERSION%-%_ROSBE_STATCOUNT%.txt" (
+            set _ROSBE_UPDATES=%_ROSBE_UPDATES% %_ROSBE_STATCOUNT% 
+        )
+    )
+    cd..
+    set /a _ROSBE_STATCOUNT+=1
+    GOTO :WHILE2
+:OUT
+
 :EOC
 cd /d "%_ROSBE_OPATH%"
 title ReactOS Build Environment %_ROSBE_VERSION%



More information about the Ros-diffs mailing list