How to make PET packages of NPM, PERL and Python packages?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

How to make PET packages of NPM, PERL and Python packages?

#1 Post by sc0ttman »

I have tried using installwatch, new2dir and various other scripts,
as well as parsing various log files, but to no avail.

Haven't tried inotify yet, not sure it's what I need..

I googled around, but can't find what I'm looking for:
A func or script that can package up a CPAN, NPM or PIP module as a .tar.gz..

Basically I would love to be able to do:

Code: Select all

new2dir cpan install <module-name>
new2dir pip install <module-name>
new2dir npm install <module-name>
or

Code: Select all

pip2pet pip install <package-name>

Code: Select all

cpan2pet cpan install <module-name>

Code: Select all

npm2pet npm install <package-name>
.. and others..

Code: Select all

gem2pet gem install <package-name>
...etc...

Can anyone point me in the right direction please?
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#2 Post by musher0 »

Hello sc0ttman.

If I may:

I don't know about the other formats, but the CPAN for perl scripts has to
be one of the best automated installation procedures in the Linux world.

CPAN even has a wonderful update sub-routine that will update
automatically your perl installation on your Puppy when you fetch a new
perl module. (I wish that PPM or even apt-get would be as efficient and
worry free...)

IMO, you do not need to create pet packages for those modules. Simply
explain in length, as best you can, to the user how to install the needed
perl modules, and that should be enough. Perl's CPAN will do the rest.

My 2¢. IHTH.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#3 Post by sc0ttman »

IMO, you do not need to create pet packages for those modules. Simply
explain in length, as best you can, to the user how to install the needed
perl modules, and that should be enough. Perl's CPAN will do the rest.
Not really what I'm asking for but thanks.

Does anyone know how does Woof-CE (or other distro/pkg building stuff) create
native (pet/deb/rpm/txz/etc) packages of the extra CPAN, PIP etc?

dir2pet, new2dir and others fail for me..

Anyone know what can wrap cpan and pip odules up into PET packages?

src2pkg, maybe?
.. would like a lightweight solution if poss..

I'm know I could fill a pinstall.sh script with cpan cmds and make a 'meta' PET
package, but I'm looking for a way to pkg up cpan and pip stuff into PETs,
so that I can add them to a remastered SFS and have them installed at boot....
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#4 Post by amigo »

search for 'cpan2tgz' to get a handle on what needs to be done -there is/was also a cpan2rpm out there.

Here's my reference build with src2pkg:

Code: Select all

#!/bin/bash
## src2pkg script for: 	perl
## src2pkg Copyright 2005-2010 Gilbert Ashley <amigo@ibilio.org>
#

SOURCE_NAME='perl-5.14.0.tar.xz'
NAME='perl'
VERSION='5.14.0'
# ARCH='${ARCH}'
# BUILD='1'
BUILD=3 # Pass 1 of toolchain rebuild
BUILD=4 # release build
# PRE_FIX='usr'

# Any extra options go here
DOCLIST='AUTHORS README Copying'
ALLOW_EMPTY_FILES="YES"
AUTO_PATCH=NO

# PATCHLIST=''
# STD_FLAGS=''

# Get the functions and configs
. /usr/libexec/src2pkg/FUNCTIONS ;

# do_all_processes can substitute these 16 steps:

pre_process
find_source
make_dirs
unpack_source
fix_source_perms

# configure_source

EXTRA_FLAGS=''
STD_FLAGS="$(echo $OPTIM_FLAGS $MACHINE $TUNE_FLAGS |white_out)"
LIB_PATH="/usr/local/lib${LIBDIRSUFFIX} /usr/lib${LIBDIRSUFFIX} /lib${LIBDIRSUFFIX}"

cd $SRC_DIR;

if [[ "$ARCH" = "x86_64" ]] ; then
  # adapted from "Cross Linux From Scratch"
  # Configure must be told to also use lib64:
  patch -p1 < $CWD/perl.configure.multilib.patch
  # "perl -V" should report that libc is in /lib64
  sed -i -e '/libc/s#/lib/#/lib64/#' hints/linux.sh
  # make perl use lib64:
  echo 'installstyle="lib64/perl5"' >>hints/linux.sh
fi

if [[ "$QUIET" = "YES" ]] ; then
 echo -n $BLUE"Running Configure script - "$NORMAL
 #./Configure $CONFIG_OPTIONS &> /dev/null
  ./Configure -de \
  -Dprefix=/usr \
  -Dcccdlflags='-fPIC' \
  -Dinstallprefix=/usr \
  -Dlibpth="${LIB_PATH}" \
  -Doptimize="${STD_FLAGS}" \
  -Dusethreads -Duseithreads \
  -Dpager='/usr/bin/less -isr' \
  -Dinc_version_list='5.10.0' \
  -Darchname=${ARCH}-linux &> /dev/null
