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
This commit is contained in:
qhuang8 2006-10-13 03:47:05 +00:00
parent a721f5c47e
commit db0e690675
4 changed files with 52 additions and 11 deletions

View File

@ -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>();

View File

@ -72,6 +72,35 @@ 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);
@ -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")) {

View File

@ -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;

View File

@ -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>();