]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Changed to format of the Package and Platform list outputs.
authorlhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 26 Oct 2006 00:17:32 +0000 (00:17 +0000)
committerlhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 26 Oct 2006 00:17:32 +0000 (00:17 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1842 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Java/Source/DbTools/src/org/tianocore/DbTools/UpdateDb.java

index ad581c93a6d4d35183b3c4c18db5fc8a00248a05..6d3ef98fc9867a86e1b97aa1726ceb67e04e01b5 100644 (file)
@@ -158,7 +158,7 @@ public class UpdateDb {
         }\r
 \r
         // Datebase update for SPD and FPD files\r
         }\r
 \r
         // Datebase update for SPD and FPD files\r
-        result = fixDB(workspace, dbFile, VERBOSE_FLAG, TEST, QUIET);\r
+        result = fixDB(workspace, dbFile, VERBOSE_FLAG, INTERACTIVE, TEST, QUIET);\r
         if ((result == 0) && (TEST) && (QUIET == false))\r
             System.out.println("Workspace is consistent with current database!");\r
         return PASS;\r
         if ((result == 0) && (TEST) && (QUIET == false))\r
             System.out.println("Workspace is consistent with current database!");\r
         return PASS;\r
@@ -185,25 +185,62 @@ public class UpdateDb {
     }\r
 \r
     public int findSpds(String workspace, int VERBOSE_FLAG) {\r
     }\r
 \r
     public int findSpds(String workspace, int VERBOSE_FLAG) {\r
-        System.out.println("The following Package (SPD) files are in the workspace!");            \r
+        System.out.println("The following Package (SPD) files are in the workspace" + workspace);            \r
         File wsDir = new File(workspace);\r
         findSPDFiles(wsDir, workspace, VERBOSE);\r
         for (int i = 0; i < spdList.size(); i++) {\r
         File wsDir = new File(workspace);\r
         findSPDFiles(wsDir, workspace, VERBOSE);\r
         for (int i = 0; i < spdList.size(); i++) {\r
-            System.out.println("  " + spdList.get(i).trim());\r
-            // TODO: get the PackageName from the file\r
+            String Filename = workspace + File.separator + spdList.get(i).trim();\r
+            File spdFilename = new File(Filename);\r
+            try {\r
+                FileReader fileReader = new FileReader(spdFilename);\r
+                BufferedReader reader = new BufferedReader(fileReader);\r
+                String PackageName = null;\r
+                String rLine = null;\r
+                while ((rLine = reader.readLine()) != null) {\r
+                    if (rLine.contains("<PackageName>")) {\r
+                        PackageName = rLine.replace("<PackageName>", "").trim();\r
+                        PackageName = PackageName.replace("</PackageName>", "").trim();\r
+                        System.out.printf("  %25s - %s\n",PackageName, spdList.get(i).trim());\r
+                        break;\r
+                    }\r
+                }\r
+                reader.close();\r
+            } catch (IOException e) {\r
+                System.out.println("ERROR Reading File: " + Filename + e);\r
+                System.exit(FAIL);\r
+            }\r
+            \r
         }\r
         }\r
-        return FAIL;\r
+        return PASS;\r
     }\r
 \r
     public int findFpds(String workspace, int VERBOSE_FLAG) {\r
     }\r
 \r
     public int findFpds(String workspace, int VERBOSE_FLAG) {\r
-        System.out.println("The following Platform (FPD) files are in the workspace!");\r
+        System.out.println("The following Platform (FPD) files are in the workspace: " + workspace);\r
         File wsDir = new File(workspace);\r
         findFPDFiles(wsDir, workspace, VERBOSE);\r
         for (int i = 0; i < fpdList.size(); i++) {\r
         File wsDir = new File(workspace);\r
         findFPDFiles(wsDir, workspace, VERBOSE);\r
         for (int i = 0; i < fpdList.size(); i++) {\r
-            System.out.println("  " + fpdList.get(i).trim());\r
-            // TODO: get the PlatformName from the file\r
+            String Filename = workspace + File.separator + fpdList.get(i).trim();\r
+            File fpdFilename = new File(Filename);\r
+            try {\r
+                FileReader fileReader = new FileReader(fpdFilename);\r
+                BufferedReader reader = new BufferedReader(fileReader);\r
+                String PlatformName = null;\r
+                String rLine = null;\r
+                while ((rLine = reader.readLine()) != null) {\r
+                    if (rLine.contains("<PlatformName>")) {\r
+                        PlatformName = rLine.replace("<PlatformName>", "").trim();\r
+                        PlatformName = PlatformName.replace("</PlatformName>", "").trim();\r
+                        System.out.printf("  %25s - %s\n",PlatformName, fpdList.get(i).trim());\r
+                        break;\r
+                    }\r
+                }\r
+                reader.close();\r
+            } catch (IOException e) {\r
+                System.out.println("ERROR Reading File: " + Filename + e);\r
+                System.exit(FAIL);\r
+            }\r
         }\r
         }\r
-        return FAIL;\r
+        return PASS;\r
     }\r
 \r
     // copy from source file to destination file\r
     }\r
 \r
     // copy from source file to destination file\r
@@ -232,7 +269,7 @@ public class UpdateDb {
         return PASS;\r
     }\r
 \r
         return PASS;\r
     }\r
 \r
-    private int fixDB(String workspace, String dbFile, int VERBOSE, boolean TEST, boolean QUIET) {\r
+    private int fixDB(String workspace, String dbFile, int VERBOSE, boolean INTERACTIVE, boolean TEST, boolean QUIET) {\r
         File wsDir = new File(workspace);\r
         int retValue = PASS;\r
         // Find all .spd and .fpd files in workspace and put them in spdList and fpdList\r
         File wsDir = new File(workspace);\r
         int retValue = PASS;\r
         // Find all .spd and .fpd files in workspace and put them in spdList and fpdList\r
@@ -251,7 +288,7 @@ public class UpdateDb {
 \r
         try {\r
             // check database file for possible update\r
 \r
         try {\r
             // check database file for possible update\r
-            retValue = checkDBForUpdate(workspace, dbFile, VERBOSE, TEST, QUIET);\r
+            retValue = checkDBForUpdate(workspace, dbFile, VERBOSE, INTERACTIVE, TEST, QUIET);\r
         } catch (IOException e) {\r
             if (QUIET == false)\r
                 System.out.println("Error: Updating " + dbFile + " file.");\r
         } catch (IOException e) {\r
             if (QUIET == false)\r
                 System.out.println("Error: Updating " + dbFile + " file.");\r
@@ -342,7 +379,7 @@ public class UpdateDb {
         }\r
     }\r
 \r
         }\r
     }\r
 \r
-    private int checkDBForUpdate(String workspace, String dbFileName, int VERBOSE, boolean TEST, boolean QUIET)\r
+    private int checkDBForUpdate(String workspace, String dbFileName, int VERBOSE, boolean INTERACTIVE, boolean TEST, boolean QUIET)\r
                                                                                                                throws IOException {\r
         int SpdFlag = 0;\r
         int FpdFlag = 0;\r
                                                                                                                throws IOException {\r
         int SpdFlag = 0;\r
         int FpdFlag = 0;\r