public String guidvalue = null;\r
public String moduletype = null;\r
public String entrypoint = null;\r
+ public String license = null;\r
\r
public final Set<String> localmodulesources = new HashSet<String>(); //contains both .c and .h\r
public final Set<String> preprocessedccodes = new HashSet<String>();\r
private static final Pattern ptninfequation = Pattern.compile("([^\\s]*)\\s*=\\s*([^\\s]*)");\r
private static final Pattern ptnsection = Pattern.compile("\\[([^\\[\\]]*)\\]([^\\[\\]]*)\\n", Pattern.MULTILINE);\r
private static final Pattern ptnfilename = Pattern.compile("[^\\s]+");\r
- \r
+\r
public final void ModuleScan() throws Exception {\r
Common.toDoAll(mi.modulepath, ModuleInfo.class.getMethod("enroll", String.class), mi, null, Common.FILE);\r
\r
}\r
}\r
}\r
- \r
+ private final String extractLicense(String wholeline) throws Exception {\r
+ String tempLine;\r
+ String license = null;\r
+\r
+ BufferedReader rd = new BufferedReader(new StringReader(wholeline));\r
+ while ((tempLine = rd.readLine()) != null) {\r
+ if (tempLine.contains("#")) {\r
+ if (tempLine.contains("Copyright")) {\r
+ //\r
+ // Find license info.\r
+ // \r
+ license = "";\r
+ while ((tempLine = rd.readLine())!= null) {\r
+ if (!tempLine.contains("#") ||\r
+ tempLine.contains("Module Name:") ||\r
+ tempLine.contains("Abstract:")) {\r
+ //\r
+ // We assume license ends here.\r
+ // \r
+ break;\r
+ }\r
+ license += " " + tempLine.replaceAll("\\s*[#]\\s*(.*)", "$1\n");\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ return license;\r
+ }\r
+\r
private final void readInf(String name) throws Exception {\r
System.out.println("\nParsing INF file: " + name);\r
String wholeline;\r
Matcher mtrfilename;\r
\r
wholeline = Common.file2string(mi.modulepath + File.separator + name);\r
+ mi.license = extractLicense(wholeline);\r
mtrsection = ptnsection.matcher(wholeline);\r
while (mtrsection.find()) {\r
if (mtrsection.group(1).matches("defines")) {\r
+/** @file\r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ \r
+ **/\r
package org.tianocore.migration;\r
\r
import java.io.BufferedWriter;\r
msaheader.setModuleType(ModuleTypeDef.Enum.forString(mi.moduletype = Query("Guid Value Not Found! Please Input Guid Value")));\r
}\r
\r
- msaheader.setCopyright("Copyright (c) 2006, Intel Corporation");\r
+ msaheader.setCopyright("Copyright (c) 2006, Intel Corporation. All right reserved.");\r
msaheader.setVersion("1.0");\r
msaheader.setAbstract("Component name for module " + mi.modulename);\r
msaheader.setDescription("FIX ME!");\r
- msaheader.addNewLicense().setStringValue("All rights reserved.\n" +\r
- " This software and associated documentation (if any) is furnished\n" +\r
- " under a license and may only be used or copied in accordance\n" +\r
- " with the terms of the license. Except as permitted by such\n" +\r
- " license, no part of this software or documentation may be\n" +\r
- " reproduced, stored in a retrieval system, or transmitted in any\n" +\r
- " form or by any means without the express written consent of\n" +\r
- " Intel Corporation.");\r
+\r
+ if (mi.license == null) {\r
+ mi.license = "FIX ME!";\r
+ MigrationTool.ui.println ("Fail to extract license info in inf file"); \r
+ }\r
+ msaheader.addNewLicense().setStringValue(mi.license);\r
msaheader.setSpecification("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");\r
\r
List<Enum> arch = new ArrayList<Enum>();\r