FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 02-28-2009, 10:28 AM
Torsten Veller
 
Default perl-module.eclass -- review - 2

* Torsten Veller <ml-en@veller.net>:
> Please review the attached perl-module.eclass.
> Patch linked below.

Thanks Bo rsted Andresen for feedback

> Changes
> ~~~~~~~
- use emake
- more quoting
- call perlinfo only once

As I've not seen any ebuild doing the replacement in line 156,
I've added a temporary ewarn. If you hits you, tell me.

> git://github.com/tove/perl-eclass.git
> http://people.gentoo.org/tove/files/perl-module.eclass.diff
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.112 2008/09/30 08:28:44 robbat2 Exp $
#
# Author: Seemant Kulleen <seemant@gentoo.org>

# @ECLASS: perl-module.eclass
# @MAINTAINER:
# perl@gentoo.org
# @BLURB: eclass for perl modules
# @DESCRIPTION:
# The perl-module eclass is designed to allow easier installation of perl
# modules, and their incorporation into the Gentoo Linux system.

inherit eutils base

case "${EAPI:-0}" in
0|1)
EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm src_compile src_install src_test src_unpack
;;
*)
EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install
;;
esac

DESCRIPTION="Based on the $ECLASS eclass"

LICENSE="${LICENSE:-|| ( Artistic GPL-2 )}"

[ -z "${SRC_URI}" -a -z "${MODULE_A}" ] && MODULE_A="${MY_P:-${P}}.tar.gz"
[ -z "${SRC_URI}" -a -n "${MODULE_AUTHOR}" ] &&
SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION}/${MODULE_A}"
[ -z "${HOMEPAGE}" ] &&
HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}"

SRC_PREP="no"
SRC_TEST="skip"
PREFER_BUILDPL="yes"

PERL_VERSION=""
SITE_ARCH=""
SITE_LIB=""
VENDOR_LIB=""
VENDOR_ARCH=""
ARCH_LIB=""
pm_echovar=""
perlinfo_done=false

perl-module_src_unpack() {
base_src_unpack unpack
has "${EAPI:-0}" 0 1 && perl-module_src_prepare
}

perl-module_src_prepare() {
if [[ -n ${PATCHES} ]] ; then
base_src_unpack autopatch
fi
esvn_clean
}

perl-module_src_configure() {
perl-module_src_prep
}

perl-module_src_prep() {
[[ "${SRC_PREP}" = "yes" ]] && return 0
SRC_PREP="yes"

${perlinfo_done} || perlinfo

export PERL_MM_USE_DEFAULT=1
# Disable ExtUtils::AutoInstall from prompting
export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"

if [[ "${PREFER_BUILDPL}" == "yes" && -f Build.PL ]] ; then
einfo "Using Module::Build"
perl Build.PL
--installdirs=vendor
--libdoc=
--destdir="${D}"
--create_packlist=0
--extra_linker_flags="${LDFLAGS}"
${myconf}
<<< ${pm_echovar}
|| die "Unable to build! (are you using USE="build"?)"
elif [[ -f Makefile.PL ]] ; then
einfo "Using ExtUtils::MakeMaker"
perl Makefile.PL
PREFIX=/usr
INSTALLDIRS=vendor
INSTALLMAN3DIR='none'
DESTDIR="${D}"
${myconf}
<<< ${pm_echovar}
|| die "Unable to build! (are you using USE="build"?)"
fi
if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then
einfo "No Make or Build file detected..."
return
fi
}

perl-module_src_compile() {
${perlinfo_done} || perlinfo

has "${EAPI:-0}" 0 1 && perl-module_src_prep

if [[ -f Build ]] ; then
./Build build || die "compilation failed"
elif [[ -f Makefile ]] ; then
#emake ${mymake} OPTIMIZE="${CFLAGS}" OTHERLDFLAGS="${LDFLAGS}" || die "compilation failed"
emake ${mymake} OTHERLDFLAGS="${LDFLAGS}" || die "compilation failed"
fi
}

perl-module_src_test() {
if [[ "${SRC_TEST}" == "do" ]] ; then
${perlinfo_done} || perlinfo
if [[ -f Build ]] ; then
./Build test || die "test failed"
elif [[ -f Makefile ]] ; then
emake test || die "test failed"
fi
fi
}

