You are not logged in.

#1 2006-04-29 14:24:57

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

ANNOUNCING perl-cpanplus-pacman

This should be of interest to all maintainers of packages based on CPAN and to Perl programmers among ArchLinux users.


In a previous thread "BlueRaven" mentioned that

Gentoo provides a perl script, called g-cpan.pl, allowing to install Perl modules from CPAN and generating the proper ebuild on the fly, thus making the installed files known to Portage

expressing the wish that a similar tool be available to us, Arch users. (I have seen that in the meanwhile Frugalware also provides fwcpan, a pretty simple/hackish bash script that processes lynx dumps from search.cpan.org queries.)

I have fairly recently discovered Arch Linux and since then I use it with great joy and enthusiasm. (Don't be misled by the low number of my posts to this board. I have been a little more active on Flyspray, Wiki and AUR ;-) Well, I thought I should contribute back to the community by providing an even better CPAN tool for the benefit of Arch Linux developers and users. Here it is.

My solution makes use of the latest version of CPANPLUS::*, a complete (OO-style) rewrite of the CPAN::* interface that is supposed to become standard in the 5.10 version of the Perl core. See here for more info. I have written a CPANPLUS::Dist::Pacman module and a companion script, cpan4pacman, which is itself based on, but considerably modified from, the cpan2dist script that comes with the CPANPLUS distribution. Basically, invoking "cpan4pacman Some::Cpan::Module [More::Cpan::Modules ...]" will do the following (assuming that you have first configured CPANPLUS by running /usr/bin/cpanp to choose your preferred CPAN mirrors etc.):

1) After updating the local CPAN metadata, it will find the CPAN distribution tarball this module is part of.
2) It will map the CPAN name to an archlinux-compatible package name.
3) Check whether it is available on the Arch repositories (by updating and scanning the local abs tree).
4) If not, it will fetch it and extract it to $localbasedir/$package-name/src ($localbasedir is /var/abs/local/cpan by default, but you can adjust this and most other parameters in a configuration file).
5) Then it will gather all necessary data from the apppropriate CPANPLUS::Backend object to write a PKGBUILD.
6) Optionally it can also build the package by calling makepkg (but only if called by a normal user). The script will not install the package, though.
There is even a plugin to the cpanp shell offering the same functionality, so from within that shell you can type

/makepkg Some::Module

The current version is usable and has been tested to a good extent but still in beta stage. Before submitting it to general enjoyment I would kindly ask interested developers/users to test it, make comments and report bugs, misfeatures or otherwise.

I have set up a repository will all necessary packages (yeah, the perl-cpanplus package depends on 14 CPAN packages (!) that are not in the Arch repos -- but as I said, they should be integrated to the Perl core rather soon).
Add these lines to your /etc/pacman.conf:

[cpanplus]
Server = http://ankabut.net/archlinux/cpanplus/os/i686

and do

pacman -Sy perl-cpanplus-pacman

This will also install perl-cpanplus and all its dependencies.

All PKGBUILDs and the tarball for perl-cpanplus-pacman are available here: http://ankabut.net/archlinux/cpanplus/c … src.tar.gz

Type "cpan4pacman --help" for detailed usage information... Or type "/? makepkg" from within the cpanp shell. Manpages also exist, but they are not yet as complete...

Greetings to all,

Firmicus

PS: Related Matters...

In the process I have realized that the build script in most PKGBUILDs based on CPAN available on ABS could be slightly improved. I think every build() function should look like this:

build() {
  cd  $startdir/src/$_srcname-$pkgver
  # Force module installation to "current" perl directories
  # next line thanks to Jan de Groot
  eval `perl -V:archname`
  /usr/bin/perl Makefile.PL 
      INSTALLARCHLIB=/usr/lib/perl5/current/${archname} 
      INSTALLSITELIB=/usr/lib/perl5/site_perl/current 
      INSTALLSITEARCH=/usr/lib/perl5/site_perl/current/${archname}
  /usr/bin/make || return 1
  /usr/bin/make DESTDIR=$startdir/pkg install
  # remove perllocal.pod and .packlist
  find $startdir/pkg/usr/lib/ -name '.packlist' -exec rm  '{}' ';'
  find $startdir/pkg/usr/lib/ -name 'perllocal.pod' -exec rm  '{}' ';'
}

The problem with unwanted empty dirs can be solved by simply stating

options=(NOEMPTYDIRS)

NB: This is not (yet) documented in the makepkg manpage. It tells makepkg to do:
find $startdir/pkg -mindepth 1 -type d -empty -exec rmdir '{}' ;

For the license entry I have

license=(GPL or Artistic)

Is this OK? Or is it Arch's convention to go with GPL only here?

Offline

#2 2006-04-30 13:20:46

PeteMo
Member
From: H'Burg, VA
Registered: 2006-01-26
Posts: 191
Website

Re: ANNOUNCING perl-cpanplus-pacman

this looks really interesting.  I'll have to check it out.  However, I get an error 403 forbidden with your link:http://ankabut.net/archlinux/cpanplus/src/

