Project

General

Profile

« Previous | Next » 

Revision d68ad324

Added by Benoît PECCATTE over 6 years ago

Fixes #11855: Automatically package fusion dependencies

View differences:

rudder-agent/SOURCES/Makefile
PCRE_SHA1 = 3ab418d0026c2a4e693ec783bd60660debc32b8f
CPANMINUS_RELEASE = 1.7036
CPANMINUS_SHA1 = a12043498ab54d9abdc58d1ebb4988da3bd515db
#CPAN_URL = https://www.cpan.org
CPAN_URL = https://www.normation.com/tarbal/cpan/$(RUDDER_MAJOR_VERSION)
# Defauth PATHs
RUDDER_DIR = /opt/rudder
......
PERL:=$(INSTALL_DIR)/bin/perl
else
FUSION_DEPS := cpan-source
PERL := /usr/bin/perl
PERL := perl
endif
# default: embed fusion
ifneq (true,$(USE_SYSTEM_FUSION))
......
perl-$(PERL_VERSION)/App-cpanminus:
mkdir -p ./perl-$(PERL_VERSION)
$(eval TMP_DIR := $(shell mktemp -dq /tmp/rudder.XXXXXX))
# Original URL: http://www.cpan.org/modules/by-module/App/App-cpanminus-1.7036.tar.gz
$(GET) $(TMP_DIR)/App-cpanminus.tar.gz https://www.normation.com/tarball/cpan/App-cpanminus-1.7036.tar.gz $(CPANMINUS_SHA1)
$(GET) $(TMP_DIR)/App-cpanminus.tar.gz https://www.normation.com/tarball/cpan/App-cpanminus-$(CPANMINUS_RELEASE).tar.gz $(CPANMINUS_SHA1)
cd perl-$(PERL_VERSION) && gunzip < $(TMP_DIR)/App-cpanminus.tar.gz | $(TAR) xf -
mv ./perl-$(PERL_VERSION)/App-cpanminus-1.7036 ./perl-$(PERL_VERSION)/App-cpanminus
mv ./perl-$(PERL_VERSION)/App-cpanminus-$(CPANMINUS_RELEASE) ./perl-$(PERL_VERSION)/App-cpanminus
rm -rf $(TMP_DIR)
rudder-agent.cron: rudder-sources
......
cd perl-$(PERL_VERSION) && $(MAKE) install DESTDIR=$(DESTDIR)
touch build-perl # because perl-$(PERL_VERSION) is touched by make install
CPANM:=$(CURDIR)/perl-$(PERL_VERSION)/App-cpanminus/bin/cpanm $(CPAN_OPT)
MODULE_INSTALL:=MAKEFLAGS= $(PERL) $(CPANM) -l $(INSTALL_DIR) --skip-installed
MODULE_TEST:=$(PERL) -I $(INSTALL_DIR)/lib/perl5 -e1
CPANM:=$(CURDIR)/perl-$(PERL_VERSION)/App-cpanminus/bin/cpanm
MODULE_INSTALL:=MAKEFLAGS= $(PERL) $(CPANM) $(CPAN_OPT) -L $(INSTALL_DIR) --from $(CPAN_URL)
# List from README / Makefile.PL in fusion-inventory-agent
# -> requires + inventory and network recommends
FUSION_MODULES = File::Which LWP::UserAgent Net::IP Text::Template UNIVERSAL::require XML::TreePP Parse::EDID Net::CUPS DateTime DateTime::TimeZone DateTime::TimeZone::Local::Unix DateTime::TimeZone::Local::Win32 Net::SNMP Net::NBName Thread::Queue
# update sources at normation.com with the command: ./mirror $VAR_CPAN $FUSION_MODULES
fusion-modules: $(FUSION_DEPS)
mkdir -p $(INSTALL_DIR)/lib/perl5
# Fusion dependencies :
# * Text::Template -> server only
# * LWP
# * Net::IP
# * XML::TreePP
# * UNIVERSAL::require
# * File::Which
# Socket::GetAddrInfo: 0 -> network
# Archive::Extract: 0
# Compress::Zlib: 0
# Crypt::DES: 0
# Digest::MD5: 0
# Digest::SHA: 0
# File::Copy::Recursive: 0
# HTTP::Daemon: 0
# IO::Socket::SSL: 0
# JSON: 0
# LWP::Protocol::https: 0
# Net::CUPS: 0.6
# Net::NBName: 0
# Net::SNMP: 0
# Net::Write::Layer2: 0
# POE::Component::Client::Ping: 0
# Parse::EDID: 0
# Proc::Daemon: 0
# Proc::PID::File: 0
# URI::Escape: 0
#
# TODO rework these dependencies, they are not the right ones
# CPAN Modules installation
# Original URL: http://www.cpan.org/modules/by-module/URI/URI-1.67.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/URI-1.67.tar.gz
$(MODULE_TEST) -MURI
# Original URL: http://www.cpan.org/modules/by-module/LWP/libwww-perl-6.13.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/libwww-perl-6.13.tar.gz
$(MODULE_TEST) -MLWP
# Original URL: http://www.cpan.org/modules/by-module/Digest/Digest-MD5-2.54.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/Digest-MD5-2.54.tar.gz
$(MODULE_TEST) -MDigest::MD5
# Orignal URL: http://www.cpan.org/modules/by-module/Net/Net-IP-1.26.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/Net-IP-1.26.tar.gz
$(MODULE_TEST) -MNet::IP
# Original URL: http://www.cpan.org/modules/by-module/XML/XML-TreePP-0.43.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/XML-TreePP-0.43.tar.gz
$(MODULE_TEST) -MXML::TreePP
# Original URL: http://www.cpan.org/modules/by-module/UNIVERSAL/UNIVERSAL-require-0.18.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/UNIVERSAL-require-0.18.tar.gz
$(MODULE_TEST) -MUNIVERSAL::require
# Original URL: http://www.cpan.org/modules/by-module/File/File-Which-1.21.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/File-Which-1.21.tar.gz
$(MODULE_TEST) -MFile::Which
# Replace destdir by prefix in files generated by cpanm
$(MODULE_INSTALL) $(FUSION_MODULES)
# Replace destdir by prefix in files generated by cpanm
find $(INSTALL_DIR)/lib/perl5 -type f -name "*.packlist" -o -name "*.pod" -exec sed -i "s,$(DESTDIR),," {} \;
touch $@
install-fusion: fusioninventory-agent fusion-modules
rudder-agent/SOURCES/mirror
#!/bin/bash
# This script create a minimalist cpan mirror in a given directory
# The mirror will contain the provided modules + their dependencies (recursively)
# For Rudder, use a directory per major version.
# Usage: ./mirror <destination_directory> [<Module::Name> ...]
DIR="$1"
shift
# Use cpanm to download all dependencies from cpan
cpanm --quiet -L /tmp/empty --self-contained --scandeps --save-dists "$DIR" "$@"
# Download 3 index files mandatory for cpanm to work without connection to cpan.org
mkdir -p "$DIR/authors"
wget https://www.cpan.org/authors/01mailrc.txt.gz -O "$DIR/authors/01mailrc.txt.gz"
mkdir -p "$DIR/modules"
wget https://www.cpan.org/modules/02packages.details.txt.gz -O "$DIR/modules/02packages.details.txt.gz"
wget https://www.cpan.org/modules/03modlist.data.gz -O "$DIR//modules/03modlist.data.gz"

Also available in: Unified diff