mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 06:49:23 +02:00
* Merging revisions r44285 from trunk:
------------------------------------------------------------------------ r44285 | michael | 2020-03-08 14:45:41 +0100 (Sun, 08 Mar 2020) | 1 line * Add category, support tags for package ------------------------------------------------------------------------ git-svn-id: branches/fixes_3_2@46577 -
This commit is contained in:
parent
d0e3fb0eb2
commit
fe716c890b
@ -122,6 +122,8 @@ Const
|
|||||||
SNodeDescription = 'description';
|
SNodeDescription = 'description';
|
||||||
SNodeDependencies = 'dependencies';
|
SNodeDependencies = 'dependencies';
|
||||||
SNodeDependency = 'dependency';
|
SNodeDependency = 'dependency';
|
||||||
|
SNodeCategory = 'category';
|
||||||
|
SNodeSupport = 'support';
|
||||||
SNodeOSes = 'oses';
|
SNodeOSes = 'oses';
|
||||||
SNodeCPUS = 'cpus';
|
SNodeCPUS = 'cpus';
|
||||||
SNodeOS = 'os';
|
SNodeOS = 'os';
|
||||||
@ -153,9 +155,9 @@ ResourceString
|
|||||||
|
|
||||||
function TFPXMLHandler.AddTextNode(Const NodeName,NodeContent : String; XML : TXMLDocument; Parent : TDomNode_WithChildren) : TDomElement;
|
function TFPXMLHandler.AddTextNode(Const NodeName,NodeContent : String; XML : TXMLDocument; Parent : TDomNode_WithChildren) : TDomElement;
|
||||||
begin
|
begin
|
||||||
Result:=XML.CreateElement(NodeName);
|
Result:=XML.CreateElement(UTF8Decode(NodeName));
|
||||||
Try
|
Try
|
||||||
Result.AppendChild(XML.CreateTextNode(NodeContent));
|
Result.AppendChild(XML.CreateTextNode(UTF8Decode(NodeContent)));
|
||||||
If Assigned(Parent) then
|
If Assigned(Parent) then
|
||||||
Parent.AppendChild(Result);
|
Parent.AppendChild(Result);
|
||||||
Except
|
Except
|
||||||
@ -179,14 +181,14 @@ end;
|
|||||||
function TFPXMLHandler.FindNextElement(Start: TDomNode; NodeName: String): TDomElement;
|
function TFPXMLHandler.FindNextElement(Start: TDomNode; NodeName: String): TDomElement;
|
||||||
begin
|
begin
|
||||||
Result:=GetNextElement(Start);
|
Result:=GetNextElement(Start);
|
||||||
While (Result<>Nil) and (Result.NodeName<>NodeName) do
|
While (Result<>Nil) and (Result.NodeName<>UTF8Decode(NodeName)) do
|
||||||
Result:=GetNextElement(Result.NextSibling);
|
Result:=GetNextElement(Result.NextSibling);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TFPXMLHandler.CheckNodeType(E : TDomElement; NodeName : String);
|
procedure TFPXMLHandler.CheckNodeType(E : TDomElement; NodeName : String);
|
||||||
begin
|
begin
|
||||||
If (E.NodeName<>NodeName) then
|
If (E.NodeName<>UTF8Decode(NodeName)) then
|
||||||
Raise EXMLPackage.CreateFmt(SErrInvalidXMLDocument,[NodeName,E.NodeName]);
|
Raise EXMLPackage.CreateFmt(SErrInvalidXMLDocument,[NodeName,E.NodeName]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -199,7 +201,7 @@ begin
|
|||||||
While (N<>Nil) and (N.NodeType<>TEXT_NODE) do
|
While (N<>Nil) and (N.NodeType<>TEXT_NODE) do
|
||||||
N:=N.NextSibling;
|
N:=N.NextSibling;
|
||||||
If (N<>Nil) then
|
If (N<>Nil) then
|
||||||
Result:=N.NodeValue
|
Result:=UTF8Encode(N.NodeValue)
|
||||||
else
|
else
|
||||||
Result:='';
|
Result:='';
|
||||||
end;
|
end;
|
||||||
@ -217,13 +219,13 @@ begin
|
|||||||
Parent:=XML;
|
Parent:=XML;
|
||||||
Parent.AppendChild(Result);
|
Parent.AppendChild(Result);
|
||||||
if V.Major > -1 then
|
if V.Major > -1 then
|
||||||
Result[SAttrMajor]:=IntToStr(V.Major);
|
Result[SAttrMajor]:=UTF8Decode(IntToStr(V.Major));
|
||||||
if V.Minor > -1 then
|
if V.Minor > -1 then
|
||||||
Result[SAttrMinor]:=IntToStr(V.Minor);
|
Result[SAttrMinor]:=UTF8Decode(IntToStr(V.Minor));
|
||||||
if V.Micro > -1 then
|
if V.Micro > -1 then
|
||||||
Result[SAttrMicro]:=IntToStr(V.Micro);
|
Result[SAttrMicro]:=UTF8Decode(IntToStr(V.Micro));
|
||||||
if V.Build > -1 then
|
if V.Build > -1 then
|
||||||
Result[SAttrBuild]:=IntToStr(V.Build);
|
Result[SAttrBuild]:=UTF8Decode(IntToStr(V.Build));
|
||||||
except
|
except
|
||||||
Parent.RemoveChild(Result);
|
Parent.RemoveChild(Result);
|
||||||
Result.Free;
|
Result.Free;
|
||||||
@ -242,7 +244,7 @@ begin
|
|||||||
Parent:=XML;
|
Parent:=XML;
|
||||||
Parent.AppendChild(Result);
|
Parent.AppendChild(Result);
|
||||||
E:=XML.CreateElement(SNodePackage);
|
E:=XML.CreateElement(SNodePackage);
|
||||||
E[SAttrPackageName]:=D.PackageName;
|
E[SAttrPackageName]:=UTF8Decode(D.PackageName);
|
||||||
Result.AppendChild(E);
|
Result.AppendChild(E);
|
||||||
if not D.MinVersion.Empty then
|
if not D.MinVersion.Empty then
|
||||||
VersionToXML(D.MinVersion,XML,Result);
|
VersionToXML(D.MinVersion,XML,Result);
|
||||||
@ -291,7 +293,7 @@ begin
|
|||||||
If (O in OSes) then
|
If (O in OSes) then
|
||||||
begin
|
begin
|
||||||
ES:=XML.CreateElement(SNodeOS);
|
ES:=XML.CreateElement(SNodeOS);
|
||||||
ES[SAttrName]:=GetEnumName(TypeInfo(TOS),Ord(O));
|
ES[SAttrName]:=UTF8Decode(GetEnumName(TypeInfo(TOS),Ord(O)));
|
||||||
Result.AppendChild(ES);
|
Result.AppendChild(ES);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -308,7 +310,7 @@ begin
|
|||||||
If (C in CPUs) then
|
If (C in CPUs) then
|
||||||
begin
|
begin
|
||||||
ES:=XML.CreateElement(SNodeCPU);
|
ES:=XML.CreateElement(SNodeCPU);
|
||||||
ES[SAttrName]:=GetEnumName(TypeInfo(TCPU),Ord(C));
|
ES[SAttrName]:=UTF8Decode(GetEnumName(TypeInfo(TCPU),Ord(C)));
|
||||||
Result.AppendChild(ES);
|
Result.AppendChild(ES);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -321,7 +323,7 @@ begin
|
|||||||
If Not Assigned(Parent) then
|
If Not Assigned(Parent) then
|
||||||
Parent:=XMl;
|
Parent:=XMl;
|
||||||
Parent.AppendChild(Result);
|
Parent.AppendChild(Result);
|
||||||
Result[SAttrName]:=P.Name;
|
Result[SAttrName]:=UTF8Decode(P.Name);
|
||||||
// Version
|
// Version
|
||||||
VersionToXML(P.Version,XML,Result);
|
VersionToXML(P.Version,XML,Result);
|
||||||
AddTextNode(SNodeAuthor,P.Author,XML,Result);
|
AddTextNode(SNodeAuthor,P.Author,XML,Result);
|
||||||
@ -331,6 +333,8 @@ begin
|
|||||||
AddTextNode(SNodeEmail,P.Email,XML,Result);
|
AddTextNode(SNodeEmail,P.Email,XML,Result);
|
||||||
AddTextNode(SNodeDescription,P.Description,XML,Result);
|
AddTextNode(SNodeDescription,P.Description,XML,Result);
|
||||||
AddTextNode(SNodeLicense,P.License,XML,Result);
|
AddTextNode(SNodeLicense,P.License,XML,Result);
|
||||||
|
AddTextNode(SNodeCategory,P.Category,XML,Result);
|
||||||
|
AddTextNode(SNodeSupport,P.Support,XML,Result);
|
||||||
if P.OSes<>AllOSes then
|
if P.OSes<>AllOSes then
|
||||||
OSesToXML(P.OSes,XML,Result);
|
OSesToXML(P.OSes,XML,Result);
|
||||||
if P.CPUs<>AllCPUs then
|
if P.CPUs<>AllCPUs then
|
||||||
@ -543,7 +547,7 @@ procedure TFPXMLRepositoryHandler.DoXMLToVersion(E: TDomElement; V: TFPVersion);
|
|||||||
var
|
var
|
||||||
i: Longint;
|
i: Longint;
|
||||||
begin
|
begin
|
||||||
if TryStrToInt(E[AttrName], i) then
|
if TryStrToInt(UTF8Encode(E[UTF8Decode(AttrName)]), i) then
|
||||||
Result := Abs(i)
|
Result := Abs(i)
|
||||||
else
|
else
|
||||||
Result := -1;
|
Result := -1;
|
||||||
@ -572,7 +576,7 @@ begin
|
|||||||
While (N<>Nil) do
|
While (N<>Nil) do
|
||||||
begin
|
begin
|
||||||
if (N.NodeName=sNodePackage) then
|
if (N.NodeName=sNodePackage) then
|
||||||
D.PackageName:=N[SAttrPackageName]
|
D.PackageName:=UTF8Encode(N[SAttrPackageName])
|
||||||
else if (N.NodeName=sNodeVersion) then
|
else if (N.NodeName=sNodeVersion) then
|
||||||
DoXMlToVersion(N,D.MinVersion)
|
DoXMlToVersion(N,D.MinVersion)
|
||||||
else if (N.NodeName=sNodeOSes) then
|
else if (N.NodeName=sNodeOSes) then
|
||||||
@ -629,7 +633,7 @@ begin
|
|||||||
E:=FindNextElement(N.FirstChild,SNodeOS);
|
E:=FindNextElement(N.FirstChild,SNodeOS);
|
||||||
While (E<>Nil) do
|
While (E<>Nil) do
|
||||||
begin
|
begin
|
||||||
J:=GetEnumValue(TypeInfo(TOS),E[SAttrName]);
|
J:=GetEnumValue(TypeInfo(TOS),UTF8Encode(E[SAttrName]));
|
||||||
If (J<>-1) then
|
If (J<>-1) then
|
||||||
Include(Result,TOS(J));
|
Include(Result,TOS(J));
|
||||||
E:=FindNextElement(E.NextSibling,SNodeOS);
|
E:=FindNextElement(E.NextSibling,SNodeOS);
|
||||||
@ -646,7 +650,7 @@ begin
|
|||||||
E:=FindNextElement(N.FirstChild,SNodeCPU);
|
E:=FindNextElement(N.FirstChild,SNodeCPU);
|
||||||
While (E<>Nil) do
|
While (E<>Nil) do
|
||||||
begin
|
begin
|
||||||
J:=GetEnumValue(TypeInfo(TCPU),E[SAttrName]);
|
J:=GetEnumValue(TypeInfo(TCPU),UTF8Encode(E[SAttrName]));
|
||||||
If (J<>-1) then
|
If (J<>-1) then
|
||||||
Include(Result,TCPU(J));
|
Include(Result,TCPU(J));
|
||||||
E:=FindNextElement(E.NextSibling,SNodeCPU);
|
E:=FindNextElement(E.NextSibling,SNodeCPU);
|
||||||
@ -658,7 +662,7 @@ procedure TFPXMLRepositoryHandler.DoXMLToPackage(E: TDomElement; P: TFPPackage);
|
|||||||
Var
|
Var
|
||||||
N : TDomElement;
|
N : TDomElement;
|
||||||
begin
|
begin
|
||||||
P.Name:=E[sAttrName];
|
P.Name:=UTF8Encode(E[sAttrName]);
|
||||||
N:=GetNextElement(E.FirstChild);
|
N:=GetNextElement(E.FirstChild);
|
||||||
While (N<>Nil) do
|
While (N<>Nil) do
|
||||||
begin
|
begin
|
||||||
@ -682,8 +686,12 @@ begin
|
|||||||
P.OSes:=DoXMLToOSes(N)
|
P.OSes:=DoXMLToOSes(N)
|
||||||
else if (N.NodeName=sNodeCPUS) then
|
else if (N.NodeName=sNodeCPUS) then
|
||||||
P.CPUs:=DoXMLToCPUs(N)
|
P.CPUs:=DoXMLToCPUs(N)
|
||||||
|
else if (N.NodeName=sNodeSupport) then
|
||||||
|
P.Support:=NodeText(N)
|
||||||
else if (N.NodeName=sNodeDependencies) then
|
else if (N.NodeName=sNodeDependencies) then
|
||||||
DoXMlToDependencies(N,P.Dependencies)
|
DoXMlToDependencies(N,P.Dependencies)
|
||||||
|
else if (N.NodeName=sNodeCategory) then
|
||||||
|
P.Category:=NodeText(N)
|
||||||
else if Not IgnoreUnknownNodes then
|
else if Not IgnoreUnknownNodes then
|
||||||
Raise EXMLPackage.CreateFmt(SErrUnknownNode,[N.NodeName,sNodePackage,P.Name]);
|
Raise EXMLPackage.CreateFmt(SErrUnknownNode,[N.NodeName,sNodePackage,P.Name]);
|
||||||
N:=GetNextElement(N.NextSibling);
|
N:=GetNextElement(N.NextSibling);
|
||||||
@ -887,7 +895,7 @@ procedure TFPXMLMirrorHandler.DoXMLToMirror(E: TDomElement; P: TFPMirror);
|
|||||||
Var
|
Var
|
||||||
N : TDomElement;
|
N : TDomElement;
|
||||||
begin
|
begin
|
||||||
P.Name:=E[sAttrName];
|
P.Name:=UTF8Encode(E[sAttrName]);
|
||||||
N:=GetNextElement(E.FirstChild);
|
N:=GetNextElement(E.FirstChild);
|
||||||
While (N<>Nil) do
|
While (N<>Nil) do
|
||||||
begin
|
begin
|
||||||
|
@ -173,11 +173,11 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
// Now try if a local config-file exists
|
// Now try if a local config-file exists
|
||||||
cfgfile:=GetFppkgConfigFile(False,False);
|
cfgfile:=GetFppkgConfigFile(Options.PreferGlobal,False);
|
||||||
if not FileExists(cfgfile) then
|
if not FileExists(cfgfile) then
|
||||||
begin
|
begin
|
||||||
// If not, try to find a global configuration file
|
// If not, try to find a global configuration file
|
||||||
cfgfile:=GetFppkgConfigFile(True,False);
|
cfgfile:=GetFppkgConfigFile(not Options.PreferGlobal,False);
|
||||||
if not FileExists(cfgfile) then
|
if not FileExists(cfgfile) then
|
||||||
begin
|
begin
|
||||||
// Create a new configuration file
|
// Create a new configuration file
|
||||||
|
@ -196,6 +196,7 @@ Type
|
|||||||
TFppkgOptions = class(TPersistent)
|
TFppkgOptions = class(TPersistent)
|
||||||
private
|
private
|
||||||
FOptionParser: TTemplateParser;
|
FOptionParser: TTemplateParser;
|
||||||
|
FPreferGlobal: Boolean;
|
||||||
FSectionList: TFppkgOptionSectionList;
|
FSectionList: TFppkgOptionSectionList;
|
||||||
function GetCommandLineSection: TFppkgCommandLineOptionSection;
|
function GetCommandLineSection: TFppkgCommandLineOptionSection;
|
||||||
function GetGlobalSection: TFppkgGLobalOptionSection;
|
function GetGlobalSection: TFppkgGLobalOptionSection;
|
||||||
@ -213,7 +214,7 @@ Type
|
|||||||
procedure AddRepositoriesForCompilerSettings(ACompilerOptions: TCompilerOptions);
|
procedure AddRepositoriesForCompilerSettings(ACompilerOptions: TCompilerOptions);
|
||||||
function AddRepositoryOptionSection(ASectionClass: TFppkgRepositoryOptionSectionClass): TFppkgRepositoryOptionSection;
|
function AddRepositoryOptionSection(ASectionClass: TFppkgRepositoryOptionSectionClass): TFppkgRepositoryOptionSection;
|
||||||
function AddIncludeFilesOptionSection(AFileMask: string): TFppkgIncludeFilesOptionSection;
|
function AddIncludeFilesOptionSection(AFileMask: string): TFppkgIncludeFilesOptionSection;
|
||||||
|
property PreferGlobal : Boolean Read FPreferGlobal Write FPreferGLobal;
|
||||||
property SectionList: TFppkgOptionSectionList read GetSectionList;
|
property SectionList: TFppkgOptionSectionList read GetSectionList;
|
||||||
property GlobalSection: TFppkgGLobalOptionSection read GetGlobalSection;
|
property GlobalSection: TFppkgGLobalOptionSection read GetGlobalSection;
|
||||||
property CommandLineSection: TFppkgCommandLineOptionSection read GetCommandLineSection;
|
property CommandLineSection: TFppkgCommandLineOptionSection read GetCommandLineSection;
|
||||||
@ -806,7 +807,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TFppkgOptions.Create;
|
constructor TFppkgOptions.Create();
|
||||||
begin
|
begin
|
||||||
FOptionParser := TTemplateParser.Create;
|
FOptionParser := TTemplateParser.Create;
|
||||||
FOptionParser.Values['AppConfigDir'] := GetFppkgConfigDir(false);
|
FOptionParser.Values['AppConfigDir'] := GetFppkgConfigDir(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user