[PC-BSD Commits] r8251 - pcbsd/current/src-sh/pbi-manager
svn at pcbsd.org
svn at pcbsd.org
Wed Dec 22 07:47:16 PST 2010
Author: kris
Date: 2010-12-22 07:47:15 -0800 (Wed, 22 Dec 2010)
New Revision: 8251
Modified:
pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:
When we schedule hash-directory cleanings, make sure to keep track of the most recent one finished,
so we dont end up skipping the most recent cleanup
Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager 2010-12-21 20:37:02 UTC (rev 8250)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager 2010-12-22 15:47:15 UTC (rev 8251)
@@ -1713,11 +1713,16 @@
add_hashdir_trigger
# Mark the hash-dir as dirty as well
- touch "${PBI_DBDIRTYFILE}"
+ make_hashdir_dirty
echo "Finished patching ${_pbilow}: $PBI_PATCHTARGET -> $PBI_PATCHVERSION"
}
+# Mark the hashdir as dirty
+make_hashdir_dirty() {
+ date "+%s" > "${PBI_DBDIRTYFILE}"
+}
+
# Do any chmod stuff after patching
patch_apply_chmod()
{
@@ -3221,7 +3226,7 @@
unregister_pbi
# Mark the hashdir as dirty
- touch "${PBI_DBDIRTYFILE}"
+ make_hashdir_dirty
}
# Save the hash-list to run a cleanup afterwards
@@ -3429,14 +3434,7 @@
done
# Check if we have a dirty hash-dir to cleanup
- if [ -e "${PBI_DBDIRTYFILE}" ] ; then
- init_tmpdir
- echo "Cleaning hash-dir: `date`" >> ${_pbid_log}
- pbi_clean_hashdir >>${_redir} 2>>${_redir}
- echo "Finished cleaning hash-dir: `date`" >> ${_pbid_log}
- rm ${PBI_DBDIRTYFILE} >/dev/null 2>/dev/null
- rm_tmpdir
- fi
+ check_clean_hashdir "$_pbid_log" "$_redir"
# Check if we need to merge files into the hashdir
if [ ! -z "`ls ${PBI_DBHASHQUEUEDIR}`" ] ; then
@@ -3474,6 +3472,28 @@
}
+check_clean_hashdir() {
+ if [ ! -e "${PBI_DBDIRTYFILE}" ] ; then return ; fi
+
+ # Get the date of the last hash-cleaning done
+ local _curDate="`cat ${PBI_DBDIRTYFILE}`"
+ if [ -e "${PBI_DBDIRTYFILE}.last" ] ; then
+ local _lastDate="`cat ${PBI_DBDIRTYFILE}.last`"
+ else
+ local _lastDate="0"
+ fi
+
+ # See if we have a new date trigger to do a cleaning
+ if [ "$_curDate" = "${_lastDate}" ]; then return; fi
+
+ init_tmpdir
+ echo "Cleaning hash-dir: `date`" >> ${1}
+ pbi_clean_hashdir >>${2} 2>>${2}
+ echo "Finished cleaning hash-dir: `date`" >> ${1}
+ echo "$_curDate" > ${PBI_DBDIRTYFILE}.last >/dev/null 2>/dev/null
+ rm_tmpdir
+}
+
pbi_info_init() {
parse_info_pbi_cmdline "$@"
More information about the Commits
mailing list