[ros-diffs] [dreimer] 47404: - Branch selection fully works now. - Errors are thrown as such now. - Update does not corrupt itself anymore when theres no Internet connection.

dreimer at svn.reactos.org dreimer at svn.reactos.org
Sat May 29 13:16:39 CEST 2010


Author: dreimer
Date: Sat May 29 13:16:38 2010
New Revision: 47404

URL: http://svn.reactos.org/svn/reactos?rev=47404&view=rev
Log:
- Branch selection fully works now.
- Errors are thrown as such now.
- Update does not corrupt itself anymore when theres no Internet connection.

Modified:
    trunk/tools/RosBE/RosBE-Windows/Powershell/Clean.ps1
    trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1
    trunk/tools/RosBE/RosBE-Windows/Powershell/charch.ps1
    trunk/tools/RosBE/RosBE-Windows/Powershell/chdefdir.ps1
    trunk/tools/RosBE/RosBE-Windows/Powershell/chdefgcc.ps1
    trunk/tools/RosBE/RosBE-Windows/Powershell/options.ps1
    trunk/tools/RosBE/RosBE-Windows/Powershell/reladdr2line.ps1
    trunk/tools/RosBE/RosBE-Windows/Powershell/sSVN.ps1
    trunk/tools/RosBE/RosBE-Windows/Powershell/update.ps1
    trunk/tools/RosBE/RosBE-Windows/Powershell/version.ps1
    trunk/tools/RosBE/RosBE-Windows/Root/sSVN.cmd

Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/Clean.ps1
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershell/Clean.ps1?rev=47404&r1=47403&r2=47404&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Powershell/Clean.ps1 [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Powershell/Clean.ps1 [iso-8859-1] Sat May 29 13:16:38 2010
@@ -15,7 +15,7 @@
         $null = (Remove-Item -path "$_ROSBE_LOGDIR\*.txt" -force)
         "Done cleaning build logs."
     } else {
-        "ERROR: There are no logs to clean."
+        throw {"ERROR: There are no logs to clean."}
     }
 }
 
