diff --git a/package/import/cpan/config.in b/package/import/cpan/config.in new file mode 100644 index 000000000..f468b26e0 --- /dev/null +++ b/package/import/cpan/config.in @@ -0,0 +1,30 @@ +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/import/cpan/config.in +# ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at http://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- + +if pkgcheck cpan X +then + menu_begin MENU_CPAN 'CPAN Packages' + . package/import/cpan/hosted_cpan.cfg + pkgremove cpan + menu_end +fi + diff --git a/package/import/cpan/cpan.conf b/package/import/cpan/cpan.conf new file mode 100644 index 000000000..0399b1d3b --- /dev/null +++ b/package/import/cpan/cpan.conf @@ -0,0 +1,85 @@ +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/import/cpan/cpan.conf +# ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at http://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- + +cpanmod="" + +# see if this is a hosted package +. $confdir/hosted_cpan.sel + +if [ -z "$cpanmod" -a "$ROCK_BUILD_TARGET" != 1 ] +then + cpan_getsrc() { + echo_status "Fetching $cpanbase/$cpanloc." + mkdir -p $builddir/archdir + + if ! wget -q -O $builddir/archdir/cpansrc.tar.gz $cpanbase/$cpanloc; then + echo_error "Downloading $cpanbase/$cpanloc failed!" + exit 1 + fi + } + srctar=cpansrc.tar.gz + taropt="--use-compress-program=gzip -xf" + hook_add prepare 2 cpan_getsrc + + pdetails=$base/download/mirror/0/02packages.details.txt.bz2 + cpanbase=http://www.cpan.org/modules/by-authors/id + + read cpanmod cpanver cpanloc < <( + bzip2 -d < $pdetails | perl -le ' + my $xpkg = "'"$xpkg"'"; + $xpkg =~ s/^cpan-//; + + while (<>) { + chomp; + last if $_ =~ /^\s*$/; + } + + while (<>) { + my ($mod, $ver, $loc) = split /\s+/; + + my $xmod = $mod; + $xmod =~ y/A-Z/a-z/; + $xmod =~ s/::/-/g; + + next unless $xmod eq $xpkg; + print "$mod $ver $loc"; + } + ') + + echo_status "MOD=$cpanmod VER=$cpanver LOC=$cpanloc" +fi + +if [ -z "$cpanmod" ]; then + echo_error "Can't resolve cpan module name for $xpkg!" + exit 1 +fi + +cpan_getdesc() { + desc_I= desc_T= desc_A= + if [ -n "$cpanbase" ]; then + desc_D="X $cpanbase/$cpanloc" + fi + parse_desc <( bash $confdir/getdesc.sh $1 ) +} + +hook_add postinstall 8 "cpan_getdesc $cpanmod" + diff --git a/package/import/cpan/cpan.desc b/package/import/cpan/cpan.desc new file mode 100644 index 000000000..b72b28425 --- /dev/null +++ b/package/import/cpan/cpan.desc @@ -0,0 +1,42 @@ + +[COPY] --- ROCK-COPYRIGHT-NOTE-BEGIN --- +[COPY] +[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch. +[COPY] Please add additional copyright information _after_ the line containing +[COPY] the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +[COPY] the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +[COPY] +[COPY] ROCK Linux: rock-src/package/import/cpan/cpan.desc +[COPY] ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf +[COPY] +[COPY] This program is free software; you can redistribute it and/or modify +[COPY] it under the terms of the GNU General Public License as published by +[COPY] the Free Software Foundation; either version 2 of the License, or +[COPY] (at your option) any later version. A copy of the GNU General Public +[COPY] License can be found at Documentation/COPYING. +[COPY] +[COPY] Many people helped and are helping developing ROCK Linux. Please +[COPY] have a look at http://www.rocklinux.org/ and the Documentation/TEAM +[COPY] file for details. +[COPY] +[COPY] --- ROCK-COPYRIGHT-NOTE-END --- + +[I] A CPAN import package + +[T] This package has been imported from CPAM using the cpan import +[T] package. See package package filelist and perldoc for details. + +[A] See perldoc +[M] Clifford Wolf + +[C] extra/base + +[L] OpenSource +[S] Stable +[V] 0000 +[P] O -----5---9 200.000 + +[D] X 02packages.details.txt.gz http://www.cpan.org/modules/ + +#include package/import/cpan/hosted_cpan.desc + diff --git a/package/import/cpan/getdesc.sh b/package/import/cpan/getdesc.sh new file mode 100644 index 000000000..3379d3b0c --- /dev/null +++ b/package/import/cpan/getdesc.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +pmfile= +for x in \ + /usr/lib/perl*/*/${1//::/\/}.pm \ + /usr/lib/perl*/*/*/${1//::/\/}.pm \ + /usr/lib/perl*/*/*/*/${1//::/\/}.pm +do + if [ -z "$pmfile" -a -f $x ]; then + pmfile="$x" + fi +done + +if [ -z "$pmfile" ]; then + echo "No *.pm file for $1 found." + exit +fi + +get_pm_desc() +{ + gawk ' + BEGIN { state = 0; } + $1 == "=head1" && state != 0 { state = 0; } + $1 == "=head1" && $2 == "'"$1"'" { state = 1; next; } + $1 != "" && state == 1 { state = 2; } + $1 == "" && state == 2 { state = 0; } + state == 2 { print; } + ' < $pmfile +} + +{ + get_pm_desc NAME | perl -pe 's,^.*?- *,[I] ,' | head -1 + get_pm_desc DESCRIPTION | fmt | perl -pe 's,^,[T] ,' + get_pm_desc AUTHORS | perl -pe 's,^,[A] ,' +} | perl -pe 's///>/ig;' + diff --git a/package/import/cpan/hosted_cpan.cfg b/package/import/cpan/hosted_cpan.cfg new file mode 100644 index 000000000..a48178321 --- /dev/null +++ b/package/import/cpan/hosted_cpan.cfg @@ -0,0 +1,35 @@ +# Auto-generated by hosted_cpan.pl from hosted_cpan.txt + +bool 'Building package Clone (cpan-clone)' ROCKCFG_PKG_CPAN_CLONE 1 +if [ $ROCKCFG_PKG_CPAN_CLONE = 1 ]; then pkgfork cpan cpan-clone priority ; fi + +bool 'Building package Data::Hierarchy (cpan-data-hierarchy)' ROCKCFG_PKG_CPAN_DATA_HIERARCHY 1 +if [ $ROCKCFG_PKG_CPAN_DATA_HIERARCHY = 1 ]; then pkgfork cpan cpan-data-hierarchy priority ; fi + +bool 'Building package HTTP::DAV (cpan-http-dav)' ROCKCFG_PKG_CPAN_HTTP_DAV 1 +if [ $ROCKCFG_PKG_CPAN_HTTP_DAV = 1 ]; then pkgfork cpan cpan-http-dav priority ; fi + +bool 'Building package PerlIO::via::dynamic (cpan-perlio-via-dynamic)' ROCKCFG_PKG_CPAN_PERLIO_VIA_DYNAMIC 1 +if [ $ROCKCFG_PKG_CPAN_PERLIO_VIA_DYNAMIC = 1 ]; then pkgfork cpan cpan-perlio-via-dynamic priority ; fi + +bool 'Building package Pod::Escapes (cpan-pod-escapes)' ROCKCFG_PKG_CPAN_POD_ESCAPES 1 +if [ $ROCKCFG_PKG_CPAN_POD_ESCAPES = 1 ]; then pkgfork cpan cpan-pod-escapes priority ; fi + +bool 'Building package Pod::Simple (cpan-pod-simple)' ROCKCFG_PKG_CPAN_POD_SIMPLE 1 +if [ $ROCKCFG_PKG_CPAN_POD_SIMPLE = 1 ]; then pkgfork cpan cpan-pod-simple priority ; fi + +bool 'Building package Regexp::Shellish (cpan-regexp-shellish)' ROCKCFG_PKG_CPAN_REGEXP_SHELLISH 1 +if [ $ROCKCFG_PKG_CPAN_REGEXP_SHELLISH = 1 ]; then pkgfork cpan cpan-regexp-shellish priority ; fi + +bool 'Building package SVK (cpan-svk)' ROCKCFG_PKG_CPAN_SVK 1 +if [ $ROCKCFG_PKG_CPAN_SVK = 1 ]; then pkgfork cpan cpan-svk priority ; fi + +bool 'Building package SVN::Mirror (cpan-svn-mirror)' ROCKCFG_PKG_CPAN_SVN_MIRROR 1 +if [ $ROCKCFG_PKG_CPAN_SVN_MIRROR = 1 ]; then pkgfork cpan cpan-svn-mirror priority ; fi + +bool 'Building package SVN::Simple::Edit (cpan-svn-simple)' ROCKCFG_PKG_CPAN_SVN_SIMPLE 1 +if [ $ROCKCFG_PKG_CPAN_SVN_SIMPLE = 1 ]; then pkgfork cpan cpan-svn-simple priority ; fi + +bool 'Building package YAML (cpan-yaml)' ROCKCFG_PKG_CPAN_YAML 1 +if [ $ROCKCFG_PKG_CPAN_YAML = 1 ]; then pkgfork cpan cpan-yaml priority ; fi + diff --git a/package/import/cpan/hosted_cpan.desc b/package/import/cpan/hosted_cpan.desc new file mode 100644 index 000000000..e791927b6 --- /dev/null +++ b/package/import/cpan/hosted_cpan.desc @@ -0,0 +1,57 @@ +# Auto-generated by hosted_cpan.pl from hosted_cpan.txt + +#if xpkg == cpan-clone +[V] 0.15 +[D] 0 Clone-0.15.tar.gz http://www.cpan.org/modules/by-authors/id/R/RD/RDF/ +#endif + +#if xpkg == cpan-data-hierarchy +[V] 0.18 +[D] 0 Data-Hierarchy-0.18.tar.gz http://www.cpan.org/modules/by-authors/id/C/CL/CLKAO/ +#endif + +#if xpkg == cpan-http-dav +[V] 0.31 +[D] 0 HTTP-DAV-0.31.tar.gz http://www.cpan.org/modules/by-authors/id/P/PC/PCOLLINS/ +#endif + +#if xpkg == cpan-perlio-via-dynamic +[V] 0.02 +[D] 0 PerlIO-via-dynamic-0.02.tar.gz http://www.cpan.org/modules/by-authors/id/C/CL/CLKAO/ +#endif + +#if xpkg == cpan-pod-escapes +[V] 1.04 +[D] 0 Pod-Escapes-1.04.tar.gz http://www.cpan.org/modules/by-authors/id/S/SB/SBURKE/ +#endif + +#if xpkg == cpan-pod-simple +[V] 3.02 +[D] 0 Pod-Simple-3.02.tar.gz http://www.cpan.org/modules/by-authors/id/S/SB/SBURKE/ +#endif + +#if xpkg == cpan-regexp-shellish +[V] 0.93 +[D] 0 Regexp-Shellish-0.93.tar.gz http://www.cpan.org/modules/by-authors/id/R/RB/RBS/ +#endif + +#if xpkg == cpan-svk +[V] 0.16 +[D] 0 SVK-0.16.tar.gz http://www.cpan.org/modules/by-authors/id/C/CL/CLKAO/ +#endif + +#if xpkg == cpan-svn-mirror +[V] 0.37 +[D] 0 SVN-Mirror-0.37.tar.gz http://www.cpan.org/modules/by-authors/id/C/CL/CLKAO/ +#endif + +#if xpkg == cpan-svn-simple +[V] 0.25 +[D] 0 SVN-Simple-0.25.tar.gz http://www.cpan.org/modules/by-authors/id/C/CL/CLKAO/ +#endif + +#if xpkg == cpan-yaml +[V] 0.35 +[D] 0 YAML-0.35.tar.gz http://www.cpan.org/modules/by-authors/id/I/IN/INGY/ +#endif + diff --git a/package/import/cpan/hosted_cpan.pl b/package/import/cpan/hosted_cpan.pl new file mode 100644 index 000000000..b3c5f10bf --- /dev/null +++ b/package/import/cpan/hosted_cpan.pl @@ -0,0 +1,108 @@ +#!/usr/bin/perl +# +# re-run this scrip if hosted_cpan.txt has changed +# generates hosted_cpan.{desc,sel,cfg} +# +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/import/cpan/hosted_cpan.pl +# ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at http://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- + +my $cpanbase="http://www.cpan.org/modules/by-authors/id"; + +my %hosted; + +open(F, "hosted_cpan.txt") || die $!; + +while () { + chomp; + next if /^#/ or /^\s*$/; + my ($p, $m) = split /\s+/; + $hosted{$m} = $p; +} + +close F; + +open(F, "bzip2 -d < ../../../download/mirror/0/02packages.details.txt.bz2 |") || die $!; +open(D, ">hosted_cpan.desc") || die $!; +open(S, ">hosted_cpan.sel") || die $!; +open(C, ">hosted_cpan.cfg") || die $!; + +print D "# Auto-generated by hosted_cpan.pl from hosted_cpan.txt\n"; +print S "# Auto-generated by hosted_cpan.pl from hosted_cpan.txt\n"; +print C "# Auto-generated by hosted_cpan.pl from hosted_cpan.txt\n"; + +print S "\ncase \"\$xpkg\" in\n"; +print D "\n"; print C "\n"; + +while () { + chomp; + last if $_ =~ /^\s*$/; +} + +while () { + my ($mod, $ver, $loc) = split /\s+/; + + next unless $loc=~/(.*\/)([^\/]+)/; + my ($d, $f) = ($1, $2); + + my $key = $mod; + goto matched if defined $hosted{$key}; + + foreach (keys %hosted) { + $key = $_; + goto matched if $mod =~ /^${key}::/; + } + next; + +matched: + my $xmod = $key; + $xmod =~ y/A-Z/a-z/; + $xmod =~ s/::/-/g; + + my $ymod = $key; + $ymod =~ y/a-z/A-Z/; + $ymod =~ s/::/_/g; + + print "$key -> $mod -> cpan-$xmod\n"; + delete $hosted{$key}; + + print D "#if xpkg == cpan-$xmod\n"; + print D "[V] $ver\n"; + print D "[D] 0 $f $cpanbase/$d\n"; + print D "#endif\n\n"; + + $f =~ s/\.gz$/.bz2/; + print S "\tcpan-$xmod)\n"; + print S "\t\tcpanmod=\"$mod\"\n"; + print S "\t\tcpanver=\"$ver\"\n"; + print S "\t\tcpanloc=\"$loc\"\n"; + print S "\t\tsrctar=\"$f\"\n"; + print S "\t\t;;\n"; + + print C "bool 'Building package $mod (cpan-$xmod)' ROCKCFG_PKG_CPAN_$ymod 1\n"; + print C "if [ \$ROCKCFG_PKG_CPAN_$ymod = 1 ]; then pkgfork cpan cpan-$xmod priority $hosted{$mod}; fi\n\n"; +} + +print S "esac\n\n"; + +close D; close S; +close F; close C; + diff --git a/package/import/cpan/hosted_cpan.sel b/package/import/cpan/hosted_cpan.sel new file mode 100644 index 000000000..5c519d723 --- /dev/null +++ b/package/import/cpan/hosted_cpan.sel @@ -0,0 +1,71 @@ +# Auto-generated by hosted_cpan.pl from hosted_cpan.txt + +case "$xpkg" in + cpan-clone) + cpanmod="Clone" + cpanver="0.15" + cpanloc="R/RD/RDF/Clone-0.15.tar.gz" + srctar="Clone-0.15.tar.bz2" + ;; + cpan-data-hierarchy) + cpanmod="Data::Hierarchy" + cpanver="0.18" + cpanloc="C/CL/CLKAO/Data-Hierarchy-0.18.tar.gz" + srctar="Data-Hierarchy-0.18.tar.bz2" + ;; + cpan-http-dav) + cpanmod="HTTP::DAV" + cpanver="0.31" + cpanloc="P/PC/PCOLLINS/HTTP-DAV-0.31.tar.gz" + srctar="HTTP-DAV-0.31.tar.bz2" + ;; + cpan-perlio-via-dynamic) + cpanmod="PerlIO::via::dynamic" + cpanver="0.02" + cpanloc="C/CL/CLKAO/PerlIO-via-dynamic-0.02.tar.gz" + srctar="PerlIO-via-dynamic-0.02.tar.bz2" + ;; + cpan-pod-escapes) + cpanmod="Pod::Escapes" + cpanver="1.04" + cpanloc="S/SB/SBURKE/Pod-Escapes-1.04.tar.gz" + srctar="Pod-Escapes-1.04.tar.bz2" + ;; + cpan-pod-simple) + cpanmod="Pod::Simple" + cpanver="3.02" + cpanloc="S/SB/SBURKE/Pod-Simple-3.02.tar.gz" + srctar="Pod-Simple-3.02.tar.bz2" + ;; + cpan-regexp-shellish) + cpanmod="Regexp::Shellish" + cpanver="0.93" + cpanloc="R/RB/RBS/Regexp-Shellish-0.93.tar.gz" + srctar="Regexp-Shellish-0.93.tar.bz2" + ;; + cpan-svk) + cpanmod="SVK" + cpanver="0.16" + cpanloc="C/CL/CLKAO/SVK-0.16.tar.gz" + srctar="SVK-0.16.tar.bz2" + ;; + cpan-svn-mirror) + cpanmod="SVN::Mirror" + cpanver="0.37" + cpanloc="C/CL/CLKAO/SVN-Mirror-0.37.tar.gz" + srctar="SVN-Mirror-0.37.tar.bz2" + ;; + cpan-svn-simple) + cpanmod="SVN::Simple::Edit" + cpanver="0.25" + cpanloc="C/CL/CLKAO/SVN-Simple-0.25.tar.gz" + srctar="SVN-Simple-0.25.tar.bz2" + ;; + cpan-yaml) + cpanmod="YAML" + cpanver="0.35" + cpanloc="I/IN/INGY/YAML-0.35.tar.gz" + srctar="YAML-0.35.tar.bz2" + ;; +esac + diff --git a/package/import/cpan/hosted_cpan.txt b/package/import/cpan/hosted_cpan.txt new file mode 100644 index 000000000..0be2223fb --- /dev/null +++ b/package/import/cpan/hosted_cpan.txt @@ -0,0 +1,11 @@ +200.000 Regexp::Shellish +200.000 PerlIO::via::dynamic +200.000 YAML +200.000 Clone +200.000 Data::Hierarchy +200.000 HTTP::DAV +200.000 Pod::Escapes +200.000 Pod::Simple +200.000 SVN::Simple +200.000 SVN::Mirror +200.000 SVK diff --git a/package/import/cpan/pkgmapper.in b/package/import/cpan/pkgmapper.in new file mode 100644 index 000000000..40d34b3e1 --- /dev/null +++ b/package/import/cpan/pkgmapper.in @@ -0,0 +1,5 @@ + +if [ -z "${pkg##cpan-*}" ]; then + pkg=cpan +fi + diff --git a/scripts/Build-Pkg b/scripts/Build-Pkg index 27cbbcd80..7f0cd34d3 100755 --- a/scripts/Build-Pkg +++ b/scripts/Build-Pkg @@ -461,7 +461,7 @@ declare -a badfiles_desc # ---- Read various config files # -parse_desc $pkg +parse_desc $confdir/$pkg.desc ver="`echo "$desc_V" | tail -n 1 | cut -f1 -d' '`" extraver="`echo "$desc_V" | tail -n 1 | cut -s -f2- -d' '`" diff --git a/scripts/functions b/scripts/functions index a95c55f62..306a3594c 100644 --- a/scripts/functions +++ b/scripts/functions @@ -319,12 +319,14 @@ postflist_static_lib() { parse_desc() { tag="`grep '^\[' $base/Documentation/Developers/PKG-DESC-FORMAT | \ sed 's, (\*),,; s,\] \[,|,g; s,\[,,; s,\],,;'`" - descfile="$( pkg="$pkg" xpkg="$xpkg" descparser < $confdir/$1.desc )" + descfile="$( pkg="$pkg" xpkg="$xpkg" descparser < $1 )" for tag in $tag ; do tagdata="`echo "$descfile" | egrep "^\[($tag)\]" | \ - cut -f2- -d']' | sed 's,^ ,,'`" + cut -f2- -d']' | sed 's,^ ,,'`" tag="`echo $tag | cut -f1 -d'|' | tr - _`" - eval "desc_$tag=\"\$tagdata\"" + if eval "[ -z \"\$desc_$tag\" ]"; then + eval "desc_$tag=\"\$tagdata\"" + fi done }