summaryrefslogtreecommitdiff
path: root/packages/fpmkunit
diff options
context:
space:
mode:
authorjoost <joost@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-06-06 13:48:51 +0000
committerjoost <joost@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-06-06 13:48:51 +0000
commit23523bf23e1e990b768b8ad2232b0970c024d923 (patch)
tree75e85c3f3c9b3dde16e94ddffbfa35bab1fdf8be /packages/fpmkunit
parent58bb0a4930fb54518f5ce9ac7244d32870ff9a02 (diff)
downloadfpc-23523bf23e1e990b768b8ad2232b0970c024d923.tar.gz
* Added functionality to ease overriding the repository classes
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@17671 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fpmkunit')
-rw-r--r--packages/fpmkunit/src/fpmkunit.pp84
1 files changed, 45 insertions, 39 deletions
diff --git a/packages/fpmkunit/src/fpmkunit.pp b/packages/fpmkunit/src/fpmkunit.pp
index b115856630..46087bd755 100644
--- a/packages/fpmkunit/src/fpmkunit.pp
+++ b/packages/fpmkunit/src/fpmkunit.pp
@@ -573,6 +573,7 @@ Type
Protected
procedure SetName(const AValue: String);override;
procedure LoadUnitConfigFromFile(Const AFileName: String);
+ procedure SaveUnitConfigToStringList(Const AStringList: TStrings;ACPU:TCPU;AOS:TOS); virtual;
procedure SaveUnitConfigToFile(Const AFileName: String;ACPU:TCPU;AOS:TOS);
Public
constructor Create(ACollection: TCollection); override;
@@ -2579,54 +2580,59 @@ begin
end;
end;
-
-procedure TPackage.SaveUnitConfigToFile(Const AFileName: String;ACPU:TCPU;AOS:TOS);
+procedure TPackage.SaveUnitConfigToStringList(const AStringList: TStrings; ACPU: TCPU; AOS: TOS);
Var
- F : TFileStream;
- L : TStringList;
Deps : String;
i : integer;
D : TDependency;
p : TPackage;
begin
+ with AStringList do
+ begin
+ Values[KeyName]:=Name;
+ Values[KeyVersion]:=Version;
+ // TODO Generate checksum based on PPUs
+ Values[KeyChecksum]:=IntToStr(DateTimeToFileDate(Now));
+ Values[KeyCPU]:=CPUToString(ACPU);
+ Values[KeyOS]:=OSToString(AOS);
+ //Installer;
+ Values[KeySourcePath]:=IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(Installer.BuildEngine.FStartDir)+Directory);
+ Values[KeyFPMakeOptions]:=trim(Installer.FPMakeOptionsString);
+ Deps:='';
+ for i:=0 to Dependencies.Count-1 do
+ begin
+ D:=Dependencies[i];
+ if (ACPU in D.CPUs) and (AOS in D.OSes) then
+ begin
+ if Deps<>'' then
+ Deps:=Deps+',';
+ Deps:=Deps+D.Value;
+ P:=TPackage(D.Target);
+ if assigned(P) and (P.InstalledChecksum<>$ffffffff) then
+ Deps:=Deps+'|'+IntToStr(P.InstalledChecksum);
+ end;
+ end;
+ Values[KeyDepends]:=Deps;
+ if NeedLibC then
+ Values[KeyNeedLibC]:='Y'
+ else
+ Values[KeyNeedLibC]:='N';
+ if IsFPMakeAddIn then
+ Values[KeyAddIn]:='Y'
+ else
+ Values[KeyAddIn]:='N';
+ end;
+end;
+
+procedure TPackage.SaveUnitConfigToFile(Const AFileName: String;ACPU:TCPU;AOS:TOS);
+Var
+ F : TFileStream;
+ L : TStringList;
+begin
F:=TFileStream.Create(AFileName,fmCreate);
L:=TStringList.Create;
try
- With L do
- begin
- Values[KeyName]:=Name;
- Values[KeyVersion]:=Version;
- // TODO Generate checksum based on PPUs
- Values[KeyChecksum]:=IntToStr(DateTimeToFileDate(Now));
- Values[KeyCPU]:=CPUToString(ACPU);
- Values[KeyOS]:=OSToString(AOS);
- //Installer;
- Values[KeySourcePath]:=IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(Installer.BuildEngine.FStartDir)+Directory);
- Values[KeyFPMakeOptions]:=trim(Installer.FPMakeOptionsString);
- Deps:='';
- for i:=0 to Dependencies.Count-1 do
- begin
- D:=Dependencies[i];
- if (ACPU in D.CPUs) and (AOS in D.OSes) then
- begin
- if Deps<>'' then
- Deps:=Deps+',';
- Deps:=Deps+D.Value;
- P:=TPackage(D.Target);
- if assigned(P) and (P.InstalledChecksum<>$ffffffff) then
- Deps:=Deps+'|'+IntToStr(P.InstalledChecksum);
- end;
- end;
- Values[KeyDepends]:=Deps;
- if NeedLibC then
- Values[KeyNeedLibC]:='Y'
- else
- Values[KeyNeedLibC]:='N';
- if IsFPMakeAddIn then
- Values[KeyAddIn]:='Y'
- else
- Values[KeyAddIn]:='N';
- end;
+ SaveUnitConfigToStringList(L,ACPU,AOS);
L.SaveToStream(F);
Finally
L.Free;