perl-module_src_install() {
local f
${perlinfo_done} || perlinfo

[[ -z ${mytargets} ]] && mytargets="pure_install"

if [[ -f Build ]] ; then
./Build ${mytargets} || die
elif [[ -f Makefile ]] ; then
emake ${myinst} ${mytargets} || die
fi

# einfo "Cleaning out stray man files"
find "${D}" -type f -name "*.3pm" -delete
find "${D}"/usr/share/man -depth -type d -empty -delete 2>/dev/null

fixlocalpod

for f in Change* CHANGES README* ${mydoc}; do
[[ -s "${f}" ]] && dodoc ${f}
done

find "${D}/${VENDOR_LIB}" -type f -a ( -name .packlist
-o ( -name '*.bs' -a -empty ) ) -delete
find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete

find "${D}" -type f -not -name '*.so' | while read f ; do
if file "${f}" | grep -q -i " text" ; then
if grep -q "${D}" "${f}" ; then ewarn "QA: File contains a temporary path ${f}" ; fi
sed -i -e "s:${D}:/:g" "${f}" || die
fi
done
}

perl-module_pkg_setup() {
${perlinfo_done} || perlinfo
}

perl-module_pkg_preinst() {
${perlinfo_done} || perlinfo
}

perl-module_pkg_postinst() { : ; }
# einfo "Man pages are not installed for most modules now."
# einfo "Please use perldoc instead."
#}

perl-module_pkg_prerm() { : ; }

perl-module_pkg_postrm() { : ; }

perlinfo() {
perlinfo_done=true

local f version install{site{arch,lib},archlib,vendor{arch,lib}}
for f in version install{site{arch,lib},archlib,vendor{arch,lib}} ; do
eval "$(perl -V:${f} )"
done
PERL_VERSION=${version}
SITE_ARCH=${installsitearch}
SITE_LIB=${installsitelib}
ARCH_LIB=${installarchlib}
VENDOR_LIB=${installvendorlib}
VENDOR_ARCH=${installvendorarch}
}

fixlocalpod() {
find "${D}" -type f -name perllocal.pod -delete
find "${D}" -depth -mindepth 1 -type d -empty -delete
}
 
Old 03-02-2009, 02:34 AM
Donnie Berkholz
 
Default perl-module.eclass -- review - 2

On 12:28 Sat 28 Feb , Torsten Veller wrote:
> case "${EAPI:-0}" in
> 0|1)
> EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm src_compile src_install src_test src_unpack
> ;;
> *)
> EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install
> ;;
> esac

Maybe this is just me, but I prefer to reserve '*' cases for the
fallback when I don't understand what I'm given.

> find "${D}/${VENDOR_LIB}" -type f -a ( -name .packlist
> -o ( -name '*.bs' -a -empty ) ) -delete
> find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete

I'm curious how portable the find () construct is. Do you know?

> find "${D}" -type f -not -name '*.so' | while read f ; do
> if file "${f}" | grep -q -i " text" ; then
> if grep -q "${D}" "${f}" ; then ewarn "QA: File contains a temporary path ${f}" ; fi
> sed -i -e "s:${D}:/:g" "${f}" || die

Could you just use dosed here?

--
Thanks,
Donnie

Donnie Berkholz
Developer, Gentoo Linux
Blog: http://dberkholz.wordpress.com
 
Old 03-02-2009, 06:24 AM
Torsten Veller
 
Default perl-module.eclass -- review - 2

* Donnie Berkholz <dberkholz@gentoo.org>:

Thanks for your comments.

> On 12:28 Sat 28 Feb , Torsten Veller wrote:
> > case "${EAPI:-0}" in
> > 0|1)
> > EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm src_compile src_install src_test src_unpack
> > ;;
> > *)
> > EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install
> > ;;
> > esac
>
> Maybe this is just me, but I prefer to reserve '*' cases for the
> fallback when I don't understand what I'm given.

As this is a general problem we should move it out of this thread.
I also think this should have been discussed months ago.


