# $Id: Portfile 57375 2009-09-10 08:16:41Z ryandesign@macports.org $

PortSystem 1.0

name		yum
version		3.2.21
platforms	darwin
categories	sysutils archivers
maintainers	mac.com:n3npq afb
description	Automatic updater and package installer/remover for RPM
long_description	Yum is an automatic updater and package installer/remover for \
			rpm systems. It automatically computes dependencies and figures \
			out what things should occur to install packages. It makes it \
			easier to maintain groups of machines without having to manually \
			update each one using rpm.

homepage	http://yum.baseurl.org/
master_sites	${homepage}download/3.2/
checksums	md5 2c9ff2e3c329e5cd0ce335d05bf96b7b \
		sha1 d9cc6cc6861bb445b81cd0946771e8510280b7e5 \
		rmd160 8c5f8be6cc60336814d3fe539d87a001a53e0f25

patchfiles	patch-prefix.diff patch-sqlutils.py patch-packages.py

depends_lib	lib:librpm:rpm port:python24 port:py-celementtree port:py-urlgrabber port:py-libxml2 port:py-yum-metadata-parser port:py-iniparse port:py-pygpgme
depends_build	port:intltool port:py-nose

patch {
		foreach patch $patchfiles {
			system "cd '${workpath}/${distname}' && \
			sed -e 's#@@PREFIX@@#${prefix}#g' -e 's#@@PYTHON@@#${prefix}/bin/python2.4#g' '${portpath}/${filesdir}/${patch}' | patch -p0"
		}
}

post-patch {
		# problem with case-insensitive filesystem:
		file delete ${workpath}/${distname}/INSTALL
}

use_configure	no

build.args	PYTHON="${prefix}/bin/python2.4"
destroot.args	PYTHON="${prefix}/bin/python2.4" PYSYSDIR="${prefix}"

post-destroot	{
		xinstall -d -m 755 ${destroot}${prefix}/etc/yum/repos.d
		xinstall -d -m 755 ${destroot}${prefix}/var/cache/yum/release/headers
		xinstall -d -m 755 ${destroot}${prefix}/var/cache/yum/release/packages
		copy -force ${filespath}/yum.conf ${destroot}${prefix}/etc/yum/yum.conf
		reinplace "s|@@PREFIX@@|$prefix|g" ${destroot}${prefix}/etc/yum/yum.conf
		reinplace "s|@@PLATFORM@@|${os.platform}|g" ${destroot}${prefix}/etc/yum/yum.conf
		destroot.keepdirs ${destroot}${prefix}/etc/yum/repos.d \
		${destroot}${prefix}/var/cache/yum/release/headers \
		${destroot}${prefix}/var/cache/yum/release/packages \
		${destroot}${prefix}/var/log \
		${destroot}${prefix}/var/run
}

test.run	yes

livecheck.type	regex
# get the last modified tarball
livecheck.url	${master_sites}?C=M\;O=D
livecheck.regex	${name}-(\[0-9\\.\]+)${extract.suffix}
