Posts

How to ssh-add in cron job

EDIT: updated link in this article.

ssh-add can let your ssh-agent remember the passphrase of your ssh
secret key, so that you don't need to type any password when loging
into a remote machine.
However, it is an interactive program, you can't call it in a cron
job. Even if you can, you will expose your passphrase in a file, which
is not safe.The solution is actually very easy. You don't really need to ssh-add.
All you need to do is letting ssh know some environment variable.First of all, I recommend you set up ssh-agent forwarding with GNU
screen following instruction here:
http://www.deadman.org/sshscreen.php
Then in your cron job script, source ${HOME}/bin/fixssh first.
Done!Enjoy ;)

2008.0 Simplified Chinese handbook all finished

http://www.gentoo-cn.org/trads/
http://www.gentoo-cn.org/doc/zh_cn/handbook/draft/
http://www.gentoo-cn.org/doc/zh_cn/handbook/2008.0/
http://www.gentoo-cn.org/gitweb/?p=gentoo-cn;a=shortlogNot too much work to do actually.
First I copied current handbook and 2007.0 networkless handbook.
Then wrote a little script to update version number and date and
change all occurrences of 2007.0 to 2008.0 automatically.
Then made a diff between old and new English handbook.
Then modify old handbook according to the diff of English version.
Done ;)

The new Simplified Chinese doc translation page is ready

I put it on my gentoo-cn.org:
http://www.gentoo-cn.org/trads

I have done some modification to neysx's trads script. And I have written a new perl script which could generate a totally new trads.xml (think it like a config file to trads) from scratch. I am using git as version control software. The gitweb page is here:
http://www.gentoo-cn.org/gitweb/?p=trads;a=summary

The gen_trads_xml.pl script is here:
http://www.gentoo-cn.org/gitweb/?p=trads;a=tree;f=xml

Shiny new Simplified Chinese doc translation list

First of all, thanks to neysx and his excellent tool. Also thanks to Simone Li for translating the original French template to English.

Actually, it is not finished yet. I have to finish translating the page to Chinese, then write a script to auto update trads.xml which records the priority, translated version, current version of each doc.

Anyway if you want to take a preview, the URL is here:
http://dev.gentoo.org/~r0bertz/trads-zh_cn.xml

Notice: don't be fooled, :) Although the current list on the above page is almost empty, we have actually translated a lot of docs into Chinese, especially the whole handbook, ;) So, check it out:
http://www.gentoo.org/doc/zh_cn/list.xml

A live binutils ebuild

I have written a live binutils ebuild.
It is now in my loongson overlay.
I wrote it because binutils cvs already got loongson 2e and 2f support, but new version is not released yet.
The ebuild itself is quite simple, thanks to cvs.eclass and toolchain.eclass.
However, in order to make it really work, I have to modify cvs.eclass.
The reason is:
The checked out directory name of binutils is called "src". While cvs.eclass expects the checked out directory name is the same as the package name, i.e. "binutils". Unfortunately, "co -d binutils binutils" doesn't work. If I use "co -d binutils binutils", I can only checked out the "binutils" directory, while the actual binutils module contains more than that.

So, the most straight forward way to solve this would be to "mv src binutils" after checking it out, and this was exactly what I did.

I need a new variable name to hold "src". I call it ECVS_CO_DIR.

Some other things to pay …

Share /usr/portage via NFS

Recently I have tried sharing /usr/portage among several boxes via NFS after I've read http://www.gentoo.org/proj/en/portage/doc/faq.xml.
I followed portage's manpage, created /etc/portage/modules on nfs client
$ cat /etc/portage/modules
portdbapi.auxdbmodule = cache.metadata_overlay.database
And removed all cache files under /var/cache/edb/dep/usr/portage
So that I don't need to run emerge --metadata on nfs client after emerge --sync.

It is not over yet for eix users. If you have a $HOME/.eixrc and defines in it PORTDIR_CACHE_METHOD as something like "portage-2.1"/"cdb"/"sqlite"(check man eix), you may want to remove the ~/.eixrc file. Since those methods requires you to run emerge --metadata before update-eix, and thus defeat our purpose in the first place.

Some progress on Loongson

The Qt-3.3.8-r4 linking problem is solved. The problem is caused by a bug in binutils which has already been fixed. I have already put an live ebuild for binutils in my loongson overlay.

Loongson already got binutils' support. Please check the links below:
1. http://sourceware.org/ml/binutils/2007-11/msg00227.html
2. http://sourceware.org/ml/binutils/2007-11/msg00232.html

Loongson's gcc support which is also developed by codesourcery is coming on the way, maybe in the next couple of month. Gcc is "in Stage 3 at the moment, which essentially amounts to regression fixes only, so the patches can't be committed yet". They will submit the patch to gcc when gcc comes to stage 1 again. In the meantime, we (some audacious guys from lemote.com's forum) have made our own gcc patch, which is already available on my overlay. Honestly, I don't think our patch would be as elegant as codesourcery's. After all, they make a living by making such patches. But we can cat…

