[darwinbuild-changes] [838] branches/PR-7872907
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jun 14 12:13:56 PDT 2010
Revision: 838
http://trac.macosforge.org/projects/darwinbuild/changeset/838
Author: wsiegrist at apple.com
Date: 2010-06-14 12:13:53 -0700 (Mon, 14 Jun 2010)
Log Message:
-----------
Add automatic touching of /System/Library/Extensions.
Modified Paths:
--------------
branches/PR-7872907/darwinup/Depot.cpp
branches/PR-7872907/darwinup/Depot.h
branches/PR-7872907/darwinup/darwinup.1
branches/PR-7872907/darwinup/main.cpp
branches/PR-7872907/testing/darwinup/run-tests.sh
Modified: branches/PR-7872907/darwinup/Depot.cpp
===================================================================
--- branches/PR-7872907/darwinup/Depot.cpp 2010-06-11 16:18:54 UTC (rev 837)
+++ branches/PR-7872907/darwinup/Depot.cpp 2010-06-14 19:13:53 UTC (rev 838)
@@ -61,6 +61,7 @@
m_is_locked = 0;
m_depot_mode = 0750;
m_is_dirty = false;
+ m_modified_extensions = false;
}
Depot::Depot(const char* prefix) {
@@ -69,6 +70,7 @@
m_depot_mode = 0750;
m_build = NULL;
m_is_dirty = false;
+ m_modified_extensions = false;
asprintf(&m_prefix, "%s", prefix);
join_path(&m_depot_path, m_prefix, "/.DarwinDepot");
@@ -91,10 +93,11 @@
if (m_downloads_path) free(m_downloads_path);
}
-const char* Depot::archives_path() { return m_archives_path; }
-const char* Depot::downloads_path() { return m_downloads_path; }
-const char* Depot::prefix() { return m_prefix; }
-bool Depot::is_dirty() { return m_is_dirty; }
+const char* Depot::archives_path() { return m_archives_path; }
+const char* Depot::downloads_path() { return m_downloads_path; }
+const char* Depot::prefix() { return m_prefix; }
+bool Depot::is_dirty() { return m_is_dirty; }
+bool Depot::has_modified_extensions() { return m_modified_extensions; }
int Depot::connect() {
m_db = new DarwinupDatabase(m_database_path);
@@ -486,7 +489,14 @@
IF_DEBUG("[analyze] needs user data backup\n");
actual->info_set(FILE_INFO_ROLLBACK_DATA);
}
- }
+ }
+
+ if (!this->m_modified_extensions &&
+ (strncmp(file->path(), "/System/Library/Extensions", 26) == 0)) {
+ IF_DEBUG("[analyze] kernel extension detected\n");
+ this->m_modified_extensions = true;
+ }
+
}
// if file == actual, but actual != preceding, then an external
Modified: branches/PR-7872907/darwinup/Depot.h
===================================================================
--- branches/PR-7872907/darwinup/Depot.h 2010-06-11 16:18:54 UTC (rev 837)
+++ branches/PR-7872907/darwinup/Depot.h 2010-06-14 19:13:53 UTC (rev 838)
@@ -122,6 +122,7 @@
void archive_header();
bool is_dirty();
+ bool has_modified_extensions();
protected:
@@ -170,7 +171,9 @@
char* m_build;
int m_lock_fd;
int m_is_locked;
- bool m_is_dirty; // track if we need to update dyld cache
+ bool m_is_dirty; // track if we need to update dyld cache
+ bool m_modified_extensions; // track if we need to touch /S/L/E
+
};
#endif
Modified: branches/PR-7872907/darwinup/darwinup.1
===================================================================
--- branches/PR-7872907/darwinup/darwinup.1 2010-06-11 16:18:54 UTC (rev 837)
+++ branches/PR-7872907/darwinup/darwinup.1 2010-06-14 19:13:53 UTC (rev 838)
@@ -46,9 +46,7 @@
.Sh OPTIONS
.Bl -tag -width -indent
.It \-d
-Do not update dyld cache. Darwinup normally runs update_dyld_shared_cache
-if the operation actually changes files on disk. To ensure this does not
-happen, you can provide this option.
+Do not run helpful automation. See HELPFUL AUTOMATION below.
.It \-f
Force. Some operations will fail gracefully due to potentially unsafe
situations, such as a root that installs a file where a directory is.
@@ -58,6 +56,7 @@
Dry run. Darwinup will go through an operation, including analyzing
the root(s) and printing the state/change symbol, but no files will
be modified on your system and no records will be added to the depot.
+This option implies -d.
.It \-p Op Ar path
Prefix path. Normally, darwinup will operate on the boot partition. You
can use the -p option to have darwinup work on another partition. You
@@ -210,6 +209,20 @@
superseded, then you should not get this error as the backup copies will
not be used anyway.
.El
+.Sh HELPFUL AUTOMATION
+Darwinup tries to detect common situations and run external tools that you
+would otherwise have to remember to run yourself. The "dry run" (-n) and
+"disable automation" (-d) options prevent any of the following from
+happening.
+.Bl -tag -width -indent
+.It Dyld Cache
+If a root modifies any file, then darwinup will run
+update_dyld_shared_cache unless the -d option is specified.
+.It Kernel Extensions
+If a root modifies a file under /System/Library/Extensions, then darwinup
+will update the mtime of /System/Library/Extensions to ensure that the
+kext cache is updated during the next boot.
+.El
.Sh EXAMPLES
.Bl -tag -width -indent
.It Install files from a tarball
@@ -231,4 +244,5 @@
.Xr curl 1 ,
.Xr tar 1 ,
.Xr gzip 1 ,
-.Xr ditto 1
\ No newline at end of file
+.Xr ditto 1 ,
+.Xr update_dyld_shared_cache 1
\ No newline at end of file
Modified: branches/PR-7872907/darwinup/main.cpp
===================================================================
--- branches/PR-7872907/darwinup/main.cpp 2010-06-11 16:18:54 UTC (rev 837)
+++ branches/PR-7872907/darwinup/main.cpp 2010-06-14 19:13:53 UTC (rev 838)
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/time.h>
#include <unistd.h>
#include <limits.h>
@@ -50,7 +51,7 @@
fprintf(stderr, " \n");
fprintf(stderr, "options: \n");
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
- fprintf(stderr, " -d do not update dyld cache \n");
+ fprintf(stderr, " -d disable helpful automation \n");
#endif
fprintf(stderr, " -f force operation to succeed at all costs \n");
fprintf(stderr, " -n dry run \n");
@@ -104,7 +105,7 @@
char* progname = strdup(basename(argv[0]));
char* path = NULL;
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
- bool update_dyld = true;
+ bool disable_automation = false;
#endif
int ch;
@@ -116,7 +117,7 @@
switch (ch) {
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
case 'd':
- update_dyld = false;
+ disable_automation = true;
break;
#endif
case 'f':
@@ -125,7 +126,7 @@
case 'n':
dryrun = 1;
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
- update_dyld = false;
+ disable_automation = true;
#endif
break;
case 'p':
@@ -158,7 +159,7 @@
if (dryrun) IF_DEBUG("option: dry run\n");
if (force) IF_DEBUG("option: forcing operations\n");
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
- if (!update_dyld) IF_DEBUG("option: not updating dyld cache\n");
+ if (!disable_automation) IF_DEBUG("option: helpful automation disabled\n");
#endif
if (!path) {
@@ -238,11 +239,21 @@
}
}
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
- if (update_dyld && depot->is_dirty() && res == 0) {
+ if (!disable_automation && depot->is_dirty() && res == 0) {
res = update_dyld_shared_cache(path);
if (res) fprintf(stderr, "Warning: could not update dyld cache.\n");
res = 0;
- }
+ }
+ if (!disable_automation && depot->has_modified_extensions() && res == 0) {
+ char *sle_path;
+ res = join_path(&sle_path, depot->prefix(), "/System/Library/Extensions");
+ if (res == 0) res = utimes(sle_path, NULL);
+ if (res) {
+ fprintf(stderr, "Warning: unable to touch %s \n", sle_path);
+ res = 0;
+ }
+ free(sle_path);
+ }
#endif
}
Modified: branches/PR-7872907/testing/darwinup/run-tests.sh
===================================================================
--- branches/PR-7872907/testing/darwinup/run-tests.sh 2010-06-11 16:18:54 UTC (rev 837)
+++ branches/PR-7872907/testing/darwinup/run-tests.sh 2010-06-14 19:13:53 UTC (rev 838)
@@ -37,7 +37,7 @@
tar zxvf $R.tar.gz -C $PREFIX
done;
-for R in 300dirs.tbz2 300files.tbz2 deep-rollback.cpgz deep-rollback-2.xar;
+for R in 300dirs.tbz2 300files.tbz2 deep-rollback.cpgz deep-rollback-2.xar extension.tar.bz2;
do
cp $R $PREFIX/
done;
@@ -300,7 +300,19 @@
echo "DIFF: diffing original test files to dest (should be no diffs) ..."
$DIFF $ORIG $DEST 2>&1
+echo "========== TEST: Modify /System/Library/Extensions =========="
+mkdir -p $DEST/System/Library/Extensions/Foo.kext
+BEFORE=$(ls -Tld $DEST/System/Library/Extensions/ | awk '{print $6$7$8$9}');
+sleep 2;
+$DARWINUP install extension.tar.bz2
+AFTER=$(ls -Tld $DEST/System/Library/Extensions/ | awk '{print $6$7$8$9}');
+test $BEFORE != $AFTER
+$DARWINUP uninstall newest
+rm -rf $DEST/System
+echo "DIFF: diffing original test files to dest (should be no diffs) ..."
+$DIFF $ORIG $DEST 2>&1
+
#
# The following are expected failures
#
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100614/b20e7833/attachment-0001.html>
More information about the darwinbuild-changes
mailing list