X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=build.common;h=622bd8005fa5cb3b0d89b847d1947fafb777fc8e;hb=refs%2Fheads%2Flxc_devel;hp=e686eb20fb911878340e0da236075a6b00cbf9d5;hpb=54f338b1da13f29ea32cfe7faa4725225b6923e1;p=build.git diff --git a/build.common b/build.common index e686eb20..622bd800 100644 --- a/build.common +++ b/build.common @@ -1,8 +1,5 @@ # -*-Shell-script-*- # -# $Id$ -# $URL$ -# # Common functions for build scripts used by various packages # incorporated (e.g., build, myplc, myplc-devel, vserver-reference) # @@ -18,7 +15,7 @@ export PATH=.:$PATH function pl_getDistro() { if [ -f "/etc/redhat-release" ] ; then distro=$(awk ' { print $1 } ' /etc/redhat-release) - case $distro in Red*) distro="Redhat" ; esac + case $distro in Scientific*) distro="SL" ; esac else echo "build.common.pl_getDistro-unknown" exit 1 @@ -30,7 +27,7 @@ function pl_getDistro() { # returns something like 8, 10, or 5.3 function pl_getRelease() { if [ -f "/etc/redhat-release" ] ; then - release=$(awk ' { if ($1=="Fedora" && $2=="Core") print $4 ; if (($1=="Fedora" && $2!="Core")||$1=="CentOS") print $3 ; if ($1=="Red") print $6 } ' /etc/redhat-release) + release=$(awk ' { if ($1=="Fedora" && $2=="Core") print $4 ; if (($1=="Fedora" && $2!="Core")||$1=="CentOS") print $3 ; if ($1=="Scientific") print $4 } ' /etc/redhat-release) else echo "build.common.pl_getRelease-unknown" exit 1 @@ -48,9 +45,6 @@ function pl_getReleaseName () { [Ff]edora*) releasename=f$release ;; - [Re]edhat*) - releasename=rhel6 - ;; [Cc]entOS*) old_IFS="$IFS" IFS="." @@ -58,6 +52,9 @@ function pl_getReleaseName () { IFS="$old_IFS" releasename=centos$1 ;; + [Ss]L*) + releasename=sl$release + ;; *) releasename="unknown-name-for-${pl_DISTRO}-please-edit-build.common" echo 1>&2 "build.common: WARNING - releasename not set for distro=$distro" @@ -73,12 +70,20 @@ function pl_getReleaseName () { function pl_getKexcludes () { distroname=$1; shift case $distroname in - f*) - echo 'kernel kernel-PAE kernel-debug kernel-vserver kernel-devel kernel-headers kernel-debuginfo util-vserver* iptables iptables-ipv6 iproute drupal' ;; - centos5) - echo 'kernel kernel-vserver kernel-devel kernel-headers kernel-debuginfo util-vserver* iptables iproute drupal inotify-tools* libnl' ;; - *) - echo "pl_DISTRO_NAME=$pl_DISTRO_NAME not supported in getexcludes.sh" ; exit 1 ;; + # when using k27, we need our own flavour of iproute + # for now we build only for k32, regardless of fcdistro + f8) + echo 'kernel* util-vserver* iptables iptables-ipv6 drupal' ;; + f16) + echo 'drupal' ;; + f*) + echo 'util-vserver* drupal' ;; + centos5) + echo 'kernel kernel-vserver kernel-devel kernel-headers kernel-debuginfo util-vserver* iptables drupal inotify-tools* libnl' ;; + sl*) + echo 'kernel kernel-debug kernel-debug-devel kernel-devel kernel-doc kernel-firmware kernel-headers iptables' ;; + *) + echo "pl_DISTRO_NAME=$pl_DISTRO_NAME not supported in getexcludes.sh" ; exit 1 ;; esac } @@ -175,7 +180,7 @@ function pl_root_makedevs() { mknod -m 600 $vroot/dev/net/tun c 10 200 # For mkinitrd (in case a kernel is being installed) - # As well for loop back mounting within a vserver. + # As well as for loop back mounting within a vserver. for i in $(seq 0 255) ; do mknod -m 640 $vroot/dev/loop$i b 7 $i done @@ -325,6 +330,7 @@ cachedir=/var/cache/yum debuglevel=2 logfile=/var/log/yum.log pkgpolicy=newest +multilib_policy=best distroverpkg=redhat-release tolerant=1 exactarch=1 @@ -376,6 +382,7 @@ fi if [ -n "$pkgs_packages" ] ; then echo "* Installing optional packages" $pkgs_packages # ignore yum's return code that is basically undefined + echo "* Install options" $vroot $yum_options yum $yum_options install $pkgs_packages || : if ! rpm --root $vroot -q $pkgs_packages >/dev/null ; then echo "* Warning: Missing packages" @@ -408,6 +415,23 @@ fi # Clean yum cache echo "* Cleaning up" + + # NOTE: this hack is for Fedora >= 12. + # if kernel-debug is installed, clean it up + # we link to our version of kernel/initrd and clean up + # kernel-debug manually + if rpm --root $vroot --quiet -q kernel-debug ; then + echo "* Cleaning up kernel-debug - (workaround for f12)" + pushd $vroot/boot/ + rm -rf kernel-boot kernel-bootsmp initrd-boot initrd-bootsmp + ln -s vmlinuz-*${pldistro}* kernel-boot + ln -s vmlinuz-*${pldistro}* kernel-bootsmp + ln -s initrd-*${pldistro}* initrd-boot + ln -s initrd-*${pldistro}* initrd-bootsmp + rpm --root $vroot --nodeps -e kernel-debug || : + popd + fi + # ignore yum's return code that is basically undefined yum $yum_options clean all || : @@ -524,6 +548,7 @@ function pl_parsePkgs () { fcdistro=$1; shift pldistro=$1; shift + echo 1>&2 "pl_parsePkgs: using -a $target_arch -f $fcdistro -d $pldistro $keyword $@" pkgs.py -a $target_arch -f $fcdistro -d $pldistro $keyword "$@" } # usage: pl_getPackages [-a arch] fcdistro pldistro pkg-file[..s] @@ -721,15 +746,13 @@ $kexclude_line" $template > $dest_yumconf return 0 } -# from a yum.conf as generated above, computes the (first) gpgkey url +# from a yum.conf as generated above, computes the gpgkey urls function yumconf_gpgkey () { dest_yumconf=$1; shift - first_line=$(grep '^gpgkey=' $dest_yumconf | head -1) - values=$(echo $first_line | sed -e s,gpgkey=,,) - value=$(echo $values | awk '{print $1;}' | sed -e 's,$basearch,'"$pl_DISTRO_ARCH",g) - [ -n "$value" ] || return 1 - echo $value + values=$(grep -h '^gpgkey=' $dest_yumconf | sed -e s,gpgkey=,, | sed -e 's,$basearch,'"$pl_DISTRO_ARCH",g | sed -e 's, ,\n,g' | sort | uniq | xargs) + [ -n "$values" ] || return 1 + echo $values return 0 }