[PC-BSD Commits] r19614 - in pcbsd/current/src-sh/pbi-manager: . man8

svn at pcbsd.org svn at pcbsd.org
Mon Oct 8 13:09:16 PDT 2012


Author: kris
Date: 2012-10-08 20:09:16 +0000 (Mon, 08 Oct 2012)
New Revision: 19614

Modified:
   pcbsd/current/src-sh/pbi-manager/man8/pbi_makeport.8
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:

Add a new -32 flag to pbi_makeport. This allows us to specifically
create an i386 PBI on an amd64 host system. 



Modified: pcbsd/current/src-sh/pbi-manager/man8/pbi_makeport.8
===================================================================
--- pcbsd/current/src-sh/pbi-manager/man8/pbi_makeport.8	2012-10-08 15:50:22 UTC (rev 19613)
+++ pcbsd/current/src-sh/pbi-manager/man8/pbi_makeport.8	2012-10-08 20:09:16 UTC (rev 19614)
@@ -12,6 +12,7 @@
 .Op Fl d Ar portsdir
 .Op Fl o Ar outdir
 .Op Fl p Ar prefix
+.Op Fl -32
 .Op Fl -delbuild
 .Op Fl -mkdebug
 .Op Fl -no-prune
@@ -48,6 +49,8 @@
 .It Fl p Ar prefix
 Manually provide a PREFIX, which determines the location where the
 PBI will end up being installed on the end-users system. 
+.It Fl -32
+Specify to create a i386 PBI from a amd64 host system
 .It Fl -delbuild
 Remove any existing build dirs before starting this build.
 .It Fl -mkdebug

Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2012-10-08 15:50:22 UTC (rev 19613)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2012-10-08 20:09:16 UTC (rev 19614)
@@ -117,6 +117,7 @@
   -k           -- Keep build files, don't delete when finished
   -o outdir    -- Where to place the finished PBI file
   -p prefix    -- Specify alternate PBI Compile PREFIX
+  -32          -- Build i386 PBI on amd64 host
   --delbuild   -- Delete existing build dirs if they exist
   --mkdebug    -- Drop to debug shell if port make fails
   --tmpfs      -- Use TMPFS for port WRKDIRPREFIX
@@ -1122,6 +1123,12 @@
                         shift; PORTSDIR="$1" ; export PORTSDIR
                         ;;
 
+                -32)    if [ "$REALARCH" != "amd64" -a "`basename $0`" != "pbi_makeport_chroot" ] ; then 
+				exit_err "-32 can only be used on amd64 host"
+			fi	
+			ARCH=i386
+                        ;;
+
                 -k)	PBI_KEEPBUILDFILES="YES"
                         ;;
 
