[ros-diffs] [dreimer] 47381: Fix Crocodile's Patch to work on branches which do not fully clone trunk, too. Port this ix over to PS, too, but this does not work yet. (Trying to do it without a wget dependency here)

dreimer at svn.reactos.org dreimer at svn.reactos.org
Fri May 28 11:32:43 CEST 2010


Author: dreimer
Date: Fri May 28 11:32:40 2010
New Revision: 47381

URL: http://svn.reactos.org/svn/reactos?rev=47381&view=rev
Log:
Fix Crocodile's Patch to work on branches which do not fully clone trunk, too.
Port this ix over to PS, too, but this does not work yet. (Trying to do it without a wget dependency here)

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

Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/sSVN.ps1
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershell/sSVN.ps1?rev=47381&r1=47380&r2=47381&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Powershell/sSVN.ps1 [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Powershell/sSVN.ps1 [iso-8859-1] Fri May 28 11:32:40 2010
@@ -6,16 +6,26 @@
 # COPYRIGHT:   Copyright 2010 Daniel Reimer <reimer.daniel at freenet.de>
 #
 
-# Set branch to trunk if one is not already set
-if ("$ENV:ROS_BRANCH" -eq "") {
-    $_ROS_BRANCH = "trunk"
+$ROS_SVNURL = "http://svn.reactos.org/reactos"
+
+if ("$ENV:ROS_ARCH" -eq "amd64") {
+    $ROS_SVNURL = "$ROS_SVNURL/branches/ros-amd64-bringup"
 } else {
-    $_ROS_BRANCH = "branches/$ENV:ROS_BRANCH"
-}
-
-# AMD64 architecture overrides branch that was previously set
-if ("$ENV:ROS_ARCH" -eq "amd64") {
-    $_ROS_BRANCH = "branches/ros-amd64-bringup"
+    if ("$ENV:ROS_BRANCH" -eq "") {
+        $ROS_SVNURL = "$ROS_SVNURL/trunk"
+    } else {
+        $ROS_SVNURL = "$ROS_SVNURL/branches/$ENV:ROS_BRANCH"
+    }
+}
+
+wget --spider --no-verbose %ROS_SVNURL%/reactos 1> NUL 2> NUL
+
+if (ERRORLEVEL 1) {
+    $rsubfolder = ""
+    $disapptest = 1
+} else {
+    $rsubfolder = "/reactos"
+    $disapptest = 0
 }
 
 $_ROSBE_SSVNSOURCEDIR = "$pwd"
@@ -24,7 +34,7 @@
     $OFFSVN = IEX "& svn.exe info" | select-string "Last Changed Rev:"
     $OFFSVN = $OFFSVN -replace "(.*)Last Changed Rev: ",''
     $OFFSVN = [CONVERT]::ToInt32($OFFSVN,10)
-    $ONSVN = IEX "& svn.exe info http://svn.reactos.org/reactos/$_ROS_BRANCH/reactos" | select-string "Last Changed Rev:"
+    $ONSVN = IEX "& svn.exe info $ROS_SVNURL$rsubfolder" | select-string "Last Changed Rev:"
     $ONSVN = $ONSVN -replace "(.*)Last Changed Rev: ",''
     $ONSVN = [CONVERT]::ToInt32($ONSVN,10)
     "Local Revision: $OFFSVN"
@@ -131,9 +141,9 @@
         $dir = get-childitem
         if ("$dir" -eq "") {
             if ("$($args[1])" -ne "") {
-                IEX "& svn.exe -r $($args[1]) checkout http://svn.reactos.org/reactos/$_ROS_BRANCH/reactos ."
-            } else {
-                IEX "& svn.exe checkout http://svn.reactos.org/reactos/$_ROS_BRANCH/reactos ."
+                IEX "& svn.exe -r $($args[1]) checkout $ROS_SVNURL$rsubfolder ."
+            } else {
+                IEX "& svn.exe checkout $ROS_SVNURL$rsubfolder ."
             }
         } else {
             "ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"
@@ -143,86 +153,94 @@
 
 # Check if the folder is empty. If not, output an error.
 elseif ("$($args[0])" -eq "rosapps") {
-    if ("$($args[1])" -ne "") {
-        if (!(Test-Path "modules\rosapps\.")) {
-            new-item -path "modules" -name rosapps -type directory
-        }
-        if (Test-Path "modules\rosapps\.svn\.") {
-            $host.ui.RawUI.WindowTitle = "SVN RosApps Updating..."
-            Set-Location "modules\rosapps"
-            IEX "& svn.exe update -r $($args[1])"
-        } else {
-            $host.ui.RawUI.WindowTitle = "SVN RosApps Creating..."
-            Set-Location "modules\rosapps"
-            $dir = get-childitem
-            if ("$dir" -eq "") {
-                IEX "& svn.exe checkout -r $($args[1]) http://svn.reactos.org/reactos/$_ROS_BRANCH/rosapps ."
-            } else {
-                "ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"
-            }
-        }
-    } else {
-        if (!(Test-Path "modules\rosapps\.")) {
-            new-item -path "modules" -name rosapps -type directory
-        }
-        if (Test-Path "modules\rosapps\.svn\.") {
-            $host.ui.RawUI.WindowTitle = "SVN RosApps Updating..."
-            Set-Location "modules\rosapps"
-            IEX "& svn.exe update"
-        } else {
-            $host.ui.RawUI.WindowTitle = "SVN RosApps Creating..."
-            Set-Location "modules\rosapps"
-            $dir = get-childitem
-            if ("$dir" -eq "") {
-                IEX "& svn.exe checkout http://svn.reactos.org/reactos/$_ROS_BRANCH/rosapps ."
-            } else {
-                "ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"
-            }
-        }
-    }
-    Set-Location "$_ROSBE_SSVNSOURCEDIR"
+    if ("$disapptest" -eq "0") {
+        if ("$($args[1])" -ne "") {
+            if (!(Test-Path "modules\rosapps\.")) {
+                new-item -path "modules" -name rosapps -type directory
+            }
+            if (Test-Path "modules\rosapps\.svn\.") {
+                $host.ui.RawUI.WindowTitle = "SVN RosApps Updating..."
+                Set-Location "modules\rosapps"
+                IEX "& svn.exe update -r $($args[1])"
+            } else {
+                $host.ui.RawUI.WindowTitle = "SVN RosApps Creating..."
+                Set-Location "modules\rosapps"
+                $dir = get-childitem
+                if ("$dir" -eq "") {
+                    IEX "& svn.exe checkout -r $($args[1]) $ROS_SVNURL/rosapps ."
+                } else {
+                    "ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"
+                }
+            }
+        } else {
+            if (!(Test-Path "modules\rosapps\.")) {
+                new-item -path "modules" -name rosapps -type directory
+            }
+            if (Test-Path "modules\rosapps\.svn\.") {
+                $host.ui.RawUI.WindowTitle = "SVN RosApps Updating..."
+                Set-Location "modules\rosapps"
+                IEX "& svn.exe update"
+            } else {
+                $host.ui.RawUI.WindowTitle = "SVN RosApps Creating..."
+                Set-Location "modules\rosapps"
+                $dir = get-childitem
+                if ("$dir" -eq "") {
+                    IEX "& svn.exe checkout $ROS_SVNURL/rosapps ."
+                } else {
+                    "ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"
+                }
+            }
+        }
+        Set-Location "$_ROSBE_SSVNSOURCEDIR"
+    } else {
+        "Rosapps and Rostests disabled."
+    }
 }
 
 # Check if the folder is empty. If not, output an error.
 elseif ("$($args[0])" -eq "rostests") {
-    if ("$($args[1])" -ne "") {
-        if (!(Test-Path "modules\rostests\.")) {
-            new-item -path "modules" -name rostests -type directory
-        }
-        if (Test-Path "modules\rostests\.svn\.") {
-            $host.ui.RawUI.WindowTitle = "SVN RosTests Updating..."
-            Set-Location "modules\rostests"
-            IEX "& svn.exe update -r $($args[1])"
-        } else {
-            $host.ui.RawUI.WindowTitle = "SVN RosTests Creating..."
-            Set-Location "modules\rostests"
-            $dir = get-childitem
-            if ("$dir" -eq "") {
-                IEX "& svn.exe checkout -r $($args[1]) http://svn.reactos.org/reactos/$_ROS_BRANCH/rostests ."
-            } else {
-                "ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"
-            }
-        }
-    } else {
-        if (!(Test-Path "modules\rostests\.")) {
-            new-item -path "modules" -name rostests -type directory
-        }
-        if (Test-Path "modules\rostests\.svn\.") {
-            $host.ui.RawUI.WindowTitle = "SVN RosTests Updating..."
-            Set-Location "modules\rostests"
-            IEX "& svn.exe update"
-        } else {
-            $host.ui.RawUI.WindowTitle = "SVN RosTests Creating..."
-            Set-Location "modules\rostests"
-            $dir = get-childitem
-            if ("$dir" -eq "") {
-                IEX "& svn.exe checkout http://svn.reactos.org/reactos/$_ROS_BRANCH/rostests ."
-            } else {
-                "ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"
-            }
-        }
-    }
-    Set-Location "$_ROSBE_SSVNSOURCEDIR"
+    if ("$disapptest" -eq "0") {
+        if ("$($args[1])" -ne "") {
+            if (!(Test-Path "modules\rostests\.")) {
+                new-item -path "modules" -name rostests -type directory
+            }
+            if (Test-Path "modules\rostests\.svn\.") {
+                $host.ui.RawUI.WindowTitle = "SVN RosTests Updating..."
+                Set-Location "modules\rostests"
+                IEX "& svn.exe update -r $($args[1])"
+            } else {
+                $host.ui.RawUI.WindowTitle = "SVN RosTests Creating..."
+                Set-Location "modules\rostests"
+                $dir = get-childitem
+                if ("$dir" -eq "") {
+                    IEX "& svn.exe checkout -r $($args[1]) $ROS_SVNURL/rostests ."
+                } else {
+                    "ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"
+                }
+            }
+        } else {
+            if (!(Test-Path "modules\rostests\.")) {
+                new-item -path "modules" -name rostests -type directory
+            }
+            if (Test-Path "modules\rostests\.svn\.") {
+                $host.ui.RawUI.WindowTitle = "SVN RosTests Updating..."
+                Set-Location "modules\rostests"
+                IEX "& svn.exe update"
+            } else {
+                $host.ui.RawUI.WindowTitle = "SVN RosTests Creating..."
+                Set-Location "modules\rostests"
+                $dir = get-childitem
+                if ("$dir" -eq "") {
+                    IEX "& svn.exe checkout $ROS_SVNURL/rostests ."
+                } else {
+                    "ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"
+                }
+            }
+        }
+        Set-Location "$_ROSBE_SSVNSOURCEDIR"
+    } else {
+        "Rosapps and Rostests disabled."
+    }
 }
 
 # Output the revision of the local and online trees and tell the user if

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=47381&r1=47380&r2=47381&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] Fri May 28 11:32:40 2010
@@ -14,15 +14,26 @@
 
 setlocal enabledelayedexpansion
 
-:: Set branch to trunk if one is not already set
-if not defined ROS_BRANCH (
-    set _ROS_BRANCH=trunk
+set ROS_SVNURL=http://svn.reactos.org/reactos
+
+if "%ROS_ARCH%" == "amd64" (
+    set ROS_SVNURL=%ROS_SVNURL%/branches/ros-amd64-bringup
 ) else (
-    set _ROS_BRANCH=branches/%ROS_BRANCH%
-)
-:: AMD64 architecture overrides branch that was previously set
-if "%ROS_ARCH%" == "amd64" (
-    set _ROS_BRANCH=branches/ros-amd64-bringup
+    if not defined ROS_BRANCH (
+        set ROS_SVNURL=%ROS_SVNURL%/trunk
+    ) else (
+        set ROS_SVNURL=%ROS_SVNURL%/branches/%ROS_BRANCH%
+    )
+)
+
+wget --spider --no-verbose %ROS_SVNURL%/reactos 1> NUL 2> NUL
+
+if ERRORLEVEL 1 (
+    set rsubfolder=
+    set disapptest=1
+) else (
+    set rsubfolder=/reactos
+    set disapptest=0
 )
 
 set _ROSBE_SSVNSOURCEDIR=%CD%
@@ -44,9 +55,7 @@
 
 if /i "%1" == "cleanup" (
     title SVN Cleaning...
-
     svn.exe cleanup
-
     goto :EOC
 )
 
@@ -61,9 +70,9 @@
     dir /b 2>nul | findstr "." >nul
     if errorlevel 1 (
         if not "%2" == "" (
-            svn.exe checkout -r %2 http://svn.reactos.org/reactos/%_ROS_BRANCH%/reactos .
-        ) else (
-            svn.exe checkout http://svn.reactos.org/reactos/%_ROS_BRANCH%/reactos .
+            svn.exe checkout -r %2 %ROS_SVNURL%%rsubfolder% .
+        ) else (
+            svn.exe checkout %ROS_SVNURL%%rsubfolder% .
         )
     ) else (
         echo ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED
@@ -73,88 +82,96 @@
 
 :: Check if the folder is empty. If not, output an error.
 if /i "%1" == "rosapps" (
-    if not "%2" == "" (
-        if not exist "modules\rosapps\." (
-            md "modules\rosapps"
-        )
-        if exist "modules\rosapps\.svn\." (
-            title SVN RosApps Updating...
-            cd "modules\rosapps"
-            svn.exe update -r %2
-        ) else (
-            title SVN RosApps Creating...
-            cd "modules\rosapps"
-            dir /b 2>nul | findstr "." >nul
-            if errorlevel 1 (
-                svn.exe checkout -r %2 http://svn.reactos.org/reactos/%_ROS_BRANCH%/rosapps .
-            ) else (
-                echo ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED
-            )
-        )
-    ) else (
-        if not exist "modules\rosapps\." (
-            md "modules\rosapps"
-        )
-        if exist "modules\rosapps\.svn\." (
-            title SVN RosApps Updating...
-            cd "modules\rosapps"
-            svn.exe update
-        ) else (
-            title SVN RosApps Creating...
-            cd "modules\rosapps"
-            dir /b 2>nul | findstr "." >nul
-            if errorlevel 1 (
-                svn.exe checkout http://svn.reactos.org/reactos/%_ROS_BRANCH%/rosapps .
-            ) else (
-                echo ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED
-            )
-        )
-    )
-    cd "%_ROSBE_SSVNSOURCEDIR%"
-    goto :EOC
+    if "%disapptest%" == "0" (
+        if not "%2" == "" (
+            if not exist "modules\rosapps\." (
+                md "modules\rosapps"
+            )
+            if exist "modules\rosapps\.svn\." (
+                title SVN RosApps Updating...
+                cd "modules\rosapps"
+                svn.exe update -r %2
+            ) else (
+                title SVN RosApps Creating...
+                cd "modules\rosapps"
+                dir /b 2>nul | findstr "." >nul
+                if errorlevel 1 (
+                    svn.exe checkout -r %2 %ROS_SVNURL%/rosapps .
+                ) else (
+                    echo ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED
+                )
+            )
+        ) else (
+            if not exist "modules\rosapps\." (
+                md "modules\rosapps"
+            )
+            if exist "modules\rosapps\.svn\." (
+                title SVN RosApps Updating...
+                cd "modules\rosapps"
+                svn.exe update
+            ) else (
+                title SVN RosApps Creating...
+                cd "modules\rosapps"
+                dir /b 2>nul | findstr "." >nul
+                if errorlevel 1 (
+                    svn.exe checkout %ROS_SVNURL%/rosapps .
+                ) else (
+                    echo ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED
+                )
+            )
+        )
+        cd "%_ROSBE_SSVNSOURCEDIR%"
+        goto :EOC
+    ) else (
+        echo Rosapps and Rostests disabled.
+    )
 )
 
 :: Check if the folder is empty. If not, output an error.
 if /i "%1" == "rostests" (
-    if not "%2" == "" (
-        if not exist "modules\rostests\." (
-            md "modules\rostests"
-        )
-        if exist "modules\rostests\.svn\." (
-            title SVN RosTests Updating...
-            cd "modules\rostests"
-            svn.exe update -r %2
-        ) else (
-            title SVN RosTests Creating...
-            cd "modules\rostests"
-            dir /b 2>nul | findstr "." >nul
-            if errorlevel 1 (
-                svn.exe checkout -r %2 http://svn.reactos.org/reactos/%_ROS_BRANCH%/rostests .
-            ) else (
-                echo ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED
-            )
-        )
-    ) else (
-        if not exist "modules\rostests\." (
-            md "modules\rostests"
-        )
-        if exist "modules\rostests\.svn\." (
-            title SVN RosTests Updating...
-            cd "modules\rostests"
-            svn.exe update
-        ) else (
-            title SVN RosTests Creating...
-            cd "modules\rostests"
-            dir /b 2>nul | findstr "." >nul
-            if errorlevel 1 (
-                svn.exe checkout http://svn.reactos.org/reactos/%_ROS_BRANCH/rostests .
-            ) else (
-                echo ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED
-            )
-        )
-    )
-    cd "%_ROSBE_SSVNSOURCEDIR%"
-    goto :EOC
+    if "%disapptest%" == "0" (
+        if not "%2" == "" (
+            if not exist "modules\rostests\." (
+                md "modules\rostests"
+            )
+            if exist "modules\rostests\.svn\." (
+                title SVN RosTests Updating...
+                cd "modules\rostests"
+                svn.exe update -r %2
+            ) else (
+                title SVN RosTests Creating...
+                cd "modules\rostests"
+                dir /b 2>nul | findstr "." >nul
+                if errorlevel 1 (
+                    svn.exe checkout -r %2 %ROS_SVNURL%/rostests .
+                ) else (
+                    echo ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED
+                )
+            )
+        ) else (
+            if not exist "modules\rostests\." (
+                md "modules\rostests"
+            )
+            if exist "modules\rostests\.svn\." (
+                title SVN RosTests Updating...
+                cd "modules\rostests"
+                svn.exe update
+            ) else (
+                title SVN RosTests Creating...
+                cd "modules\rostests"
+                dir /b 2>nul | findstr "." >nul
+                if errorlevel 1 (
+                    svn.exe checkout %ROS_SVNURL%/rostests .
+                ) else (
+                    echo ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED
+                )
+            )
+        )
+        cd "%_ROSBE_SSVNSOURCEDIR%"
+        goto :EOC
+    ) else (
+        echo Rosapps and Rostests disabled.
+    )
 )
 
 :: Output the revision of the local and online trees and tell the user if
@@ -174,7 +191,7 @@
 
 :UP
     for /f "usebackq tokens=4" %%i in (`"svn.exe info | find "Last Changed Rev:""`) do set OFFSVN=%%i
-    for /f "usebackq tokens=4" %%j in (`"svn.exe info http://svn.reactos.org/reactos/%_ROS_BRANCH%/reactos | find "Last Changed Rev:""`) do set ONSVN=%%j
+    for /f "usebackq tokens=4" %%j in (`"svn.exe info %ROS_SVNURL%%rsubfolder% | find "Last Changed Rev:""`) do set ONSVN=%%j
 
     echo Local Revision: !OFFSVN!
     echo Online HEAD Revision: !ONSVN!




More information about the Ros-diffs mailing list