Monday, 26 January 2009

MakeStatus plasmoid: Code uploaded

Hi, in my previous blog I introduced the new plasmoid I wrote as a means of learning experience.

I got some good suggestions like pastebin integration, KJob based implementation etc.. Really thanks for such good ideas :)

However I have not yet thought of implementing them as I just started learning some basics. It will take quite some time to master plasma and then actually dive into kde internals.

Anyways, I have decided to use code.google.com to host the plasmoid as of now. I thought of uploading code in kde svn playground but then I was confused on where exactly to import the 'makeinvoker' program code.

I have done a couple of changes since my last blog

  • First of all I have notify-enabled the makeinvoker program which informs the completion of the make invocation along with number of errors/warnings.
  • Secondly, a rather minor impacted change, converted makeinvoker program from qtcore app to kapp so that I can use notifications :)

Here is a screenshot:
Here are some meta-info about MakeStatus















Project url: http://code.google.com/p/makestatus/
SVN (anonymous) : svn checkout http://makestatus.googlecode.com/svn/trunk/ makestatus-read-only
Tarball(~13kB): http://makestatus.googlecode.com/files/makestatus-0_0_1.tar.gz


I hope this plasmoid will be of some use to others as well :) I appreciate your feedback :)

Tuesday, 20 January 2009

MakeStatus: A new plasmoid for developers!

I always wanted to develop a plasmoid ever since kde4.0 but I wasn't getting any ideas which had enough driving force in them. Finally, about 2 days back, I got an idea which was the result of "scratch your own itch"!

Let me introduce the functionality of this plasmoid, which served as learning means to me.

Usually we developers keep building from sources quite often. Many a times we do multiple builds in the background. Its quite annoying to monitor the progress staring at the screen. Others start some other work only to realize that the build has completed long time back.
Some smart people invoke echo -e '\a' immediately after make invocation to alert them.

However, wouldn't it be cool to have sneak-peak of the progress somewhere in the panel or as applet on the desktop ?

Especially, cmake has a wonderful method of saying the progress in percentile. So the visualization could really be made simple.

I used this as a use-case and developed a simple data-engine based plasmoid which is made up of following three components.
  • The data-engine, which has a dbus-interface to add, remove make source and also set the progress for an already added make-source.
  • The plasmoid, which at the moment is just a simple visualization, which displays the total progress of all builds.
  • The makeinvoker, which is a simple stand-alone qt-core based program that wraps around make and parses the output of make for progress information. As soon as it finds the progress information, it relays this information to the data-engine using a dbus-call. Also the makeinvoker prints out both the stdout and stderr of the make process to its stdout and stderr.

Here is snapshot of the applet in work


Armed with Techbase, I could grasp the basics quite fast. I really love the architecture of plasma - its flexible, intuitive yet powerful :)
However the codebase of MakeStatus isn't as clean since I am newbie to plasmoids, data-engines and D-Bus. It will take some time to shape up the code.

Some more ideas that can be implemented are:
  1. Notification mechanism to indicate completion of make job (probably with error/warning clue as well if any)
  2. Ability to pause/resume make
  3. Display all make jobs with their progress in an extender when clicked.
As of now there is an issue bugging me and I am afraid there isn't an easy solution for it. The issue is, the "coloring of the output text" by cmake based Makefiles don't work. I don't know how I can read stdout from a QProcess and also forward the same to parent process with coloring. Any help is appreciated :)

Also I somehow could not get data-engine d-bus connection to exist standalone as I wanted. I tried
QDBusConnection::connectToBus(QDBusConnection::SessionBus, "org.MakeStatusEngine")
but somehow that created the connection at ":1.125". I really don't know much dbus - so will resolve this later (or may be I'll get help soon ).
The dbus interface path currently lies in the connection "org.kde.plasma"


BTW, for non cmake based Makefiles there is currently no way to display the progress information. For these build systems, the progress is either 0% or 100% (yeah, its binary in nature ;) )

Thats all I had to say. Any feedback is appreciated. Infact I'd love to listen to many more ideas that can be incorporated into this plasmoid.

Saturday, 10 January 2009

Metalinks (contd)

My previous post turned out to be very messy with updations because of my confusions. Hence I am doing a new post.

