RPerl

 view release on metacpan or  search on metacpan

script/rperl_installer.sh  view on Meta::CPAN

            S perl -MCPAN -e 'install App::cpanminus'

        elif [ $PERL_INSTALL_CHOICE == 'd' ] || [ $PERL_INSTALL_CHOICE == 'system' ]; then

            echo '21d. [[[ LINUX, INSTALL SYSTEM-WIDE SYSTEM PERL & CPANM ]]]'
            if [[ "$OS_CHOICE" == "ubuntu" ]]; then
                VERIFY_UBUNTU
                echo '[ Install Perl & CPANM ]'
                S apt-get install perl cpanminus
                echo '[ Check Install, Confirm No Errors ]'
                S apt-get -f install
            # OR
            elif [[ "$OS_CHOICE" == "centos" ]]; then
                VERIFY_CENTOS 
                echo '[ Install Perl & CPANM Dependencies ]'
                S yum install perl-core perl-libs perl-devel perl-CPAN curl
                echo '[ Install CPANM System-Wide ]'
                S 'curl -L http://cpanmin.us | perl - --sudo App::cpanminus'
                if [ $DEVELOPER_CHOICE == 'yes' ]; then
                    echo '[ Check Install, Confirm No Errors; WARNING! MAY TAKE HOURS TO RUN! ]'
                    S yum check
                fi
            fi
        else
            echo "ERROR: Unrecognized value for PERL_INSTALL_CHOICE, '${PERL_INSTALL_CHOICE}', please see '--help' option for valid values"
        fi
    elif [ $MACHINE_CHOICE == '1' ] || [ $MACHINE_CHOICE == 'existing' ]; then
        echo "Nothing To Do On Existing Machine!"
    fi
    CURRENT_SECTION_COMPLETE
fi

# SECTION 22 VARIABLES
# overwrites previous settings, makes it easier to copy-and-paste from LAMP_installer.sh to rperl_installer.sh
EDITOR='__EMPTY__'
USERNAME='__EMPTY__'

if [ $SECTION_CHOICE -le 22 ] && [ $DEVELOPER_CHOICE != 'yes' ]; then
    echo  '22. [[[ LINUX, PACKAGE RPERL DEPENDENCIES ]]]'
    echo
    echo 'SKIPPING!  Developer Sections Disabled'
    echo
    CURRENT_SECTION_COMPLETE
elif [ $SECTION_CHOICE -le 22 ]; then
    echo  '22. [[[ LINUX, PACKAGE RPERL DEPENDENCIES ]]]'
    echo
    if [ $MACHINE_CHOICE == '0' ] || [ $MACHINE_CHOICE == 'new' ]; then

        # [[[ FPM ]]]
        # [[[ FPM ]]]
        # [[[ FPM ]]]
        # fpm, install deps
        if [[ "$OS_CHOICE" == "ubuntu" ]]; then
            VERIFY_UBUNTU
            S apt-get install ruby ruby-dev rubygems build-essential
        elif [[ "$OS_CHOICE" == "centos" ]]; then
            VERIFY_CENTOS
            S yum install ruby-devel gcc make rpm-build rubygems perl-generators
        fi

        S gem update --system  # must have RubyGems >= v2.7.5 to avoid "Errno::EPERM: Operation not permitted @ chown_internal" on `bundle install` for fpm dev version
        S cpan App::cpanminus

        # fpm, install release version
        S gem install --no-ri --no-rdoc fpm
        B which fpm
        B fpm --version
        B fpm --verbose -s cpan -t rpm ExtUtils::MakeMaker