@@ -55,7 +55,7 @@
 
         "Done cleaning ReactOS $ENV:ROS_ARCH source directory."
     } else {
-        "ERROR: This directory contains no $ENV:ROS_ARCH compiler output to clean."
+        throw {"ERROR: This directory contains no $ENV:ROS_ARCH compiler output to clean."}
     }
 }
 

Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1?rev=47404&r1=47403&r2=47404&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1 [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1 [iso-8859-1] Sat May 29 13:16:38 2010
@@ -14,6 +14,23 @@
 # For NT4 compatibility
 if ($ENV:APPDATA.Length -lt 1) {
     $ENV:APPDATA = $ENV:USERPROFILE
+}
+
+# Web Downloader in a function.
+
+function global:Get-WebFile {
+    param(
+        $url = $null,
+        $file = $null
+    )
+    $local:ErrorActionPreference = "SilentlyContinue"
+    $clnt = new-object System.Net.WebClient
+    $global:_ROSBE_DWERRLVL = "0"
+    trap [Exception] {
+        $global:_ROSBE_DWERRLVL = "1"
+    }
+    $clnt.DownloadFile($url,$file)
+    $local:ErrorActionPreference = "Continue"
 }
 
 # Set defaults to work with and override them if edited by

Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/charch.ps1
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershell/charch.ps1?rev=47404&r1=47403&r2=47404&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Powershell/charch.ps1 [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Powershell/charch.ps1 [iso-8859-1] Sat May 29 13:16:38 2010
@@ -12,7 +12,7 @@
     # Parse the command line arguments.
     $ARCH = Read-Host "Please enter a Architecture you want to build ReactOS for: "
     if ($ARCH.length -eq 0) {
-        "ERROR: You must enter a Architecture."
+        throw {"ERROR: You must enter a Architecture."}
     }
 } else {
     $ARCH = $args

Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/chdefdir.ps1
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershell/chdefdir.ps1?rev=47404&r1=47403&r2=47404&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Powershell/chdefdir.ps1 [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Powershell/chdefdir.ps1 [iso-8859-1] Sat May 29 13:16:38 2010
@@ -13,7 +13,7 @@
 if ($args.count -eq 0) {
     $SOURCEDIR = Read-Host "Please enter a ReactOS source directory, or 'previous': "
     if ($SOURCEDIR.length -eq 0) {
-        "ERROR: You must enter a ReactOS source directory, or 'previous'."
+        throw {"ERROR: You must enter a ReactOS source directory, or 'previous'."}
     }
 } else {
     $SOURCEDIR = $args
@@ -22,7 +22,7 @@
     pop-location
 } else {
     if (!(Test-Path "$SOURCEDIR\.")) {
-        "ERROR: The path specified doesn't seem to exist."
+        throw {"ERROR: The path specified doesn't seem to exist."}
     }
     push-location "$SOURCEDIR"
 }

Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/chdefgcc.ps1
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershell/chdefgcc.ps1?rev=47404&r1=47403&r2=47404&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Powershell/chdefgcc.ps1 [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Powershell/chdefgcc.ps1 [iso-8859-1] Sat May 29 13:16:38 2010
@@ -25,14 +25,14 @@
 if ("$TOOLPATH" -eq "") {
     $TOOLPATH = Read-Host "Please enter a MinGW/GCC directory (don't use quotes): "
     if ($TOOLPATH.length -eq 0) {
-        "ERROR: You must enter a MinGW/GCC directory."
+        throw {"ERROR: You must enter a MinGW/GCC directory."}
         settitle
     }
 }
 if ("$TOOLMODE" -eq "") {
     $TOOLMODE = Read-Host "Please specify, if this will be the Target or Host GCC: "
     if ($TOOLMODE.length -eq 0) {
-        "ERROR: You must enter ""target"" or ""host""."
+        throw {"ERROR: You must enter ""target"" or ""host""."}
         settitle
     }
 }
@@ -42,12 +42,12 @@
 if (Test-Path "$_ROSBE_BASEDIR\$TOOLPATH\.") {
     $TOOLPATH = "$_ROSBE_BASEDIR\$TOOLPATH"
 } elseif (!(Test-Path "$TOOLPATH\.")) {
-    "ERROR: The path specified doesn't seem to exist."
+    throw {"ERROR: The path specified doesn't seem to exist."}
     settitle
 }
 $local:ErrorActionPreference = "Continue"
 if (!(Test-Path "$TOOLPATH\bin\*gcc.exe")) {
-    "ERROR: No MinGW/GCC found in the specified path."
+    throw {"ERROR: No MinGW/GCC found in the specified path."}
     settitle
 }
 
@@ -61,6 +61,6 @@
     "Host Location: $_ROSBE_HOST_MINGWPATH"
     EOA
 } else {
-    "ERROR: You specified wrong parameters."
+    throw {"ERROR: You specified wrong parameters."}
     settitle
 }

Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/options.ps1
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershell/options.ps1?rev=47404&r1=47403&r2=47404&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Powershell/options.ps1 [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Powershell/options.ps1 [iso-8859-1] Sat May 29 13:16:38 2010
@@ -3,7 +3,7 @@
 # LICENSE:     GNU General Public License v2. (see LICENSE.txt)
 # FILE:        Root/options.ps1
 # PURPOSE:     Starts options.exe and restarts RosBE afterwards.
-# COPYRIGHT:   Copyright 2009 Daniel Reimer <reimer.daniel at freenet.de>
+# COPYRIGHT:   Copyright 2010 Daniel Reimer <reimer.daniel at freenet.de>
 #
 
 $host.ui.RawUI.WindowTitle = "Options"
@@ -26,7 +26,7 @@
         & "$cfgfile"
     }
 } else {
-    "ERROR: options executable was not found."
+    throw {"ERROR: options executable was not found."}
 }
 
 $host.ui.RawUI.WindowTitle = "ReactOS Build Environment $_ROSBE_VERSION"

Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/reladdr2line.ps1
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershell/reladdr2line.ps1?rev=47404&r1=47403&r2=47404&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Powershell/reladdr2line.ps1 [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Powershell/reladdr2line.ps1 [iso-8859-1] Sat May 29 13:16:38 2010
@@ -27,10 +27,10 @@
 
 # Check if parameters were really given
 if ("$FILEPATH" -eq "") {
-    "ERROR: You must specify a path/file to examine."
+    throw {"ERROR: You must specify a path/file to examine."}
 }
 if ("$ADDRESS" -eq "") {
-    "ERROR: You must specify a address to analyze."
+    throw {"ERROR: You must specify a address to analyze."}
 }
 
 if ("$ENV:ROS_OUTPUT" -ne "") {

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=47404&r1=47403&r2=47404&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] Sat May 29 13:16:38 2010
@@ -17,12 +17,17 @@
         $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
+"$ROS_SVNURL"
+get-webfile $ROS_SVNURL/reactos "$ENV:TEMP\tmp"
+if ("$_ROSBE_DWERRLVL" -eq "1") {
+    get-webfile $ROS_SVNURL "$ENV:TEMP\tmp2"
+    if ("$_ROSBE_DWERRLVL" -eq "1") {
+        throw {"ERROR: The selected branch does not exist or the Internet Connection is down."}
+        exit
+    } else {
+        $rsubfolder = ""
+        $disapptest = 1
+    }
 } else {
     $rsubfolder = "/reactos"
     $disapptest = 0
@@ -135,7 +140,7 @@
 elseif ("$($args[0])" -eq "create") {
     $host.ui.RawUI.WindowTitle = "SVN Creating..."
     if (Test-Path ".svn\.") {
-        "ERROR: Folder already contains a repository."
+        throw {"ERROR: Folder already contains a repository."}
     } else {
         $null = (Remove-Item "$_ROSBE_LOGDIR" -recurse -force)
         $dir = get-childitem
@@ -146,7 +151,7 @@
                 IEX "& svn.exe checkout $ROS_SVNURL$rsubfolder ."
             }
         } else {
-            "ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"
+            throw {"ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"}
         }
     }
 }
@@ -169,7 +174,7 @@
                 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"
+                    throw {"ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"}
                 }
             }
         } else {
@@ -187,7 +192,7 @@
                 if ("$dir" -eq "") {
                     IEX "& svn.exe checkout $ROS_SVNURL/rosapps ."
                 } else {
-                    "ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"
+                    throw {"ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"}
                 }
             }
         }
