Jul 30

Introduction

As a KDE packager, I usually have to write and test patches, especially build system related (Examples: Choqok, Amarok, Plasma and happy KStatusNotifierItem’d Akregator and Kaffeine, they don’t look ancient any more :) ). Gentoo, as a source based distro, has the ability to provide packages that clone/checkout the source from upstream’s SCM and compile it directly (called live ebuilds). For KDE, it provides live ebuilds from KDE SC master/trunk and the branch(es) (currently 4.7), plus live ebuilds for many extragear/playground and other packages (all of the above are available in the kde overlay). Also, we provide Qt live ebuilds both from master and many branches, in the qting-edge overlay. I wanted to use our Gentoo live ebuilds in order to test patches, but there were multiple problems. Emerge downloads the sources in $DISTDIR and stores them as the portage user. Plus, the git eclass was using bare repos, and it would reset the repo to master before each emerge. In order to solve those problems, I created a few scripts and wrappers, and convinced Tomas to introduce two new variables in the new git-2 eclass to fit my needs (thanks a lot bro, you owe me a beer).

Define the needs

In short, what I want is:

  • download the sources somewhere in my homedir
  • my everyday user to have write permissions to them
  • non-bare clones
  • url = anongit.kde.org AND pushUrl = git.kde.org, if possible directly on initial clone
  • if possible, have a live and a regular release side by side