Offline

#3 2006-04-30 13:36:09

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: ANNOUNCING perl-cpanplus-pacman

Looking good, Firmicus. I'll try it our over the next few days.

A couple of inital comments:
- Step 3, where the repos are checked to see if the package already exists, would need to include the AUR as well - there are a lot of perl PKGBUILDs there already.
- Interesting comments about the existing PKGBUILDs. Standardisation along your suggested lines would be a very good thing, IMO.

Offline

#4 2006-04-30 16:55:20

Cerebral
Forum Fellow
From: Waterloo, ON, CA
Registered: 2005-04-08
Posts: 3,108
Website

Re: ANNOUNCING perl-cpanplus-pacman

Agree with Tomk - standardization of a group of similarily-built packages is an important thing.  This is why we have seperate CVS/SVN and Java packaging guidelines in the Wiki.

I'd suggest taking a look at our existing Arch Packaging Standards wiki page, along with the CVS/SVN and Java pages (linked from the standards page) and perhaps authoring a CPAN package guidelines page to go with them.

Increasing the overall package quality is a good thing. big_smile

Also, the cpan4pacman script is a great idea, good work.  I remember being quite confused when I first started making packages because one I wanted to write depended on a couple of cpan modules that weren't in the official repos and I had no idea how to package those up, so I decided not to make a real package for it.  Mind you, I can't for the life of me remember what that app was back then; I doubt I use it anymore for that matter.

Offline

#5 2006-04-30 17:29:44

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

Re: ANNOUNCING perl-cpanplus-pacman

pmo6022 wrote:

this looks really interesting.  I'll have to check it out.  However, I get an error 403 forbidden with your link:http://ankabut.net/archlinux/cpanplus/src/

Yes, I've seen that, sorry. There seems to be a problem with the permissions on the server of my ISP. You can access the files, though, but  the contents of directories can't be seen. I'll try to fix that asaic.

tomk wrote:

Looking good, Firmicus. I'll try it our over the next few days.
A couple of inital comments:
- Step 3, where the repos are checked to see if the package already exists, would need to include the AUR as well - there are a lot of perl PKGBUILDs there already.

I thought about it already, but I doubt whether this would be useful. First the PKGBUILDs in AUR/unsupported are unlikely to be any different or for that matter better than those generated by cpan4pacman, whereas with the latter you are certain to have the latest version. What might make sense in a future version would be to have the option to fetch the PKGBUILDs from AUR so that you can compare it with the one generated by cpan4pacman.

- Interesting comments about the existing PKGBUILDs. Standardisation along your suggested lines would be a very good thing, IMO.

Yes. Actually I think it could be a good idea to have, besides the PKGBUILD.proto already provided by Arch, a repertoire of officially recommended PKGBUILD templates for various types of packages. Of course one can always browse through the ABS tree to find out, but in the course of my work I realized that at least in the case of perl stuff, there were a lot of different build scripts, some of which turned out to be incorrect (I filed bug reports for those I saw and they have been very quickly corrected by Jan de Groot, I must say). In any case, some Standardization is certainly a virtue to strive for here.

Offline

#6 2006-04-30 17:48:18

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

Re: ANNOUNCING perl-cpanplus-pacman

Cerebral wrote:

Agree with Tomk - standardization of a group of similarily-built packages is an important thing.  This is why we have seperate CVS/SVN and Java packaging guidelines in the Wiki.

I'd suggest taking a look at our existing Arch Packaging Standards wiki page, along with the CVS/SVN and Java pages (linked from the standards page) and perhaps authoring a CPAN package guidelines page to go with them.

OK, I might take care of that when I have some time. The wiki you mention goes along the lines of what I wrote above. I'll have a look.

Also, the cpan4pacman script is a great idea, good work.  I remember being quite confused when I first started making packages because one I wanted to write depended on a couple of cpan modules that weren't in the official repos and I had no idea how to package those up, so I decided not to make a real package for it.  Mind you, I can't for the life of me remember what that app was back then; I doubt I use it anymore for that matter.

I think I forgot to mention in my initial post that my script takes care of all dependencies, recursively. You can disable this with --noprereqs if you just want one PKGBUILD. (NB: right now the cpanp shell plugin does not handle dependencies, because I simply forgot :? ... It should be in the next version.)

Offline

#7 2006-05-04 19:45:57

hypermegachi
Member
Registered: 2004-07-25
Posts: 311

Re: ANNOUNCING perl-cpanplus-pacman

~: cpan4pacman --help
YAML Error: Couldn't open /home/user/.cpanplus/cpan4pacman.yml for output:nBad file descriptor
Code: YAML_DUMP_ERR_FILE_OUTPUT
at /usr/bin/cpan4pacman line 27
Compilation failed in require at /usr/bin/cpan4pacman line 27, <> line 52.
BEGIN failed--compilation aborted at /usr/bin/cpan4pacman line 27, <> line 52

Offline

#8 2006-05-04 20:32:29

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