> > find "${D}/${VENDOR_LIB}" -type f -a ( -name .packlist
> > -o ( -name '*.bs' -a -empty ) ) -delete
> > find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete
>
> I'm curious how portable the find () construct is. Do you know?

http://www.opengroup.org/onlinepubs/000095399/utilities/find.html

The brackets are no problem.
But -mindepth and -delete are not in the specs:

| The -mindepth and -maxdepth options are GNU extensions that should be
| avoided if possible. (from devmanual.g.o)
Well, even the portage ebuild uses -mindepth. So should I replace it?

| The `-delete' action was introduced by the BSD family of operating
| systems (from `info find`)
and is also used several times in the tree.


> > find "${D}" -type f -not -name '*.so' | while read f ; do
> > if file "${f}" | grep -q -i " text" ; then
> > if grep -q "${D}" "${f}" ; then ewarn "QA: File contains a temporary path ${f}" ; fi
> > sed -i -e "s:${D}:/:g" "${f}" || die
>
> Could you just use dosed here?

I guess you mean the default expression?

dosed defaults to "s:${D}::g"
$D is supposed to end with a trailing slash.
-> is the path still absolute?

Strange at least.


BTW: After I looked up the devmanual part about "find" above, I wonder:
| find "${S}" -type f | while read f ; do
| [...]
| for f in $(find "${S}" -type f) ; do
| [...]
| Warning
| In both cases, files with weird characters or spaces in their names may
| cause serious problems.

Is there still a problem in the snippet above and is the following better
(if we assume that packages contain files with sane names)?

pushd "${D}" > /dev/null
for f in $(find . -type f -not -name '*.so' ) ; do
if file "${f}" | grep -q -i " text" ; then
sed -i -e "s:${D}:/:g" "${f}" || die
fi
done
popd > /dev/null

Maybe i need some coffee.
 
Old 03-02-2009, 11:01 AM
Bo rsted Andresen
 
Default perl-module.eclass -- review - 2

On Monday 02 March 2009 08:24:35 Torsten Veller wrote:
> > > find "${D}/${VENDOR_LIB}" -type f -a ( -name .packlist
> > > -o ( -name '*.bs' -a -empty ) ) -delete
> > > find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete
> >
> > I'm curious how portable the find () construct is. Do you know?

It was established well over a year ago that find in the ebuild environment
must be GNU find. Using portable find is not worth the pain.

[...]
> > Could you just use dosed here?

dosed needs to die.

[...]
> BTW: After I looked up the devmanual part about "find" above, I wonder:
> | find "${S}" -type f | while read f ; do
> | [...]
> | for f in $(find "${S}" -type f) ; do
> | [...]
> | Warning
> | In both cases, files with weird characters or spaces in their names may
> | cause serious problems.

The while loop breaks with leading or trailing spaces in the path. If the
spaces are anywhere else in the path it works. The for loop breaks with spaces
regardless of where they are. And you can of course come up with weird
characters that break them both.

If you really want to do better use:

find "${S}" -print0 | while read -rd ' f; do
if file "${f}" ...
done

You also really should provide proper die messages.

--
Bo Andresen


Mon Mar 2 14:30:01 2009
Return-path: <ubuntu-devel-bounces@lists.ubuntu.com>
Envelope-to: tom@linux-archive.org
Delivery-date: Mon, 02 Mar 2009 13:57:53 +0200
Received: from chlorine.canonical.com ([91.189.94.204]:34290)
by s2.java-tips.org with esmtp (Exim 4.69)
(envelope-from <ubuntu-devel-bounces@lists.ubuntu.com>)
id 1Le6mP-0004AX-1w
for tom@linux-archive.org; Mon, 02 Mar 2009 13:57:53 +0200
Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com)
by chlorine.canonical.com with esmtp (Exim 4.60)
(envelope-from <ubuntu-devel-bounces@lists.ubuntu.com>)
id 1Le6r6-0003v3-Oj; Mon, 02 Mar 2009 12:02:44 +0000
Received: from mail-fx0-f170.google.com ([209.85.220.170])
by chlorine.canonical.com with esmtp (Exim 4.60)
(envelope-from <ubuntu@bugabundo.net>) id 1Le6pA-0002fg-QO
for ubuntu-devel@lists.ubuntu.com; Mon, 02 Mar 2009 12:00:44 +0000
Received: by fxm18 with SMTP id 18so2081332fxm.38
for <ubuntu-devel@lists.ubuntu.com>;
Mon, 02 Mar 2009 04:00:44 -0800 (PST)
Received: by 10.103.175.8 with SMTP id c8mr2889760mup.117.1235995244337;
Mon, 02 Mar 2009 04:00:44 -0800 (PST)
Received: from blubug.localnet (87-196-252-175.net.novis.pt [87.196.252.175])
by mx.google.com with ESMTPS id
s10sm1695228mue.46.2009.03.02.04.00.42
(version=SSLv3 cipher=RC4-MD5); Mon, 02 Mar 2009 04:00:43 -0800 (PST)
From: "(=?iso-8859-1?q?=60=60-=5F-=B4=B4?=) -- BUGabundo"
<ubuntu@bugabundo.net>
Organization: Ubuntu LoCoTeam Portugal http://ubuntu-pt.org
To: Scott Kitterman <ubuntu@kitterman.com>
Subject: Re: Notifications: uselessness of
Date: Mon, 2 Mar 2009 12:00:38 +0000
User-Agent: KMail/1.11.0 (Linux/2.6.28-8-generic; KDE/4.2.0; x86_64; ; )
References: <1234983808.8503.3.camel@Scooby-Dum>
<49ABAE3C.1060504@canonical.com>
<36265-SnapperMsgD8DB99B6C5D17488@[75.196.236.56]>
In-Reply-To: <36265-SnapperMsgD8DB99B6C5D17488@[75.196.236.56]>
X-Face: ~}'<3p"*yj,xO6NSrZxSF:8+:ARG}z+uBcQFI6(6Esp}B9HXF }#f<#F4,
=?utf-8?q?Zk=60X8=60nkyp=7E=0A=09jGc3z8mjoC=5F3=3A0=5BWo =3F=3B3=5ET1D5Jn*y?=
=?utf-8?q?cy=26nt?=>4Q5!hgs{6s,
=?utf-8?q?0=5D0=5FwuWI+TVBYY=3A=2E=3F=3B7dMIv=0A=09=7C-WTTUv1=3FAUcH=7E?=<&KY4Xf3a!`-n8Q?3a_93'HYJw[G5g?xg-a@UOF*4be/2Y1@Kh(
=?utf-8?q?eZE=7C=5C=0A=09=25=7Der=24/d=2Eck9Y=3F=23=3Dm+=24PW4m8?=)
=?utf-8?q?UiP1=24k=3B*k-=60q=5C4=60TEO=7CwIWR=60Bbcz=5Emc=7Dc=23l35p=5DrG/?=
=?utf-8?q?axh-=0A=09TSf=25=5BQOD=5D263P?=,
*+m$+3YFpTi{.}iB`Ir|grbLo`F/3ldsx""
=?utf-8?q?G4F=2E5=2E=7CrZlg=7DD=60=5Ck4Ip=0A=09bT=2422uN Z?=(n
MIME-Version: 1.0
Message-Id: <200903021200.39436.Ubuntu@bugabundo.net>
Cc: ubuntu-devel@lists.ubuntu.com
X-BeenThere: ubuntu-devel@lists.ubuntu.com
X-Mailman-Version: 2.1.8
Precedence: list
Reply-To: ubuntu-reply@bugabundo.net, ubuntu-devel@lists.ubuntu.com
List-Id: "Ubuntu Development (developers)" <ubuntu-devel.lists.ubuntu.com>
List-Unsubscribe: <https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel>,
<mailto:ubuntu-devel-request@lists.ubuntu.com?subject=unsubscribe>
List-Archive: <https://lists.ubuntu.com/archives/ubuntu-devel>
List-Post: <mailto:ubuntu-devel@lists.ubuntu.com>
List-Help: <mailto:ubuntu-devel-request@lists.ubuntu.com?subject=help>
List-Subscribe: <https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel>,
<mailto:ubuntu-devel-request@lists.ubuntu.com?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============2478363650840177878=="
Mime-version: 1.0
Sender: ubuntu-devel-bounces@lists.ubuntu.com
Errors-To: ubuntu-devel-bounces@lists.ubuntu.com

--===============2478363650840177878==
Content-Type: multipart/signed;
boundary="nextPart27473929.nV989KnsPJ";
protocol="application/pgp-signature";
micalg=pgp-sha1
Content-Transfer-Encoding: 7bit

--nextPart27473929.nV989KnsPJ
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Ol=E1 Scott e a todos.

On Monday 02 March 2009 11:29:16 Scott Kitterman wrote:
> In a related note, I was chatting with a Xubuntu dev who does not follow=
=20
> this list closely last night and this topic come up. He was completely=20
> boggled that the icon had been removed on purpose. He had been trying to=
=20
> figure out how they had broken it so it didn't show up anymore.

We see 3 or 4 of those every day on #ubuntu+1

=2D-=20
Hi, I'm BUGabundo, and I am Ubuntu (whyubuntu.com)
(``-_-=B4=B4) http://LinuxNoDEI.BUGabundo.net
Linux user #443786 GPG key 1024D/A1784EBB
My new micro-blog @ http://BUGabundo.net
ps. My emails tend to sound authority and aggressive. I'm sorry in advance.=
I'll try to be more assertive as time goes by...

--nextPart27473929.nV989KnsPJ
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEABECAAYFAkmrymcACgkQOkFKvntFMm6UGQCfaBMpYrZuhs PvXCc6c20SCbAG
sWcAnRWhyz7nY52FYwncfHSbtymtKRxe
=DXd4
-----END PGP SIGNATURE-----

--nextPart27473929.nV989KnsPJ--


--===============2478363650840177878==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--
ubuntu-devel mailing list
ubuntu-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel

--===============2478363650840177878==--
 
Old 03-03-2009, 10:13 AM
Peter Volkov
 
Default perl-module.eclass -- review - 2

В Пнд, 02/03/2009 в 13:01 +0100, Bo Ørsted Andresen пишет:
> On Monday 02 March 2009 08:24:35 Torsten Veller wrote:
> > > Could you just use dosed here?
>
> dosed needs to die.

Why?

--
Peter.
 
Old 03-03-2009, 12:09 PM
Bo rsted Andresen
 
Default perl-module.eclass -- review - 2

On Tuesday 03 March 2009 12:13:34 Peter Volkov wrote:
> > > > Could you just use dosed here?
> >
> > dosed needs to die.
>
> Why?

Because it's utterly pointless and exists only for legacy reasons. Few
packages use it anyway.

--
Bo Andresen
 
Old 03-09-2009, 12:50 AM
Donnie Berkholz
 
Default perl-module.eclass -- review - 2

On 14:09 Tue 03 Mar , Bo rsted Andresen wrote:
> On Tuesday 03 March 2009 12:13:34 Peter Volkov wrote:
> > > > > Could you just use dosed here?
> > >
> > > dosed needs to die.
> >
> > Why?
>
> Because it's utterly pointless and exists only for legacy reasons. Few
> packages use it anyway.

I did a quick check to look at the data supporting your point and found
120 packages using it. I guess that qualifies as "few" when compared to
the whole tree.

--
Thanks,
Donnie

Donnie Berkholz
Developer, Gentoo Linux
Blog: http://dberkholz.wordpress.com
 
Old 03-09-2009, 07:02 AM
Rmi Cardona
 
Default perl-module.eclass -- review - 2

Le 09/03/2009 02:50, Donnie Berkholz a crit :

On 14:09 Tue 03 Mar , Bo rsted Andresen wrote:

On Tuesday 03 March 2009 12:13:34 Peter Volkov wrote:

Could you just use dosed here?

dosed needs to die.

Why?

Because it's utterly pointless and exists only for legacy reasons. Few
packages use it anyway.


I did a quick check to look at the data supporting your point and found
120 packages using it. I guess that qualifies as "few" when compared to
the whole tree.


Doing a bit of a cross thread thing here:

How about getting rid of dosed in EAPI=3 ? Sounds like the perfect time
to do it.


Rmi
 

Thread Tools




All times are GMT. The time now is 12:32 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org