diff options
author | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-10-13 03:47:05 +0000 |
---|---|---|
committer | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-10-13 03:47:05 +0000 |
commit | db0e690675ba50c2463c47e4811227e56c4858d9 (patch) | |
tree | 7cc065055ec8afdb622c63fe51c717571ba0e261 /Tools/Java | |
parent | a721f5c47e42989f67f28377a208158cdb6f6d3d (diff) | |
download | edk2-platforms-db0e690675ba50c2463c47e4811227e56c4858d9.tar.xz |
Extract msa license info from inf file.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1737 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Java')
4 files changed, 52 insertions, 11 deletions
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java index aa19522e02..48ecc56e56 100644 --- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java +++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java @@ -36,6 +36,7 @@ public final class ModuleInfo { public String guidvalue = null;
public String moduletype = null;
public String entrypoint = null;
+ public String license = null;
public final Set<String> localmodulesources = new HashSet<String>(); //contains both .c and .h
public final Set<String> preprocessedccodes = new HashSet<String>();
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java index 09d426282f..0f1df7b593 100644 --- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java +++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java @@ -26,7 +26,7 @@ public final class ModuleReader implements Common.ForDoAll { private static final Pattern ptninfequation = Pattern.compile("([^\\s]*)\\s*=\\s*([^\\s]*)");
private static final Pattern ptnsection = Pattern.compile("\\[([^\\[\\]]*)\\]([^\\[\\]]*)\\n", Pattern.MULTILINE);
private static final Pattern ptnfilename = Pattern.compile("[^\\s]+");
-
+
public final void ModuleScan() throws Exception {
Common.toDoAll(mi.modulepath, ModuleInfo.class.getMethod("enroll", String.class), mi, null, Common.FILE);
@@ -72,7 +72,36 @@ public final class ModuleReader implements Common.ForDoAll { }
}
}
-
+ private final String extractLicense(String wholeline) throws Exception {
+ String tempLine;
+ String license = null;
+
+ BufferedReader rd = new BufferedReader(new StringReader(wholeline));
+ while ((tempLine = rd.readLine()) != null) {
+ if (tempLine.contains("#")) {
+ if (tempLine.contains("Copyright")) {
+ //
+ // Find license info.
+ //
+ license = "";
+ while ((tempLine = rd.readLine())!= null) {
+ if (!tempLine.contains("#") ||
+ tempLine.contains("Module Name:") ||
+ tempLine.contains("Abstract:")) {
+ //
+ // We assume license ends here.
+ //
+ break;
+ }
+ license += " " + tempLine.replaceAll("\\s*[#]\\s*(.*)", "$1\n");
+ }
+ break;
+ }
+ }
+ }
+ return license;
+ }
+
private final void readInf(String name) throws Exception {
System.out.println("\nParsing INF file: " + name);
String wholeline;
@@ -81,6 +110,7 @@ public final class ModuleReader implements Common.ForDoAll { Matcher mtrfilename;
wholeline = Common.file2string(mi.modulepath + File.separator + name);
+ mi.license = extractLicense(wholeline);
mtrsection = ptnsection.matcher(wholeline);
while (mtrsection.find()) {
if (mtrsection.group(1).matches("defines")) {
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java index 65873a3c69..9217857fc6 100644 --- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java +++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java @@ -1,3 +1,15 @@ +/** @file
+
+ Copyright (c) 2006, Intel Corporation
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ **/
package org.tianocore.migration;
import java.io.BufferedWriter;
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java index 132d6c3bc5..af8646f792 100644 --- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java +++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java @@ -100,18 +100,16 @@ public class MsaWriter { msaheader.setModuleType(ModuleTypeDef.Enum.forString(mi.moduletype = Query("Guid Value Not Found! Please Input Guid Value")));
}
- msaheader.setCopyright("Copyright (c) 2006, Intel Corporation");
+ msaheader.setCopyright("Copyright (c) 2006, Intel Corporation. All right reserved.");
msaheader.setVersion("1.0");
msaheader.setAbstract("Component name for module " + mi.modulename);
msaheader.setDescription("FIX ME!");
- msaheader.addNewLicense().setStringValue("All rights reserved.\n" +
- " This software and associated documentation (if any) is furnished\n" +
- " under a license and may only be used or copied in accordance\n" +
- " with the terms of the license. Except as permitted by such\n" +
- " license, no part of this software or documentation may be\n" +
- " reproduced, stored in a retrieval system, or transmitted in any\n" +
- " form or by any means without the express written consent of\n" +
- " Intel Corporation.");
+
+ if (mi.license == null) {
+ mi.license = "FIX ME!";
+ MigrationTool.ui.println ("Fail to extract license info in inf file");
+ }
+ msaheader.addNewLicense().setStringValue(mi.license);
msaheader.setSpecification("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");
List<Enum> arch = new ArrayList<Enum>();
|