Be aware that both cscope and make honor $SOURCEDIRS

Emerging media-sound/cdparanoia failed lately on my box when I was running "sudo emerge...".
The error was that an archive file was missing.
However, I didn't find any bug report related to that on bug.g.o.
So, I decided to take a look myself. I found that if I emerged it using root user, then everything was ok. So, I suspected this might have something to do with my environment setting, coz I don't reset env for users in wheel group(so that I can "USE=... sudo emerge").
I ran ebuild unpack/install/compile/install separately using normal user and root to determine which stage caused the difference. Finally, I found the difference happened when "make"ing in the paranoia directory. An target called "lib" defines the rule to build that archive file. The lib is not a real file, however it is not labeled as PHONY. Apparently, the target is not run. But why?
I straced make as normal user. I found something strange. The strange thing was make lo…

the myths about stardict-3.0.1's text-to-speech feature

stardict-3 is now available via gentoo-china overlay. (I wish I could pass ebuild quiz soon and become stardict's maintainer in gentoo...)
stardict-3 has got tts feature. It could use festival or espeak to play an arbitrary sequence of characters.
There are two ways to use this feature. One way is via tts plugin, one for each tts engine. In fact, tts plugin does more than that - it could set the voice of its corresponding tts engine as well. The other way is to specify the command to play yourself, and there are two options which you can choose from, "echo %s | festival --tts" and "espeak %s".
My experience is the first way has priority over the latter one.
My suggestion is to use the latter one. Because tts plugin's functionality is redundant. You can choose tts engine's voices anyway. And you can use tts engine without them. Moreover, the festival plugin will segfault the program[1]. So, IMHO, the tts plugins are dispensable. So in my stardict-3.0.1-r2.eb…

failed to build qt-3.3.8-r4 on loongson

Haven't solve it yet.
I have already tried to add -mxgot to CFLAGS and CXXFLAGS. But it didn't work for me.
Some useful link:
http://cygwin.com/ml/binutils/2003-04/msg00258.html
http://gcc.gnu.org/ml/java/2004-10/msg00018.html
http://www.cygwin.com/ml/binutils/2006-04/msg00006.html

Fixed a bug in xml2po

http://bugzilla.gnome.org/show_bug.cgi?id=437371#c4

The condition to trigger the bug is that opening tag or the content of the tag contains non-ascii chars. e.g:
<title>Quotes are for weak people, strong people have their own opinions
- Dawid Węgliński (cla)</title>
<body>
<figure link="/images/gwn/20070917_cla.jpg"
short="cla" caption="Dawid Węgliński, aka cla"/>
The symptom is:
Stack trace:
Traceback (most recent call last):
File "xml2po.py", line 856, in ?
doSerialize(doc)
File "xml2po.py", line 589, in doSerialize
outtxt += doSerialize(child)
File "xml2po.py", line 583, in doSerialize
(starttag, content, endtag, translation) = processElementTag(node, repl, 1)
File "xml2po.py", line 525, in processElementTag
translation = translation.replace('' % (i), replacement)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
635: ordinal not in range(128)

official Simplified Chinese doc translation team lead

I have passed doc quiz, :)
Now I can commit docs direclty.

The following is what neysx sent to me.

--
Zhang Le wrote:
> Hi, neysx!
>
> Please find my quiz answer and fix-me.xml in the attachment.

Not perfect, but good enough :)
You're now in charge of /doc/zh_cn/


Cheers,
--
/ Xavier Neys
\_ Gentoo Documentation Project
/
/\ http://www.gentoo.org/doc/en/

Pulseaudio-0.96 on MIPS

Pulseaudio depends on libatomic_ops. However, libatomic_ops don't have support for mips.
I've created a patch for mips, though only work on 32bit userland. Get it here.

Pulseaudio now compiled and installed on my loongson box. Can't use it to play though. The following is some detailed info, if you are interested in.

My setup is to use alsa's pulse plugin.
I tried aplay, for example:
$ aplay /usr/share/sounds/alsa/Front_Right.wav
aplay: pulsecore/mutex-posix.c:75: pa_mutex_lock: Assertion `_r == 0' failed.
AbortedBefore this assertion failed, aplay is stuck on a futex system call.
connect(7, {sa_family=AF_FILE, path="/var/run/pulse/native"}, 110) = 0
send(6, "W", 1, MSG_NOSIGNAL) = -1 ENOTSOCK (Socket operation on non-socket)
write(6, "W", 1) = 1
gettimeofday({1187375795, 973686}, NULL) = 0
write(6, "W", 1) = 1
futex(0x45dd1c, FUTEX_WAIT, 1, NULL