Re: ANNOUNCING perl-cpanplus-pacman

hypermegachi wrote:

~: cpan4pacman --help
YAML Error: Couldn't open /home/user/.cpanplus/cpan4pacman.yml for output:nBad file descriptor
Code: YAML_DUMP_ERR_FILE_OUTPUT
at /usr/bin/cpan4pacman line 27
Compilation failed in require at /usr/bin/cpan4pacman line 27, <> line 52.
BEGIN failed--compilation aborted at /usr/bin/cpan4pacman line 27, <> line 52

FIXED: Sorry, I blindly assumed the user would have configured cpanplus before, so that the directory ~/.cpanplus would automatically exist. Now the directory is created if necessary, and a warning is issued to invite the user to configure cpanplus (not necessary but recommended). As a workaround until I upload this bugfix just type

 
mkdir .cpanplus

in your home directory and everything should work fine.

UPDATE: Version 0.1c is now available on my repository.
Above problem has been fixed. Also dependencies are handled more intelligently now.

Offline

#9 2006-05-05 19:49:55

hypermegachi
Member
Registered: 2004-07-25
Posts: 311

Re: ANNOUNCING perl-cpanplus-pacman

it appears that your program needs to download source packages to /home/francois

i had to create a new directory to get the script working.  it seems to be working so far... i'm trying to install svk right now cuz the one in community is broken (missing a whole bunch of module dependencies)

EDIT:  hmmm, SVK didn't work...said that i needed Archive::Zip or something, and it kinda just froze there

Offline

#10 2006-05-05 20:46:05

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

Re: ANNOUNCING perl-cpanplus-pacman

hypermegachi wrote:

it appears that your program needs to download source packages to /home/francois

Oops again! but I've located the problem. When I built perl-cpanplus on my system it subrepticely located and saved a copy of my already installed  configuration file CPANPLUS/Config.pm into the package! I fixed the PKGBUILD and the new version 0.061-3 is now clean of all that.

To configure cpanplus you have to type cpanp to enter the cpanplus shell and from there type 's reconfigure'. That way you would also overwrite the file Config.pm which got integrated by mistake to the previous version...

Offline

#11 2006-05-05 21:09:09

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

Re: ANNOUNCING perl-cpanplus-pacman

hypermegachi wrote:

EDIT:  hmmm, SVK didn't work...said that i needed Archive::Zip or something, and it kinda just froze there

I just ran "cpan4pacman --nobuild SVK" ...
Thanks man! that's heavy duty testing!!

It works on my system, but I realize that I do have Archive::Zip available.
EDIT: Install perl-archive-zip from community
I don't know why this is needed. CPANPLUS does not list it as a dependency. EDIT: As far as I can see this is a bug or at least a misfeature of Archive::Extract. It relies too much on the option 'prefer_bin' which is false by default with CPANPLUS, so it tries to extract by means of Archive::ZIP instead of /usr/bin/unzip , but when the former is not available it should certainly check the latter possibility instead of exiting with an error message. (I'll fill a bug report on that)

Anyhow, processing SVK with cpan4pacman generated a bunch of PKGBUILDs on my machine. Yet after generating successfully 12 PKGBUILDs out of 18 cpan4pacman stopped with an error at Pod::Simple because this module lists a bogus requirement 'Config'. I'll fix the handling of such problematic dependencies so that they are skipped with a warning instead of stopping with an error message.

EDIT: See further below

Offline

#12 2006-05-06 00:08:17

stavrosg
Member
From: Rhodes, Greece
Registered: 2005-05-01
Posts: 330
Website

Re: ANNOUNCING perl-cpanplus-pacman

I get this error:

failed downloading /archlinux/cpanplus/os/i686/perl-object-accessor-0.12-1.pkg.tar.gz from ankabut.net: HTTP/1.1 404 Not Found

and obviously, the installation fails (argh!)

Offline

#13 2006-05-06 09:54:47

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

Re: ANNOUNCING perl-cpanplus-pacman

stavrosg wrote:

I get this error:

failed downloading /archlinux/cpanplus/os/i686/perl-object-accessor-0.12-1.pkg.tar.gz from ankabut.net: HTTP/1.1 404 Not Found

and obviously, the installation fails (argh!)

FIXED: I'm very sorry, it seems I had forgotten to upload this one...  :oops:

Offline

#14 2006-05-06 17:38:46

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

Re: ANNOUNCING perl-cpanplus-pacman

/hypermegachi: Again thanks for giving me the opportunity to test cpan4pacman with argument "SVK".
I was thus able to purge several bugs and optimize the code considerably.

