From: gnublin Date: Wed, 21 Jun 2017 12:30:26 +0000 (+0200) Subject: gnublin X-Git-Tag: sysd2sysv_0.1-1~12 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/projects.git/commitdiff_plain/9f900ca37096790daab2fd817144badd826c2708?hp=91e0fccb96d28028d78ea41e34c1990585048d3b gnublin --- diff --git a/tools/cpan2deb b/tools/cpan2deb new file mode 100755 index 0000000..8d43bf8 --- /dev/null +++ b/tools/cpan2deb @@ -0,0 +1,105 @@ +#!/bin/bash +set -e + +function process_lib { + pushd ~/locallib 1>/dev/null + if [ $(ls lib/p*/ |wc -w) -eq 1 ] + then + # seems to be arichtecturalsub dir + arch_dir=$(ls lib/p*/) + cd lib/p*/ + mv $arch_dir/* . + rmdir $arch_dir + cd ../.. + fi + + # check, if there is a real archtecturel depandence + shared_lib=$(find . -name "*.so") + if [ -n "$shared_lib" ] + then + arch=$(arch) + fi + popd 1>/dev/null + mv ~/locallib/lib $name/usr/ +} + +usage="cpan2deb " + +if [ $# -ne 1 ]; then + echo $usage + exit 1 +fi + +#cd $HOME +if [ -d locallib ]; then + rm -rf locallib +fi +#if [ -d build ]; then +# rm -rf build +#fi + +start_dir=$(pwd) + +echo "call CPAN ..." +cpan -m $1 1>$start_dir/cpan.out 2>&1 || (echo "cpan failed"; exit 1) + +# find build directory +mname=$1 +name=lib${mname/::/-}-perl +name=${name,,*} +builddir=$(ls -rtd ~/.cpan/build/*/ |tail -1) + +pushd $builddir 1>/dev/null + perl Makefile.PL INSTALL_BASE="~/locallib" + make + make install 1>>~/cpan.out 2>&1 + echo "Module $1 installed to ~/locallib, output written to $start_dir/cpan.out" +popd 1>/dev/null + +arch=all + +# move locallib content +mkdir -p $name/usr/ + +for dir in $(ls ~/locallib); do + case $dir in + lib) process_lib + ;; + share) mv ~/locallib/share $name/usr/ + ;; + man) mv ~/locallib/man $name/usr/ + ;; + esac +done + +# check version +export PERL5LIB="$start_dir/$name/usr/lib/perl5:$PERL5LIB" +version=$(perl -M$mname -e 'print $ARGV[0]->VERSION' $mname) + +arch_name="" +if [ "$arch" != "all" ] +then + arch_name="_$arch" + if [ "$arch" = "i686" ] + then + # i686-Paketarchitektur gibt es nicht + arch="i386" + fi +fi + +mkdir -p $name/DEBIAN +cat << EOF >$name/DEBIAN/control +Package: $name +Version: $version +Section: base +Priority: optional +Architecture: $arch +Depends: +Maintainer: WagnerTech UG +Description: $1 perl modul +EOF + +fakeroot dpkg-deb --build $name +cp $name.deb ${name}_$version$arch_name.deb +echo "${name}_$version$arch_name.deb erstellt." + diff --git a/tools/make/configure b/tools/make/configure index 3dfa084..6d8a67f 100755 --- a/tools/make/configure +++ b/tools/make/configure @@ -88,13 +88,14 @@ then fi # copy package control -control=$(find src -name $paket.control) +control=$(find -L src -name $paket.control) +build_number=${build#*_} if [ -z "$control" ] then echo "warning: control file not found" echo " this file is necessary for any package production." else - sed "s/%BUILD%/$build/" $control |sed "s/%ARCH%/$ARCH/" >$paket.control + sed "s/%BUILD%/$build_number/" $control |sed "s/%ARCH%/$ARCH/" >$paket.control echo "$paket.control written." # extract version @@ -102,7 +103,7 @@ else fi # check for copy file -copy=$(find src -name $paket.cp) +copy=$(find -L src -name $paket.cp) if [ -n "$copy" ] then ln -sf $copy .