[Lazarus] Installing packages using lazbuild - am I on the right path?
Zaher Dirkey
parmaja at gmail.com
Wed May 23 17:27:54 CEST 2012
On Mon, May 21, 2012 at 9:58 AM, Reinier Olislagers <
reinierolislagers at gmail.com> wrote:
> Hi all,
>
> I'm trying to figure out how to set packages for
> installation/compilation in Lazbuild.
>
> Goal: add packages to user IDE from command line using lazbuild.
>
> I've looked around the code and started a rough hack to try and install
> the rx component when rebuilding the IDE.
>
> I added this in TLazBuildApplication.BuildLazarusIDE:
> var
> ..
> raotestpackage: TLazPackage;
> PkgName: string;
> APackage: TLazPackage;
> ConflictDep: TPkgDependency;
> ...
>
> // try loading install packages
>
> PackageGraph.LoadAutoInstallPackages(BuildLazProfiles.StaticAutoInstallPackages);
> // my modifications start
> //rao: testing: add rx
> // adapted from addtoinstall
> PkgName:='rx';
> raotestpackage:=TLazPackage.Create;
> //todo: replace 'rx' with package name
> if not raotestpackage.StringToID(PkgName) then
> begin
> debugln('Invalid ID: ', PkgName);
> exit;
> end;
> APackage:=PackageGraph.FindPackageWithID(raotestpackage);
> if APackage<>nil then begin
> // check if package is loaded and has some attributes that prevents
> // installation in the IDE
> if APackage.PackageType in [lptRunTime,lptRunTimeOnly] then begin
> writeln(lisNotADesigntimePackage,
> Format(lisThePackageIsNotADesignTimePackageItCanNotBeInstall, [
> APackage.IDAsString]));
> exit;
> end;
> ConflictDep:=PackageGraph.FindRuntimePkgOnlyRecursively(
> APackage.FirstRequiredDependency);
> if ConflictDep<>nil then begin
> writeln(lisNotADesigntimePackage,
> Format(lisThePackageCanNotBeInstalledBecauseItRequiresWhichI, [
> APackage.Name, ConflictDep.AsString]));
> exit;
> end;
> end; //apackage<>nil
> // Mark package for installation - is this the right way?
> raotestpackage.AutoInstall:=pitStatic;
> // Add our new package to the packages we've currently loaded
> PackageGraph.AddPackage(raotestpackage);
> // I thought this would save the list of user-defined packages, is
> this correct?
> PackageGraph.SaveAutoInstallConfig;
>
> // Do I need something like this to save the list of packages?:
> //PkgManager.InstallPackages(pkgidlist, [piiifQuiet]);
>
> // save target directory //existing code resumes
> TargetDir:=CurProf.TargetDirectory;
> IDEMacros.SubstituteMacros(TargetDir);
>
> While the code runs, nothing happens... and I'm sure just copy/pasting
> code from other parts without understanding what's going on isn't the
> fastest/surest way of getting things working.
>
> Questions:
> 1. Am I on the right track?
> 2. Is packagegraph a representation of all packages present in the IDE?
> 3. What do the package .AutoInstall types mean? None: not installed,
> dynamic: needed as a dependency for other packages, static: always
> installed in IDE (e.g. because it is selected by the user)? Am I right
> in manipulating this property?
>
> Thanks,
> Reinier
>
Good feature,
I think it is related my my old ask,
http://comments.gmane.org/gmane.comp.ide.lazarus.general/53455
Best Regards
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120523/fd057398/attachment-0003.html>
More information about the Lazarus
mailing list