Since 2014-09-29 suddenly multiple -9999 ebuilds from ::kde started to fail when trying to fetch via git. The result looks like this: >>> Unpacking source... * Fetching git://anongit.kde.org/plasma-workspace ... git fetch git://anongit.kde.org/plasma-workspace +HEAD:refs/git-r3/HEAD * ERROR: kde-base/plasma-workspace-9999::kde failed (unpack phase): * Unable to find a matching branch for remote HEAD (344a005f12fd914534471fdce8cb6ad3247d88ab) * * Call stack: * ebuild.sh, line 93: Called src_unpack * environment, line 4045: Called kde5_src_unpack * environment, line 3178: Called git-r3_src_unpack * environment, line 2711: Called git-r3_src_fetch * environment, line 2705: Called git-r3_fetch * environment, line 2610: Called _git-r3_find_head 'refs/git-r3/HEAD' * environment, line 762: Called die * The specific snippet of code: * die "Unable to find a matching branch for remote HEAD (${head_hash})"; First I thought this was caused by either the recent bash or git updates, but I was able to reproduce this issue with the older versions of both of them. Wiping /usr/portage/distfiles/git3-src/${P}.git doesn't help either. Packages where you should be able to currently reproduce this issue: kde-frameworks/kwidgetsaddons-9999:5/9999::kde kde-frameworks/kdoctools-9999:5/9999::kde kde-frameworks/kconfigwidgets-9999:5/9999::kde kde-frameworks/solid-9999:5/9999::kde kde-base/breeze-9999:5/5::kde kde-frameworks/ktexteditor-9999:5/9999::kde kde-frameworks/plasma-9999:5/9999::kde kde-base/baloo-9999:5/5::kde kde-base/gwenview-9999:5/5::kde kde-base/plasma-desktop-9999:5/5::kde emerge --info: Portage 2.2.14_rc1 (python 2.7.7-final-0, default/linux/amd64/13.0/desktop, gcc-4.8.3, glibc-2.19-r1, 3.16.3-gentoo x86_64) ================================================================= System uname: Linux-3.16.3-gentoo-x86_64-Intel-R-_Core-TM-_i7-3537U_CPU_@_2.00GHz-with-gentoo-2.2 KiB Mem: 8034652 total, 344620 free KiB Swap: 1535996 total, 619092 free Timestamp of tree: Tue, 30 Sep 2014 17:30:02 +0000 ld GNU ld (GNU Binutils) 2.23.2 ccache version 3.1.9 [enabled] app-shells/bash: 4.2_p45::eliasp dev-java/java-config: 2.2.0 dev-lang/python: 2.7.7, 3.3.5-r1, 3.4.1 dev-util/ccache: 3.1.9-r3 dev-util/cmake: 2.8.12.2-r1::kde dev-util/pkgconfig: 0.28-r2 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.12.4 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.13, 2.69 sys-devel/automake: 1.11.6, 1.12.6, 1.13.4 sys-devel/binutils: 2.23.2 sys-devel/gcc: 4.8.3 sys-devel/gcc-config: 1.7.3 sys-devel/libtool: 2.4.2-r1 sys-devel/make: 3.82-r4 sys-kernel/linux-headers: 3.14 (virtual/os-headers) sys-libs/glibc: 2.19-r1 Repositories: gentoo eliasp eliasp-public gamerlay perl-experimental multimedia sunrise benf kde docker qt x11 mozilla Installed sets: @allback, @gpxsync, @kde-applications-live, @kde-next-live, @otrs ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=core2 -O2 -pipe -ggdb" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-march=core2 -O2 -pipe -ggdb" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--jobs=2 --keep-going --load-average=2.5" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs ccache collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userpriv usersandbox usersync" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://de-mirror.org/distro/gentoo/ http://mirror.netcologne.de/gentoo/ http://mirror.switch.ch/ftp/mirror/gentoo/" LANG="en_US.utf8" LC_ALL="C" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/var/lib/layman/eliasp /var/lib/layman/eliasp-public /var/lib/layman/gamerlay /var/lib/layman/perl-experimental /var/lib/layman/multimedia /var/lib/layman/sunrise /var/lib/layman/benf /var/lib/layman/kde /var/lib/layman/docker /var/lib/layman/qt /var/lib/layman/x11 /var/lib/layman/mozilla" USE="X a52 aac acl acpi alsa amd64 apache2 audiofile avahi berkdb bluetooth branding bzip2 cairo cdda cdparanoia cli cracklib crypt css cups cxx dbus dri dts dvd dvdr emboss encode exif fastcgi ffmpeg fftw firefox flac gdbm gif git glamor glib gnutls gs gstreamer gtk gtk3 handbook hdri iconv icu imagemagick imap inotify ipv6 jabber jpeg jpeg2k kde kdeprefix kerberos kipi kms lame lcms ldap libnotify libsamplerate lzma mac mad matroska mmap mmx mng modules mp3 mp4 mpeg mplayer multilib musicbrainz mysql ncurses networkmanager nls nptl nsplugin ogg opengl opus pam pango pcre pdf perl plasma png policykit postgres ppds private-headers pulseaudio python qt qt3support qt4 qt5 rdesktop readline rss ruby samba sdl semantic-desktop session smp spell spice sqlite sse sse2 ssl startup-notification subversion svg systemd taglib tcpd theora tiff truetype udev udisks unicode upnp upower usb v4l2 vaapi vcd vim-syntax vnc vorbis wayland wmf wxwidgets x264 xcb xcomposite xinerama xml xv xvid xvmc zeroconf zip zlib zsh-completion" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi sheets" CAMERAS="*" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="plymouth caps systemd" ELIBC="glibc" ENLIGHTENMENT_MODULES="backlight battery clock comp conf-applications conf-dialogs conf-display conf-edgebindings conf-interaction conf-intl conf-keybindings conf-menus conf-paths conf-performance conf-randr conf-shelves conf-theme conf-window-manipulation conf-window-remembers cpufreq dropshadow everything fileman fileman-opinfo gadman ibar ibox illume2 mixer msgbus notification pager quickaccess start syscon systray tasks temperature tiling winlist wizard xkbswitch" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en de" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" QEMU_SOFTMMU_TARGETS="x86_64 i386" QEMU_USER_TARGETS="x86_64 i386" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="intel vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON
The problem was caused by out-of-sync KDE anongit mirrors, as the actual server used for different git operations within git-r3.eclass is not always the same. As it's still something which needs to be handled differently in git-r3.eclass, I'll leave this bug open for now.
So let me shed some light on what's happening. In a bare git repo, 'HEAD' is a ref that points to the default branch in the repository. That's usually 'master' but not always, and it change during repo's lifetime (e.g. on github you've got 'default branch' option to control that). It's a symbolic ref -- that is, it names another branch (like symlink) rather than a commit. This way, it is always in-sync with that branch without any special effort. Now, plain 'git clone' attempts to clone the default branch. For this reason, it requests HEAD and tries to find out which branch that was. How -- it depends on the particular transport. Some transports support querying symbolic ref target directly, and in this case it gets the branch name straight. For other transports, it iterates over all branches and tries to find one with the commit fitting HEAD on top of it. Git does that over a single connection. Sadly, we can't do the same easily. As far as I'm aware, there's no explicit command to request remote symbolic ref over transport that supports it -- that is, that feature is kept internal. That's why we do the other thing and iterate over all remote branches. However, we can't do that over a single connection -- we call 'git fetch' and 'git ls-remote' separately, and that's why it happens to you. To be honest, this is quite ugly. And in fact, there's no strong reason to do this at all. Right now, it allows us to map the fetched HEAD into a real branch and make HEAD a symbolic ref to it. It's pretty but I don't think it's all that important. I think that it can make a difference in two cases: 1. when you switch from empty EGIT_BRANCH to the default branch -- without that, the eclass might refetch the whole branch rather than reusing what was fetched before, 2. when the default branch changes -- the eclass will try to force update old HEAD to the new branch, while normally it would use a clean new branch for that. So I think the simplest solution would be to drop the extra code, and just fetch HEAD into dedicated refs/git-r3/HEAD, and leave it like this.
Created attachment 386010 [details, diff] Proposed patch (I've sent it to the ml for review as well)
anongit.kde.org provoked this problem again. Was the review successful?
Well, I didn't get any clear response and I forgot about it. Could you test the patch yourself, please?
Ping. Any testing?
commit 0b92ce7546729284ffdca21d5e6b1658b187b870 Author: Michał Górny <mgorny@gentoo.org> AuthorDate: Fri Oct 3 23:19:39 2014 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: Thu May 26 10:58:08 2016 git-r3.eclass: Remove unnecessary HEAD->branch mapping code, #524146 Remove the code responsible for recognizing which branch HEAD pointed out to since it was unsafe and unnecessarily complex. A proper match is not really necessary since all operations can be safely performed on an opaque 'HEAD' (or rather refs/git-r3/HEAD since fetching to HEAD directly breaks git a bit).