Whamcloud - gitweb
LU-5094 Fetch SLES11SP3 build artifacts automatically 96/10396/13
authorBrian J. Murrell <brian.murrell@intel.com>
Tue, 20 May 2014 23:40:27 +0000 (19:40 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 27 May 2014 18:36:56 +0000 (18:36 +0000)
If the user has an account at nu.novell.com for getting SLES packages,
they must configure that account info in the standard .netrc file for
wget/curl to use when trying to get packages from nu.novell.com.

Signed-off-by: Brian J. Murrell <brian.murrell@intel.com>
Change-Id: Ic3cbfc78e0a813d7ac5051bc4a4a358caac0d5a7
Reviewed-on: http://review.whamcloud.com/10396
Reviewed-by: Minh Diep <minh.diep@intel.com>
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
contrib/lbuild/funcs.sh
contrib/lbuild/lbuild
contrib/lbuild/lbuild-sles
contrib/lbuild/lbuild-sles11

index c369453..7627dc2 100644 (file)
@@ -57,7 +57,7 @@ find_linux_rpms() {
     local prefix="$1"
     local pathtorpms=${2:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
 
-    local wanted_kernel="${lnxmaj}${lnxmin}-${lnxrel}"
+    local wanted_kernel="${lnxmaj}${lnxmin}-${lnxrel}${rpmfix}"
     local kernel_rpms=$(find_linux_rpm "$prefix" "$pathtorpms")
     # call a distro specific hook, if available
     if type -p find_linux_rpms-$DISTRO; then
@@ -88,7 +88,7 @@ find_linux_rpm() {
     local pathtorpms=${2:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
 
     local found_rpm=""
-    local wanted_kernel="${lnxmaj}${lnxmin}-${lnxrel}"
+    local wanted_kernel="${lnxmaj}${lnxmin}-${lnxrel}${rpmfix}"
     local ret=1
     if [ -d "$pathtorpms" ]; then
         local rpm
@@ -153,8 +153,7 @@ autodetect_distro() {
         # try some heuristics
         if [ -f /etc/SuSE-release ]; then
             name=sles
-            version=$(grep ^VERSION /etc/SuSE-release)
-            version=${version#*= }
+            version=$(sed -n -e 's/^VERSION = //p' /etc/SuSE-release)
         elif [ -f /etc/redhat-release ]; then
             #name=$(head -1 /etc/redhat-release)
             name=rhel
@@ -182,12 +181,11 @@ autodetect_target() {
          rhel6) target="2.6-rhel6";;
         sles10) target="2.6-sles10";;
         sles11) target="$(uname -r | cut -d . -f 1,2)-sles11"
-               local PLEV=$(grep PATCHLEVEL /etc/SuSE-release | \
-                            sed -e 's/.*= *//')
-               if [ "$PLEV" = "3" ]; then
-                       target=${target}sp3
-               fi
-               ;;
+                local PLEV=$(sed -n -e 's/^PATCHLEVEL = //p' /etc/SuSE-release)
+                if [ "$PLEV" = "3" ]; then
+                        target=${target}sp3
+                fi
+                ;;
           fc15) target="2.6-fc15";;
           fc18) target="3.x-fc18";;
             *) fatal 1 "I don't know what distro $distro is.\nEither update autodetect_target() or use the --target argument.";;
index 836c5b2..7d0c690 100755 (executable)
@@ -402,13 +402,21 @@ fetch_url() {
     local url="$1"
     local target="$2"
 
+    if [ -z "$target" ]; then
+        fatal 1 "fetch_url() called without a target to fetch to"
+    fi
+
+    if [ -d $target ]; then
+        target+="/${url##*/}"
+    fi
+
     local rc=0
     if which wget >/dev/null 2>&1; then
         if ! wget -nv "$url" -O "$target"; then
             rc=${PIPESTATUS[0]}
         fi
     elif which curl >/dev/null 2>&1; then
-        if ! curl -L -s -o "$target" "$url"; then
+        if ! curl -n -L -s -o "$target" "$url"; then
             rc=${PIPESTATUS[0]}
         fi
     else
index 9ed22f1..a7fffdc 100644 (file)
@@ -131,5 +131,12 @@ mcpu_rpmbuild_opt() {
 
 # This function digs out the linux release from a linux-obj tree
 find_linux_release() {
-       _find_linux_release $LINUXOBJ
+    _find_linux_release $LINUXOBJ
+}
+
+kernel_srpm_location() {
+
+    local PLEV=$(sed -n -e 's/^PATCHLEVEL = //p' /etc/SuSE-release)
+    echo "https://nu.novell.com/repo/\$RCE/SLES11-SP${PLEV}-Updates/sle-11-$(resolve_arch $TARGET_ARCH)/rpm/src/"
+
 }
index 0b508f8..f287507 100644 (file)
@@ -91,12 +91,19 @@ find_linux_rpm-sles11() {
     local wanted_kernel="$2"
     local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
 
-    # what, oh what, do we do for sles11?
-    # if anyone knows how we get an arbitrary (kernel-source and
-    # kernel-default-base in this case) from the Suse update mechanism,
-    # please feel free to fix this
-
-    fatal 1 "I don't know how to get packages for SLES11"
+    local PLEV=$(sed -n -e 's/^PATCHLEVEL = //p' /etc/SuSE-release)
+    local site="https://nu.novell.com/repo/\$RCE/SLES11-SP${PLEV}-Updates/sle-11-$(resolve_arch $TARGET_ARCH)/rpm/$(resolve_arch $TARGET_ARCH)"
+    case $prefix in
+        -devel)
+            fetch_url "$site/kernel-default-base-$wanted_kernel.$(resolve_arch $TARGET_ARCH).rpm" $pathtorpms
+            fetch_url "$site/kernel-default-devel-$wanted_kernel.$(resolve_arch $TARGET_ARCH).rpm" $pathtorpms
+            echo "kernel-default-devel-$wanted_kernel.$(resolve_arch $TARGET_ARCH).rpm"
+            ;;
+        -source)
+            fetch_url "$site/kernel-source-$wanted_kernel.$(resolve_arch $TARGET_ARCH).rpm" $pathtorpms
+            echo "kernel-source-$wanted_kernel.$(resolve_arch $TARGET_ARCH).rpm"
+            ;;
+    esac
 
     return 0