From 00e67e1211e5a4b56ecdbe27b40509e4026eab3b Mon Sep 17 00:00:00 2001 From: geos_one Date: Tue, 12 Oct 2010 13:07:19 +0000 Subject: [PATCH] add rpm5 offset git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/mds@2516 6952d904-891a-0410-993b-d76249ca496b --- app-arch/rpm5offset/ChangeLog | 13 +++ app-arch/rpm5offset/Manifest | 5 + app-arch/rpm5offset/files/rpmoffset.c | 72 ++++++++++++ app-arch/rpm5offset/metadata.xml | 5 + app-arch/rpm5offset/rpm5offset-9.0-r1.ebuild | 26 +++++ app-arch/rpm5offset/rpm5offset-9.0.ebuild | 26 +++++ eclass/rpm5.eclass | 113 +++++++++++++++++++ www-apps/zarafa/Manifest | 6 +- www-apps/zarafa/zarafa-6.40.2.ebuild | 30 +++-- 9 files changed, 283 insertions(+), 13 deletions(-) create mode 100644 app-arch/rpm5offset/ChangeLog create mode 100644 app-arch/rpm5offset/Manifest create mode 100644 app-arch/rpm5offset/files/rpmoffset.c create mode 100644 app-arch/rpm5offset/metadata.xml create mode 100644 app-arch/rpm5offset/rpm5offset-9.0-r1.ebuild create mode 100644 app-arch/rpm5offset/rpm5offset-9.0.ebuild create mode 100644 eclass/rpm5.eclass diff --git a/app-arch/rpm5offset/ChangeLog b/app-arch/rpm5offset/ChangeLog new file mode 100644 index 0000000..5c80ae0 --- /dev/null +++ b/app-arch/rpm5offset/ChangeLog @@ -0,0 +1,13 @@ +# ChangeLog for app-arch/rpm5offset +# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 +# $Header: $ + +*rpm5offset-9.0-r1 (09 Sep 2009) + + 09 Sep 2009; Mario Fetka + +rpm5offset-9.0-r1.ebuild: + add support for app-arch/xz-utils + + 16 Jan 2009; Mario Fetka +metadata.xml: + initial rpm5offset + diff --git a/app-arch/rpm5offset/Manifest b/app-arch/rpm5offset/Manifest new file mode 100644 index 0000000..a7d2553 --- /dev/null +++ b/app-arch/rpm5offset/Manifest @@ -0,0 +1,5 @@ +AUX rpmoffset.c 1964 RMD160 acea626f5080b7ea47863cf9e3bc2ab3b381c61e SHA1 5ec35b3d37773ca4a09443c6ea687c7d3a739f34 SHA256 e1e18d68009bd4541d6c65b43f45b58d720b9c87eba612d7616e244142f80dfe +EBUILD rpm5offset-9.0-r1.ebuild 653 RMD160 4da00e851208ae017289a981bf221125bed1300e SHA1 d7585e5c0953ae6106dcd1dd16eb4ac14c11b80a SHA256 84511d3c96d0269d0105cd2aede19170f7b421bea7bc921de47da221320e4139 +EBUILD rpm5offset-9.0.ebuild 628 RMD160 cf664dc26a5305e9d85b29ef89f9a1faf26bbae2 SHA1 c08ecbb217ffa829d134544c78fbbeb451510193 SHA256 5b9561a70c0dece76fb9e4f94690e8b8cf143dd98edf08d13938a922ce0eaef5 +MISC ChangeLog 359 RMD160 bf3896dfe95be868cff866614fe45990b1ade8e0 SHA1 de47c41139412e2e786222dd562b5ed8df0e36f5 SHA256 10185acde0bf53f6596e95e8fdc496e0a209dc7790b92a2e07f8370620b3a1cf +MISC metadata.xml 170 RMD160 645927a396fdc21cdeb089fe42c5397332420ea6 SHA1 ac7f48a14fec325926f9ce1be8fbf1f311b4f2e4 SHA256 d797a2ec6f9dc516c9f9c1a758ee87ad3e8c43101b5dc76c2f872d5bd4639b42 diff --git a/app-arch/rpm5offset/files/rpmoffset.c b/app-arch/rpm5offset/files/rpmoffset.c new file mode 100644 index 0000000..61a4624 --- /dev/null +++ b/app-arch/rpm5offset/files/rpmoffset.c @@ -0,0 +1,72 @@ + +/* Find how deeply inside an .RPM the real data is */ +/* kept, and report the offset in bytes */ + +/* Wouldn't it be a lot more sane if we could just untar these things? */ + +#include +#include + +/* These offsets keep getting bigger, so we're going to just bite a 2MB */ +/* chunk of RAM right away so that we have enough. Yeah, horrible */ +/* quick and dirty implementation, but hey -- it gets the job done. */ + +#define RPMBUFSIZ 3145728 + +main() +{ + char *buff = malloc(RPMBUFSIZ),*eb,*p; + for (p = buff, eb = buff + read(0,buff,RPMBUFSIZ); p < eb; p++) + { + + /* gzip format */ + if (*p == '\037' && p[1] == '\213' && p[2] == '\010') + { + printf("%ld\n",p - buff); + exit(0); + } + + /* bzip2 format */ + else if (*p == 'B' && p[1] == 'Z' && p[2] == 'h' ) + { + printf("%ld\n",p - buff); + exit(0); + } + + /* LZMA files; both LZMA_Alone and LZMA utils formats. The LZMA_Alone + * format is used by the LZMA_Alone tool from LZMA SDK. The LZMA utils + * format is the default format of LZMA utils 4.32.1 and later. */ + + /* LZMA utils format */ + else if (*p == '\377' && p[1] == 'L' && + p[2] == 'Z' && p[3] == 'M' && + p[4] == 'A' && p[5] == '\000') + { + printf("%ld\n",p - buff); + exit(0); + } + + /* The LZMA_Alone format has no magic bytes, thus we + * need to play a wizard. This can give false positives, + * thus the detection below should be removed when + * the newer LZMA utils format has got popular. */ +// else if (*p == 0x5D && p[1] == 0x00 && + else if (*p == '\135' && + p[5] == '\377' && p[6] == '\377' && + p[7] == '\377' && p[8] == '\377' && + p[9] == '\377' && p[10] == '\377' && + p[11] == '\377' && p[12] == '\377') + +/* ((p[10] == 0x00 && p[11] == 0x00 && + p[12] == 0x00) || + (p[5] == 0xFF && p[6] == 0xFF && + p[7] == 0xFF && p[8] == 0xFF && + p[9] == 0xFF && p[10] == 0xFF && + p[11] == 0xFF && p[12] == 0xFF))) +*/ { + printf("%ld\n",p - buff); + exit(0); + } + } + exit(1); +} diff --git a/app-arch/rpm5offset/metadata.xml b/app-arch/rpm5offset/metadata.xml new file mode 100644 index 0000000..7e32869 --- /dev/null +++ b/app-arch/rpm5offset/metadata.xml @@ -0,0 +1,5 @@ + + + +maintainer-wanted + diff --git a/app-arch/rpm5offset/rpm5offset-9.0-r1.ebuild b/app-arch/rpm5offset/rpm5offset-9.0-r1.ebuild new file mode 100644 index 0000000..2251aae --- /dev/null +++ b/app-arch/rpm5offset/rpm5offset-9.0-r1.ebuild @@ -0,0 +1,26 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit toolchain-funcs + +DESCRIPTION="Find how deeply inside an .RPM the real data is" +HOMEPAGE="http://www.slackware.com/config/packages.php" +SRC_URI="" + +LICENSE="as-is" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="userland_GNU" + +RDEPEND="app-arch/cpio + || ( app-arch/lzma-utils app-arch/xz-utils )" +DEPEND="${DEPEND}" + +src_compile() { + "$(tc-getCC)" ${CFLAGS} ${LDFLAGS} ${FILESDIR}/rpmoffset.c -o rpm5offset || die +} + +src_install() { + dobin rpm5offset || die +} diff --git a/app-arch/rpm5offset/rpm5offset-9.0.ebuild b/app-arch/rpm5offset/rpm5offset-9.0.ebuild new file mode 100644 index 0000000..6090fc1 --- /dev/null +++ b/app-arch/rpm5offset/rpm5offset-9.0.ebuild @@ -0,0 +1,26 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit toolchain-funcs + +DESCRIPTION="Find how deeply inside an .RPM the real data is" +HOMEPAGE="http://www.slackware.com/config/packages.php" +SRC_URI="" + +LICENSE="as-is" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="userland_GNU" + +RDEPEND="app-arch/cpio + app-arch/lzma-utils" +DEPEND="${DEPEND}" + +src_compile() { + "$(tc-getCC)" ${CFLAGS} ${LDFLAGS} ${FILESDIR}/rpmoffset.c -o rpm5offset || die +} + +src_install() { + dobin rpm5offset || die +} diff --git a/eclass/rpm5.eclass b/eclass/rpm5.eclass new file mode 100644 index 0000000..6fe20a7 --- /dev/null +++ b/eclass/rpm5.eclass @@ -0,0 +1,113 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/rpm.eclass,v 1.20 2010/07/18 21:57:20 vapier Exp $ + +# @ECLASS: rpm.eclass +# @MAINTAINER: +# base-system@gentoo.org +# @BLURB: convenience class for extracting RPMs + +inherit eutils + +DEPEND=">=app-arch/rpm5offset-9.0" + +# @FUNCTION: rpm_unpack +# @USAGE: +# @DESCRIPTION: +# Unpack the contents of the specified rpms like the unpack() function. +rpm5_unpack() { + [[ $# -eq 0 ]] && set -- ${A} + local a rpmoff decompcmd + for a in "$@" ; do + echo ">>> Unpacking ${a} to ${PWD}" + if [[ ${a} == ./* ]] ; then + : nothing to do -- path is local + elif [[ ${a} == ${DISTDIR}/* ]] ; then + ewarn 'QA: do not use ${DISTDIR} with rpm_unpack -- it is added for you' + elif [[ ${a} == /* ]] ; then + ewarn 'QA: do not use full paths with rpm_unpack -- use ./ paths instead' + else + a="${DISTDIR}/${a}" + fi +# rpm2tar -O "${a}" | tar xf - || die "failure unpacking ${a}" + rpmoff=`rpm5offset < ${rpmfile}` + [ -z "${rpmoff}" ] && return 1 + + decompcmd="lzma -dc" + if [ -n "`dd if=${a} skip=${rpmoff} bs=1 count=3 2>/dev/null | file - | grep bzip2`" ]; then + decompcmd="bzip2 -dc" + fi + if [ -n "`dd if=${a} skip=${rpmoff} bs=1 count=3 2>/dev/null | file - | grep gzip`" ]; then + decompcmd="gzip -dc" + fi + + dd ibs=${rpmoff} skip=1 if=${a} 2> /dev/null \ + | ${decompcmd} \ + | cpio -idmu --no-preserve-owner --quiet || return 1 + done +} + +# @FUNCTION: srcrpm_unpack +# @USAGE: +# @DESCRIPTION: +# Unpack the contents of the specified rpms like the unpack() function as well +# as any archives that it might contain. Note that the secondary archive +# unpack isn't perfect in that it simply unpacks all archives in the working +# directory (with the assumption that there weren't any to start with). +srcrpm5_unpack() { + [[ $# -eq 0 ]] && set -- ${A} + rpm5_unpack "$@" + + # no .src.rpm files, then nothing to do + [[ "$* " != *".src.rpm " ]] && return 0 + + eshopts_push -s nullglob + + # unpack everything + local a + for a in *.tar.{gz,bz2} *.t{gz,bz2} *.zip *.ZIP ; do + unpack "./${a}" + rm -f "${a}" + done + + eshopts_pop + + return 0 +} + +# @FUNCTION: rpm_src_unpack +# @DESCRIPTION: +# Automatically unpack all archives in ${A} including rpms. If one of the +# archives in a source rpm, then the sub archives will be unpacked as well. +rpm5_src_unpack() { + local a + for a in ${A} ; do + case ${a} in + *.rpm) srcrpm5_unpack "${a}" ;; + *) unpack "${a}" ;; + esac + done +} + +# @FUNCTION: rpm_spec_epatch +# @USAGE: [spec] +# @DESCRIPTION: +# Read the specified spec (defaults to ${PN}.spec) and attempt to apply +# all the patches listed in it. If the spec does funky things like moving +# files around, well this won't handle that. +rpm5_spec_epatch() { + local p spec=${1:-${PN}.spec} + local dir=${spec%/*} + grep '^%patch' "${spec}" | \ + while read line ; do + set -- ${line} + p=$1 + shift + EPATCH_OPTS="$*" + set -- $(grep "^P${p#%p}: " "${spec}") + shift + epatch "${dir:+${dir}/}$*" + done +} + +EXPORT_FUNCTIONS src_unpack diff --git a/www-apps/zarafa/Manifest b/www-apps/zarafa/Manifest index 48eda5c..2400877 100644 --- a/www-apps/zarafa/Manifest +++ b/www-apps/zarafa/Manifest @@ -13,9 +13,9 @@ AUX zarafa-monitor.rc6 705 RMD160 d1e524b7ed48ec5b53594595a35d4fb3c02b1a5a SHA1 AUX zarafa-server.rc6 706 RMD160 d3734a455367d93d316fca873e79467f624b97a2 SHA1 e819806ba99c5b5d4c195cfbace7b4027b053976 SHA256 5a8553127bc529350cf56ea35b558e1d276ca0d4bde92a32583d62d0d790fa4f AUX zarafa-spooler.rc6 705 RMD160 a2981b8e9b60df19d5adce5507ec51ac6d5b12e8 SHA1 09527095beb3891986656cb0e1c53414b7f038bf SHA256 4cf183daf6d86e2bb39073993af8f244bc28ee90feb4cf1ba34e5302894aa2fe AUX zarafa.logrotate 1857 RMD160 d295f5307be6577d3f8fdc89edc7995adae2fd47 SHA1 7188133da91ad6d453811ff5e67d84fde49b4fb9 SHA256 44e26d9ad5eff2e159388698a068df72d9626d91e9be478be00b3e3eaa15913f -DIST zarafa-6.40.2-ubuntu10.04-i386.tar.gz 7749271 RMD160 0de3af308b678695d938d14897d87b0501a51235 SHA1 11281457fc146831406d64a8962d48f394272c3e SHA256 6b850c2103692cfa8ab54e9f496df90a489f50519d97c4dc19833c0b2d97d7cf -DIST zarafa-6.40.2-ubuntu10.04-x86_64.tar.gz 7770638 RMD160 c739c37b0cbebcf57812c7492702af95323691dc SHA1 2513ee339d3d96338408816ffd2da36c8b73db15 SHA256 8c0cf068785a3afef6ce423f8fdafad5b3d29fa85637b894b7ee0daac6dcbfda +DIST zarafa-6.40.2-sles11-i586.tar.gz 33437198 RMD160 7fb143fe435a4bf08d1ce8b292388e6d21cb27e1 SHA1 4413d70a5a4d38cd982932caa339d840201ca56d SHA256 28f312275483ad69aa6dd4f120d1b0f96438f3096642d5611be59835e6f34d8e +DIST zarafa-6.40.2-sles11-x86_64.tar.gz 33495754 RMD160 d13b1ba2ec8ac21605baac4fb473b6dfa7c33e92 SHA1 98b82ba0343b0eab734cb4c528c869f4133a878e SHA256 b8a0c09c44b22bdfedd146cf79cc2327c95f6c13d3d08bcdfbf25409e363d2a9 DIST zarafa-6.40.2.tar.gz 4605538 RMD160 9da243c0d7f5b9e86a5606482a1728b1056dde89 SHA1 3554a6f6cc2f32ee30f628598eb2d5de09fe5f1d SHA256 3ad4598cc6943e7e99d3d8340916dc425db1c54ed76c66a309183cb53b838350 -EBUILD zarafa-6.40.2.ebuild 3591 RMD160 a7a8695dc9a12f75ce06655cc99f794b5e43c052 SHA1 45496364de1f9c09a6331a7dadfb5d3ed80ade45 SHA256 e65400409c6e767e417222da6f4b83df7dcf4493aebdd4b1873caecf61800d5a +EBUILD zarafa-6.40.2.ebuild 4024 RMD160 2085e898054074c33115d997be57e9a8ae2b4a2a SHA1 ad12760ebbca30f150be9b91faf4c80b727c8b2c SHA256 9557f972ce1dde1c2ca7b21c25a891c51f9e95ffc7cfeef5db65e2f147ced27a MISC ChangeLog 462 RMD160 679b139915ff212ecd25cc408eb091b8703dcd59 SHA1 e655896faf5f7a31915e99cdaf8e8763997939a9 SHA256 ba3c15083b4d654f4631319c575b1a80172ae4e209b4ee86674f822b0ddd213e MISC metadata.xml 1238 RMD160 c82938e77f387291d6a1c3bf9b0d802f2878dd12 SHA1 b5738f14922c69e78cfb867acdc65eeea25977bf SHA256 2c13f98be5fa8bdaf21ac86bcd00bbeb8944df5615de0cfce35ae4c00ef4b4d5 diff --git a/www-apps/zarafa/zarafa-6.40.2.ebuild b/www-apps/zarafa/zarafa-6.40.2.ebuild index 30d0854..739b18b 100644 --- a/www-apps/zarafa/zarafa-6.40.2.ebuild +++ b/www-apps/zarafa/zarafa-6.40.2.ebuild @@ -8,14 +8,14 @@ PHP_EXT_NAME="mapi" PHP_EXT_INI="yes" PHP_EXT_ZENDEXT="no" -inherit eutils php-ext-base-r1 autotools +inherit eutils php-ext-base-r1 autotools rpm DESCRIPTION="Open Source Groupware Solution" HOMEPAGE="http://zarafa.com/" SRC_URI="http://download.zarafa.com/zarafa/drupal/ondemand.php?version=${PV}&src=zarafa-${PV} -> ${P}.tar.gz licensed? ( - amd64? ( http://download.zarafa.com/zarafa/drupal/beta/ondemand.php?version=${PV}&distro=ubuntu&distroversion=10.04&arch=x86_64&type=1 -> zarafa-${PV}-ubuntu10.04-x86_64.tar.gz ) - x86? ( http://download.zarafa.com/zarafa/drupal/beta/ondemand.php?version=${PV}&distro=ubuntu&distroversion=10.04&arch=i386&type=1 -> zarafa-${PV}-ubuntu10.04-i386.tar.gz ) )" + amd64? ( http://download.zarafa.com/zarafa/drupal/ondemand.php?version=${PV}&distro=sles&distroversion=11&arch=x86_64&type=1 -> zarafa-${PV}-sles11-x86_64.tar.gz ) + x86? ( http://download.zarafa.com/zarafa/drupal/ondemand.php?version=${PV}&distro=sles&distroversion=11&arch=i586&type=1 -> zarafa-${PV}-sles11-i586.tar.gz ) )" LICENSE="AGPL-3" SLOT="0" @@ -48,15 +48,14 @@ src_unpack() { unpack ${A} if use licensed; then cd "${WORKDIR}" - if use x86; then - unpack $(find ./zarafa-${PV}-ubuntu10.04-i386 -name "zarafa-licensed*") - fi - if use amd64; then - unpack $(find ./zarafa-${PV}-ubuntu10.04-x86_64 -name "zarafa-licensed*") - fi mkdir licensed cd licensed - unpack ./../data.tar.gz + if use x86; then + rpm_unpack $(find ./../zarafa-${PV}-sles11-i586 -name "zarafa-licensed*") + fi + if use amd64; then + rpm_unpack $(find ./../zarafa-${PV}-sles11-x86_64 -name "zarafa-licensed*") + fi cd "${S}" fi } @@ -109,6 +108,17 @@ src_install() { keepdir /var/log/zarafa if use licensed; then + dobin ${WORKDIR}/licensed/usr/bin/* + exeinto /usr/$(get_libdir)/zarafa/ + doexe ${WORKDIR}/licensed/usr/lib/zarafa/*.so + doman ${WORKDIR}/licensed/usr/share/man/*/*.gz + exeinto /usr/share/zarafa/zarafa-backup-helpers/ + doexe ${WORKDIR}/licensed/usr/share/zarafa/zarafa-backup-helpers/* + dodoc ${WORKDIR}/licensed/usr/share/doc/zarafa-licensed/* + insinto /etc/zarafa + doins -r ${WORKDIR}/licensed/etc/zarafa/* + insinto /etc/cron.d + doins ${WORKDIR}/licensed/etc/cron.d/* newinitd ${FILESDIR}/zarafa-licensed.rc6 zarafa-licensed fi