OLD | NEW |
(Empty) | |
| 1 # Copyright 1999-2010 Gentoo Foundation |
| 2 # Distributed under the terms of the GNU General Public License v2 |
| 3 # $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.9.25.ebuild,v 1.
3 2010/12/20 16:27:58 phajdan.jr Exp $ |
| 4 |
| 5 # Require EAPI 2 since we now require at least python-2.6 (for python 3 |
| 6 # syntax support) which also requires EAPI 2. |
| 7 EAPI=2 |
| 8 inherit eutils multilib python |
| 9 |
| 10 DESCRIPTION="Portage is the package management and distribution system for Gento
o" |
| 11 HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml" |
| 12 LICENSE="GPL-2" |
| 13 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~spar
c ~x86 ~sparc-fbsd ~x86-fbsd" |
| 14 PROVIDE="virtual/portage" |
| 15 SLOT="0" |
| 16 IUSE="build doc epydoc +ipc linguas_pl python3 selinux" |
| 17 |
| 18 python_dep="python3? ( =dev-lang/python-3* ) |
| 19 !python3? ( |
| 20 build? ( || ( dev-lang/python:2.8 dev-lang/python:2.7 dev-lang/p
ython:2.6 ) ) |
| 21 !build? ( || ( dev-lang/python:2.8 dev-lang/python:2.7 dev-lang/
python:2.6 >=dev-lang/python-3 ) ) |
| 22 )" |
| 23 |
| 24 # The pysqlite blocker is for bug #282760. |
| 25 DEPEND="${python_dep} |
| 26 !build? ( >=sys-apps/sed-4.0.5 ) |
| 27 doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 ) |
| 28 epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )" |
| 29 |
| 30 RDEPEND="${python_dep} |
| 31 !build? ( >=sys-apps/sed-4.0.5 |
| 32 >=app-shells/bash-3.2_p17 |
| 33 >=app-admin/eselect-1.2 ) |
| 34 elibc_FreeBSD? ( sys-freebsd/freebsd-bin ) |
| 35 elibc_glibc? ( >=sys-apps/sandbox-1.6 ) |
| 36 elibc_uclibc? ( >=sys-apps/sandbox-1.6 ) |
| 37 >=app-misc/pax-utils-0.1.17 |
| 38 selinux? ( sys-libs/libselinux ) |
| 39 !<app-shells/bash-3.2_p17" |
| 40 PDEPEND=" |
| 41 !build? ( |
| 42 >=net-misc/rsync-2.6.4 |
| 43 userland_GNU? ( >=sys-apps/coreutils-6.4 ) |
| 44 )" |
| 45 # coreutils-6.4 rdep is for date format in emerge-webrsync #164532 |
| 46 # rsync-2.6.4 rdep is for the --filter option #167668 |
| 47 |
| 48 SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives" |
| 49 |
| 50 prefix_src_archives() { |
| 51 local x y |
| 52 for x in ${@}; do |
| 53 for y in ${SRC_ARCHIVES}; do |
| 54 echo ${y}/${x} |
| 55 done |
| 56 done |
| 57 } |
| 58 |
| 59 PV_PL="2.1.2" |
| 60 PATCHVER_PL="" |
| 61 TARBALL_PV=$PV |
| 62 SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2 |
| 63 $(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2) |
| 64 linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2 |
| 65 $(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )" |
| 66 |
| 67 PATCHVER= |
| 68 [[ $TARBALL_PV = $PV ]] || PATCHVER=$PV |
| 69 if [ -n "${PATCHVER}" ]; then |
| 70 SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2 |
| 71 $(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)" |
| 72 fi |
| 73 |
| 74 S="${WORKDIR}"/${PN}-${TARBALL_PV} |
| 75 S_PL="${WORKDIR}"/${PN}-${PV_PL} |
| 76 |
| 77 compatible_python_is_selected() { |
| 78 [[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >=
0x2060000 and "good" or "bad")') = good ]] |
| 79 } |
| 80 |
| 81 pkg_setup() { |
| 82 if ! use python3 && ! compatible_python_is_selected ; then |
| 83 ewarn "Attempting to select a compatible default python interpre
ter" |
| 84 local x success=0 |
| 85 for x in /usr/bin/python2.* ; do |
| 86 x=${x#/usr/bin/python2.} |
| 87 if [[ $x -ge 6 ]] 2>/dev/null ; then |
| 88 eselect python set python2.$x |
| 89 if compatible_python_is_selected ; then |
| 90 elog "Default python interpreter is now
set to python-2.$x" |
| 91 success=1 |
| 92 break |
| 93 fi |
| 94 fi |
| 95 done |
| 96 if [ $success != 1 ] ; then |
| 97 eerror "Unable to select a compatible default python int
erpreter!" |
| 98 die "This version of portage requires at least python-2.
6 to be selected as the default python interpreter (see \`eselect python --help\
`)." |
| 99 fi |
| 100 fi |
| 101 |
| 102 if use python3; then |
| 103 python_set_active_version 3 |
| 104 fi |
| 105 } |
| 106 |
| 107 src_prepare() { |
| 108 if [ -n "${PATCHVER}" ] ; then |
| 109 if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then |
| 110 rm "$S/bin/ebuild-helpers/portageq" \ |
| 111 || die "failed to remove portageq helper symlink
" |
| 112 fi |
| 113 epatch "${WORKDIR}/${PN}-${PATCHVER}.patch" |
| 114 fi |
| 115 einfo "Setting portage.VERSION to ${PVR} ..." |
| 116 sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py ||
\ |
| 117 die "Failed to patch portage.VERSION" |
| 118 sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \ |
| 119 die "Failed to patch VERSION in doc/fragment/version" |
| 120 sed -e "1s/VERSION/${PVR}/" -i man/* || \ |
| 121 die "Failed to patch VERSION in man page headers" |
| 122 |
| 123 if ! use ipc ; then |
| 124 einfo "Disabling ipc..." |
| 125 sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:"
\ |
| 126 -i pym/_emerge/AbstractEbuildProcess.py || \ |
| 127 die "failed to patch AbstractEbuildProcess.py" |
| 128 fi |
| 129 |
| 130 if use python3; then |
| 131 einfo "Converting shebangs for python3..." |
| 132 python_convert_shebangs -r 3 . |
| 133 fi |
| 134 } |
| 135 |
| 136 src_compile() { |
| 137 if use doc; then |
| 138 cd "${S}"/doc |
| 139 touch fragment/date |
| 140 make xhtml xhtml-nochunks || die "failed to make docs" |
| 141 fi |
| 142 |
| 143 if use epydoc; then |
| 144 einfo "Generating api docs" |
| 145 mkdir "${WORKDIR}"/api |
| 146 local my_modules epydoc_opts="" |
| 147 my_modules="$(find "${S}/pym" -name "*.py" \ |
| 148 | sed -e 's:/__init__.py$::' -e 's:\.py$::' -e "s:^${S}/
pym/::" \ |
| 149 -e 's:/:.:g' | sort)" || die "error listing modules" |
| 150 # workaround for bug 282760 |
| 151 > "$S/pym/pysqlite2.py" |
| 152 PYTHONPATH=${S}/pym:${PYTHONPATH:+:}${PYTHONPATH} \ |
| 153 epydoc -o "${WORKDIR}"/api \ |
| 154 -qqqqq --no-frames --show-imports $epydoc_opts \ |
| 155 --name "${PN}" --url "${HOMEPAGE}" \ |
| 156 ${my_modules} || die "epydoc failed" |
| 157 rm "$S/pym/pysqlite2.py" |
| 158 fi |
| 159 } |
| 160 |
| 161 src_test() { |
| 162 # make files executable, in case they were created by patch |
| 163 find bin -type f | xargs chmod +x |
| 164 PYTHONPATH=${S}/pym:${PYTHONPATH:+:}${PYTHONPATH} \ |
| 165 ./pym/portage/tests/runTests || die "test(s) failed" |
| 166 } |
| 167 |
| 168 src_install() { |
| 169 local libdir=$(get_libdir) |
| 170 local portage_base="/usr/${libdir}/portage" |
| 171 local portage_share_config=/usr/share/portage/config |
| 172 |
| 173 cd "${S}"/cnf |
| 174 insinto /etc |
| 175 doins etc-update.conf dispatch-conf.conf || die |
| 176 |
| 177 insinto "$portage_share_config" |
| 178 doins "$S/cnf/make.globals" || die |
| 179 if [ -f "make.conf.${ARCH}".diff ]; then |
| 180 patch make.conf "make.conf.${ARCH}".diff || \ |
| 181 die "Failed to patch make.conf.example" |
| 182 newins make.conf make.conf.example || die |
| 183 else |
| 184 eerror "" |
| 185 eerror "Portage does not have an arch-specific configuration for
this arch." |
| 186 eerror "Please notify the arch maintainer about this issue. Usin
g generic." |
| 187 eerror "" |
| 188 newins make.conf make.conf.example || die |
| 189 fi |
| 190 |
| 191 dosym ..${portage_share_config}/make.globals /etc/make.globals |
| 192 |
| 193 insinto /etc/logrotate.d |
| 194 doins "${S}"/cnf/logrotate.d/elog-save-summary || die |
| 195 |
| 196 # BSD and OSX need a sed wrapper so that find/xargs work properly |
| 197 if use userland_GNU; then |
| 198 rm "${S}"/bin/ebuild-helpers/sed || die "Failed to remove sed wr
apper" |
| 199 fi |
| 200 |
| 201 local x symlinks |
| 202 |
| 203 cd "$S" || die "cd failed" |
| 204 for x in $(find bin -type d) ; do |
| 205 exeinto $portage_base/$x || die "exeinto failed" |
| 206 cd "$S"/$x || die "cd failed" |
| 207 doexe $(find . -mindepth 1 -maxdepth 1 -type f ! -type l) || \ |
| 208 die "doexe failed" |
| 209 symlinks=$(find . -mindepth 1 -maxdepth 1 -type l) |
| 210 if [ -n "$symlinks" ] ; then |
| 211 cp -P $symlinks "$D$portage_base/$x" || die "cp failed" |
| 212 fi |
| 213 done |
| 214 |
| 215 cd "$S" || die "cd failed" |
| 216 for x in $(find pym/* -type d) ; do |
| 217 insinto $portage_base/$x || die "insinto failed" |
| 218 cd "$S"/$x || die "cd failed" |
| 219 # __pycache__ directories contain no py files |
| 220 [[ "*.py" != $(echo *.py) ]] || continue |
| 221 doins *.py || die "doins failed" |
| 222 symlinks=$(find . -mindepth 1 -maxdepth 1 -type l) |
| 223 if [ -n "$symlinks" ] ; then |
| 224 cp -P $symlinks "$D$portage_base/$x" || die "cp failed" |
| 225 fi |
| 226 done |
| 227 |
| 228 # Symlinks to directories cause up/downgrade issues and the use of these |
| 229 # modules outside of portage is probably negligible. |
| 230 for x in "${D}${portage_base}/pym/"{cache,elog_modules} ; do |
| 231 [ ! -L "${x}" ] && continue |
| 232 die "symlink to directory will cause upgrade/downgrade issues: '
${x}'" |
| 233 done |
| 234 |
| 235 exeinto ${portage_base}/pym/portage/tests |
| 236 doexe "${S}"/pym/portage/tests/runTests |
| 237 |
| 238 doman "${S}"/man/*.[0-9] |
| 239 if use linguas_pl; then |
| 240 doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] |
| 241 doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] |
| 242 fi |
| 243 |
| 244 dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} |
| 245 use doc && dohtml -r "${S}"/doc/* |
| 246 use epydoc && dohtml -r "${WORKDIR}"/api |
| 247 |
| 248 dodir /usr/bin |
| 249 for x in ebuild egencache emerge portageq quickpkg repoman ; do |
| 250 dosym ../${libdir}/portage/bin/${x} /usr/bin/${x} |
| 251 done |
| 252 |
| 253 dodir /usr/sbin |
| 254 local my_syms="archive-conf |
| 255 dispatch-conf |
| 256 emaint |
| 257 emerge-webrsync |
| 258 env-update |
| 259 etc-update |
| 260 fixpackages |
| 261 regenworld" |
| 262 local x |
| 263 for x in ${my_syms}; do |
| 264 dosym ../${libdir}/portage/bin/${x} /usr/sbin/${x} |
| 265 done |
| 266 dosym env-update /usr/sbin/update-env |
| 267 dosym etc-update /usr/sbin/update-etc |
| 268 |
| 269 dodir /etc/portage |
| 270 keepdir /etc/portage |
| 271 } |
| 272 |
| 273 pkg_preinst() { |
| 274 if ! use build && ! has_version dev-python/pycrypto && \ |
| 275 ! has_version '>=dev-lang/python-2.6[ssl]' ; then |
| 276 ewarn "If you are an ebuild developer and you plan to commit ebu
ilds" |
| 277 ewarn "with this system then please install dev-python/pycrypto
or" |
| 278 ewarn "enable the ssl USE flag for >=dev-lang/python-2.6 in orde
r" |
| 279 ewarn "to enable RMD160 hash support." |
| 280 ewarn "See bug #198398 for more information." |
| 281 fi |
| 282 if [ -f "${ROOT}/etc/make.globals" ]; then |
| 283 rm "${ROOT}/etc/make.globals" |
| 284 fi |
| 285 |
| 286 [[ -n $PORTDIR_OVERLAY ]] && has_version "<${CATEGORY}/${PN}-2.1.6.12" |
| 287 REPO_LAYOUT_CONF_WARN=$? |
| 288 } |
| 289 |
| 290 pkg_postinst() { |
| 291 # Compile all source files recursively. Any orphans |
| 292 # will be identified and removed in postrm. |
| 293 python_mod_optimize /usr/$(get_libdir)/portage/pym |
| 294 |
| 295 if [ $REPO_LAYOUT_CONF_WARN = 0 ] ; then |
| 296 ewarn |
| 297 echo "If you want overlay eclasses to override eclasses from" \ |
| 298 "other repos then see the portage(5) man page" \ |
| 299 "for information about the new layout.conf and repos.con
f" \ |
| 300 "configuration files." \ |
| 301 | fmt -w 75 | while read -r ; do ewarn "$REPLY" ; done |
| 302 ewarn |
| 303 fi |
| 304 |
| 305 einfo |
| 306 einfo "For help with using portage please consult the Gentoo Handbook" |
| 307 einfo "at http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3" |
| 308 einfo |
| 309 } |
| 310 |
| 311 pkg_postrm() { |
| 312 python_mod_cleanup /usr/$(get_libdir)/portage/pym |
| 313 } |
OLD | NEW |