@@ -215,7 +220,7 @@
                 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"
+                    throw {"ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"}
                 }
             }
         } else {
@@ -233,7 +238,7 @@
                 if ("$dir" -eq "") {
                     IEX "& svn.exe checkout $ROS_SVNURL/rostests ."
                 } else {
-                    "ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"
+                    throw {"ERROR: Folder is not empty. Continuing is dangerous and can cause errors. ABORTED"}
                 }
             }
         }

Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/update.ps1
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershell/update.ps1?rev=47404&r1=47403&r2=47404&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Powershell/update.ps1 [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Powershell/update.ps1 [iso-8859-1] Sat May 29 13:16:38 2010
@@ -13,13 +13,17 @@
 
 # Web Downloader in a function.
 
-function global:Get-WebFile {
+function Get-WebFile {
     param(
         $url = $null,
         $file = $null
     )
     $local:ErrorActionPreference = "SilentlyContinue"
     $clnt = new-object System.Net.WebClient
+    $global:_ROSBE_DWERRLVL = "0"
+    trap [Exception] {
+        $global:_ROSBE_DWERRLVL = "1"
+    }
     $clnt.DownloadFile($url,$file)
     $local:ErrorActionPreference = "Continue"
 }
@@ -54,7 +58,7 @@
                 IEX "& .\$_ROSBE_VERSION-$_ROSBE_STATCOUNT.ps1"
                 return
             } else {
-                "ERROR: This Update does not seem to exist or the Internet connection is not working correctly."
+                throw {"ERROR: This Update does not seem to exist or the Internet connection is not working correctly."}
                 return
             }
         } elseif (("$YESNO" -eq "no") -or ("$YESNO" -eq "n")) {
@@ -67,7 +71,7 @@
         }
     } else {
         if ($_ROSBE_MULTIUPD -ne 1) {
-            "ERROR: This Update does not seem to exist or the Internet connection is not working correctly."
+            throw {"ERROR: This Update does not seem to exist or the Internet connection is not working correctly."}
         }
         $_ROSBE_STATCOUNT = 9
         return
@@ -85,7 +89,7 @@
 # First check for a new Updater.
 rename-item update.ps1 update2.ps1
 get-webfile $_ROSBE_URL/update.ps1 $PWD\update.ps1
-if ((gi .\update.ps1).length -ne (gi .\update2.ps1).length) {
+if (((gi .\update.ps1).length -ne (gi .\update2.ps1).length) -and ((gi .\update.ps1).length -gt 0)) {
     clear-host
     "Updater got updated and needs to be restarted."
     remove-item update2.ps1 -force
@@ -127,7 +131,7 @@
         if (Test-Path "$_ROSBE_VERSION-$_ROSBE_STATCOUNT.txt") {
             get-content "$_ROSBE_VERSION-$_ROSBE_STATCOUNT.txt"
         } else {
-            "ERROR: This Update does not seem to exist or the Internet connection is not working correctly."
+            throw {"ERROR: This Update does not seem to exist or the Internet connection is not working correctly."}
         }
     }
     set-location ..

Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/version.ps1
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershell/version.ps1?rev=47404&r1=47403&r2=47404&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Powershell/version.ps1 [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Powershell/version.ps1 [iso-8859-1] Sat May 29 13:16:38 2010
@@ -3,7 +3,7 @@
 # LICENSE:     GNU General Public License v2. (see LICENSE.txt)
 # FILE:        Root/version.ps1
 # PURPOSE:     Display the current version of GCC, NASM, ld and make.
-# COPYRIGHT:   Copyright 2009 Daniel Reimer <reimer.daniel at freenet.de>
+# COPYRIGHT:   Copyright 2010 Daniel Reimer <reimer.daniel at freenet.de>
 #
 
 (get-WmiObject Win32_OperatingSystem).caption

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=47404&r1=47403&r2=47404&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] Sat May 29 13:16:38 2010
@@ -29,8 +29,14 @@
 wget --spider --no-verbose %ROS_SVNURL%/reactos 1> NUL 2> NUL
 
 if ERRORLEVEL 1 (
-    set rsubfolder=
-    set disapptest=1
+    wget --spider --no-verbose %ROS_SVNURL% 1> NUL 2> NUL
+    if ERRORLEVEL 1 (
+        echo The selected branch does not exist or the Internet Connection is down.
+        goto :EOC
+    ) else (
+        set rsubfolder=
+        set disapptest=1
+    )
 ) else (
     set rsubfolder=/reactos
     set disapptest=0
@@ -187,7 +193,7 @@
 if not "%1" == "" (
     echo Unknown parameter specified. Try 'help ssvn'.
 )
-goto EOC
+goto :EOC
 
 :UP
     for /f "usebackq tokens=4" %%i in (`"svn.exe info | find "Last Changed Rev:""`) do set OFFSVN=%%i
@@ -206,7 +212,7 @@
     )
     if !OFFSVN! equ !ONSVN! (
         echo Your tree is up to date.
-        goto EOC
+        goto :EOC
     )
 
     if "!_ROSBE_SSVN_JOB!" == "update" (
@@ -263,7 +269,7 @@
         )
     )
 
-goto EOC
+goto :EOC
 
 :EOC
 title ReactOS Build Environment %_ROSBE_VERSION%




More information about the Ros-diffs mailing list