Opkman: Warn user if a package is incompatible with the current system. Implemented for third party packages too.

git-svn-id: trunk@61325 -
This commit is contained in:
balazs 2019-06-06 10:49:34 +00:00
parent 3791e9a6da
commit ea23df45e0
2 changed files with 56 additions and 35 deletions

View File

@ -737,58 +737,79 @@ begin
if not IsSomethingChecked(False) then if not IsSomethingChecked(False) then
Exit; Exit;
CanGo := True; CanGo := True;
NeedToRebuild := False;
VisualTree.UpdatePackageStates;
PackageListFrm := TPackageListFrm.Create(MainFrm);
try
PackageListFrm.lbMessage.Caption := rsMainFrm_PackageUpdate0;
PackageListFrm.PopulateList(2);
if PackageListFrm.Count > 0 then
CanGo := PackageListFrm.ShowModal = mrYes
else
CanGo := True;
finally
PackageListFrm.Free;
end;
if Options.IncompatiblePackages then
begin
PackageListFrm := TPackageListFrm.Create(MainFrm);
try
PackageListFrm.lbMessage.Caption := rsMainFrm_PackageIncompatible;
PackageListFrm.PopulateList(3);
if PackageListFrm.Count > 0 then
CanGo := PackageListFrm.ShowModal = mrYes
else
CanGo := True;
finally
PackageListFrm.Free;
end;
end;
if CanGo then if CanGo then
begin begin
if MessageDlgEx(rsMainFrm_PackageUpdateWarning, mtConfirmation, [mbYes, mbNo], Self) <> mrYes then NeedToRebuild := False;
Exit;
PackageAction := paUpdate;
VisualTree.UpdatePackageStates; VisualTree.UpdatePackageStates;
if SerializablePackages.DownloadCount > 0 then if Options.AlreadyInstalledPackages then
begin begin
DoExtract := True; PackageListFrm := TPackageListFrm.Create(MainFrm);
CanGo := UpdateP(Options.LocalRepositoryUpdateExpanded, DoExtract) = mrOK; try
VisualTree.UpdatePackageStates; PackageListFrm.lbMessage.Caption := rsMainFrm_PackageUpdate0;
PackageListFrm.PopulateList(2);
if PackageListFrm.Count > 0 then
CanGo := PackageListFrm.ShowModal = mrYes
else
CanGo := True;
finally
PackageListFrm.Free;
end;
end; end;
if CanGo then if CanGo then
begin begin
if SerializablePackages.ExtractCount > 0 then if MessageDlgEx(rsMainFrm_PackageUpdateWarning, mtConfirmation, [mbYes, mbNo], Self) <> mrYes then
Exit;
PackageAction := paUpdate;
VisualTree.UpdatePackageStates;
if SerializablePackages.DownloadCount > 0 then
begin begin
DoOpen := False; DoExtract := True;
CanGo := Extract(Options.LocalRepositoryUpdateExpanded, Options.LocalRepositoryPackagesExpanded, DoOpen, True) = mrOk; CanGo := UpdateP(Options.LocalRepositoryUpdateExpanded, DoExtract) = mrOK;
VisualTree.UpdatePackageStates; VisualTree.UpdatePackageStates;
end; end;
if CanGo then if CanGo then
begin begin
if Options.DeleteZipAfterInstall then if SerializablePackages.ExtractCount > 0 then
SerializablePackages.DeleteDownloadedZipFiles;
if SerializablePackages.InstallCount > 0 then
begin begin
InstallStatus := isFailed; DoOpen := False;
if Install(InstallStatus, NeedToRebuild) = mrOk then CanGo := Extract(Options.LocalRepositoryUpdateExpanded, Options.LocalRepositoryPackagesExpanded, DoOpen, True) = mrOk;
VisualTree.UpdatePackageStates;
end;
if CanGo then
begin
if Options.DeleteZipAfterInstall then
SerializablePackages.DeleteDownloadedZipFiles;
if SerializablePackages.InstallCount > 0 then
begin begin
if (InstallStatus = isSuccess) or (InstallStatus = isPartiallyFailed) then InstallStatus := isFailed;
if Install(InstallStatus, NeedToRebuild) = mrOk then
begin begin
SerializablePackages.MarkRuntimePackages; if (InstallStatus = isSuccess) or (InstallStatus = isPartiallyFailed) then
VisualTree.UpdatePackageStates; begin
if NeedToRebuild then SerializablePackages.MarkRuntimePackages;
Rebuild; VisualTree.UpdatePackageStates;
if NeedToRebuild then
Rebuild;
end;
end; end;
end; end;
end; end;

View File

@ -232,7 +232,7 @@ begin
begin begin
Node := FVST.AddChild(nil); Node := FVST.AddChild(nil);
Data := FVST.GetNodeData(Node); Data := FVST.GetNodeData(Node);
Data^.FName := LazarusPkg.Name + '(' + LazarusPkg.InstalledFileVersion + ')'; Data^.FName := LazarusPkg.Name + '(' + LazarusPkg.VersionAsString + ')';
Data^.FImageIndex := IMG_PKG_FILE; Data^.FImageIndex := IMG_PKG_FILE;
Data^.FSupLazVers := LazarusPkg.LazCompatibility; Data^.FSupLazVers := LazarusPkg.LazCompatibility;
Data^.FIsLazComp := LazComp; Data^.FIsLazComp := LazComp;