[darwinbuild-changes] [799] branches/PR-7798586
source_changes at macosforge.org
source_changes at macosforge.org
Mon Mar 29 15:37:14 PDT 2010
Revision: 799
http://trac.macosforge.org/projects/darwinbuild/changeset/799
Author: wsiegrist at apple.com
Date: 2010-03-29 15:37:13 -0700 (Mon, 29 Mar 2010)
Log Message:
-----------
Conditionalize some features
Modified Paths:
--------------
branches/PR-7798586/darwinup/Archive.cpp
branches/PR-7798586/darwinup/Archive.h
branches/PR-7798586/darwinup/Depot.cpp
branches/PR-7798586/darwinup/Depot.h
branches/PR-7798586/darwinup/Utils.cpp
branches/PR-7798586/darwinup/Utils.h
branches/PR-7798586/darwinup/main.cpp
branches/PR-7798586/testing/darwinup/run-tests.sh
Modified: branches/PR-7798586/darwinup/Archive.cpp
===================================================================
--- branches/PR-7798586/darwinup/Archive.cpp 2010-03-28 02:49:32 UTC (rev 798)
+++ branches/PR-7798586/darwinup/Archive.cpp 2010-03-29 22:37:13 UTC (rev 799)
@@ -240,7 +240,7 @@
return exec_with_args(args);
}
-
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
XarArchive::XarArchive(const char* path) : Archive(path) {}
int XarArchive::extract(const char* destdir) {
@@ -252,8 +252,8 @@
};
return exec_with_args(args);
}
+#endif
-
ZipArchive::ZipArchive(const char* path) : Archive(path) {}
int ZipArchive::extract(const char* destdir) {
@@ -319,8 +319,10 @@
archive = new TarGZArchive(actpath);
} else if (has_suffix(actpath, ".tar.bz2") || has_suffix(actpath, ".tbz2")) {
archive = new TarBZ2Archive(actpath);
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
} else if (has_suffix(actpath, ".xar")) {
archive = new XarArchive(actpath);
+#endif
} else if (has_suffix(actpath, ".zip")) {
archive = new ZipArchive(actpath);
} else {
Modified: branches/PR-7798586/darwinup/Archive.h
===================================================================
--- branches/PR-7798586/darwinup/Archive.h 2010-03-28 02:49:32 UTC (rev 798)
+++ branches/PR-7798586/darwinup/Archive.h 2010-03-29 22:37:13 UTC (rev 799)
@@ -33,6 +33,7 @@
#ifndef _ARCHIVE_H
#define _ARCHIVE_H
+#include <Availability.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
@@ -298,7 +299,7 @@
virtual int extract(const char* destdir);
};
-
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
////
// XarArchive
//
@@ -309,8 +310,8 @@
XarArchive(const char* path);
virtual int extract(const char* destdir);
};
+#endif
-
////
// ZipArchive
//
Modified: branches/PR-7798586/darwinup/Depot.cpp
===================================================================
--- branches/PR-7798586/darwinup/Depot.cpp 2010-03-28 02:49:32 UTC (rev 798)
+++ branches/PR-7798586/darwinup/Depot.cpp 2010-03-29 22:37:13 UTC (rev 799)
@@ -154,8 +154,12 @@
res = this->create_storage();
if (res) return res;
-
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
build_number_for_path(&m_build, m_prefix);
+#else
+ m_build = (char*)calloc(1, 2);
+ snprintf(m_build, 2, " ");
+#endif
}
struct stat sb;
Modified: branches/PR-7798586/darwinup/Depot.h
===================================================================
--- branches/PR-7798586/darwinup/Depot.h 2010-03-28 02:49:32 UTC (rev 798)
+++ branches/PR-7798586/darwinup/Depot.h 2010-03-29 22:37:13 UTC (rev 799)
@@ -33,6 +33,7 @@
#ifndef _DEPOT_H
#define _DEPOT_H
+#include <Availability.h>
#include <sys/types.h>
#include <uuid/uuid.h>
#include "DB.h"
Modified: branches/PR-7798586/darwinup/Utils.cpp
===================================================================
--- branches/PR-7798586/darwinup/Utils.cpp 2010-03-28 02:49:32 UTC (rev 798)
+++ branches/PR-7798586/darwinup/Utils.cpp 2010-03-29 22:37:13 UTC (rev 799)
@@ -337,6 +337,7 @@
return res;
}
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
int build_number_for_path(char** build, const char* path) {
int res = 0;
char system[PATH_MAX];
@@ -391,6 +392,7 @@
return -1;
}
+#endif
void __data_hex(FILE* f, uint8_t* data, uint32_t size) {
if (!size) return;
Modified: branches/PR-7798586/darwinup/Utils.h
===================================================================
--- branches/PR-7798586/darwinup/Utils.h 2010-03-28 02:49:32 UTC (rev 798)
+++ branches/PR-7798586/darwinup/Utils.h 2010-03-29 22:37:13 UTC (rev 799)
@@ -33,6 +33,7 @@
#ifndef _UTILS_H
#define _UTILS_H
+#include <Availability.h>
#include <stdint.h>
#include <sys/types.h>
#include <fts.h>
@@ -78,7 +79,10 @@
int find_base_system_path(char** output, const char* path);
int update_dyld_shared_cache(const char* path);
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
int build_number_for_path(char** build, const char* path);
+#endif
void __data_hex(FILE* f, uint8_t* data, uint32_t size);
Modified: branches/PR-7798586/darwinup/main.cpp
===================================================================
--- branches/PR-7798586/darwinup/main.cpp 2010-03-28 02:49:32 UTC (rev 798)
+++ branches/PR-7798586/darwinup/main.cpp 2010-03-29 22:37:13 UTC (rev 799)
@@ -30,6 +30,7 @@
* @APPLE_BSD_LICENSE_HEADER_END@
*/
+#include <Availability.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
@@ -48,7 +49,9 @@
fprintf(stderr, "version: 16.2 \n");
fprintf(stderr, " \n");
fprintf(stderr, "options: \n");
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
fprintf(stderr, " -d do not update dyld cache \n");
+#endif
fprintf(stderr, " -f force operation to succeed at all costs \n");
fprintf(stderr, " -n dry run \n");
fprintf(stderr, " -p DIR operate on roots under DIR (default: /) \n");
@@ -71,7 +74,11 @@
fprintf(stderr, " cpio, cpio.gz, cpio.bz2 \n");
fprintf(stderr, " pax, pax.gz, pax.bz2 \n");
fprintf(stderr, " tar, tar.gz, tar.bz2 \n");
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
fprintf(stderr, " xar, zip \n");
+#else
+ fprintf(stderr, " zip \n");
+#endif
fprintf(stderr, " \n");
fprintf(stderr, "archive is one of: \n");
fprintf(stderr, " <serial> the Serial number \n");
@@ -95,20 +102,30 @@
int main(int argc, char* argv[]) {
char* progname = strdup(basename(argv[0]));
char* path = NULL;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
bool update_dyld = true;
-
+#endif
+
int ch;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
while ((ch = getopt(argc, argv, "dfnp:vh")) != -1) {
+#else
+ while ((ch = getopt(argc, argv, "fnp:vh")) != -1) {
+#endif
switch (ch) {
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
case 'd':
update_dyld = false;
break;
+#endif
case 'f':
force = 1;
break;
case 'n':
dryrun = 1;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
update_dyld = false;
+#endif
break;
case 'p':
if (optarg[0] != '/') {
@@ -139,7 +156,9 @@
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");
+#endif
if (!path) {
asprintf(&path, "/");
@@ -205,11 +224,13 @@
usage(progname);
}
}
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
if (update_dyld && depot->is_dirty() && res == 0) {
res = update_dyld_shared_cache(path);
if (res) fprintf(stderr, "Warning: could not update dyld cache.\n");
res = 0;
}
+#endif
}
free(path);
Modified: branches/PR-7798586/testing/darwinup/run-tests.sh
===================================================================
--- branches/PR-7798586/testing/darwinup/run-tests.sh 2010-03-28 02:49:32 UTC (rev 798)
+++ branches/PR-7798586/testing/darwinup/run-tests.sh 2010-03-29 22:37:13 UTC (rev 799)
@@ -11,6 +11,10 @@
DEST=$PREFIX/dest
DESTTAR=dest.tar.gz
+HASXAR=$(darwinup 2>&1 | grep xar | wc -l)
+HAS386=$(file `which darwinup` | grep i386 | wc -l)
+HASX64=$(file `which darwinup` | grep x86_64 | wc -l)
+
DARWINUP="darwinup $1 -p $DEST "
DIFF="diff -x .DarwinDepot -x broken -qru"
@@ -41,30 +45,35 @@
mkdir -p $ORIG
cp -R $DEST/* $ORIG/
-echo "========== TEST: Listing ============="
-sudo -u nobody $DARWINUP list
-$DARWINUP list
+if [ -f /usr/bin/sudo ];
+then
+ echo "========== TEST: Listing ============="
+ /usr/bin/sudo -u nobody $DARWINUP list
+ $DARWINUP list
+fi
-echo "========== TEST: Trying both 32 and 64 bit =========="
-for R in $ROOTS;
-do
- echo "INFO: Installing $R ...";
- arch -i386 $DARWINUP install $PREFIX/$R
- UUID=$($DARWINUP list | head -3 | tail -1 | awk '{print $1}')
- echo "INFO: Uninstalling $R ...";
- arch -x86_64 $DARWINUP uninstall $UUID
- echo "DIFF: diffing original test files to dest (should be no diffs) ..."
- $DIFF $ORIG $DEST 2>&1
- echo "INFO: Installing $R ...";
- arch -x86_64 $DARWINUP install $PREFIX/$R
- UUID=$($DARWINUP list | head -3 | tail -1 | awk '{print $1}')
- echo "INFO: Uninstalling $R ...";
- arch -i386 $DARWINUP uninstall $UUID
- echo "DIFF: diffing original test files to dest (should be no diffs) ..."
- $DIFF $ORIG $DEST 2>&1
-done
+if [ $HAS386 -gt 0 -a $HASX64 -gt 0 ];
+then
+ echo "========== TEST: Trying both 32 and 64 bit =========="
+ for R in $ROOTS;
+ do
+ echo "INFO: Installing $R ...";
+ arch -i386 $DARWINUP install $PREFIX/$R
+ UUID=$($DARWINUP list | head -3 | tail -1 | awk '{print $1}')
+ echo "INFO: Uninstalling $R ...";
+ arch -x86_64 $DARWINUP uninstall $UUID
+ echo "DIFF: diffing original test files to dest (should be no diffs) ..."
+ $DIFF $ORIG $DEST 2>&1
+ echo "INFO: Installing $R ...";
+ arch -x86_64 $DARWINUP install $PREFIX/$R
+ UUID=$($DARWINUP list | head -3 | tail -1 | awk '{print $1}')
+ echo "INFO: Uninstalling $R ...";
+ arch -i386 $DARWINUP uninstall $UUID
+ echo "DIFF: diffing original test files to dest (should be no diffs) ..."
+ $DIFF $ORIG $DEST 2>&1
+ done
+fi
-
echo "========== TEST: Trying roots one at a time =========="
for R in $ROOTS;
do
@@ -201,13 +210,15 @@
echo "DIFF: diffing original test files to dest (should be no diffs) ..."
$DIFF $ORIG $DEST 2>&1
-$DARWINUP install $PREFIX/deep-rollback.cpgz
-$DARWINUP install $PREFIX/deep-rollback-2.xar
-$DARWINUP uninstall all
-echo "DIFF: diffing original test files to dest (should be no diffs) ..."
-$DIFF $ORIG $DEST 2>&1
+if [ $HASXAR -gt 0 ];
+then
+ $DARWINUP install $PREFIX/deep-rollback.cpgz
+ $DARWINUP install $PREFIX/deep-rollback-2.xar ;
+ $DARWINUP uninstall all
+ echo "DIFF: diffing original test files to dest (should be no diffs) ..."
+ $DIFF $ORIG $DEST 2>&1
+fi
-
echo "========== TEST: Testing broken symlink handling =========="
$DARWINUP install $PREFIX/symlinks
$DARWINUP uninstall symlinks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100329/1b76dcc5/attachment-0001.html>
More information about the darwinbuild-changes
mailing list