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

svn at pcbsd.org svn at pcbsd.org
Thu Oct 6 11:09:16 PDT 2011


Author: kris
Date: 2011-10-06 11:09:16 -0700 (Thu, 06 Oct 2011)
New Revision: 13168

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

Make sure we use the mdate as a validator when doing patching, so we don't
apply a binary diff to the wrong PBI file with the same version number



Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2011-10-06 16:08:57 UTC (rev 13167)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2011-10-06 18:09:16 UTC (rev 13168)
@@ -2468,6 +2468,13 @@
 	if [ "$_pFbsdVer" != "$_sFbsdVer" ] ; then
      		exit_err "\"${_pbilow}\" patch is for FreeBSD ${_sFbsdVer}.X only!"
 	fi
+
+	# Check the mdate of the pbi
+	_pMDate="`cat ${oldDir}/pbi_mdate`"
+	_sMDate="$PBI_PATCHMDATE"
+	if [ "$_pMDate" != "$_sMDate" ] ; then
+     		exit_err "\"${_pbilow}\" patch is for the $PBI_PATCHMDATE build!"
+	fi
 }
 
 # Start the pbi_add process
@@ -2750,6 +2757,7 @@
 	PBI_ENABLEAUTOUPDATE=""
         PBI_FBSDVER=""
 	PBI_ORIGPROGDIRPATH=""
+	PBI_PATCHMDATE=""
 	PBI_PATCHVERSION=""
 	PBI_PATCHTARGET=""
 	PBI_PROGNAME=""
@@ -2794,6 +2802,11 @@
         	PBI_REPO=`cat ${1}/pbi_repo`
 	fi
 
+	# See if this patch is for a particular mdate
+	if [ -e "${1}/pbi_patchmdate" ] ; then
+        	PBI_PATCHMDATE=`cat ${1}/pbi_patchmdate`
+	fi
+
 	# See if this PBI was signed
 	if [ -e "${1}/pbi_archivesum.sha1" ] ; then
 		check_valid_sigs "${1}"
@@ -5484,6 +5497,10 @@
 	get_prefix_from_pbi_file "$_pbiOld"
 	_pbiOldPrefix="`basename $VAL`"
 
+	# Get the mdate of the old PBI
+	get_mdate_from_pbi_file "$_pbiOld"
+	_pbiOldMDate="$VAL"
+
 	# Sanity check these prefixes
 	if [ "${_pbiNewPrefix}" != "${_pbiOldPrefix}" ] ; then
 		echo "Error: Prefix mismatch between $_pbiNew and $_pbiOld"
@@ -5548,6 +5565,9 @@
 	open_header_tmp "${PBI_TMPDIR}"
   	cp ${PBI_HEADER_TMPDIR}/* "$_pbiPatchHeaderDir/"
 
+	# Save the mdate of the old PBI
+	echo "$_pbiOldMDate" > $_pbiPatchHeaderDir/pbi_patchmdate
+
 	# Remove any signatures
   	rm $_pbiPatchHeaderDir/*.sha1 >/dev/null 2>/dev/null
 
@@ -5771,6 +5791,12 @@
 	export VAL
 }
 
+get_mdate_from_pbi_file()
+{
+	VAL="`pbi_add -i $1 | grep Built: | cut -d ' ' -f 2-5 | tr -s ' '`"
+	export VAL
+}
+
 # Move old PBIs to the archive
 archive_old_pbis()
 {



More information about the Commits mailing list