The last dot was solvable, but not any more. We used to provide a kdeprefix USE flag, that allowed us to do exactly this (install multiple KDE versions using different prefix (eg /usr/kde/4.7 /usr/kde/live). It had many problems though, that forced us to remove it. The problems it had were mostly in non-KDE packages, eg Sip, which also needed to be prefixed, which was too much workload. Anyway, a chroot could solve that issue.

As for the permission issue, I asked Zac if portage itself could provide something like this (using my user instead of the portage user), and he suggested that creating a git wrapper would be a clean solution.

After a while I was able to extend the above for my gentoo overlays (unofficial ebuild git repositories), since I have write access to most of the ones I use in my system.

Configuration

All the scripts mentioned can be found here. Although well tested here for the past few months, use them at your own risk. In the following examples I’m going to use the configurations for both the KDE and Gentoo git repos. Of course, you can ignore them (“Gentoo repos” blocks in the following scripts).

First, we need to set the following in /etc/make.conf:

# Needed by the Git wrapper
KDE_DEVELOPER=1 # For the KDE repos
GENTOO_DEVELOPER=1 # For the Gentoo repos
EGIT_NONBARE=1 # This one sets the git-2 eclass to clone non-bare repos

Next, we set up some git aliases in ~/.gitconfig, as suggested here:

# KDE Repos
[url "git://anongit.kde.org/"]
    insteadOf = kde:
[url "git@git.kde.org:"]
    pushInsteadOf = kde:
# Gentoo Repos
[url "git://git.overlays.gentoo.org/"]
    insteadOf = gentoo:
[url "git@git.overlays.gentoo.org:"]
    pushInsteadOf = gentoo:

And the git wrapper, which should be put in /usr/local/sbin/git:

#!/bin/bash
source /etc/make.conf
USER="tampakrap"
GROUP="tampakrap"
GIT="/usr/bin/git"
 
if [[ $1 == 'clone' ]]; then
    # KDE Repos
    if [[ $2 == "git://anongit.kde.org/"* ]] && [[ $KDE_DEVELOPER == 1 ]]; then
        KDE_REPO=$(echo $2 | sed 's:git\://anongit.kde.org/::')
        $GIT "$@"
        chown -R $USER:$USER $DISTDIR/egit-src/$KDE_REPO
    # Gentoo Repos
    elif [[ $2 == "git://git.overlays.gentoo.org/"* ]] && [[ $GENTOO_DEVELOPER == 1 ]];then
        GENTOO_REPO=$(echo $2 | sed 's:git\://git.overlays.gentoo.org/::')
        $GIT "$@"
        chown -R $USER:$GROUP $DISTDIR/egit-src/$GENTOO_REPO
    else
        $GIT "$@"
    fi
else 
    if [[ ${PWD%/*} == $DISTDIR/egit-src ]] && ( grep -s -q gentoo .git/config || grep -s -q kde .git/config ); then
        sudo -u $USER $GIT "$@"
    else
        $GIT "$@"
    fi
fi

The above script consists of two parts: if the git argument is clone, it checks if the URL is a KDE or Gentoo one and chowns the repo after cloning. If it is something else (eg pull), it checks again if the URL is a KDE or Gentoo one, and uses sudo -u $USER:$GROUP to preserve the permissions of the repo. The repos are still in the $DISTDIR/egit-src dir ($DISTDIR is usually /usr/portage/distfiles, but it can be changed in /etc/make.conf), so the following script creates symlinks of those somewhere in the homedir (put it in /usr/local/bin/create_repolinks):

#!/bin/bash
 
# Headers
source /etc/make.conf
. /etc/init.d/functions.sh
 
# Variables
REPO_DIR="/home/tampakrap/Source_Code/" # Where to store the symlinks of the repos
GENTOO_REPO_DIR="${REPO_DIR}gentoo/"  # Gentoo repos
KDE_REPO_DIR="${REPO_DIR}kde/" # KDE repos
OVERLAY_DIR="/var/lib/layman"
 
# No root
if [[ $UID == 0 ]]; then
	   eerror 'root is forbidden'
	   exit 1
fi
 
# Gentoo Overlays
cd $OVERLAY_DIR
for repo in `ls -d */`
do
	   pushd $repo > /dev/null
	   einfo "Checking $repo overlay"
	   if [[ ! -z `grep git.overlays.gentoo.org .git/config` ]]; then
		      sed -i -e 's:git\://git.overlays.gentoo.org/:gentoo\::' .git/config
		      ewarn "gentoo git url corrected for $repo overlay"
	   fi
	   [[ -L ${GENTOO_REPO_DIR}${repo%/*} ]] || (ln -s /var/lib/layman/$repo ${GENTOO_REPO_DIR} && ewarn "New symlink for $repo overlay")
	   popd > /dev/null
done
 
# KDE Repositories
cd $DISTDIR/egit-src
for repo in `ls -d */`
do
	   pushd $repo > /dev/null
	   einfo "Checking $repo repository"
	   if [[ ! -z `grep anongit.kde.org .git/config` ]]; then
		      sed -i -e 's:git\://anongit.kde.org:kde\::' .git/config
		      ewarn "kde git url corrected for $repo"
	   fi
	   if [[ ! -z `grep kde: .git/config` ]]; then
		      [[ -L ${KDE_REPO_DIR}${repo%/*} ]] || (ln -s ${DISTDIR}/egit-src/$repo ${KDE_REPO_DIR} && ewarn "New symlink for $repo")
	   fi
	   popd > /dev/null
done

Last but not least, we need the kde overlay, to get the live ebuilds:

layman -f -a kde

For more information on this, take a look at the Gentoo KDE Guide

Usage

With the above configuration, we can use:

emerge -av =amarok-9999
create_repolinks

and get the amarok repository in our homedir, ready to patch it. As I said, in case we modified the code and tried to re-emerge the ebuild to get our patch in action, emerge will reset our repo to master again. Thus, we need to use the following variable:

EVCS_OFFLINE=1 emerge -av1 amarok

This will prevet the reset of the repo. In case we want to use a full live environment, we can even put that var in make.conf, but it is not recommended, better to use it in single emerge runs like the above.

That’s it. I plan to write a PyKDE UI for easy installation of the scripts, and maybe write a proper techbase article for it. Any feedback is appreciated.

Jan 13

Today I did:

  • 17 commits in portage tree
  • 8 commits and 1 proxy commit in kde overlay (one was reverted :( )
  • 1 commit in amarok repo
  • 1 commit in choqok repo
  • and wrangled about 40 bugs (most of them are now fixed, and most of the leftovers have pending fixes)

good night :)

=-=-=-=-=
Powered by Blogilo

Nov 02

A little introduction about the problem: When trying to build the embedded MySQL (and MariaDB) library, the build system produced a static linked instead of a shared library (libmysqld.a instead of libmysqld.so) which caused build failures (on 64bit systems only, it doesn’t affect 32bit) to all applications that depend on the shared library, most importantly Amarok. There was a dirty workaround for this though, export CFLAGS="-fPIC" before building MySQL and Amarok. This is very nasty though, as Robin explains, although most distros chose that way. The other option would be to disable the embedded feature from Amarok and force users to use an external MySQL instance instead. As a result, this led up to lots of argues, flames and yelling. After some time, three Gentoo Developers (Diego E. Petteno, Jorge Manuel B.S. Vicetto and Robin H. Johnson) managed to create a patch for MySQL 5.0 series that could produce a shared library, and while it was reported upstream, it got stuck somewhere in the middle and never made it to MySQL’s source code.

With the release of MySQL 5.1 we had to face the same problem, but it was twice as hard to deal with our users, as MySQL 5.1 got a fast stabilization because of security bugs, and the KDE Team suddenly got a million of complaints about a regression in Amarok. After some time, Maciej Mrozowski took the old patch over over and did a significant step in getting it ported to MySQL 5.1.51, creating a patch that while it creates a shared library it failed all tests. Out of the sudden, MariaDB developer Kristian Nielsen left a reply on our bug report that he committed a patch to MariaDB based on ours, and with his precious help on IRC we were able to have a working patch for MySQL and MariaDB as well, with the MySQL one reported upstream again. Let’s hope that this time it will be accepted, we don’t want to go through this again :) MariaDB will have the shared library patch in their next release,

In Gentoo land, MySQL 5.1.51 and Amarok 2.3.2-r1 will be stabilized soon (because of security bug 339717). The only blocker is bug 335995. Gentoo users can normally put dev-db/mysql-5.1.51 and media-sound/amarok-2.3.2-r1 in their /etc/portage/package.keywords file and enjoy the default embedded USE flag (by popular demand).

Bug reports:

Patches:

=-=-=-=-=
Powered by Blogilo

Mar 05

In the last KDE and Qt meetings, there have been many and important changes, so I decided to blog about them to keep users up-to-date. The summaries and logs are available in each project’s site (http://kde.gentoo.org and http://qt.gentoo.org). Both projects have regular meetings, every third Thursday of the month (unless announced otherwise), and very often they have a common one. The channel that hosts us is #gentoo-meetings in Freenode, and everyone is welcome to join us. I will mention only the most remarkable issues that were discussed/decided, which seem to be a lot:

Qt meeting, 19 February 2010

This was delayed one day, so I missed it. I really hate it when I miss Gentoo meetings, as every time they are very fun and challenging, and I like very much interacting with so many Gentoo developers and contributors at the same time. Before proceeding, I’d like to point out that the Qt Project was very recently founded as a separate project, because the Qt Team (sub-herd of the KDE Project) has grown too much and had too many non-KDE issues. The Qt members are doing an awesome work. And here are some of the important issues:

  1. We now have an "unofficial" channel in IRC, and a new shiny Qt Subdomain! So from now on you can find us in #gentoo-qt on Freenode, and our documentation resides in http://qt.gentoo.org (thanks to Robin (robbat2) for setting that up). Of course we will still be available in #gentoo-kde or #gentoo-desktop.
  2. Raster USE flag is going to be on by default. Μάρκος (hwoarang) already blogged about this asking for testing.
  3. Qt 3 has been masked for removal from the tree, along with all Qt 3 packages and the qt3 USE flag. The only blocker for this task was MythTV, which now has a stable Qt 4 replacement in Gentoo. Also, Ben (yngwin) informed the kde-sunset maintainers about this, but so far I didn’t see anyone committing those apps there, so if you want to do it (or do general qt3 and kde3 work), consult this document. (Reminder: kde-sunset is user-maintained overlay, anyone interested can ask for access there, so if you are still interested in Qt 3 and/or KDE 3 packages, please ask for commit access instead of complaining to the Gentoo developers).

KDE meeting, 25 February 2010

This was delayed one week, which was a request by me, so it won’t be during my exams. There hasn’t been a KDE meeting in January, so there were plenty of topics to discuss. I was also the moderator of this one, which made it double fun. In most of the issues there has been some progress, so let’s begin:

  1. We now have a new leader, Tomáš Chvátal aka scarabeus. After a year of Jorge Manuel B.S. Vicetto’s (jmbsvicetto) absolutely perfect leadership, we had the annual elections, were scarabeus was voted by pretty much everyone. He is admittedly very skilled and very active in Gentoo community in general, as a member of QA, X11 and KDE Teams and also a recent council member. I’d also like to give props to my former "boss" Jorge, especially for taking over that old nasty mysql/amarok issue and creating the libmysqld.so patch.
  2. KDE SC 4.3.5 is stable in tree now, and the newly released KDE SC 4.4.1 is available in tree as testing. There have been many problems with 4.4.0 (mostly crashes), so it won’t be a stable candidate for sure. We’ll see how 4.4.1 goes and accordingly decide if this is going to be a stable candidate, or wait for 4.4.2.
  3. Amarok and MySQL 5.1 suffer from the same old libmysqld.so issue. Thus, we strongly recommend to remove the embedded USE flag from both Amarok and MySQL. In fact, it is not anymore enabled by default in the ebuilds. As a side note about MySQL, Akonadi seems to break in some machines with >MySQL-5.1.42. The problem is known to upstream developers, and there have been some workarounds in KDE forum, but I didn’t have time to test any of them yet.
  4. KDEPIM in trunk KDE is currently broken (really just kmail). This is because kmail’s mail storage is being ported to akonadi, so IMAP (I don’t know about the other protocols for sure) doesn’t work at all at the moment. Sput (Quassel developer) proposed to use the enterprise KDEPIM branch, which is supposed to work, as it is being paid by companies. I sent an email asking for help in gentoo-desktop mailing list, with no answers so far. Please see the thread archive (available here) for more info. I would also like to inform you that the KDE Team decided not to provide the usual trunk snapshots until version 4.4.70 (which is going to be the first alphas), because of this KDEPIM issue.
  5. KOffice 2.1.1 is released a month ago, but it is not available to users yet. Actually, it is in tree hardmasked, as it needs a close depedency checking in ebuilds. I was held responsible for this, and I hope till the weekend it will be done, if I get enough help from scarabeus which was the former KOffice ebuilds maintainer, or by anyone else from the KDE Team (there are plenty of people in the Team, I’m sure I’ll find someone to help me). By the way, this is my only KDE todo thing left.
  6. KNetworkManager is now in tree, but also hardmasked. This was in upstream’s kdereview branch, which contains packages that stay there for review by the developers for wider testing, before they move to their final KDE module or extragear branch (take a look at KDE’s SVN repo to get the picture). It was supposed to be released along with KDE 4.4, but it didn’t make it. So, I created a snapshot of the current SVN repository, which seems to have many problems, like crashes, missing features etc. So I guess it will remain hardmasked for a while, and I will continue to update the snapshot once every two weeks.
  7. The KDE Documentation is also one of my playgrounds. I recently updated the guide, and with a quick look I did the following: closed all three bugs regarding the KDE Installation Guide, added more items in Hints and Troubleshooting section, completely removed the kdeprefix reference, replaced the snapshots installation guide with a note that we won’t provide them for now, and done a bunch of small fixes (mostly version corrections and typos).
  8. I raised the issue of kde-meta (and accordingly @kde-* sets) not including all KDE modules. It currently excludes the developer-specific modules like KDESDK and KDEbindings (although it does contain KDEWebDev), and proposed either to include them all in kde-meta or to introduce a developer or sdk USE flag in kde-meta. Some developers were opposed on this, proposing to have a new meta package, like kdefull-meta, an idea which I actually hated. Our final word on this was to open a new discussion thread in gentoo-desktop mailing list, which I did, and review the issue in the next meeting.
  9. Finally, I’d like the attention of everybody here, as the following issue is very very important. In a previous meeting we discussed the split of the desktop profile in gnome/ and kde/ subprofiles. We raised the idea in gentoo-dev mailing list for review, and we had a positive feedback in general. Other DE’s refused to have a special subprofile, so they will stick to the basic desktop profile. What this means is that the desktop profile from now on will not contain GNOME or KDE-specific USE flags, which are transfered to the according subprofile. For users that want both DE’s (or just both DE-specific USE flags) can enable them manually in their make.conf (they are not many after all). The major advantage from the user-side of view is that many unwanted dependencies get stripped off automatically, and from the developer-side of view is that from now on we’ll have a more separate approach when packaging. The patches are ready and sent for review in gentoo-dev mailing list. Currently the result can be seen in the kde-crazy overlay, and here you can see the relevant thread. A news item will also be made before committing, and I hope that the final move will happen next week. I’d like to thank Maciej (reavertm), Ben (yngwin) and Samuli (ssuominen) for their precious help on this. (P.S. This is one of the very few moments that I felt I did some Gentoo development instead of KDE packaging, if you know what I mean :) )

Qt Team meeting Log and Summary
KDE Team meeting Log and Summary

=-=-=-=-=
Powered by Blogilo