[PC-BSD Commits] r21386 - pcbsd/current/src-sh/pbi-manager

svn at pcbsd.org svn at pcbsd.org
Thu Feb 7 10:16:38 PST 2013


Author: kris
Date: 2013-02-07 18:16:37 +0000 (Thu, 07 Feb 2013)
New Revision: 21386

Modified:
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:

Make pbi-manager also pull files in new dist style



Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2013-02-07 17:50:33 UTC (rev 21385)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2013-02-07 18:16:37 UTC (rev 21386)
@@ -1317,7 +1317,7 @@
   	FBSDREL=`uname -r`
 	FBSDMAJOR=${FBSDREL%%.*}
 
-	PBI_CHROOTFILE="${PBI_APPDIR}/.pbi-world-$ARCH.txz"
+	PBI_WORLDCHROOT="${PBI_APPDIR}/.pbi-world-$ARCH"
 	if [ `id -u` = "0" ] ; then 
 		PBI_HASHDIR="${PBI_APPDIR}/.hashdir"
 	else
@@ -6746,16 +6746,7 @@
 chroot_extract() {
 
 	# If no freebsd base exists, make it first
-	isDirZFS "${PBI_APPDIR}"
-	if [ $? -eq 0 ] ; then
-		# Use ZFS base for cloning
-		PBI_CHROOTZFS="${PBI_APPDIR}/.pbi-world-$ARCH"
-		[ -e "${PBI_CHROOTZFS}/COPYRIGHT" ] || mk_chroot_file
-	else
-		# Use regular .txz file
-		PBI_CHROOTFILE="${PBI_APPDIR}/.pbi-world-$ARCH.txz"
-		[ -e "${PBI_CHROOTFILE}" ] || mk_chroot_file
-	fi
+	[ -e "${PBI_WORLDCHROOT}/COPYRIGHT" ] || mk_chroot_file
 
 	# Set the chroot path
 	PBI_CHROOTDIR="${PBI_PROGDIRPATH}.chroot"
@@ -6768,18 +6759,19 @@
 	mkdir -p "${PBI_CHROOTDIR}"
 
 	# If on ZFS, we can just clone our existing base system
-	if [ -n "$PBI_CHROOTZFS" ] ; then
-           tank=`getZFSTank "$PBI_CHROOTZFS"`
-	   echo "Cloning ${PBI_CHROOTZFS} -> ${PBI_CHROOTDIR}"
+	isDirZFS "${PBI_APPDIR}"
+        if [ $? -eq 0 ] ; then   
+           tank=`getZFSTank "$PBI_WORLDCHROOT"`
+	   echo "Cloning ${PBI_WORLDCHROOT} -> ${PBI_CHROOTDIR}"
 	   if [ -n "${PBI_AB_TMPDIR}" ] ; then
               echo "${tank}${PBI_CHROOTDIR}" > ${PBI_AB_TMPDIR}/${PBI_AB_BUILDER}.zmnt
 	   fi
-           zfs clone ${tank}${PBI_CHROOTZFS}@clean ${tank}${PBI_CHROOTDIR}
+           zfs clone ${tank}${PBI_WORLDCHROOT}@clean ${tank}${PBI_CHROOTDIR}
 	   if [ $? -ne 0 ] ; then exit_err "Failed creating clean ZFS base snapshot"; fi
 	else
-	   echo "Extracting chroot environment..."
-	   tar xvf ${PBI_CHROOTFILE} -C "${PBI_CHROOTDIR}" >/dev/null 2>/dev/null
-	   [ $? -ne 0 ] && exit_err "Failed extracting chroot environment!"
+	   echo "Creating chroot environment..."
+	   tar cvf - -C ${PBI_WORLDCHROOT} . | tar xvf - -C "${PBI_CHROOTDIR}" 2>/dev/null
+	   [ $? -ne 0 ] && exit_err "Failed copying chroot environment!"
 	fi
 
 	# If we plan on using TMPFS mount it now
@@ -6942,43 +6934,51 @@
           MIRRORURL="$VAL"
 
   	  # Get the system version we are checking for updates to
-  	  SYSVER="`pbreg get /PC-BSD/Version`" ; export SYSVER
+  	  SYSVER="`uname -r`" ; export SYSVER
 
-  	  # To fetch the jail environment
- 	  echo "Fetching FreeBSD chroot environment... This may take a while..."
-  	  fetch -o rel-$ARCH.txz ${MIRRORURL}/${SYSVER}/${ARCH}/netinstall/fbsd-release.txz
-    	  fetch -o rel-$ARCH.md5 ${MIRRORURL}/${SYSVER}/${ARCH}/netinstall/fbsd-release.txz.md5
-  	  fetch -o src-$ARCH.txz ${MIRRORURL}/${SYSVER}/${ARCH}/netinstall/extras/components/src.txz
+          local dFiles="base.txz doc.txz games.txz src.txz"
+          if [ "$ARCH" = "amd64" ] ; then
+             dFiles="$dFiles lib32.txz"
+          fi
 
-    	  [ `md5 -q rel-$ARCH.txz` != `cat rel-$ARCH.md5` ] && exit_err "Error in download data, checksum mismatch.. Please try again later."
+          echo "Fetching chroot environment. This may take a while..."
+          for i in $dFiles
+          do
+            echo "Downloading ${MIRRORURL}/${SYSVER}/${ARCH}/dist/${i} ..."
+            fetch -o ${i} "${MIRRORURL}/${SYSVER}/${ARCH}/dist/${i}"
+            [ $? -ne 0 ] && exit_err "Error while downloading the freebsd world."
+          done
 
+	  # Create the WORLDCHROOT
 	  isDirZFS "${PBI_APPDIR}"
           if [ $? -eq 0 ] ; then   
             # Use ZFS base for cloning
-	    echo "Creating ZFS ${PBI_CHROOTZFS} dataset..."
+	    echo "Creating ZFS ${PBI_WORLDCHROOT} dataset..."
             tank=`getZFSTank "$PBI_APPDIR"`
-	    isDirZFS "${PBI_CHROOTZFS}" "1"
+	    isDirZFS "${PBI_WORLDCHROOT}" "1"
             if [ $? -ne 0 ] ; then   
-              zfs create -o mountpoint=${PBI_CHROOTZFS} -p ${tank}${PBI_CHROOTZFS}
+              zfs create -o mountpoint=${PBI_WORLDCHROOT} -p ${tank}${PBI_WORLDCHROOT}
 	      if [ $? -ne 0 ] ; then exit_err "Failed creating ZFS base dataset"; fi
 	    fi
-	    echo "Extracting rel-$ARCH.txz..."
-	    tar xvpf rel-$ARCH.txz -C ${PBI_CHROOTZFS} 2>/dev/null
-	    if [ $? -ne 0 ] ; then exit_err "Failed extracting ZFS base dataset"; fi
-	    mkdir -p ${PBI_CHROOTZFS}/usr/src 2>/dev/null
-	    echo "Extracting src-$ARCH.txz..."
-	    tar xvpf src-$ARCH.txz -C ${PBI_CHROOTZFS}/usr/src 2>/dev/null
-	    if [ $? -ne 0 ] ; then exit_err "Failed extracting ZFS base src dataset"; fi
-	    rm rel-$ARCH.txz
-	    rm src-$ARCH.txz
-	    rm rel-$ARCH.md5
-            zfs snapshot ${tank}${PBI_CHROOTZFS}@clean
-	    if [ $? -ne 0 ] ; then exit_err "Failed creating clean ZFS base snapshot"; fi
 	  else
-	    mv rel-$ARCH.txz ${PBI_CHROOTFILE}
-	    rm rel-$ARCH.md5
+            mkdir ${PBI_WORLDCHROOT}
 	  fi
 
+ 	  # Extract dist files
+          for i in $dFiles
+          do
+            tar xvpf ${i} -C ${PBI_WORLDCHROOT} 2>/dev/null
+            if [ $? -ne 0 ] ; then exit_err "Failed extracting freebsd environment"; fi
+            rm ${i}
+          done
+
+          # Create the clean snapshot
+	  isDirZFS "${PBI_APPDIR}"
+          if [ $? -eq 0 ] ; then   
+            zfs snapshot ${tank}${PBI_WORLDCHROOT}@clean
+	    if [ $? -ne 0 ] ; then exit_err "Failed creating clean ZFS base snapshot"; fi
+          fi
+
 	  return
  	fi
 
@@ -6987,7 +6987,7 @@
                 PBI_BUILDSRC="${_srcdir}"
         fi
 
-        local _targetDir="${PBI_APPDIR}/.worldTarget.$$"
+        local _targetDir="${PBI_WORLDCHROOT}"
         if [ -z "${PBI_BUILDTARGET}" ] ; then
                 PBI_BUILDTARGET="${_targetDir}"
         fi
@@ -7075,15 +7075,13 @@
 	isDirZFS "${PBI_APPDIR}"
         if [ $? -eq 0 ] ; then   
             # Use ZFS base for cloning
-	    echo "Creating ZFS ${PBI_CHROOTZFS} dataset..."
+	    echo "Creating ZFS ${PBI_WORLDCHROOT} dataset..."
             tank=`getZFSTank "$PBI_APPDIR"`
-	    isDirZFS "${PBI_CHROOTZFS}" "1"
+	    isDirZFS "${PBI_WORLDCHROOT}" "1"
             if [ $? -ne 0 ] ; then   
-              zfs create -o mountpoint=${PBI_CHROOTZFS} -p ${tank}${PBI_CHROOTZFS}
+              zfs create -o mountpoint=${PBI_WORLDCHROOT} -p ${tank}${PBI_WORLDCHROOT}
 	      if [ $? -ne 0 ] ; then exit_err "Failed creating ZFS base dataset"; fi
 	    fi
-            rmdir "${PBI_BUILDTARGET}"
-	    PBI_BUILDTARGET="$PBI_CHROOTZFS"
 	fi
 
         make ${PBI_BUILDFLAGS} installworld TARGET=$ARCH DESTDIR=${PBI_BUILDTARGET} >>${PBI_BUILDLOG} 2>>${PBI_BUILDLOG}
@@ -7109,27 +7107,8 @@
 	echo "Copying FreeBSD sources to chroot environment"
 	mkdir -p ${PBI_BUILDTARGET}/usr/src >/dev/null 2>/dev/null
 	tar cvf - -C "${PBI_BUILDSRC}" --exclude "\.svn/" . 2>/dev/null | tar xvf - -C "${PBI_BUILDTARGET}/usr/src" 2>/dev/null
+	cd
 
-	# If using ZFS we can stop here
-	if [ -n "$PBI_CHROOTZFS" ] ; then
-           	zfs snapshot ${tank}${PBI_CHROOTZFS}@clean
-	    	if [ $? -ne 0 ] ; then exit_err "Failed creating clean ZFS base snapshot"; fi
-		rm ${PBI_BUILDLOG}
-		return
-	fi
-
-	echo "Creating chroot environment tarball"
-	tar cvjf ${PBI_CHROOTFILE} -C ${PBI_BUILDTARGET} . >>${PBI_BUILDLOG} 2>>${PBI_BUILDLOG}
-	if [ $? -ne 0 ] ; then
-		cd
-                if [ "${PBI_BUILDSRC}" != "/usr/src" -a "${PBI_DELETE_BUILD}" != "0" ] ; then
-                        rm -rf "${PBI_BUILDSRC}"
-                        rm -rf "${PBI_BUILDTARGET}"
-                fi
-		rm -rf "${PBI_CHROOTFILE}"
-		exit_err "Making chroot environment tarball failed! Logfile saved: ${PBI_BUILDLOG}"
-	fi
-
 	# Cleanup after ourselves
 	chflags -R noschg "${PBI_BUILDTARGET}" >/dev/null 2>/dev/null
         if [ "${PBI_BUILDSRC}" != "/usr/src" -a "${PBI_DELETE_BUILD}" != "0" ] ; then
@@ -7139,6 +7118,16 @@
                 rm -rf "${PBI_BUILDTARGET}" >/dev/null 2>/dev/null
         fi
 	rm ${PBI_BUILDLOG}
+
+	# If on ZFS, create snapshot
+	isDirZFS "${PBI_APPDIR}"
+	if [ $? -eq 0 ] ; then
+           	zfs snapshot ${tank}${PBI_WORLDCHROOT}@clean
+	    	if [ $? -ne 0 ] ; then exit_err "Failed creating clean ZFS base snapshot"; fi
+		rm ${PBI_BUILDLOG}
+		return
+	fi
+
 }
 
 # Read the target ports plist, and generate a external_links config based upon it



More information about the Commits mailing list