From d565d6cd83653b74519dcdf3a56ad9707dc0adf8 Mon Sep 17 00:00:00 2001 From: lhauch Date: Thu, 26 Oct 2006 00:17:32 +0000 Subject: [PATCH 1/1] Changed to format of the Package and Platform list outputs. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1842 6f19259b-4bc3-4df7-8a09-765794883524 --- .../src/org/tianocore/DbTools/UpdateDb.java | 61 +++++++++++++++---- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/UpdateDb.java b/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/UpdateDb.java index ad581c93a6..6d3ef98fc9 100644 --- a/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/UpdateDb.java +++ b/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/UpdateDb.java @@ -158,7 +158,7 @@ public class UpdateDb { } // Datebase update for SPD and FPD files - result = fixDB(workspace, dbFile, VERBOSE_FLAG, TEST, QUIET); + result = fixDB(workspace, dbFile, VERBOSE_FLAG, INTERACTIVE, TEST, QUIET); if ((result == 0) && (TEST) && (QUIET == false)) System.out.println("Workspace is consistent with current database!"); return PASS; @@ -185,25 +185,62 @@ public class UpdateDb { } public int findSpds(String workspace, int VERBOSE_FLAG) { - System.out.println("The following Package (SPD) files are in the workspace!"); + System.out.println("The following Package (SPD) files are in the workspace" + workspace); File wsDir = new File(workspace); findSPDFiles(wsDir, workspace, VERBOSE); for (int i = 0; i < spdList.size(); i++) { - System.out.println(" " + spdList.get(i).trim()); - // TODO: get the PackageName from the file + String Filename = workspace + File.separator + spdList.get(i).trim(); + File spdFilename = new File(Filename); + try { + FileReader fileReader = new FileReader(spdFilename); + BufferedReader reader = new BufferedReader(fileReader); + String PackageName = null; + String rLine = null; + while ((rLine = reader.readLine()) != null) { + if (rLine.contains("")) { + PackageName = rLine.replace("", "").trim(); + PackageName = PackageName.replace("", "").trim(); + System.out.printf(" %25s - %s\n",PackageName, spdList.get(i).trim()); + break; + } + } + reader.close(); + } catch (IOException e) { + System.out.println("ERROR Reading File: " + Filename + e); + System.exit(FAIL); + } + } - return FAIL; + return PASS; } public int findFpds(String workspace, int VERBOSE_FLAG) { - System.out.println("The following Platform (FPD) files are in the workspace!"); + System.out.println("The following Platform (FPD) files are in the workspace: " + workspace); File wsDir = new File(workspace); findFPDFiles(wsDir, workspace, VERBOSE); for (int i = 0; i < fpdList.size(); i++) { - System.out.println(" " + fpdList.get(i).trim()); - // TODO: get the PlatformName from the file + String Filename = workspace + File.separator + fpdList.get(i).trim(); + File fpdFilename = new File(Filename); + try { + FileReader fileReader = new FileReader(fpdFilename); + BufferedReader reader = new BufferedReader(fileReader); + String PlatformName = null; + String rLine = null; + while ((rLine = reader.readLine()) != null) { + if (rLine.contains("")) { + PlatformName = rLine.replace("", "").trim(); + PlatformName = PlatformName.replace("", "").trim(); + System.out.printf(" %25s - %s\n",PlatformName, fpdList.get(i).trim()); + break; + } + } + reader.close(); + } catch (IOException e) { + System.out.println("ERROR Reading File: " + Filename + e); + System.exit(FAIL); + } } - return FAIL; + return PASS; } // copy from source file to destination file @@ -232,7 +269,7 @@ public class UpdateDb { return PASS; } - private int fixDB(String workspace, String dbFile, int VERBOSE, boolean TEST, boolean QUIET) { + private int fixDB(String workspace, String dbFile, int VERBOSE, boolean INTERACTIVE, boolean TEST, boolean QUIET) { File wsDir = new File(workspace); int retValue = PASS; // Find all .spd and .fpd files in workspace and put them in spdList and fpdList @@ -251,7 +288,7 @@ public class UpdateDb { try { // check database file for possible update - retValue = checkDBForUpdate(workspace, dbFile, VERBOSE, TEST, QUIET); + retValue = checkDBForUpdate(workspace, dbFile, VERBOSE, INTERACTIVE, TEST, QUIET); } catch (IOException e) { if (QUIET == false) System.out.println("Error: Updating " + dbFile + " file."); @@ -342,7 +379,7 @@ public class UpdateDb { } } - private int checkDBForUpdate(String workspace, String dbFileName, int VERBOSE, boolean TEST, boolean QUIET) + private int checkDBForUpdate(String workspace, String dbFileName, int VERBOSE, boolean INTERACTIVE, boolean TEST, boolean QUIET) throws IOException { int SpdFlag = 0; int FpdFlag = 0; -- 2.39.2