Google Summer of Code 2019 Update


I didn't publish after the third week, was saving drafts and had planned to publish it once was successful in achieving the main goal of the project. But after discussing with my mentor, I've realised it's better to have regular updates. I will now keep posting blogs every alternate day, if not everyday.

Achievements so far:

In the last post I mentioned that I have created a page that lists all the Operating Systems that haven't yet reached their end of lifecycle, this was basically similar to the page that would come up when we press the show more button in Download an OS option. Now the challenge was to remove the Operating Systems that do not support tree based installations from this list. I initially tried keeping only the Operating Systems that were returning true for tree.hastreeinfo()  but when I tried printing the kernel and initrd path for them, some returned null. While my mentor suggested an approach to read .treeinfo file, that is to call Osinfo.Tree.create_from_location(), both of these methods failed for some operating systems, with the help of my mentor, we finally realised that there are basically two different types of installation trees:
  • The ones that use treeinfo: We have to call Osinfo.Tree.create_from_location(), so it'll read the .treeinfo file and populate kernel & initrd path.
  • The ones that point to kernel & initrd directly: kernel path & initrd path must be set manually in osinfo-db (which is the case for debian & ubuntu distros).

After this when I was trying to build the project, I realised that the code of a dependency, that is upstream gtk-vnc was broken, so my mentor suggested to build without using the builder. It's easy to build all the dependencies on terminal, we just have to run "sudo dnf builddep gnome-boxes" and that's it. We can then build the project using meson and ninja. For running the project with debugging messages on, we need to append G_MESSAGES_DEBUG=Boxes to the install location.

We finally got the list of Operating Systems that support tree based installations right, there are 18 of them. Here is how the list looks like: 



I then checked if we were able to get the script and command line for installing these Operating Systems, we can get the script list for an OS, and then choose one using get_nth(), we also needed installation configuration to generate command line from this script, I used default unattended configuration and printed the generated command line on terminal.

After having a discussion with my mentor, we split the work further into steps and he created issues for every task on my development branch. First, I created a new class Installer from which the already existing class InstallerMedia will inherit and also the new InstallerTree class which we would need for tree based installations. 

I realised how important it is to write clear commit messages at every step, especially when your code might be read by many other people, I once included a lot of things in one commit, hence, had to undo it and do it in smaller and cleaner commits.

Until now, GNOME Boxes was performing express installations using ISO of the Operating System, so we would extract the kernel and initrd from the downloaded ISO, we had a helper class ISOExtractor, that would help in extracting the kernel and initrd from an ISO file using the ArchiveReader and ArchiveWriter class, but now for tree based installations, we will need to download the kernel and initrd from a https location, so I have created a TreeExtractor class that takes the help of Downloader class, the same class that we use to download ISOs for an Operating System. Hence, now there is an Extractor class from which TreeExtractor and ISOExtractor class inherit.

New Git Commands I've Learned
  • git branch -a: Lists all the branches in your codebase
  • git mv old_filename new_filename: can be used for renaming of a file 
  •  git reset --head HARD~n: Reset the head n commits back 
  • touch new_filename: create a new file, but will separately have to add it using git add
  • git reset --head HARD: Remove all uncommitted changes  
I've planned to create children branches of my development branch for every issue to make things clearer.

Plan Ahead

The extract_boot_files method in UnattendedInstaller class calls the ISOExtractor method to extract kernel and initrd for a media, I want to expand it or create a similar method that would use TreeExtractor class to download kernel and initrd for tree based installations.

UnattendedInstaller class also needs some refactoring as it now revolves around media only, especially the prepare_for_installation method. 

For now when we click on an entry in the list of Operating Systems that support tree based installations, the prep page comes up, I'll make the kernel and initrd download, script and command line generation happen there.

I will get the tree installations happening right by the end of this month and then we will focus on removing the separate "Download from Tree" button and adding the tree based installation feature to the Download an OS option only, that is, whenever we click on an Operating System on the Download an OS list, if the OS supports tree based installations, we will make use of it as it is faster or else we will go ahead by downloading the ISO method.






















Comments

Popular posts from this blog