Whamcloud - gitweb
LU-177 lbuild autonomy fixes
authorBrian J. Murrell <brian@whamcloud.com>
Fri, 25 Mar 2011 04:48:57 +0000 (00:48 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 30 Mar 2011 18:15:41 +0000 (11:15 -0700)
Fixes to allow lbuild to work without uneeded help from it's caller:
- kernel srpm location for rhel5
- CentOS is a "rhel" distro
Direct output to the output FD.
Refactor find_linux_rpm-rhel{5,6}.

Signed-off-by: Brian J. Murrell <brian@whamcloud.com>
Change-Id: I714b90b53b14ac4ef4cd6bfe638a029656a151b0
Reviewed-on: http://review.whamcloud.com/361
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: Hudson
Reviewed-by: Michael MacDonald <mjmac@whamcloud.com>
build/funcs.sh
build/lbuild
build/lbuild-rhel
build/lbuild-rhel5
build/lbuild-rhel6

index 5e8db78..09292d0 100644 (file)
@@ -137,7 +137,7 @@ autodetect_distro() {
                 name="oel"
                 version="${version%%.*}"
                 ;;
                 name="oel"
                 version="${version%%.*}"
                 ;;
-            "RedHatEnterpriseServer" | "ScientificSL")
+            "RedHatEnterpriseServer" | "ScientificSL" | "CentOS")
                 name="rhel"
                 version="${version%%.*}"
                 ;;
                 name="rhel"
                 version="${version%%.*}"
                 ;;
index 20ed08b..b4a91c2 100755 (executable)
@@ -1231,7 +1231,7 @@ build_kernel_with_srpm() {
                                    "$REUSE_SIGNATURE"; then
         # nothing cached, build from scratch
         if [ ! -r "$KERNELDIR/$KERNEL_SRPM" ]; then
                                    "$REUSE_SIGNATURE"; then
         # nothing cached, build from scratch
         if [ ! -r "$KERNELDIR/$KERNEL_SRPM" ]; then
-            echo "Downloading kernel SRPM"
+            echo "Downloading kernel SRPM" >&${outfd}
             download_srpm "$CANONICAL_TARGET" "$KERNEL_SRPM" >&${outfd}
         fi
 
             download_srpm "$CANONICAL_TARGET" "$KERNEL_SRPM" >&${outfd}
         fi
 
@@ -1256,7 +1256,7 @@ build_kernel_with_srpm() {
                                  "kernel" "$REUSEBUILD" "$REUSE_SIGNATURE" \
                                  "$CAN_LINK_FOR_REUSE"; then
                 error "Failed to store kernel RPMS for reuse"
                                  "kernel" "$REUSEBUILD" "$REUSE_SIGNATURE" \
                                  "$CAN_LINK_FOR_REUSE"; then
                 error "Failed to store kernel RPMS for reuse"
-                echo "unknown"
+                echo "unknown" >&${outfd}
                 return 1
             fi
         fi
                 return 1
             fi
         fi
index bcac604..3ad89d8 100644 (file)
@@ -170,3 +170,26 @@ unpack_linux_devel_rpm-rhel() {
     return 0
 
 }
     return 0
 
 }
+
+# this of course requires a sudo rule on the builder for real RHEL:
+# hudson ALL= NOPASSWD: /usr/bin/yumdownloader
+# also must disable the requiretty attribute in the sudoers file
+find_linux_rpm-rhel() {
+    local prefix="$1"
+    local wanted_kernel="$2"
+    local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
+
+    local tmpdir=$(mktemp -d $pathtorpms/yumXXXXXX)
+    local sudo=""
+    if [ "$(lsb_release -s -i)" = "RedHatEnterpriseServer" ]; then
+        sudo="sudo"
+    fi
+    $sudo yumdownloader --destdir "$tmpdir" kernel-devel-"$wanted_kernel" > /dev/null
+    local rpm=$(cd $tmpdir; echo *)
+    mv "$tmpdir/$rpm" "$pathtorpms"
+    rmdir $tmpdir
+    echo "$rpm"
+
+    return 0
+
+}
index 1ab4b8a..7bd8909 100644 (file)
@@ -98,3 +98,17 @@ unpack_linux_devel_rpm-rhel5() {
     return 0
 
 }
     return 0
 
 }
+
+find_linux_rpm-rhel5() {
+    local prefix="$1"
+    local wanted_kernel="$2"
+    local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
+
+    find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms"
+}
+
+kernel_srpm_location() {
+
+    echo "http://mirror.centos.org/centos-5/5/updates/SRPMS/"
+
+}
index 9ac2a48..53bcee7 100644 (file)
@@ -60,14 +60,7 @@ find_linux_rpm-rhel6() {
     local wanted_kernel="$2"
     local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
 
     local wanted_kernel="$2"
     local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
 
-    local tmpdir=$(mktemp -d $pathtorpms/yumXXXXXX)
-    sudo yumdownloader --destdir "$tmpdir" kernel-devel-"$wanted_kernel" > /dev/null
-    local rpm=$(cd $tmpdir; echo *)
-    mv "$tmpdir/$rpm" "$pathtorpms"
-    rmdir $tmpdir
-    echo "$rpm"
-
-    return 0
+    find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms"
 
 }
 
 
 }