Metalink is a protocol which allows to embed several links for a given file. The links can be bittorent, ftp, http. Metalink enabled clients can use all these links to download segments of files from different sources.

aria2 is one such client. It is a special download utility which is really fast. Its power lies in ability to handle multiple connections from multiple sources simultaneously.

Opensuse has adopted such goodness already. All its iso's and rpm's also come with metalinks, which means people can download opensuse faster.

This sweetness is also being adopted in libzypp as well by providing a download handler using aria. However the default handler is curl for opensuse 11. zypper can be made to use aria by setting the environment variable as follows
ZYPP_ARIA2C=1

Now here comes the part, where I am confused.
Looking at the invocation of aria by the zypper (ps aux |grep aria) it seems libzypp instructs aria to download from direct rpm link and not its metalink. The metalink for each rpm file can be seen in html pages of repos (look to right of each rpm link in http://download.opensuse.org/distribution/11.1/repo/oss/suse/noarch/)
According to my testing, zypper is quite slow even while using aria for downloading which suggests its not using metalink.
So, somebody please confirm whether libzypp-aria integration uses metalinks to download rpm files or not.

Meanwhile I tried a manual download of several rpm metalinks and this was really fast. I could get a stable download rate of 80+kbps.

So I decided to work out some python magic to extract metalinks of packages to be downloaded from zypper output and then feed those metalinks to aria2c. The script is messy, but it did increase download speed. More importantly it served my purpose of maximizing bandwidth exploiting in the free download hours.

It certainly is a good idea for zypper to use metalinks rather than direct rpm links if its using aria. However this might already be the case as I am unsure. If it isn't, may be it can be done as summer of code project as well :)

So, I hope to have cleared up the confusion I set up in my previous post.

I will end with a question. Is there a way to get openSuSE factory KDE packages as an ISO which is available through torrents/metalink ?

Opensuse and metalinks

Finally the time to try opensuse on my dell notebook had come. Previously I had Kubuntu 8.04 which was affected by the infamous hard-drive killer bug. So i thought of giving opensuse a shot after my exams and here i did it.

Actually I had downloaded the installer cd for 11.1-rc-x86_64 during my exams so, installed it right away. Almost everything was fine, except for the wifi. Dell inspiron 1525 comes with broadcom card and I had to install the 64bit driver for it. Thankfully I found this link with ease and hence got wifi working as well.

Very soon, I also compiled kdelibs, kdebase, kdesdk, kdepimlibs and kdeplasma-addons and was happy using the trunk kde as my main desktop environment. Desktop effects were descent though I was getting only 57 FPS in glxgears. However, I was running a mix and match kde4 apps from trunk and 4.1.3. Because of this there were some problems like
  • Akregator's menu and icons were absent when run through trunk KDE environment.
  • Setting the KDEHOME variable meant kde3 apps would also use kde4's home directory.
  • Yakuake's prompt used to hang whenever I did tab completetion for the first time in the session

These annoyances drove me to go for stability and hence I switched back to KDE 4.1.3. I wasn't satisfied still as I wanted something which was "latest" and yet somewhat "stable". So I chose to use factory packages for KDE.

The annoyances aggravated once I started the update with KDE factory repos enabled..

First of all, the download was really slow (about 2 kbps!) And also the update required me to monitor it because, either download.opensuse.org or the mirror used to fail and zypper used to hang on stdin asking me to abort/retry every 10 minutes. I took some patience and completed the update.

After the update, I ran into one more problem. KDM won't authenticate me at all, no matter what!! I tried xdm, but I guess I had done an unclean update because of which kde 4.1 didn't work for me. I was forced to use trunk KDE compiled by me, but again there were too many crashes. I think I had by mistake, enabled/disabled repos in between update (when download had failed).

All these left me with no choice, but to reinstall a clean opensuse. I did that but I haven't installed packages nor updated it yet. This is because I am tired of 2 kbps. Also I can't download all time as I have already amassed quite a hefty download and will be paying more for internet usage. The only way I can update is to make use of 2am to 8am free download time by my ISP(BSNL).

I also tried using different mirrors for the repos, yet the speed wasn't impressive. Some research led me to the wonder called METALINKS

Continued here.

Update: I apologize for updations because of my confusions. To clear the things, here is a new post which describes the metalink and its adoption by openSuSE. I have removed those parts from this blog.