# SRPM START HERE: to build source packages, figure out which parts to insert into spec file via --edit, BuildRequires & Obsoletes %build & %install & %check   https://src.fedoraproject.org/cgit/rpms/perl-IO-Compress.git/tree/perl-IO-Compress.spec
# SRPM START HERE: to build source packages, figure out which parts to insert into spec file via --edit, BuildRequires & Obsoletes %build & %install & %check   https://src.fedoraproject.org/cgit/rpms/perl-IO-Compress.git/tree/perl-IO-Compress.spec
# SRPM START HERE: to build source packages, figure out which parts to insert into spec file via --edit, BuildRequires & Obsoletes %build & %install & %check   https://src.fedoraproject.org/cgit/rpms/perl-IO-Compress.git/tree/perl-IO-Compress.spec

        B fpm --verbose --debug-workspace --edit --no-cpan-test -s cpan -t rpm IO::Compress::Gzip
        B rpm -qp --whatprovides ./perl-IO-Compress-2.081-1.noarch.rpm  # package not installed
        B rpm -q --whatprovides  perl-IO-Compress  # package installed
        B repoquery --provides perl-IO-Compress  # package installed or not

        # fpm, install dev version
        if [[ "$OS_CHOICE" == "ubuntu" ]]; then
            S apt-get install bsdtar
        elif [[ "$OS_CHOICE" == "centos" ]]; then
            S yum install bsdtar
        elif [[ "$OS_CHOICE" == "macosx" ]]; then
            VERIFY_MACOSX
            S xcode-select --install  # Mac OS 10.9 (Mavericks)
        fi

        S gem install bundler
        B mkdir -p ~/repos_github
