[PC-BSD Commits] r3926 - in pbibuild/pbibuilder: pbicreator pbicreator/PBIfiles scripts

svn at pcbsd.org svn at pcbsd.org
Thu May 14 11:51:35 PDT 2009


Author: kris
Date: 2009-05-14 11:51:35 -0700 (Thu, 14 May 2009)
New Revision: 3926

Added:
   pbibuild/pbibuilder/pbicreator/createpbi.sh
   pbibuild/pbibuilder/scripts/autopopulate.sh
Modified:
   pbibuild/pbibuilder/pbicreator/PBIfiles/copylibs.sh
   pbibuild/pbibuilder/scripts/3.makepbi.sh
   pbibuild/pbibuilder/scripts/functions.sh
Log:

Update to the PBI Builder software. Now it'll be more flexible searching for binaries in bin, sbin, libexec to run "ldd" on. It'll also search the PBI path for .so files, to ensure we include any dependancies they need as well. 

Also added an option PBIAUTOPOPULATE="YES" in pbi.conf. This option will parse the pkg list from the compiled port, and copy its contents, plus any dependancies to the generated PBI



Modified: pbibuild/pbibuilder/pbicreator/PBIfiles/copylibs.sh
===================================================================
--- pbibuild/pbibuilder/pbicreator/PBIfiles/copylibs.sh	2009-05-14 18:33:08 UTC (rev 3925)
+++ pbibuild/pbibuilder/pbicreator/PBIfiles/copylibs.sh	2009-05-14 18:51:35 UTC (rev 3926)
@@ -38,7 +38,16 @@
   if [ ! -e "${COPYDIR}/`basename ${FILE}`" ]
   then
     echo "Copy Lib ${FILE} -> ${COPYDIR}"
-    cp ${FILE} ${COPYDIR}/
+    
+    # Check if we have a symlink here and copy the real file
+    if [ -h "${FILE}" ]
+    then
+      REALFILE=`echo ${FILE} | cut -d ">" -f 2 | sed -e "s| ||"` 
+      cp ${FILE} ${COPYDIR}/${REALFILE}
+      cp -R ${FILE} ${COPYDIR}/
+    else
+      cp ${FILE} ${COPYDIR}/
+    fi
 
     # If we have found a new library, do a recursive call on copylibs, to ensure its depends are copied also
     ${PROGDIR}/PBIfiles/copylibs.sh ${FILE} ${COPYDIR} ${PROGDIR} 


Property changes on: pbibuild/pbibuilder/pbicreator/createpbi.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: pbibuild/pbibuilder/scripts/3.makepbi.sh
===================================================================
--- pbibuild/pbibuilder/scripts/3.makepbi.sh	2009-05-14 18:33:08 UTC (rev 3925)
+++ pbibuild/pbibuilder/scripts/3.makepbi.sh	2009-05-14 18:51:35 UTC (rev 3926)
@@ -1,9 +1,9 @@
-#!/bin/bash
+#!/bin/sh
 
 HOME="/root" ; export HOME
 
 # Check if we have sourced the variables yet
-if [ "${PROGDIR}" == "" ]
+if [ "${PROGDIR}" = "" ]
 then
   . /pbi-build/conf/pbibuild.conf
 fi
@@ -41,6 +41,7 @@
 
 # Unset the PBIVERSION
 PBIVERSION="" ; export PBIVERSION
+PBIAUTOPOPULATE="" ; export PBIAUTOPOPULATE
 INMATEVER="" ; export INMATEVER
 BUILDINMATE="" ; export BUILDINMATE
 
@@ -58,8 +59,9 @@
 MODULEDIR="${PROGDIR}/modules/${module}" ; export MODULEDIR
 BLOG="${OUTDIR}/build.log" ; export BLOG
 
-# Locate the port version for this program
+# Locate the port version and name for this program
 find_port_ver
+find_port_portname
 
 # Copy over the PBI module directory
 echo "Copying over ${module}..." >>${BLOG}
@@ -73,8 +75,28 @@
 mkdir ${PDESTDIR}/PBC
 tar cvf - -C ${PROGDIR}/pbicreator/ . 2>/dev/null | tar xvpf - -C ${PDESTDIR}/PBC 2>/dev/null
 
+# Check if we were given a custom LOCALBASE and use it if so
+CPROGNAME="`echo $PROGNAME | tr -d ' '`"
+if [ -z "${PBILOCALBASE}" ]
+then
+  PBILOCALBASE="/Programs/${CPROGNAME}${PORTVER}"
+  export PBILOCALBASE
+fi
 
 
+# Check if we have auto-populate set for this PBI
+if [ "${PBIAUTOPOPULATE}" = "YES" ]
+then
+  # This PBI wants to populate automatically with port plist info
+  cp ${PROGDIR}/scripts/autopopulate.sh ${PDESTDIR}/autopopulate.sh
+  chmod 755 ${PDESTDIR}/autopopulate.sh
+  rm -rf ${PDESTDIR}/tmp/autodupdir >/dev/null 2>/dev/null
+  export PORTNAME PORTVER
+else
+  rm ${PDESTDIR}/autopopulate.sh >/dev/null 2>/dev/null
+fi
+
+
 # Create the script which chroot will run
 echo '#!/bin/sh
 
