Revision: 861 http://trac.macosforge.org/projects/darwinbuild/changeset/861 Author: wsiegrist@apple.com Date: 2010-08-10 17:22:13 -0700 (Tue, 10 Aug 2010) Log Message: ----------- Merge PR-8279204 Added Paths: ----------- trunk/darwinbuild/digest.c Removed Paths: ------------- trunk/darwinbuild/Makefile trunk/darwinup/Makefile trunk/darwinxref/Makefile Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/PR-4841388:399-419 /branches/PR-6358021:442-443 /branches/PR-6392966:423-427 /branches/PR-6398060:433-434 /branches/PR-6493844:460-461 /branches/PR-6497694:466-468,471 /branches/PR-6634286:632-650 /branches/PR-6688645:479-490 /branches/PR-6722857:495-499 /branches/PR-6729491:655-664 /branches/PR-6973110:804-813 /branches/PR-7250612:635-650 /branches/PR-7341154:682-694 /branches/PR-7431723:660-664 /branches/PR-7461534:650-664 /branches/PR-7482850:670-671 /branches/PR-7489777:676-731 /branches/PR-7529688:692-694 /branches/PR-7593824:739-772 /branches/PR-7598640:703-731 /branches/PR-7748469:777-785 /branches/PR-7765119:790-791 /branches/PR-7798586:796-799 /branches/PR-7872907:830-840 /branches/PR-7935095:819-821 /branches/PR-8116613:849 + /branches/PR-4841388:399-419 /branches/PR-6358021:442-443 /branches/PR-6392966:423-427 /branches/PR-6398060:433-434 /branches/PR-6493844:460-461 /branches/PR-6497694:466-468,471 /branches/PR-6634286:632-650 /branches/PR-6688645:479-490 /branches/PR-6722857:495-499 /branches/PR-6729491:655-664 /branches/PR-6973110:804-813 /branches/PR-7250612:635-650 /branches/PR-7341154:682-694 /branches/PR-7431723:660-664 /branches/PR-7461534:650-664 /branches/PR-7482850:670-671 /branches/PR-7489777:676-731 /branches/PR-7529688:692-694 /branches/PR-7593824:739-772 /branches/PR-7598640:703-731 /branches/PR-7748469:777-785 /branches/PR-7765119:790-791 /branches/PR-7798586:796-799 /branches/PR-7872907:830-840 /branches/PR-7935095:819-821 /branches/PR-8116613:849 /branches/PR-8279204:854-860 Deleted: trunk/darwinbuild/Makefile =================================================================== --- trunk/darwinbuild/Makefile 2010-08-09 21:21:36 UTC (rev 860) +++ trunk/darwinbuild/Makefile 2010-08-11 00:22:13 UTC (rev 861) @@ -1,75 +0,0 @@ -include ../common.mk - -### -### Variables for the 'install' phase -### -DATDIR:=$(DATDIR)/darwinbuild - -PrefixReplacements = darwinbuild \ - darwinmaster.sh \ - packageRoots.sh \ - thinPackages.sh \ - installXcode \ - installXcode32 - -all: manifest prefixes - -manifest: manifest.c - cc $(CFLAGS) -Wall -Werror -o $(OBJROOT)/$@ -lcrypto $^ - -prefixes: $(PrefixReplacements) - -$(PrefixReplacements): % : %.in - $(SED) -e 's,%%PREFIX%%,$(PREFIX),' $@.in > $@ ; - -install: all - [ -d $(BINDIR) ] || $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(BINDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) darwinbuild $(BINDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) darwinmaster $(BINDIR) - - [ -d $(DATDIR) ] || $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(DATDIR) - $(INSTALL) $(INSTALL_DOC_FLAGS) darwinbuild.common $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode2 $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode3 $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode31 $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) installXcode32 $(DATDIR) - $(INSTALL) $(INSTALL_DOC_FLAGS) Info.plist $(DATDIR) - $(INSTALL) $(INSTALL_DOC_FLAGS) SDKSettings.plist $(DATDIR) - - $(INSTALL) $(INSTALL_EXE_FLAGS) createChroot $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) $(OBJROOT)/manifest $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) ditto $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) buildlist $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) buildorder $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) packageRoots $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) synthfat $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) thinFile $(DATDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) thinPackages $(DATDIR) - -uninstall: - rm -f $(BINDIR)/darwinbuild - rm -f $(BINDIR)/darwinmaster - rm -f $(DATDIR)/darwinbuild.common - rm -f $(DATDIR)/installXcode - rm -f $(DATDIR)/installXcode2 - rm -f $(DATDIR)/installXcode3 - rm -f $(DATDIR)/installXcode31 - rm -f $(DATDIR)/installXcode32 - rm -f $(DATDIR)/Info.plist - rm -f $(DATDIR)/SDKSettings.plist - rm -f $(DATDIR)/createChroot - rm -f $(DATDIR)/manifest - rm -f $(DATDIR)/ditto - rm -f $(DATDIR)/buildlist - rm -f $(DATDIR)/buildorder - rm -f $(DATDIR)/packageRoots - rm -f $(DATDIR)/synthfat - rm -f $(DATDIR)/thinFile - rm -f $(DATDIR)/thinPackages - - -clean: - rm -f manifest - @$(foreach SCRIPT,$(PrefixReplacements), \ - rm -f $(SCRIPT) ; ) Copied: trunk/darwinbuild/digest.c (from rev 860, branches/PR-8279204/darwinbuild/digest.c) =================================================================== --- trunk/darwinbuild/digest.c (rev 0) +++ trunk/darwinbuild/digest.c 2010-08-11 00:22:13 UTC (rev 861) @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010 Apple Computer, Inc. All rights reserved. + * + * @APPLE_BSD_LICENSE_HEADER_START@ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @APPLE_BSD_LICENSE_HEADER_END@ + */ + +#include <sys/types.h> +#include <errno.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <CommonCrypto/CommonDigest.h> + + +void print_usage() { + fprintf(stdout, "digest [-1] \n"); + fprintf(stdout, " Print digest hash of stdin to stdout. \n"); + fprintf(stdout, " \n"); + fprintf(stdout, " -1 Use SHA1 hash (default) \n"); + fprintf(stdout, " \n"); +} + +char* format_digest(const unsigned char* m) { + char* result = NULL; + // SHA-1 + asprintf(&result, + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x", + m[0], m[1], m[2], m[3], + m[4], m[5], m[6], m[7], + m[8], m[9], m[10], m[11], + m[12], m[13], m[14], m[15], + m[16], m[17], m[18], m[19] + ); + return result; +} + +char* calculate_digest(int fd) { + unsigned char md[CC_SHA1_DIGEST_LENGTH]; + CC_SHA1_CTX c; + CC_SHA1_Init(&c); + + memset(md, 0, CC_SHA1_DIGEST_LENGTH); + + ssize_t len; + const unsigned int blocklen = 8192; + unsigned char* block = (unsigned char*)malloc(blocklen); + if (!block) { + errno = ENOMEM; + return NULL; + } + while(1) { + len = read(fd, block, blocklen); + if (len == 0) { close(fd); break; } + if ((len < 0) && (errno == EINTR)) continue; + if (len < 0) { close(fd); return NULL; } + CC_SHA1_Update(&c, block, (size_t)len); + } + + CC_SHA1_Final(md, &c); + free(block); + return format_digest(md); +} + + +int main(int argc, char* argv[]) { + + int digest = 1; // default to SHA1 + + int ch; + while ((ch = getopt(argc, argv, "1")) != -1) { + switch (ch) { + case '1': + digest = 1; + break; + case '?': + default: + print_usage(); + exit(1); + } + } + argc -= optind; + argv += optind; + + fprintf(stdout, "%s\n", calculate_digest(fileno(stdin))); + + return 0; +} Deleted: trunk/darwinup/Makefile =================================================================== --- trunk/darwinup/Makefile 2010-08-09 21:21:36 UTC (rev 860) +++ trunk/darwinup/Makefile 2010-08-11 00:22:13 UTC (rev 861) @@ -1,30 +0,0 @@ -include ../common.mk - -CXXFLAGS=-g -Wall -Werror -Wno-non-virtual-dtor $(CFLAGS) -# libredo.o is generated from cctools_ofiles -REDO=$(shell if [ -f /usr/local/lib/libredo_prebinding.a ]; then \ - echo /usr/local/lib/libredo_prebinding.a ; else \ - echo libredo.o ; fi) - -all: darwinup - -darwinup: Archive.o Depot.o Digest.o File.o SerialSet.o Utils.o main.o \ - $(REDO) - g++ $(CXXFLAGS) -lcrypto -lsqlite3 -o $@ $^ - -Archive.o: Archive.cpp Archive.h Depot.h File.h Utils.h -Depot.o: Depot.cpp Archive.h Depot.h File.h Utils.h -Digest.o: Digest.cpp Digest.h -File.o: File.cpp Archive.h Digest.h File.h Utils.h -Utils.o: Utils.h -main.o: main.cpp Depot.h Utils.h - -install: all - [ -d $(BINDIR) ] || $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(BINDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) darwinup $(BINDIR) - -uninstall: - rm -f $(BINDIR)/darwinup - -clean: - rm -f darwinup Archive.o Depot.o Digest.o File.o SerialSet.o Utils.o main.o Deleted: trunk/darwinxref/Makefile =================================================================== --- trunk/darwinxref/Makefile 2010-08-09 21:21:36 UTC (rev 860) +++ trunk/darwinxref/Makefile 2010-08-11 00:22:13 UTC (rev 861) @@ -1,108 +0,0 @@ -include ../common.mk - -### -### Variables for the 'install' phase -### -DATDIR:=$(DATDIR)/darwinxref -INCDIR:=$(INCDIR)/darwinbuild - -SOURCES= \ - DBDataStore.c \ - DBPlugin.c \ - DBTclPlugin.c \ - cfutils.c \ - main.c - -PLUGIN_SOURCES=$(wildcard plugins/*.c) -PLUGIN_OBJECTS=$(PLUGIN_SOURCES:.c=.so) $(wildcard plugins/*.tcl) - -### todo: --with-plugin-path configuration -CFLAGS+= \ - -DDEFAULT_DB_FILE=\".build/xref.db\" \ - -DDEFAULT_PLUGIN_PATH=\"$(subst $(DESTDIR),,$(DATDIR))/plugins\" \ - -### todo: --with-tcl-plugins configuration -TCL_CFLAGS=-DHAVE_TCL_PLUGINS=1 -TCL_LDFLAGS=-ltcl - -CFLAGS+=-g -Wall -Werror $(TCL_CFLAGS) $(SQLITEINC) -LDFLAGS+=-framework CoreFoundation $(TCL_LDFLAGS) -PLUGIN_CFLAGS=$(CFLAGS) -I. -PLUGIN_LDFLAGS=$(LDFLAGS) -bundle -bundle_loader $(SYMROOT)/darwinxref - -CC = cc -DSYMUTIL = dsymutil - -all: \ - darwinxref \ - $(PLUGIN_SOURCES:.c=.so) \ - upgrade_plist \ - apple_plugins - -install: all install_apple_plugins - [ -d $(BINDIR) ] || \ - $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(BINDIR) - $(INSTALL) $(INSTALL_EXE_FLAGS) $(SYMROOT)/darwinxref $(BINDIR) - - [ -d $(DATDIR)/plugins ] || \ - $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(DATDIR)/plugins - $(INSTALL) $(INSTALL_DOC_FLAGS) $(OBJROOT)/plugins/*.so plugins/*.tcl $(DATDIR)/plugins - - [ -d $(INCDIR) ] || \ - $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(INCDIR) - $(INSTALL) $(INSTALL_DOC_FLAGS) DBPlugin.h cfutils.h $(INCDIR) - -uninstall: - rm -f $(BINDIR)/darwinxref - [ ! -d $(DATDIR) ] || ( cd $(DATDIR) && rm -f $(PLUGIN_OBJECTS) ) - -rmdir $(DATDIR)/plugins - -rmdir $(DATDIR) - - rm -f $(INCDIR)/DBPlugin.h - rm -f $(INCDIR)/cfutils.h - -rmdir $(INCDIR) - -clean: - rm -f darwinxref - rm -rf darwinxref.dSYM - rm -f $(SOURCES:.c=.o) - rm -f $(PLUGIN_SOURCES:.c=.so) - rm -rf $(PLUGIN_SOURCES:.c=.so.dSYM) - rm -f upgrade_plist - rm -rf upgrade_plist.dSYM - -darwinxref: $(SOURCES) - @for CFILE in $(SOURCES); do \ - OFILE=$$(echo $$(basename $${CFILE}) | sed -e 's,\.[^.]*$$,.o,') ; \ - CMD="$(CC) $(CFLAGS) -c -o $(OBJROOT)/$${OFILE} $${CFILE}"; \ - echo $$CMD ; $$CMD || exit 1 ; \ - done - $(CC) $(LDFLAGS) $(CFLAGS) -o $(SYMROOT)/darwinxref \ - $(SQLITELIB) \ - $(foreach OFILE, $(SOURCES:.c=.o), $(OBJROOT)/$(notdir $(OFILE))) - $(DSYMUTIL) --out $(SYMROOT)/darwinxref.dSYM $(SYMROOT)/darwinxref || true - -plugins/register.so: plugins/register.c DBPlugin.h darwinxref - @mkdir -p $(OBJROOT)/plugins - cc $(CFLAGS) -o $(OBJROOT)/$@ $(PLUGIN_CFLAGS) $(PLUGIN_LDFLAGS) $(SQLITEINC) $(SQLITELIB) -lcrypto $< - -plugins/%.so: plugins/%.c DBPlugin.h darwinxref - @mkdir -p $(OBJROOT)/plugins - cc $(CFLAGS) -o $(OBJROOT)/$@ $(PLUGIN_CFLAGS) $(PLUGIN_LDFLAGS) $< - -plugins-darwinports/%.so: plugins-darwinports/%.c DBPlugin.h darwinxref - cc $(CFLAGS) -o $(OBJROOT)/$@ $(PLUGIN_CFLAGS) $(PLUGIN_LDFLAGS) $< - -apple_plugins: - @if [ -d plugins-apple ]; then \ - make -C plugins-apple; \ - fi - -install_apple_plugins: - @if [ -d plugins-apple ]; then \ - make -C plugins-apple install; \ - fi - -upgrade_plist: upgrade_plist.c cfutils.c - cc $(CFLAGS) -o $(OBJROOT)/$@ $(CFLAGS) $(LDFLAGS) $^ -
participants (1)
-
source_changes@macosforge.org