Tuesday, October 4, 2011

Updated Spotify ebuild (0.6.1.309)

Earlier I posted an ebuild to Spotify (for the package manager in Gentoo called Portage). Here is a newer version of that ebuild. Like the last time, put it in a file called spotify-0.6.1.309.ebuild inside your local repository (like /usr/local/portage/media-sound/spotify/)

# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

DESCRIPTION="Spotify desktop client"
HOMEPAGE="http://www.spotify.com/"

LICENSE="Spotify"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="gnome"

MY_PV="${PV}.gb871a7d-1"
MY_P="${PN}-client-qt_${MY_PV}"

SRC_BASE="http://repository.spotify.com/pool/non-free/${PN:0:1}/${PN}/"
SRC_URI="
    x86?   ( ${SRC_BASE}${MY_P}_i386.deb )
    amd64? ( ${SRC_BASE}${MY_P}_amd64.deb )
"

RDEPEND="
    gnome? ( >=gnome-base/gconf-2.12 )
    >=sys-libs/glibc-2.6
    >=media-libs/alsa-lib-1.0.14
    >=x11-libs/qt-core-4.5
    >=x11-libs/qt-dbus-4.5
    >=x11-libs/qt-gui-4.5
    >=x11-libs/qt-webkit-4.5
    >=sys-devel/gcc-4.0
    sys-apps/usbutils
    "

RESTRICT="mirror strip"

src_unpack() {
    for MY_A in ${A}; do
        unpack ${MY_A}
        unpack ./data.tar.gz
    done
}

src_install() {
    mv "${WORKDIR}"/usr "${D}" || die "Install failed"
}
Update: Remove gnome-support since Spotify states this is broken and will be removed in the future.
Update2: This ebuild does NOT work on Gentoo (~amd64) right now since there is a dependency on libssl-0.9.8, and we are currently using v1.0. Hopefully this will be solved somehow. I'll remove this update when it is.

Friday, February 11, 2011

Locked svn repository and you can't unlock or clean?

I discovered that I couldn't update my subversion repository, nor could I commit, revert or even run cleanup on it! The error I got was
"Working copy is locked, run cleanup on it to remove locks"
I was wondering what the hell had happened since I hadn't locked any files on purpose. 'svn unlock --force' didn't do the job so I had to try cleanup. But when running cleanup all I got was
"svn cleanup: can't find .svn/tmp/log. "
It seems to stem from some version problem, and all that is really needed is to create a .svn/tmp directory by hand. By running a little command on the shell, we fix the problem within seconds.

find . -iname '.svn' -exec mkdir {}/tmp \;

After creating all the '/tmp' dirs, just run 'svn cleanup' again, and it should be ok for an update or a commit.

Thanks to Kyle Cordes for the fix.

Tuesday, February 8, 2011

Speeding up your secure file-transfer by using tar and ssh

Normally when transferring files between computers, one would use 'scp', and for a directory 'scp -cr'. The problem with this is that scp creates a connection for each file when transferring it, and this adds a lot of overhead.

To speed up the transfer of many small files, it is better to use the beloved Unix pipe, together with tar (the archiving software) and SSH (Secure SHell). What we do is 'tarball' all these files and directories, compress them if we would like to, and pipe the result to ssh, which on the other computer either puts them in a (compressed) tarball or untar it back into its original directory structure.

To decrease the use of bandwidth, we also set tar to filter the output through gzip, a compression program. This is done using the '-z' flag. The other two flags we use is '-c' and '-f' which means 'create archive' and which file to create (in our case '-' which means stdout) respectively.
Tar usually uses stdout if nothing else is specified, so we could actually skip the last flag.

Using scp, it would look something like this:
scp -rc directory/ user@host:~/

But with tar and ssh, we instead write it like:
tar -zcf - directory/ | ssh user@host "tar zxvf -"

I have created a directory on the receiving host called 'backup', so I want to put it into that directory instead:
tar -zcf - directory/ | ssh user@host "tar zxvf - -C backup/"

or if we remove the '-f' flag with its corresponding argument:
tar -zc directory/ | ssh user@host "tar zxv -C backup/"

I tried using bzip2 as a filter as well, but it seems to have a tendency to be too cpu-heavy in comparison to its improved compression ratio. But this depends on the amount of available bandwidth.

I found some comparisons at http://smaftoul.wordpress.com/2008/08/19/ssh-scp-little-files-and-tar/, which saw an 19x transfer time improvement when transferring a 109 Mb large directory containing 9992 files. This is definitely worth a little command line magic!

Thursday, January 6, 2011

Native Spotify ebuild for Gentoo

You also love Spotify? Well, it truly is the best thing since the Interwebs, that's for sure!

A lot of Linux users don't know that the wonderful developers over at Spotify are actually releasing early beta builds of their native Linux client. It's not perfect, but for being early-releases it's damn near close! You just have to love those guys...

Anyway, here's an ebuild I've completely stolen from dstien a couple of months ago, and then updated to new versions as they've come out. I've added the Pulseaudio dependency (dstien doesn't seen to have done that yet) since the previous version didn't work without it).

Ebuild:
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

DESCRIPTION="Spotify desktop client"
HOMEPAGE="http://www.spotify.com/"

LICENSE="Spotify"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="gnome"

MY_PV="${PV}.g604b4fb-1"
MY_P="${PN}-client-qt_${MY_PV}"

SRC_BASE="http://repository.spotify.com/pool/non-free/${PN:0:1}/${PN}/"
SRC_URI="
    x86?   ( ${SRC_BASE}${MY_P}_i386.deb )
    amd64? ( ${SRC_BASE}${MY_P}_amd64.deb )
    gnome? ( ${SRC_BASE}${PN}-client-gnome-support_${MY_PV}_all.deb )
    "

RDEPEND="
    >=media-libs/alsa-lib-1.0.14
    >=media-sound/pulseaudio-0.9.21
    >=sys-devel/gcc-4.0
    >=sys-libs/glibc-2.6
    >=x11-libs/qt-core-4.5
    >=x11-libs/qt-dbus-4.5
    >=x11-libs/qt-gui-4.5
    >=x11-libs/qt-webkit-4.5
    "

RESTRICT="mirror strip"

src_unpack() {
    for MY_A in ${A}; do
        unpack ${MY_A}
        unpack ./data.tar.gz
    done
}

src_install() {
    mv "${WORKDIR}"/usr "${D}" || die "Install failed"
}
Just copy this into an empty file within your portage overlay (for example /usr/local/portage/) in the media-sound directary, go into the directory and run

> ebuild spotify-0.4.9.302.ebuild digest

and then you're ready to go! Should be at least ;)