@@ -92,6 +114,13 @@
   tar cvf - -C /module/overlay-dir . 2>/dev/null | tar xvpf - -C ${PBIDIR} 2>/dev/null
 fi
 
+# Perform PBI auto-population
+if [ -e "/autopopulate.sh" ]
+then
+  echo "/autopopulate.sh ${PORTNAME}-${PORTVER} ${PBILOCALBASE} ${PBIDIR} /autopopulate.sh"
+  /autopopulate.sh "${PORTNAME}-${PORTVER}" "${PBILOCALBASE}" "${PBIDIR}" "/autopopulate.sh"
+fi
+
 if [ -e "/module/copy-files" ]
 then
 


Property changes on: pbibuild/pbibuilder/scripts/autopopulate.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: pbibuild/pbibuilder/scripts/functions.sh
===================================================================
--- pbibuild/pbibuilder/scripts/functions.sh	2009-05-14 18:33:08 UTC (rev 3925)
+++ pbibuild/pbibuilder/scripts/functions.sh	2009-05-14 18:51:35 UTC (rev 3926)
@@ -1,66 +1,50 @@
-#!/bin/bash
+#!/bin/sh
 
+# Exports PORTVER to the ports version
+# Requires PDESTDIR and PBIPORT to be set
 find_port_ver()
 {
   PORTVER=""
 
-  # Check if we have a custom version string key and try to set PORTVER
-  if [ ! -z "${VERKEY}" ]
-  then
-   # Now try the supplied VERKEY strings
-   PORTVER="`grep ^$VERKEY ${PDESTDIR}/${PBIPORT}/Makefile | tr -d '\t' | tr -d ' ' | cut -d '=' -f 2`"
-  fi
+  # Get the port version number
+  PORTVER="`chroot ${PDESTDIR} /usr/bin/make -C ${PBIPORT} -V DISTVERSION 2>/dev/null`"
 
-  if [ -z "${PORTVER}" ]
+  # Check if we have a portrevision to use in version number
+  PORTREV=""
+  PORTREV="`chroot ${PDESTDIR} /usr/bin/make -C ${PBIPORT} -V PORTREVISION 2>/dev/null`"
+  if [ ! -z "${PORTREV}" -a "${PORTREV}" != "0" ]
   then
-   # Get the port version number
-   PORTVER="`grep ^DISTVERSION= ${PDESTDIR}/${PBIPORT}/Makefile | tr -d '\t' | tr -d ' ' | cut -d '=' -f 2`"
+   PORTVER="${PORTVER}_${PORTREV}" ; export PORTVER
   fi
 
-  if [ -z "${PORTVER}" ]
+  if [ ! -z "${PBIVERSION}" ]
   then
-   # Now try the PORTVERSION= line
-   PORTVER="`grep ^PORTVERSION= ${PDESTDIR}/${PBIPORT}/Makefile | tr -d '\t' | tr -d ' ' | cut -d '=' -f 2`"
+     PORTVER="${PBIVERSION}"
   fi
   
   if [ -z "${PORTVER}" ]
   then
-   # Now try the PORTVERSION?= line
-   PORTVER="`grep ^PORTVERSION?= ${PDESTDIR}/${PBIPORT}/Makefile | tr -d '\t' | tr -d ' ' | cut -d '=' -f 2`"
+    PORTVER="UNKNOWN"
   fi
 
+  export PORTVER
+};
 
-  if [ -z "${PORTVER}" ]
-  then
-   # Now try the DISTVERSION?= line
-   PORTVER="`grep ^DISTVERSION?= ${PDESTDIR}/${PBIPORT}/Makefile | tr -d '\t' | tr -d ' ' | cut -d '=' -f 2`"
-  fi
 
+# Exports PORTNAME
+# Requires PDESTDIR and PBIPORT to be set
+find_port_portname()
+{
+  PORTNAME=""
 
-  # Check if we have a portrevision to use in version number
-  cat ${PDESTDIR}/${PBIPORT}/Makefile | grep "^PORTREVISION=" >/dev/null
-  if [ "$?" = "0" ]
-  then
-    PORTREV=""
-    PORTREV="`grep ^PORTREVISION= ${PDESTDIR}/${PBIPORT}/Makefile | tr -d '\t' | tr -d ' ' | cut -d '=' -f 2`"
-    PORTVER="${PORTVER}_${PORTREV}" ; export PORTVER
-  fi
+  # Get the port version number
+  PORTNAME="`chroot ${PDESTDIR} /usr/bin/make -C ${PBIPORT} -V PORTNAME`"
 
-  # Check a last time for PORTREVISION?=
-  cat ${PDESTDIR}/${PBIPORT}/Makefile | grep "^PORTREVISION?=" >/dev/null
-  if [ "$?" = "0" -a -z "${PORTREV}" ]
+  if [ -z "${PORTNAME}" ]
   then
-    PORTREV=""
-    PORTREV="`grep ^PORTREVISION?= ${PDESTDIR}/${PBIPORT}/Makefile | tr -d '\t' | tr -d ' ' | cut -d '=' -f 2`"
-    PORTVER="${PORTVER}_${PORTREV}" ; export PORTVER
+    PORTNAME="UNKNOWN"
   fi
 
-  if [ ! -z "${PBIVERSION}" ]
-  then
-     PORTVER="${PBIVERSION}"
-  fi
-
-  export PORTVER
+  export PORTNAME
 };
 
-



More information about the Commits mailing list