Xupeng's blog

圆外之大,心向往之

LFS时Fontconfig 2.3.2的编译错误和解决方法

LFS还算很顺利,现在已经进入到BLFS之Xorg7.0阶段,呵呵

编译Fontconfig2.3.2时出错了,提示找不到jw解析器:
/bin/sh ../libtool --mode=link gcc  -g -O2   -o fc-cache
fc-cache.o ../src/libfontconfig.la
mkdir .libs
gcc -g -O2 -o .libs/fc-cache fc-cache.o ../src/.libs/libfontconfig.so
creating fc-cache
rm -f fc-cache.1
docbook2man ../fc-cache/fc-cache.sgml
jw: No parser available
make[2]: *** [fc-cache.1] Error 6
无可奈何,不过在LFS的邮件列表中已经有人解决了这个问题:
before you begin, rename the docbook2html to docbook2html.---
mv /usr/bin/docbook2html /usr/bin/docbook2html.--
once all done, rename it back again !
mv /usr/bin/docbook2html.--- /usr/bin/docbook2html
没什么技术含量,做下记录吧。

wxGTK引发的些案

我的gentoo最近有些不听话,有好些个应用程序都不能用了:amule、xchm等。revdep-rebuild的时候发现少了很多的库,大概是因为最近几次更新系统都没有revdep-rebuild吧,系统有些凌乱了。

revdep-build并不能解决问题,因为这根本就没有办法运行下去,第一个软件包amule的重新编译就遇到了问题:
!!! set-wxconfig: Error: Can’t find normal or debug version:
!!! set-wxconfig: /usr/lib/wx/config/gtk2-unicode-release-2.6 not found
!!! set-wxconfig: /usr/lib/wx/config/gtk2-unicode-debug-2.6 not found
!!! You need to emerge wxGTK with unicode in your USE


按照错误提示,似乎是因为我编译wxGTK时没有使用unicode这个USE?不对啊,从equery u wxGTK的输出来看,我使用了这个USE,那为什么它还告诉我说要使用unicode呢?哦,这个只是它的建议而已,再看上面的错误信息:
找不到gtk2-unicode-release-2.6,看一下,/usr/lib/wx/config下的确没有这样的文件,这个应该是编译wxGTK的时候缺少了什么USE导致的,但不是unicode,因为我的确使用了unicode。

google的结果并没有为我提供可用的信息,还是自己动手吧,丰衣足食:)

vi /usr/portage/x11-libs/wxGTK/wxGTK-2.6.3.3.ebuild,仔细看了看这个ebuild,我找到了这样的一段代码:
pkg_setup() {
    if use X; then
        einfo “To install only wxbase (non-gui libs) use USE=-X”
    else
        einfo “To install GUI libraries, in addition to wxbase, use USE=X”
    fi
}
再仔细看看equery u wxGTK的输出,哦,居然没有X这个USE,问题大概就是在这里了,USE=”X” emerge wxGTK,漫长的等待之后,ok,amule等问题程序编译通过了,问题得到圆满的解决。

列出子类的新方法

刚才在python邮件列表中看到有人提出这样的一个问题:
I am writing a library in which I need to find the names of methods
which are implemented in a class, rather than inherited from another
class. To explain more, and to find if there is another way of doing
it, here is what I want to do: I am defining two classes, say A and B,
as:

class A(object):
   def list_cmds(self):
       ’implementation needed’
       ?
   def __init__(self):
   … (rest of class)

class B(A):
   def cmd1(self, args):
       pass
   def cmd2(self, args):
       pass

I need an implementation of list_cmds in A above so that I can get a
result:

>>> b=B()
>>> b.list_cmds()
['cmd1','cmd2']                    #order not important

I will be happy if anybody can point to me any way of doing it, using
class attributes, metaclasses or otherwise. What I don’t want to do is
modifying class B, which contains just the cmds, if possible.
想了一下我使用下面的代码完成了他所需要的功能:
#!/usr/bin/python
#filename: p.y

class A(object):
    def listcmds(self):
        allInChild = dir(self)
        allInParent = dir(A)

        allOnlyInChild = []
        for att in allInChild:
            if att not in allInParent:
                allOnlyInChild.append(att)

        return allOnlyInChild

    def __init__(self):
        pass

class B(A):
    def m1(self):
        pass

    def m2(self):
        pass
b = B()
print b.listcmds()
功能是实现了,就是不知道方法是不是笨了点。等我把邮件发出去发现在几分钟前也有人回复了这个邮件,其中一个解决方案和我的几乎是一个样的,也没有出现更高明的方法,看来我的想法还是有可取之处的,不早了,早上起来再看看有没有人给出更好的方案。

把gnome升级到2.16的一个参考方案

昨天参考了网上一份升级gnome到2.14的文档,把gnome从2.14升级到了2.16,方法也很简单,我写的比较简略,需要更详细的介绍和解释,可以参考原文档(http://gentoo-wiki.com/HOWTO_Update_to_GNOME_unstable):

gnome2.16 9月6号才进入portgae吧,首先要更新一下portage:
代码:
emerge --sync
先把gnome2.16相关的包给unmask了:
代码:
sed -n '/# New GNOME 2.16 gtk# components/,/# End GNOME 2.16 mask/p' /usr/portage/profiles/package.mask >> /etc/portage/package.unmask
把这些包加入/etc/portage/package.keywords中:
代码:
sed -n '/# New GNOME 2.16 gtk# components/,/# End GNOME 2.16 mask/p' /usr/portage/profiles/package.mask |awk '{ print $1 " ~x86" }' >> /etc/portage/package.keywords
把gnome依赖的包也加入到keywords中:
代码:
ACCEPT_KEYWORDS="~x86" emerge -p =gnome-base/gnome-2.16* | grep \[ebuild |awk '{ print $4 }' | sed -e 's/^/~/' -e 's/-r[0-9]{1,2}//' |uniq -u | sort >>/etc/portage/package.keywords
最后,升级gnome:
代码:
emerge -DuN gnome

注:要把~x86替换为与你的平台相对应的关键字