Skip to content

Commit

Permalink
Fix severe bugger in help and version info regarding Lazarus.
Browse files Browse the repository at this point in the history
  • Loading branch information
LongDirtyAnimAlf committed Jun 8, 2024
1 parent 81d37b5 commit fdef17b
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 8 deletions.
7 changes: 5 additions & 2 deletions sources/fpcuputil.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1391,8 +1391,11 @@ procedure VersionFromString(const VersionSnippet:string;out Major,Minor,Build:in

function CalculateFullVersion(const Major,Minor,Release:integer):dword;
begin
if (Major>=0) AND (Major<=6) AND (Minor>=0) AND (Release>=0) then
result:=((Major * 100 + Minor) * 100 + Release)
if (Major>=0) AND (Major<=6) AND (Minor>=0) then
begin
result:=((Major * 100 + Minor) * 100);
if (Release>=0) then result:=result+Release;
end
else
result:=0;
end;
Expand Down
52 changes: 49 additions & 3 deletions sources/installerhelp.pas
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ THelpInstaller = class(TBaseHelpInstaller)
FBuildLCLDocsExeDirectory: string;
{$endif}
protected
function GetReleaseCandidateFromSource:integer;override;
function GetVersionFromSource:string;override;
// Build module descendant customisation
function BuildModuleCustom(ModuleName:string): boolean; virtual;
// internal initialisation, called from BuildModule,CleanModule,GetModule
Expand Down Expand Up @@ -240,6 +242,45 @@ function Decompress(SourceFile, TargetFile: string): boolean;

{ THelpInstaller }

function THelpInstaller.GetReleaseCandidateFromSource:integer;
begin
result:=-1;
end;

function THelpInstaller.GetVersionFromSource:string;
var
OperationSucceeded:boolean;
LazbuildApp: string;
begin
result:='0.0.0';

OperationSucceeded:=true;

LazbuildApp:=IncludeTrailingPathDelimiter(InstallDirectory)+LAZBUILDNAME+GetExeExt;
if CheckExecutable(LazbuildApp, ['--help'],LAZBUILDNAME)=false then
begin
//WritelnLog('No valid lazbuild executable found. Aborting.', true);
OperationSucceeded:=false;
end;

if OperationSucceeded then
begin
// We have a working lazbuild; let's hope it works with primary config path as well
// Build Lazarus chm help compiler; will be used to compile fpdocs xml format into .chm help
Processor.Executable := LazbuildApp;
Processor.Process.Parameters.Clear;
Processor.SetParamData('--version');
ProcessorResult:=Processor.ExecuteAndWait;
//if (ProcessorResult=0) then
begin
if Processor.WorkerOutput.Count>0 then
begin
result:=Processor.WorkerOutput.Strings[Processor.WorkerOutput.Count-1];
end;
end;
end;
end;

function THelpInstaller.BuildModuleCustom(ModuleName: string): boolean;
begin
result:=true;
Expand Down Expand Up @@ -308,6 +349,9 @@ function THelpInstaller.InitModule: boolean;
PlainBinDir,true,false);
{$ENDIF UNIX}
end;

GetVersion;
InitDone:=result;
end;

function THelpInstaller.BuildModule(ModuleName: string): boolean;
Expand Down Expand Up @@ -392,7 +436,11 @@ function THelpInstaller.GetModule(ModuleName: string): boolean;
i:=Low(HELPSOURCEURL);
repeat
LazarusVersion:=HELPSOURCEURL[i,0];
if CalculateNumericalVersion(LazarusVersion)>=CalculateFullVersion(FMajorVersion,FMinorVersion,FReleaseVersion) then
if
(CalculateNumericalVersion(LazarusVersion)>=CalculateFullVersion(FMajorVersion,FMinorVersion,FReleaseVersion)) // check for a stable version of Lazarus
OR
((Odd(FMinorVersion)) AND (CalculateNumericalVersion(LazarusVersion)>=CalculateFullVersion(FMajorVersion,(FMinorVersion-1),FReleaseVersion))) // check for a fixes version of Lazarus
then
begin
HelpUrl:=HELPSOURCEURL[i,1];
//Continue search for even better version with same version number
Expand All @@ -410,7 +458,6 @@ function THelpInstaller.GetModule(ModuleName: string): boolean;
Inc(i);
until (i>High(HELPSOURCEURL));


if Length(HelpUrl)=0 then
begin
//Help version determination failed.
Expand All @@ -430,7 +477,6 @@ function THelpInstaller.GetModule(ModuleName: string): boolean;
DocsZip := GetTempFileNameExt('FPCUPTMP','zip');
DocsTar := ChangeFileExt(DocsZip,'.tar');


for RunTwice in boolean do
begin
if OperationSucceeded then break;
Expand Down
6 changes: 3 additions & 3 deletions sources/revision.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const
{%H-}DELUXEVERSION='2.4.0e';
{%H-}RevisionStr='502';
{%H-}VersionDate='20240605';
{%H-}DELUXEVERSION='2.4.0fp';
{%H-}RevisionStr='503';
{%H-}VersionDate='20240608';
Binary file modified up.res
Binary file not shown.

0 comments on commit fdef17b

Please sign in to comment.