Re: [gentoo-dev] Re: perl-module.eclass -- review - 2

2009-03-09 Thread Rémi Cardona

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.


Rémi



Re: [gentoo-dev] Re: perl-module.eclass -- review - 2

2009-03-08 Thread Donnie Berkholz
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


pgp17EdQMQtWH.pgp
Description: PGP signature


Re: [gentoo-dev] Re: perl-module.eclass -- review - 2

2009-03-03 Thread Bo Ørsted Andresen
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



Re: [gentoo-dev] Re: perl-module.eclass -- review - 2

2009-03-03 Thread Peter Volkov
В Пнд, 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.


signature.asc
Description: Эта  часть  сообщения  подписана  цифровой  подписью


Re: [gentoo-dev] Re: perl-module.eclass -- review - 2

2009-03-02 Thread Bo Ørsted Andresen
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



[gentoo-dev] Re: perl-module.eclass -- review - 2

2009-03-01 Thread Torsten Veller
* Donnie Berkholz :

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/95399/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.



Re: [gentoo-dev] Re: perl-module.eclass -- review - 2

2009-03-01 Thread Donnie Berkholz
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


pgpWs6JUuSQUs.pgp
Description: PGP signature


[gentoo-dev] Re: perl-module.eclass -- review - 2

2009-02-28 Thread Torsten Veller
* Torsten Veller :
> 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 

# @ECLASS: perl-module.eclass
# @MAINTAINER:
# p...@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