FlightGear Package Manager
|This article is a stub. You can help the wiki by|
|Description||Provides an integrated package manager for installing/managing and uninstalling aircraft and other fgdata resources|
|Status||Under active development as of 03/2015.|
| Note In its current form, this section/article is largely based on quotes collected from various related discussions/channels (devel list, forum etc) using the Instant-Cquotes script. Wiki users and other contributors are encouraged to help rewrite/edit contents accordingly to help get rid of unnecessary quoting (i.e. while the wiki is not intended to be a collection of quotes, quotes are sometimes the best/easiest way to bootstrap new articles, while also providing a good way to link back to related discussions in the archives).
While rewriting usually only entails changing first person speech to 3rd person. However, please try to retain references/links to the original discussion whenever possible.
|Note The Integrated Qt5 launcher has a hangar download feature and is included in FlightGear 3.6+.|
TheTom and Zakalawe have begun working on an aircraft package manager, the backend pieces are mostly there but will need some intensive testing. The UI is implemented via Canvas and Nasal in the form of the Aircraft Center. There is a
#define flag you can toggle (in HTTPClient.cxx) to enable the code including the Nasal API; it will download / refresh a catalog, which is generated by the scripts committed to fgmeta. Then you can access the package system from
pkg.root in the Nasal Console, using the API defined at the bottom of HTTPClient.cxx .
The idea to encourage hangar authors to ideally use some standard tooling to create their XML, or alternatively we need to provide some XML verification tools around it. Given that property-list XML is not easy to check with an XML schema, any suggestions on a ‘catalog compliance check’ are welcome; we could write one in Python using the same scripts used to generate the official catalog.
|The default aircraft catalog download path is
Tthe goal here is to almost get rid of a centralised aircraft repo anyway, and have a decentralised development system with the only central point being the aircraft package manager for end users. Then 99% of people never care where the aircraft is stored while it’s developed.
The goal is that no one except people working on an individual aircraft should care where it’s developed at all (on GitHub, in a private SVN repo, stored as sheets of paper in a filing cabinet). SCM systems are not distribution/release systems, we’ve simply been using them in that fashion by accident
The intention is that adding additional ‘hangars’ (aka ‘catalogs’) will be trivial. And anyone can host a hangar, it’s deliberately de-centralised. There is also the expectation that some hangars might have different license terms, e.g. some Creative Commons license which is incompatible with the GPL. (Then we need to decide, how we explain this to users, but right now they download a .zip from a website and don’t care about the license at all).
Then the role of the development team is simply to select which aircraft appear (in each release) in the official catalog (hangar). Obviously we would only select from GPLd aircraft, but beyond that the aircraft could be developed anywhere at all.
And I would expect/hope other people to curate hangars based on their choices - e.g. based on time period (WW2), type of aircraft (gliders) or whatever. Often these people might be the aircraft developers themselves (e.g. FGUK team or Lake Of Constance) but again the code doesn’t care. Of course once the technical system is in place there are some social discussions around this to figure out :) 
Please be aware that the code downloads zips, unpacks them, makes calls to unlink files, renames directories, and so on. So, some caution is recommended, and especially, don’t run it as root (while developing it, Zakalawe had it extract a few zips to ‘/‘ or worse due to screwed up path logic).
A code review of the code in simgear/package/Install.cxx to check any security issues or dangerous behaviour would be appreciate. The code /tries/ to be ‘safe’ - extract zip to a temporary folder, and uses rename/unlink to atomically update if the zip extraction succeeds. But it’s only had one pair of eyes on it so far.
|Well, if we make a manual catalog.xml from the current fgdata/Aircraft (which I have parts of a script to do), and we treat the current aircraft zip URLs as canonical, that is possible with current code right now - since it can do the zip download + extraction to a directory of our choice. We could throw an (ugly) PUI UI around that, and then if someone with more talent than me wants to Canvas-GUI-ify it, that will be great.
I will attempt to get a prototype version of this working tonight / tomorrow. I don’t promise to produce anything usable but as you say, anything would be an improvement.
— James Turner (2014-05-30). Re: [Flightgear-devel] select/download aircraft.
If you wish to dig into the package system, and create some tooling so it’s easy to publish releases from a Git repo to a web-host, please do. The current script is in fgmeta; see ‘create_catalog.py’ which runs over FGData of course, but you can imagine something similar for any SCM store containing several aircraft. There’s additional features that can be added of course, such as support for ‘beta’ or ‘testing’ versions of aircraft, being able to exist alongside stable versions. That would require some C++ hacking on the client side but pretty straightforward stuff I think. 
|The question is how far we'd want to go with something like this - because at some point, it would make more sense to adopt an existing package management system that is multi-platform and open source (e.g. pacm or miniconda). Otherwise, most of the building blocks for a simple package manager are already available to Nasal, i.e. http bindings and SGPath wrappers to download stuff into $FG_HOME and install stuff there. Even though it would probably make sense to also expose zlib (i.e. for extracting compressed archives). Metadata for package names, dependencies, URLs and version/description info could be provided via existing PropertyList XML files. So there's very little missing to pull this off, and a simple prototype for an existing addon, like FGCamera, should be fairly straightforward to build - it's mainly a matter of integrating existing technologies properly, and exposing them first to scripting space.
But most of the infrastructure is already available, i.e. was implemented for installing aircraft and managing scenery via TerraSync.
- James Turner (Apr 12th, 2016). Re: [Flightgear-devel] Built-in launcher: reproducible segfault when downloading an aircraft.