Portage学习记录[原创]

http://www.gentoo.org/proj/en/desktop/
http://www.gentooportage.info/
引用zhllg
不是随便一个变量就是USE EXPAND变量
/usr/portage/profiles/base/make.defaults:USE_EXPAND="APACHE2_MODULES APACHE2_MPMS FOO2ZJS_DEVICES MISDN_CARDS FRITZCAPI_CARDS FCDSL_CARDS VIDEO_CARDS DVB_CARDS LIRC_DEVICES INPUT_DEVICES LINGUAS USERLAND KERNEL ELIBC CROSSCOMPILE_OPTS ALSA_CARDS ALSA_PCM_PLUGINS LCD_DEVICES CAMERAS"

http://devmanual.gentoo.org/
中文版必看 http://man.ddvip.com/linux/gentoo/gentoo_dev/hb_part2_chap1.html

S="${WORKDIR}/${PN}${PV}"              当下载文件不等于 ${PN}-${PV} 格式时有用
if has sandbox ${FEATURES} ; then
SRC_URI="mirror://sourceforge/${PN}/${P}-doc.zip"  很灵活的应对 sourceforget
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz
mirror://sourceforge/${PN}/bkhive-${BKHIVE_VER}.tar.gz
mirror://sourceforge/${PN}/samdump2-${SAMDUMP_VER}.tar.gz
!ophsmall? ( http://lasecwww.epfl.ch/SSTIC04-5k.zip )
ophsmall? ( http://lasecwww.epfl.ch/SSTIC04-10k.zip )"



SRC_URI="http://goodies.xfce.org/releases/${PN}/${P}${COMPRESS}"  其中 ${COMPRESS} 和
RDEPEND="              >=xfce-base/libxfcegui4-${XFCE_MASTER_VERSION}
            >=xfce-base/libxfce4util-${XFCE_MASTER_VERSION}"
${XFCE_MASTER_VERSION}  这个变量也用得好 不过,全是在xfce44.eclass中定义的,所以不能抄来用喔

dodir 这个玩意终于找到了,原来在 /usr/lib/portage/bin
查找方法是 qlist portage 发现里面有很多变量或者函数都放在这里
cd $(dirname $(qlist portage|grep dodir))


qgrep -H "epatch()" 倒能找到
今天发现gentoo-china里的media-fonts/wqy-zenhei 里面
SRC_URI="mirror://sourceforge/wqy/${P}-${PR/r/}.tar.gz"  -->> 就能把-r0 -->> 0 不解,也许是shell的功能吧
,自己写了shell测试完发现是shell的功能,看来要加强SHELL学习才行

PKG_SUFFIX=""

if [[ ${P/_pre} == ${P} ]]; then
MY_P="${P/_/-}"

if [[ ${P/_rc} == ${P} ]]; then
 SRC_URI="mirror://kde/stable/amarok/${PV}/src/${MY_P}.tar.bz2"
 S="${WORKDIR}/${P/_/-}"
else
 SRC_URI="mirror://gentoo/${MY_P}.tar.bz2"
 S="${WORKDIR}/${P/_rc*}"
fi
else
SRC_URI="mirror://gentoo/${P}.tar.bz2"
fi

26 RESTRICT="strip binchecks" 这个要查一下,为啥没有 mirror也行,难道是查找不到官方的话会自动根据SRC_URI="mirror: 来查找境像?        答: 凡在自己overlay里面的全都在RESTRICT加mirror

在这个 http://www.qsor.pl/files/dynamips_cisco_7200_ebuild_gentoo/dynamips-0.2.5.ebuild 里面
FEATURES="nostrip" 可以特定这种方式? 之前 FEATURES="-sandbox"无效,非得 FEATURES=-sandbox emerge foo
如果能在ebuild里面就能控制它的特性的话就很灵活了,但问题来了,这个变量按理说是控制emerge的行为,
qgrep -H FEATURES 查找发现大部分都是在查询而已,类似以下的情况
if hasq userpriv ${FEATURES} ; then


       # NEED_KDE=":${SLOT}"
       :kde-4)
               _kdedir="4.0"

               _pv="${NEED_KDE}"

               ;;

       # NEED_KDE="${PV}:${SLOT}"

       *:kde-4)

               _kdedir="4.0"

               _operator=">="

               _pv="-${NEED_KDE}"

               ;;

       3.9*)

               _kdedir="3.9"

               _operator=">="

               _pv="-${NEED_KDE}:kde-4"

               ;;

       4*)

               _kdedir="4.0"

               _operator=">="

               _pv="-${NEED_KDE}:kde-4"

               ;;

       *) die "NEED_KDE=${NEED_KDE} currently not supported."

               ;;

esac


http://www.gentoo.org/proj/en/desktop/games/games-ebuild-howto.xml

SRC_URI (and friends)

This is the first real interesting thing in our ebuild, and also the first place for potential problems.  Most upstream packagers use very strange names for their packages.  Let's say kickball uses sourceforge.net's distribution system.  The file is named "kick-ball-src-v1.0.tar.gz".  As you can see, this does not fit the package name in portage.  There are a few portage variables which can be used here.  The two that I will be discussing are ${P} and ${PV}, which refer to the package name and version, and package version, respectively.  If you need to make changes to these, it is recommended to use MY_P or MY_PV, as needed.  Proper games team coding style places these variables above DESCRIPTION, but in the same block.  In this example, we are going to set MY_P to "kick-ball-src" and MY_PV to "v${PV}".  We want to use the ${PV} variable within MY_PV so that future upgrades are easier.

Note: Never hard-code package versions within an ebuild unless there is absolutely no other choice.

This makes our SRC_URI look like the following.

Code Listing 3.1: SRC_URI example 1

                                                   SRC_URI="mirror://sourceforge/${PN}/${MY_P}-${MY_PV}.tar.bz2"                        

This would cause portage to search the sourceforge mirrors for kickball/kick-ball-src-v1.0.tar.bz2, which is exactly what we are looking to find.  If the package sources are named to match the package, then the SRC_URI line is much simpler.

Code Listing 3.2: SRC_URI example 2

                                                   SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"                                                            

Code Listing 3.4: S with no subdirectory example

                                                   S=${WORKDIR}                        

If the upstream packager did not include a version number, but did use the package name, then S would be set as follows.

Code Listing 3.5: S with no version example

                                                   S=${WORKDIR}/${PN}

你可能感兴趣的:(#学习笔记类)