#        B git clone git@github.com:jordansissel/fpm.git ~/repos_github/fpm-latest
        B git clone https://github.com/wbraswell/fpm.git ~/repos_github/fpm-fork-latest
        CD ~/repos_github/fpm-fork-latest
        S bundle install
            # OUTPUT: ... Using FOO (X.Y.Z)    Using fpm (X.Y.Z) from source at `.`    Using BAR (X.Y.Z) ...
        B make
        # ERRORS MAY OCCUR, it should work anyway
        B export PATH=~/repos_github/fpm-fork-latest/bin:$PATH
        B which fpm
        B fpm --version

        # fpm, build RPerl package w/out deps
        if [[ "$OS_CHOICE" == "ubuntu" ]]; then
            B reset; rm -Rf ~/cpantofpm_tmp/* ~/cpantofpm_packages/*; cd ~/cpantofpm_packages/; time fpm --no-cpan-test --cpan-verbose --verbose --debug-workspace --maintainer 'William N. Braswell, Jr. <william.braswell@NOSPAM.autoparallel.com>' --wo...
        elif [[ "$OS_CHOICE" == "centos" ]]; then
            B reset; rm -Rf ~/cpantofpm_tmp/* ~/cpantofpm_packages/*; cd ~/cpantofpm_packages/; time fpm --no-cpan-test --cpan-verbose --verbose --debug-workspace --maintainer 'William N. Braswell, Jr. <william.braswell@NOSPAM.autoparallel.com>' --wo...
        fi

        # [[[ FPM-Cookery ]]]
        # [[[ FPM-Cookery ]]]
        # [[[ FPM-Cookery ]]]
        S gem install bundler
        B mkdir -p ~/repos_github
        B git clone https://github.com/bernd/fpm-cookery.git ~/repos_github/fpm-cookery-latest
        CD ~/repos_github/fpm-cookery-latest
        S bundle install  # ignore warning about not running as root, must run as root for `sudo fpm-cook install-deps` to find facter.rb & other fpm-cookery runtime deps
        B rake spec --trace  # run tests, may seem frozen for 5 - 10 minutes
        B export PATH=~/repos_github/fpm-cookery-latest/bin:$PATH
        B which fpm-cook
        B fpm-cook --version

script/rperl_installer.sh  view on Meta::CPAN

#            B wget https://github.com/wbraswell/mongo-c-driver-mirror/raw/master/libmongoc-1.0-config.cmake
#            S mv ./libmongoc-1.0-config.cmake /lib64/cmake/libmongoc-1.0/libmongoc-1.0-config.cmake

            echo '[ Build RPerl Dependencies, MongoDB C++ Driver ]'
            S yum install cmake3

#            # DEV NOTE: prefer already-fixed tarball below
#            B wget https://github.com/mongodb/mongo-cxx-driver/archive/r3.2.0.tar.gz
#            S mv ./r3.2.0.tar.gz /root/rpmbuild/SOURCES/mongo-cxx-driver-3.2.0.tar.gz
#            CD /root/rpmbuild/SOURCES
#            S tar -xzvf mongo-cxx-driver-3.2.0.tar.gz
#            S mv mongo-cxx-driver-r3.2.0 mongo-cxx-driver-3.2.0
#            S rm mongo-cxx-driver-3.2.0.tar.gz
#            S tar -czvf mongo-cxx-driver-3.2.0.tar.gz ./mongo-cxx-driver-3.2.0
            # DEV NOTE: prefer our own already-fixed tarball below, for convenience
            B wget https://github.com/wbraswell/mongo-cxx-driver-mirror/raw/master/mongo-cxx-driver-3.2.0.tar.gz
            S mv ./mongo-cxx-driver-3.2.0.tar.gz /root/rpmbuild/SOURCES/mongo-cxx-driver-3.2.0.tar.gz
            CD /root/rpmbuild/SPECS
            S wget https://raw.githubusercontent.com/wbraswell/mongo-cxx-driver-mirror/master/mongo-cxx-driver.spec
            S rpmbuild -ba /root/rpmbuild/SPECS/mongo-cxx-driver.spec
            S rpm -i -vv /root/rpmbuild/RPMS/x86_64/mongo-cxx-driver-libs-3.2.0-1.el7.centos.x86_64.rpm
            S rpm -i -vv /root/rpmbuild/RPMS/x86_64/mongo-cxx-driver-3.2.0-1.el7.centos.x86_64.rpm
            S rpm -i -vv /root/rpmbuild/RPMS/x86_64/mongo-cxx-driver-devel-3.2.0-1.el7.centos.x86_64.rpm

            # DEV NOTE: copy our own pre-built packages into CPANtoFPM directory structure
            CD ~/cpantofpm_packages/SPECS/
            B wget https://github.com/wbraswell/mongo-cxx-driver-mirror/raw/master/mongo-cxx-driver.spec    
            CD ~/cpantofpm_packages/SRPMS/
            B wget https://github.com/wbraswell/mongo-cxx-driver-mirror/raw/master/mongo-cxx-driver-3.2.0-1.el7.centos.src.rpm
            CD ~/cpantofpm_packages/x86_64/
            B wget https://github.com/wbraswell/mongo-cxx-driver-mirror/raw/master/mongo-cxx-driver-libs-3.2.0-1.el7.centos.x86_64.rpm
            B wget https://github.com/wbraswell/mongo-cxx-driver-mirror/raw/master/mongo-cxx-driver-3.2.0-1.el7.centos.x86_64.rpm
            B wget https://github.com/wbraswell/mongo-cxx-driver-mirror/raw/master/mongo-cxx-driver-devel-3.2.0-1.el7.centos.x86_64.rpm
        fi

        # [[[ RPM, YUM REPOSITORY ]]]
        # [[[ RPM, YUM REPOSITORY ]]]
        # [[[ RPM, YUM REPOSITORY ]]]

        # server, install deps, RUN ONCE ONLY
        if [[ "$OS_CHOICE" == "ubuntu" ]]; then
            S apt-get install createrepo yum-utils gnupg2 gnupg-agent rng-tools
        elif [[ "$OS_CHOICE" == "centos" ]]; then
            S yum install createrepo yum-utils gnupg2 rng-tools
        fi

        # server, prepare to receive RPMs tarball
        S mkdir -p /srv/www/packages.rperl.org/public_html/centos/7/rperl
        CD /srv/www/packages.rperl.org/public_html/centos/7/rperl
        S rm -Rf DEPS SPECS SRPMS x86_64 *.tar.gz
        
        # packager machine, create & transfer RPMs tarball
        B ~/manual_packages_copy.sh
        CD ~/cpantofpm_packages
        B tar -czvf ./perl-RPerl-VERSION-1-RPM_ALL_DEPS.tar.gz ./*
        B scp ./perl-RPerl-VERSION-1-RPM_ALL_DEPS.tar.gz packages.rperl.org:/srv/www/packages.rperl.org/public_html/centos/7/rperl/

        # server, unpack RPMs tarball & set initial permissions
        CD /srv/www/packages.rperl.org/public_html/centos/7/rperl
        B tar -xzvf perl-RPerl-VERSION-1-RPM_ALL_DEPS.tar.gz
        S chown -R www-data.www-data /srv/www/packages.rperl.org/
        S chmod -R g+rwX,o-w /srv/www/packages.rperl.org/

        # server, generate & export & import GPG keys, RUN ONCE ONLY
        S rngd -r /dev/urandom
        B gpg2 --full-gen-key
            # William N. Braswell, Jr. (packages.rperl.org) <william.braswell@autoparallel.com>
        B gpg2 --list-keys
        B gpg2 --export --armor "William N. Braswell, Jr. (packages.rperl.org) <william.braswell@autoparallel.com>" > /srv/www/packages.rperl.org/public_html/centos/RPM-GPG-KEY-RPerl-7
        B less /srv/www/packages.rperl.org/public_html/centos/RPM-GPG-KEY-RPerl-7  # confirm key has been exported
        B rpmkeys --import /srv/www/packages.rperl.org/public_html/centos/RPM-GPG-KEY-RPerl-7
        B rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n'  # confirm key has been imported

        # server, prepare to sign RPMs, RUN ONCE ONLY
        B vi ~/.rpmmacros
            # %_signature gpg
            # %_gpg_name William N. Braswell, Jr. (packages.rperl.org) <william.braswell@autoparallel.com>
            # %_gpg_bin /usr/bin
            # %__gpg /usr/bin/gpg2

        # server, sign RPMs & confirm signed
        CD /srv/www/packages.rperl.org/public_html/centos/7/rperl
        B export GPG_TTY=$(tty)
        B rpmsign --addsign SRPMS/*.rpm x86_64/*.rpm
        B rpm -qpi SRPMS/*.rpm x86_64/*.rpm | grep Signature

        # server, create repo & sign repo metadata & confirm signed
        CD /srv/www/packages.rperl.org/public_html/centos/7/rperl/x86_64
        B rm -Rf ./repodata/
        B createrepo --verbose .
        B gpg2 --detach-sign --armor repodata/repomd.xml
        B less repodata/repomd.xml.asc

        # server, generate repo file, RUN ONCE ONLY
        B vi /srv/www/packages.rperl.org/public_html/centos7-perl-cpan.repo
            [centos7-perl-cpan]
            name=CentOS 7 Perl CPAN Repository
            baseurl=https://packages.rperl.org/centos/7/rperl/x86_64/
            enabled=1
            gpgcheck=1
            repo_gpgcheck=1
            gpgkey=https://packages.rperl.org/centos/RPM-GPG-KEY-RPerl-7

        # server, set final permissions
        S chown -R www-data.www-data /srv/www/packages.rperl.org/
        S chmod -R g+rwX,o-w /srv/www/packages.rperl.org/

        # [[[ DEB, APT REPOSITORY ]]]
        # [[[ DEB, APT REPOSITORY ]]]
        # [[[ DEB, APT REPOSITORY ]]]

# DEB START HERE: set up server, set up client, install
# DEB START HERE: set up server, set up client, install
# DEB START HERE: set up server, set up client, install

    elif [ $MACHINE_CHOICE == '1' ] || [ $MACHINE_CHOICE == 'existing' ]; then
        echo "Nothing To Do On Existing Machine!"
    fi
    CURRENT_SECTION_COMPLETE
fi

if [ $SECTION_CHOICE -le 23 ]; then
    echo '23. [[[ LINUX, INSTALL RPERL DEPENDENCIES ]]]'
    echo
    if [ $MACHINE_CHOICE == '0' ] || [ $MACHINE_CHOICE == 'new' ]; then
        echo '[ Overview Of RPerl Dependencies In This Section ]'
        echo '[ GCC: gcc & g++ Required For Compiling ]'
        echo '[ libc: libcrypt.(a|so) Required For Compiling ]'
        echo '[ libperl: libperl.(a|so) & perl.h etc, Required For Compiling ]'
        echo '[ openssl: err.h Required By RPerl Subdependency Net::SSLeay From IO::Socket::SSL From ... From Alien::* ]'
        echo '[ zlib: zlib.h Required By SDL.pm, Itself Required For Graphics In RPerl Applications ]'
        echo '[ GMP: GNU Multiple-Precision Arithmetic Library Required For Math ]'
        echo '[ GSL: GNU Scientific Library Required For Math ]'
        echo '[ Pluto polyCC: polycc Required For Parallel Compiling, Depends On texinfo flex bison ]'
        echo '[ AStyle: Artistic Style C++ Formatter, Required By RPerl Test Suite ]'
        echo '[ pkg-config: Compilation Library Detection Tool, Required By RPerl Support For MongoDB ]'
        echo '[ MongoDB Drivers: Both C & C++, Required By RPerl Support For MongoDB ]'
        echo

        # DEV NOTE: libperl packages in Ubuntu vs CentOS
        # Ubuntu, libperl-dev,  /usr/lib/x86_64-linux-gnu/libperl.so SYMLINK    /usr/lib/x86_64-linux-gnu/libperl.a REAL FILE
        # Ubuntu, libperl5.XX,  /usr/lib/x86_64-linux-gnu/libperl.so.5.XX.Y REAL FILE    /usr/lib/x86_64-linux-gnu/perl/5.26.0/CORE/perl.h  and other *.h *.so *.pm *.ph files
        # CentOS 7, perl-libs,  /usr/lib64/perl5/CORE/libperl.so
        # CentOS 7, perl-devel, /usr/lib64/perl5/CORE/perl.h     /usr/bin/h2xs  and other *.h files

        if [[ "$OS_CHOICE" == "ubuntu" ]]; then
            VERIFY_UBUNTU
            echo '[ Add Non-Base APT Repositories ]'
            S add-apt-repository \"deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse\"
            echo '[ Update APT Repositories ]'
            S apt-get update
            echo '[ Install RPerl Dependencies ]'
            S apt-get install g++ make libc6-dev perl libperl-dev libssl-dev zlib1g zlib1g-dev libgmp10 libgmpxx4ldbl libgmp-dev libgsl0-dev texinfo flex bison astyle

            echo '[ Install RPerl Dependencies, MongoDB C++ Driver Prerequisites, pkg-config ]'
            S apt-get install pkg-config

# DEB START HERE: build & use our own libbson & libmongoc & libmongocxx packages, remove use of Bionic repo below
# DEB START HERE: build & use our own libbson & libmongoc & libmongocxx packages, remove use of Bionic repo below
# DEB START HERE: build & use our own libbson & libmongoc & libmongocxx packages, remove use of Bionic repo below

            echo "[ Install RPerl Dependencies, MongoDB C & C++ Drivers; Must Use Latest libbson & libmongoc From Bionic v18.04 Repositories ]"
            echo "[ Install RPerl Dependencies, MongoDB C & C++ Drivers; In Xenial v16.04, Temporarily Replace All Occurrences Of 'xenial' With 'bionic' (Same For Other Non-Bionic Releases), Skip If Already Using Bionic Or Newer ]"
            S $EDITOR /etc/apt/sources.list
            echo "[ Install RPerl Dependencies, MongoDB C & C++ Drivers; Update To Bionic v18.04 Repositories, Skip If Already Using Bionic Or Newer ]"



( run in 0.491 second using v1.01-cache-2.11-cpan-71847e10f99 )