else
 echo $BLUE"Running Configure script - "$NORMAL
 #./Configure $CONFIG_OPTIONS
 ./Configure -de \
  -Dprefix=/usr \
  -Dcccdlflags='-fPIC' \
  -Dinstallprefix=/usr \
  -Dlibpth="${LIB_PATH}" \
  -Doptimize="${STD_FLAGS}" \
  -Dusethreads -Duseithreads \
  -Dpager='/usr/bin/less -isr' \
  -Dinc_version_list='5.10.0' \
  -Darchname=${ARCH}-linux
fi
if [[ $? -eq 0 ]] ; then
 echo $GREEN"Done"$NORMAL
else
 echo $RED"FAILED configuration!"$NORMAL
 exit
fi

# Kludge for gcc-4.2.4's needlessly changed output:
cat makefile | grep -v '\<command-line\>' > makefile.tmp
mv makefile.tmp makefile
cat x2p/makefile | grep -v '\<command-line\>' > makefile.tmp
mv makefile.tmp x2p/makefile

compile_source
fake_install

( cd $PKG_DIR/usr/bin ; ln -sf perl${VERSION} perl )

fix_pkg_perms
strip_bins
create_docs
compress_man_pages
make_description
make_doinst
make_package
post_process

# src2pkg - Copyright 2005-2007  Gilbert Ashley <amigo@ibiblio.org>
## See the documentation for more help and examples. Below are some of
# the most common Extras and Options for easy cut-and-paste use.
# EXTRA_CONFIGS='' PRE_FIX='' DOCLIST=''
# MAKE_COMMAND='' INSTALL_LINE='' 
# SHELL_INSTALL='YES' CORRECT_PERMS='NO'
You could also look at this:
http://distro.ibiblio.org/amigolinux/do ... ite-5.8.8/
BTW, don't be fooled that microperl would be smaller than miniperl/perllite microperl is larger and can't load modules.

Here's one more example for perl-html-parser using src2pkg:

Code: Select all

#!/bin/bash
## src2pkg script for: 	perl-html-parser
## Auto-generated by src2pkg-2.6
## src2pkg - Copyright 2005-2011 Gilbert Ashley <amigo@ibilio.org>

SOURCE_NAME='HTML-Parser-3.68.tar.gz'
ALT_NAME='perl-html-parser'
VERSION='3.68'   # Use ALT_VERSION to override guessed value
# ARCH=''
# BUILD='1'
# PRE_FIX='usr'
# Any extra options go here:
# EXTRA_CONFIGS=""
INSTALL_FAIL=JAIL
ADD_REQS=perl,perl-html-tagset

# Optional function replaces configure_source, compile_source, fake_install
# To use, uncomment and write/paste CODE between the {} brackets.
# build() { CODE }

# Get the functions and configs
. /usr/libexec/src2pkg/FUNCTIONS ;

# Execute the named packaging steps:
pre_process
find_source
make_dirs
unpack_source
fix_source_perms
configure_source #
compile_source   # If used, the 'build' function replaces these 3
fake_install     #
fix_pkg_perms
strip_bins
create_docs
compress_man_pages
make_description
make_doinst
make_package
post_process

As you can see, no special options are needed if you have the sources -except that you need:
INSTALL_FAIL=JAIL
for nearly all perl modules. What this means is that src2pkg cannot use the 'JAIL' option during fake_install.

Here's a pip2tgz also:
https://slackbuilds.org/repository/14.2 ... t/pip2tgz/

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#5 Post by sc0ttman »

Brilliant, thanks very much :)
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
battleshooter
Posts: 1378
Joined: Wed 14 May 2008, 05:10
Location: Australia

#6 Post by battleshooter »

For those weird ones you can't use DESTDIR on, I use Porg (Paco's successor)
[url=http://www.murga-linux.com/puppy/viewtopic.php?t=94580]LMMS 1.0.2[/url], [url=http://www.murga-linux.com/puppy/viewtopic.php?t=94593]Ardour 3.5.389[/url], [url=http://www.murga-linux.com/puppy/viewtopic.php?t=94629]Kdenlive 0.9.8[/url]

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#7 Post by sc0ttman »

Thanks for the info, I never used either of those...

Will have a download .. If I can't find a shell only (dep free) solution, it looks like it would fit perfect..

I'm essentially trying to write some cpan2dir and pip2dir funcs for Pkg which
will reliably download modules, compile them if needed and use something
like INSTALLDIR to put the file generated into a dir... ready to be packaged up..
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

Post Reply