As you can see in the next posting, two of the modules required by SVK  have themselves bogus dependencies (Pod::Simple requires 'Config' -- which you can probably ignore -- and SVN::Mirror requires SVN::Core, which does not exist on CPAN and looks more serious. You should contact the maintainer of SVK for help on that wink


/everyone:

VERSION 0.2 IS NOW AVAILABLE

      * Improved handling of dependencies
      * Bogus dependencies are removed from the prereqs hash so they don't annoy us again
      * Added option --forceinstalled to force processing an already installed module and avoid it otherwise
      * Documented option --basedir
      * Optimized fetching and extracting of tarballs from CPAN
      * Fixed verbosity passed to Archive::Extract via CPANPLUS::Internals::Extract
      * Overwriting an already present PKGBUILD is only possible with option --force
      * New options are automatically inserted in config file ~/.cpanplus/cpan4pacman.yml


As an illustration of how cpan4pacman works, see the next posting.

Offline

#15 2006-05-06 21:37:08

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

Re: ANNOUNCING perl-cpanplus-pacman

Here is an example of cpan4pacman, version 0.2, in action (excerpts only):

$ cpan4pacman --nobuild --basedir '/home/francois/tmp' SVK
Processing module SVK
[MSG] Checking if source files are up to date
[MSG] Retrieving /home/francois/.cpanplus/sourcefiles.2.15.stored
[MSG] Trying to get 'ftp://cpan.noris.de/pub/CPAN/authors/id/C/CL/CLKAO/CHECKSUMS'
[MSG] Checksum matches for 'SVK-1.07.tar.gz'
[MSG] Fetched to /home/francois/.cpanplus/authors/id/C/CL/CLKAO/SVK-1.07.tar.gz
[MSG] Extracted to /home/francois/tmp/perl-svk/src/SVK-1.07
PKGBUILD for package perl-svk generated successfully
This module lists following dependencies:
                Algorithm::Annotate (stacked)
                Algorithm::Diff (stacked)
                Class::Autouse (stacked)
                Clone (stacked)
                Data::Hierarchy (stacked)
                Date::Parse (ignored -- perl-timedate already in Arch repos)
                Encode (core module ignored)
                File::Temp (core module ignored)
                File::Type (stacked)
                Getopt::Long (core module ignored)
                IO::Digest (stacked)
                PerlIO::eol (stacked)
                PerlIO::via::dynamic (stacked)
                PerlIO::via::symlink (stacked)
                Pod::Escapes (stacked)
                Pod::Simple (stacked)
                Regexp::Shellish (stacked)
                SVN::Mirror (stacked)
                SVN::Simple::Edit (stacked)
                URI (ignored -- perl-uri already in Arch repos)
                YAML (ignored -- already available on system)

Processing dependency Algorithm::Annotate
[MSG] Trying to get 'ftp://cpan.noris.de/pub/CPAN/authors/id/C/CL/CLKAO/CHECKSUMS'
[MSG] Checksum matches for 'Algorithm-Annotate-0.10.tar.gz'
[MSG] Fetched to /home/francois/.cpanplus/authors/id/C/CL/CLKAO/Algorithm-Annotate-0.10.tar.gz
[MSG] Extracted to /home/francois/tmp/perl-algorithm-annotate/src/Algorithm-Annotate-0.10
PKGBUILD for package perl-algorithm-annotate generated successfully
This module lists following dependencies:
                Algorithm::Diff (already stacked)

<...>

Processing dependency Pod::Simple
[MSG] Trying to get 'ftp://cpan.noris.de/pub/CPAN/authors/id/A/AR/ARANDAL/CHECKSUMS'
[MSG] Checksum matches for 'Pod-Simple-3.04.tar.gz'
[MSG] Fetched to /home/francois/.cpanplus/authors/id/A/AR/ARANDAL/Pod-Simple-3.04.tar.gz
[MSG] Extracted to /home/francois/tmp/perl-pod-simple/src/Pod-Simple-3.04
[ERROR] Couldn't find module object for prerequisite 'Config' -- skipping

PKGBUILD for package perl-pod-simple generated successfully
This module lists following dependencies:
                Carp (already ignored)
                Cwd (core module ignored)
                File::Basename (core module ignored)
                File::Find (core module ignored)
                File::Spec (already ignored)
                Pod::Escapes (already stacked)
                Symbol (core module ignored)
                Text::Wrap (core module ignored)
                constant (core module ignored)
                integer (core module ignored)
                overload (core module ignored)
                strict (core module ignored)

<...>

Processing dependency SVN::Mirror
[MSG] Trying to get 'ftp://cpan.noris.de/pub/CPAN/authors/id/C/CL/CLKAO/CHECKSUMS'
[MSG] Checksum matches for 'SVN-Mirror-0.68.tar.gz'
[MSG] Fetched to /home/francois/.cpanplus/authors/id/C/CL/CLKAO/SVN-Mirror-0.68.tar.gz
[MSG] Extracted to /home/francois/tmp/perl-svn-mirror/src/SVN-Mirror-0.68
[ERROR] Couldn't find module object for prerequisite 'SVN::Core' -- skipping

PKGBUILD for package perl-svn-mirror generated successfully
This module lists following dependencies:
                Class::Accessor (stacked)
                Date::Format (ignored -- perl-timedate already in Arch repos)
                File::chdir (stacked)
                SVN::Simple::Edit (already stacked)
                Term::ReadKey (ignored -- perl-term-readkey already in Arch repos)
                URI::Escape (ignored -- perl-uri already in Arch repos)

<...>

Offline

#16 2006-05-08 20:25:04

hypermegachi
Member
Registered: 2004-07-25
Posts: 311

Re: ANNOUNCING perl-cpanplus-pacman

hmmm, got some new problems sad
i deleted .cpanplus from my home directory, and did the "s reconfigure" with cpanp, and created a new file in my home directory, and i said no to have it autoconfigure everything.

when i type to get SVK, here's the list of errors i get:

[hypermegachi@archlinux ~]$ cpan4pacman SVK
Processing module SVK
[MSG] Checking if source files are up to date
[MSG] Updating source file '01mailrc.txt.gz'
[ERROR] Could not create directory '/authors': mkdir /authors: Permission denied at /usr/lib/perl5/site_perl/5.8.8/CPANPLUS/Internals/Fetch.pm line 129

[MSG] Could not create path '/authors'
[ERROR] Couldn't fetch '01mailrc.txt.gz'

[MSG] Unable to update source, attempting to get away with using old source file!
[MSG] Updating source file '03modlist.data.gz'
[ERROR] Could not create directory '/modules': mkdir /modules: Permission denied at /usr/lib/perl5/site_perl/5.8.8/CPANPLUS/Internals/Fetch.pm line 129

[MSG] Could not create path '/modules'
[ERROR] Couldn't fetch '03modlist.data.gz'

[MSG] Unable to update source, attempting to get away with using old source file!
[MSG] Updating source file '02packages.details.txt.gz'
[ERROR] Could not create directory '/modules': mkdir /modules: Permission denied at /usr/lib/perl5/site_perl/5.8.8/CPANPLUS/Internals/Fetch.pm line 129

[MSG] Could not create path '/modules'
[ERROR] Couldn't fetch '02packages.details.txt.gz'

[MSG] Unable to update source, attempting to get away with using old source file!
[MSG] Rebuilding author tree, this might take a while
Key 'archive' (/01mailrc.txt.gz) is of invalid type for 'Archive::Extract::new' provided by CPANPLUS::Internals::Source::__create_author_tree at /usr/lib/perl5/site_perl/5.8.8/CPANPLUS/Internals/Source.pm line 632
[MSG] Rebuilding module tree, this might take a while
Key 'archive' (/03modlist.data.gz) is of invalid type for 'Archive::Extract::new' provided by CPANPLUS::Internals::Source::__create_dslip_tree at /usr/lib/perl5/site_perl/5.8.8/CPANPLUS/Internals/Source.pm line 854
Key 'archive' (/02packages.details.txt.gz) is of invalid type for 'Archive::Extract::new' provided by CPANPLUS::Internals::Source::_create_mod_tree at /usr/lib/perl5/site_perl/5.8.8/CPANPLUS/Internals/Source.pm line 718
[MSG] Checking if source files are up to date
[MSG] Updating source file '01mailrc.txt.gz'
[ERROR] Could not create directory '/authors': mkdir /authors: Permission denied at /usr/lib/perl5/site_perl/5.8.8/CPANPLUS/Internals/Fetch.pm line 129

[MSG] Could not create path '/authors'
[ERROR] Couldn't fetch '01mailrc.txt.gz'

[MSG] Unable to update source, attempting to get away with using old source file!
[MSG] Updating source file '03modlist.data.gz'
[ERROR] Could not create directory '/modules': mkdir /modules: Permission denied at /usr/lib/perl5/site_perl/5.8.8/CPANPLUS/Internals/Fetch.pm line 129

[MSG] Could not create path '/modules'
[ERROR] Couldn't fetch '03modlist.data.gz'

[MSG] Unable to update source, attempting to get away with using old source file!
[MSG] Updating source file '02packages.details.txt.gz'
[ERROR] Could not create directory '/modules': mkdir /modules: Permission denied at /usr/lib/perl5/site_perl/5.8.8/CPANPLUS/Internals/Fetch.pm line 129

[MSG] Could not create path '/modules'
[ERROR] Couldn't fetch '02packages.details.txt.gz'

[MSG] Unable to update source, attempting to get away with using old source file!
[MSG] Rebuilding author tree, this might take a while
Key 'archive' (/01mailrc.txt.gz) is of invalid type for 'Archive::Extract::new' provided by CPANPLUS::Internals::Source::__create_author_tree at /usr/lib/perl5/site_perl/5.8.8/CPANPLUS/Internals/Source.pm line 632
[MSG] Rebuilding module tree, this might take a while
Key 'archive' (/03modlist.data.gz) is of invalid type for 'Archive::Extract::new' provided by CPANPLUS::Internals::Source::__create_dslip_tree at /usr/lib/perl5/site_perl/5.8.8/CPANPLUS/Internals/Source.pm line 854
Key 'archive' (/02packages.details.txt.gz) is of invalid type for 'Archive::Extract::new' provided by CPANPLUS::Internals::Source::_create_mod_tree at /usr/lib/perl5/site_perl/5.8.8/CPANPLUS/Internals/Source.pm line 718
[ERROR] 'SVK' does not contain an author part

[ERROR] Cannot find 'SVK' in the module tree

Exiting subroutine via next at /usr/bin/cpan4pacman line 247.

Offline

#17 2006-05-08 22:51:37

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: ANNOUNCING perl-cpanplus-pacman

hypermegachi - during 's reconfigure', you should have seen a warning about setting the PERL5_CPANPLUS_CONFIG enviroment variable. That needs to point to your new config file.

Firmicus - I finally got around to trying this, and it's way cool - thanks! I've a few comments about the generated PKGBUILD, which looks like this:

# This PKGBUILD was generated by the CPANPLUS::Dist::Pacman plugin
# Maintainer: open.tom@gmail.com
# Contributor: Generated by the CPANPLUS::Dist::Pacman plugin
pkgname=perl-dbd-sqlite
pkgver=1.12
pkgrel=1
pkgdesc="DBD::SQLite"
url="http://search.cpan.org/~MSERGEANT/DBD-SQLite-1.12.tar.gz"
depends=('perl' 'perl-dbi>=1.21')
makedepends=('')
license="Artistic or GPL"
# options=(NOEMPTYDIRS)
source=(http://www.cpan.org/authors/id/M/MS/MSERGEANT/DBD-SQLite-1.12.tar.gz) 
md5sums=('40b1d208d70d5d8cab7723df96fc239c')

build() {
  cd  $startdir/src/DBD-SQLite-$pkgver
  eval `perl -V:archname`
  # Force module installation to "current" perl directories.
  /usr/bin/perl Makefile.PL 
      INSTALLARCHLIB=/usr/lib/perl5/current/${archname} 
      INSTALLSITELIB=/usr/lib/perl5/site_perl/current 
      INSTALLSITEARCH=/usr/lib/perl5/site_perl/current/${archname}
  /usr/bin/make || return 1
  /usr/bin/make DESTDIR=$startdir/pkg install
  # remove perllocal.pod, .packlist, and empty dirs:
  /usr/bin/find $startdir/pkg -name '.packlist' -exec rm  '{}' ;
  /usr/bin/find $startdir/pkg -name 'perllocal.pod' -exec rm  '{}' ;
  # this works better than options=(NOEMPTYDIRS):
  /usr/bin/find $startdir/pkg -depth -type d -empty -exec rmdir '{}' ;
  }

- The Contributor tag format is

 Contributor: Name <email>

- Ideally, pkgdesc should be more descriptive e.g. for the DBD::SQLite example, I use the text provided in CPAN - 'Self Contained RDBMS in a DBI Driver'.
- The guidelines for the LICENSE field are here. As Artistic is not one of Arch's standard licenses, you would have to include it as a Custom license with every package, in which case the format would be

license=('Custom' 'GPL')

I think it might be simpler to go with GPL only.
- We use the $pkgver variable in the source field e.g.

DBD-SQLite-$pkgver.tar.gz

- You have a variable called archname, which is assigned the value 'i686-linux-thread-multi'. In the Arch environment, is it not always going to be that? If so, you should hard-code it.
- If options=(NOEMPTYDIRS) improves enough to do the job for you, use it - until then take it out.
- And finally, a very small point - the final } should not be indented.

Looking forward to the next release. smile

Offline

#18 2006-05-09 13:54:21

hypermegachi
Member
Registered: 2004-07-25
Posts: 311

Re: ANNOUNCING perl-cpanplus-pacman

tomk, thanks for the tip, didn't see that (maybe i should read READMEs more tongue)

anyways, after reading it, i just went with the global config file cuz i was too lazy to type it out and set the environment variable big_smile

anyways, got svk built and working.  thanks!  i think this script needs to go into community/aur!

Offline

#19 2006-05-09 21:52:17

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

Re: ANNOUNCING perl-cpanplus-pacman

/tomk : thanks a lot for these very useful comments!

I have taken every single point you raised into account and they will be reflected in the next release 0.2.1.

Some further comments though:
* The $archname variable gets its value through the line

eval `perl -V:archname`

This was suggested to me on FlySpray by Jan de Groot. That way we are sure the PKGBUILD will also work with future versions of Perl (in case the archname changes) and also on Arch64 and even perhaps on other distros that use Pacman (for which we do not care of course  wink ).

* Concerning the description field: it turns out that in the CPAN databases culled by cpan and cpanplus, only a minority of modules have proper descriptions, weirdly enough. In such cases, cpan4pacman displays the name of the module instead. But you inspired me to add a few lines to my script to effectively retrieve the description line that is displayed on search.cpan.org or kobesearch.cpan.org. Try this for example:

use LWP::Simple; 
use XML::XPath;
my $pkgname = "DBD-SQLite";
my $url = "http://search.cpan.org/search?mode=dist&format=xml&query=$pkgname";
my $xmlinfo = LWP::Simple::get($url);
my $xp = XML::XPath->new( xml => $xmlinfo );
my $xpath = '//*[name="' . $pkgname . '"]/description';
my $xpdesc = $xp->find($xpath);
$pkgdesc = $xpdesc->string_value;
print "The description for $pkgname is:n$pkgdesc";

Easy, no?

* OK the license will now be GPL only.

* I've taken out the NOEMPTYDIRS option (for the moment).

* The maintainer entry is now taken from /etc/makepkg.conf

$maintainer = `source /etc/makepkg.conf && echo $PACKAGER`

The useless 'contributor' line is removed.

* I've also fixed the url field, which was incorrect.

Again, thanks for your comments, tomk!

/hypermegachi: Glad my script was useful, despite being beta-staged!

Now I have included a simple install script in the perl-cpanplus package that displays information about configuration. I've also marked the .../CPANPLUS/Config.pm file in the 'backup' array, so that it doesnt get overwritten with the next update. (But back it up to your ~/.cpanplus directory, just in case smile )

Offline

#20 2006-05-10 00:03:35

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

Re: ANNOUNCING perl-cpanplus-pacman

Version 0.2.1 is out
- Now missing descriptions are fetched directly from search.cpan.org.

- PKGBUILD template was polished, thanks to tomk's comments. See previous message for details.

Offline

#21 2006-05-29 10:22:16

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: ANNOUNCING perl-cpanplus-pacman

I've just used this "in production" for the first time - perl-dbd-sqlite above was a test - so here are a few more comments.

After entering this command:

cpan4pacman WWW::SMS::IE::iesms --basedir builds

The script proceeded to build two packages - perl-o2sms, which provides the WWW::SMS::IE::iesms module, and perl-testgen4web-runner, which provides the additional TestGen4Web::Runner module required. Here's the output from the build, and as you can see, perl-o2sms was built as expected under ./builds, the basedir specified on the command line, but perl-testgen4web-runner was built under ./builds/perl-o2sms/builds. I accept that they have a dependency relationship, but that's taken care of in the PKGBUILDs. I'd prefer all builds to use the same basedir.

You could also take another look at the way the dependencies are created in the PKGBUILDs. Here are the two from this exercise:

# This PKGBUILD was generated by cpan4pacman via CPANPLUS::Dist::Pacman
# Maintainer: 
pkgname=perl-o2sms
pkgver=3.12
pkgrel=1
pkgdesc="WWW::SMS::IE::iesms"
url="http://search.cpan.org/~MACKERS/o2sms"
depends=('perl' 'perl-crypt-ssleay' 'perl-io-socket-ssl' 'perl-net-ssleay' 'perl-testgen4web-runner>=0.07' 'perl-uri>=1.26')
makedepends=('perl')
license="GPL"
source=(http://www.cpan.org/authors/id/M/MA/MACKERS/o2sms-$pkgver.tar.gz) 
md5sums=('820d75a8c0d2e9a90b1e5792362a7b77')

build() {
  cd  $startdir/src/o2sms-$pkgver
  eval `perl -V:archname`
  # Force module installation to "current" perl directories.
  /usr/bin/perl Makefile.PL 
      INSTALLARCHLIB=/usr/lib/perl5/current/${archname} 
      INSTALLSITELIB=/usr/lib/perl5/site_perl/current 
      INSTALLSITEARCH=/usr/lib/perl5/site_perl/current/${archname}
  /usr/bin/make || return 1
  /usr/bin/make DESTDIR=$startdir/pkg install
  # remove perllocal.pod, .packlist, and empty dirs:
  /usr/bin/find $startdir/pkg -name '.packlist' -exec rm  '{}' ;
  /usr/bin/find $startdir/pkg -name 'perllocal.pod' -exec rm  '{}' ;
  /usr/bin/find $startdir/pkg -depth -type d -empty -exec rmdir '{}' ;
}
# This PKGBUILD was generated by cpan4pacman via CPANPLUS::Dist::Pacman
# Maintainer: 
pkgname=perl-testgen4web-runner
pkgver=0.07
pkgrel=1
pkgdesc="TestGen4Web::Runner"
url="http://search.cpan.org/~MACKERS/TestGen4Web-Runner"
depends=('perl' 'perl-libwww' 'perl-libwww' 'perl-uri' 'perl-xml-simple')
makedepends=('perl')
license="GPL"
source=(http://www.cpan.org/authors/id/M/MA/MACKERS/TestGen4Web-Runner-$pkgver.tar.gz) 
md5sums=('e690f8782224d50f92bacd6e690b2152')

build() {
  cd  $startdir/src/TestGen4Web-Runner-$pkgver
  eval `perl -V:archname`
  # Force module installation to "current" perl directories.
  /usr/bin/perl Makefile.PL 
      INSTALLARCHLIB=/usr/lib/perl5/current/${archname} 
      INSTALLSITELIB=/usr/lib/perl5/site_perl/current 
      INSTALLSITEARCH=/usr/lib/perl5/site_perl/current/${archname}
  /usr/bin/make || return 1
  /usr/bin/make DESTDIR=$startdir/pkg install
  # remove perllocal.pod, .packlist, and empty dirs:
  /usr/bin/find $startdir/pkg -name '.packlist' -exec rm  '{}' ;
  /usr/bin/find $startdir/pkg -name 'perllocal.pod' -exec rm  '{}' ;
  /usr/bin/find $startdir/pkg -depth -type d -empty -exec rmdir '{}' ;
}

'perl' is not needed in the depends array, as all perl modules listed already depend on perl. SImilarly, perl-io-socket-ssl depends on perl-net-ssleay, perl-libwww depends on perl-uri, etc - in other words, it is only necessary to add the last link in the deps chain to the array. The second PKGBUILD shows perl-libwww in depends twice. And finally, as perl is already a dependency, it does not need to be included in makedepends.

I hope some of that's useful. Let me know if you need more details.

Offline

#22 2006-05-31 21:39:09

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

Re: ANNOUNCING perl-cpanplus-pacman

Hi Tomk

Thanks again for your useful comments. I'll have a look at the points you raise as soon as I can. Concerning the --basedir issue it seems I had naively assumed an absolute path here, so it'll be easy to fix. The depends array at this stage is more or less a reflection of the dependencies stated in the CPAN distribution, so making it more "intelligent" will still require some work.

I intend to upload perl-cpanplus-pacman and its dependencies to AUR in the near future. So one day it may perhaps end up in community...

Cheers,
F

Offline

#23 2006-06-07 20:14:43

PieterO
Member
From: Belgium
Registered: 2004-03-03
Posts: 27

Re: ANNOUNCING perl-cpanplus-pacman

When I try to run cpan4pacman I get this error

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_COLLATE = "C",
        LANG = "en_US.utf8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Use of uninitialized value in substitution (s///) at /usr/lib/perl5/5.8.8/File/Spec/Unix.pm line 59.
Use of uninitialized value in substitution (s///) at /usr/lib/perl5/5.8.8/File/Spec/Unix.pm line 60.
Use of uninitialized value in string eq at /usr/lib/perl5/5.8.8/File/Spec/Unix.pm line 61.
Use of uninitialized value in substitution (s///) at /usr/lib/perl5/5.8.8/File/Spec/Unix.pm line 61.
Use of uninitialized value in substitution (s///) at /usr/lib/perl5/5.8.8/File/Spec/Unix.pm line 62.
Use of uninitialized value in substitution (s///) at /usr/lib/perl5/5.8.8/File/Spec/Unix.pm line 63.
Use of uninitialized value in string eq at /usr/lib/perl5/5.8.8/File/Spec/Unix.pm line 64.
Use of uninitialized value in substitution (s///) at /usr/lib/perl5/5.8.8/File/Spec/Unix.pm line 64.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/5.8.8/File/Spec/Unix.pm line 65.
YAML Error: Couldn't open /home/pieter/.cpanplus/ for output:nBad file descriptor
   Code: YAML_DUMP_ERR_FILE_OUTPUT
 at /usr/bin/cpan4pacman line 27
Compilation failed in require at /usr/bin/cpan4pacman line 27.
BEGIN failed--compilation aborted at /usr/bin/cpan4pacman line 27.

There are off course the warnings about the locale but I don't think that's the problem. And I did a quick look to change the locale but couldn't find anything

Offline

#24 2006-06-08 15:54:45

Firmicus
Forum Fellow
From: Germany
Registered: 2006-02-28
Posts: 168

Re: ANNOUNCING perl-cpanplus-pacman

PieterO wrote:

When I try to run cpan4pacman I get this error

YAML Error: Couldn't open /home/pieter/.cpanplus/ for output:nBad file descriptor

It appears the subdirectory .cpanplus in your home does not exist. Did you configure cpanplus before running cpan4pacman? In principle you should have seen the following warning:

***************************************************
It seems you have not configured CPANPLUS yet.
This is not necessary but recommended, for instance 
to set your nearest CPAN mirrors. Type 'cpanp' to 
enter the cpanplus shell and type 's reconfigure' 
from there. We suggest you choose to set the config 
file as '$cpanplusdir/config', but 
if you prefer to use the system-wide Config.pm    
then you will have to run cpanp as super-user. 
************************************************

but in any case ~/.cpanplus/ should have been created by the script.
Do you have the latest version?

Offline

#25 2006-06-08 20:32:27

PieterO
Member
From: Belgium
Registered: 2004-03-03
Posts: 27

Re: ANNOUNCING perl-cpanplus-pacman

It appears the subdirectory .cpanplus in your home does not exist. Did you configure cpanplus before running cpan4pacman? In principle you should have seen the following warning:

Yes, I configured it before I ran cpan4pacman

Do you have the latest version?

I added your repo yesterday and pacman'ed your program afterwards. So if your repo is up to date I think I have the latest version.

If you need more info, feel free to ask.

Offline

Board footer

Powered by FluxBB