@@ -1280,15 +1287,19 @@
 # Initialize some vars
 init_vars() {
 
+	# Set sys vars
+	REALARCH="`uname -m`"
+	ARCH="$REALARCH"
+	FBSDMAJOR=`uname -r | cut -c 1`
+
         # Where is pbi-manager installed?
-	FBSDMAJOR=`uname -r | cut -c 1`
         PROGBASE="/usr/local" 
 	SYS_LOCALBASE="/usr/local"
 	if [ -z "${PBI_APPDIR}" -o "`basename $0`" = "pbi_makeport_chroot" ] ; then
 		PBI_APPDIR="/usr/pbi"
         fi
 	PBI_WRAPPERFILE="${PBI_APPDIR}/.pbiwrapper"
-	PBI_CHROOTFILE="${PBI_APPDIR}/.pbi-world.txz"
+	PBI_CHROOTFILE="${PBI_APPDIR}/.pbi-world-$ARCH.txz"
 	if [ `id -u` = "0" ] ; then 
 		PBI_HASHDIR="${PBI_APPDIR}/.hashdir"
 	else
@@ -1563,10 +1574,6 @@
 	fi
 
 	tmp="`echo ${PBI_PROGNAME} | tr -d ' ' | tr '[A-Z]' '[a-z]'`"
-	ARCH="`uname -m`"
-	if [ -n "${PBI_OSARCH}" ] ; then
-		ARCH="${PBI_OSARCH}"
-	fi
 	if [ -z "${PBI_PROGDIRNAME}" ] ; then
 		PBI_PROGDIRNAME="${tmp}-${ARCH}"
 	fi
@@ -4043,11 +4050,7 @@
 
 # Start copying pbi details into header file
 save_pbi_details_to_header() {
-	local _osArch="`uname -m`"
-	if [ -n "${PBI_OSARCH}" ] ; then
-		_osArch="${PBI_OSARCH}"
-	fi
-
+	local _osArch="$ARCH"
 	local _osRel="`uname -r`"
 	if [ -n "${PBI_OSREL}" ] ; then
 		_osRel="${PBI_OSREL}"
@@ -4143,10 +4146,6 @@
 
 # All the pieces are ready, spit out the final PBI file
 mk_output_pbi() {
-	if [ -z "${PBI_OSARCH}" ] ; then
-		PBI_OSARCH="`uname -m`"
-	fi
-
         if [ -n "${PBI_PROGICON}" -a -e "${PBI_STAGEDIR}/${PBI_PROGICON}" ] ; then
                 icon="${PBI_STAGEDIR}/${PBI_PROGICON}"
         else
@@ -4154,7 +4153,7 @@
         fi
 	_pbilow="`echo ${PBI_PROGNAME} | tr '[:upper:]' '[:lower:]' | sed 's| ||g'`"
 
-	outfile="${PBI_CREATE_OUTDIR}/${_pbilow}-${PBI_PROGVERSION}-${PBI_OSARCH}.pbi"
+	outfile="${PBI_CREATE_OUTDIR}/${_pbilow}-${PBI_PROGVERSION}-${ARCH}.pbi"
 	mark1="${PBI_CREATE_OUTDIR}/.pbimark1.$$"
 	mark2="${PBI_CREATE_OUTDIR}/.pbimark2.$$"
 
@@ -5934,7 +5933,7 @@
 	get_progname_from_pbi_file "$_pbiNew"
         _pbilow="`echo ${VAL} | tr '[:upper:]' '[:lower:]' | sed 's| ||g'`"
         
-        outfile="${_cDir}/${_pbilow}-${_pbiOldVer}_to_${_pbiNewVer}-`uname -m`.pbp"
+        outfile="${_cDir}/${_pbilow}-${_pbiOldVer}_to_${_pbiNewVer}-$ARCH.pbp"
         mark1="${_cDir}/.pbimark1.$$"
         mark2="${_cDir}/.pbimark2.$$"
         
@@ -6454,6 +6453,7 @@
 chroot_extract() {
 
 	# If no chroot file exists, make it first
+	PBI_CHROOTFILE="${PBI_APPDIR}/.pbi-world-$ARCH.txz"
 	[ -e "${PBI_CHROOTFILE}" ] || mk_chroot_file
 
 	# Set the chroot path
@@ -6478,6 +6478,7 @@
 	# Copy resolv.conf
 	cp /etc/resolv.conf ${PBI_CHROOTDIR}/etc/resolv.conf
 
+
 	# Copy our binary wrapper
 	mkdir ${PBI_CHROOTDIR}${PBI_APPDIR} 2>/dev/null
 	cp ${PBI_WRAPPERFILE} ${PBI_CHROOTDIR}${PBI_WRAPPERFILE}
@@ -6485,6 +6486,18 @@
 	# If we have a custom PBI_MAKECONF include it
 	[ -e "${PBI_MAKECONF}" ] && cp ${PBI_MAKECONF} ${PBI_CHROOTDIR}/etc/make.conf
 
+	# Set any target arch vars
+        if [ "${ARCH}" = "i386" -a "${REALARCH}" = "amd64" ];then
+                LOGIN_ENV=",UNAME_p=i386,UNAME_m=i386"
+                cat >> ${PBI_CHROOTDIR}/etc/make.conf << EOF
+ARCH=i386
+MACHINE=i386
+MACHINE_ARCH=i386
+EOF
+        	sed -i .back -e "s/:\(setenv.*\):/:\1${LOGIN_ENV}:/" ${PBI_CHROOTDIR}/etc/login.conf
+        	cap_mkdb ${PBI_CHROOTDIR}/etc/login.conf
+        fi
+
 	#echo "Copying ${PORTSDIR} -> ${PBI_CHROOTDIR}/usr/ports"
 	#tar cvf - -C "${PORTSDIR}" --exclude ./distfiles . 2>/dev/null | tar xvf - -C "${PBI_CHROOTDIR}/usr/ports" 2>/dev/null
 	[ -d "${PORTSDIR}/distfiles" ] || mkdir -p ${PORTSDIR}/distfiles
@@ -6574,21 +6587,15 @@
   	  # Get the system version we are checking for updates to
   	  SYSVER="`pbreg get /PC-BSD/Version`" ; export SYSVER
 
-  	  # Set the system arch type
-  	  ARCH=`uname -m`
-	  if [ -n "${PBI_OSARCH}" ] ; then
-	  	ARCH="${PBI_OSARCH}"
-	  fi
-
   	  # To fetch the jail environment
  	  echo "Fetching FreeBSD chroot environment... This may take a while..."
-  	  fetch -o rel.txz ${MIRRORURL}/${SYSVER}/${ARCH}/netinstall/fbsd-release.txz
-    	  fetch -o rel.md5 ${MIRRORURL}/${SYSVER}/${ARCH}/netinstall/fbsd-release.txz.md5
+  	  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
 
-    	  [ `md5 -q rel.txz` != `cat rel.md5` ] && exit_err "Error in download data, checksum mismatch.. Please try again later."
+    	  [ `md5 -q rel-$ARCH.txz` != `cat rel-$ARCH.md5` ] && exit_err "Error in download data, checksum mismatch.. Please try again later."
 
-	  mv rel.txz ${PBI_CHROOTFILE}
-	  rm rel.md5
+	  mv rel-$ARCH.txz ${PBI_CHROOTFILE}
+	  rm rel-$ARCH.md5
 	  return
  	fi
 



More information about the Commits mailing list