From owner-p4-projects@FreeBSD.ORG Thu Jun 10 19:02:58 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B1051106567A; Thu, 10 Jun 2010 19:02:58 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CCD5106564A for ; Thu, 10 Jun 2010 19:02:58 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from repoman.freebsd.org (unknown [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 42AF88FC1C for ; Thu, 10 Jun 2010 19:02:58 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5AJ2wd7055296 for ; Thu, 10 Jun 2010 19:02:58 GMT (envelope-from ivoras@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5AJ2wZv055294 for perforce@freebsd.org; Thu, 10 Jun 2010 19:02:58 GMT (envelope-from ivoras@FreeBSD.org) Date: Thu, 10 Jun 2010 19:02:58 GMT Message-Id: <201006101902.o5AJ2wZv055294@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ivoras@FreeBSD.org using -f From: Ivan Voras To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 179430 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jun 2010 19:02:58 -0000 http://p4web.freebsd.org/@@179430?ac=10 Change 179430 by ivoras@betelgeuse on 2010/06/10 19:02:06 Skeleton for applypatch function Affected files ... .. //depot/projects/soc2010/pkg_patch/src/patch/Makefile#11 edit .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#1 add .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#1 add .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#10 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#10 edit .. //depot/projects/soc2010/pkg_patch/src/patch/main.c#11 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#9 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#9 edit .. //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#9 edit .. //depot/projects/soc2010/pkg_patch/src/patch/support.c#8 edit Differences ... ==== //depot/projects/soc2010/pkg_patch/src/patch/Makefile#11 (text+ko) ==== @@ -3,7 +3,7 @@ .include PROG= pkg_patch -SRCS= main.c mkpatch.c support.c hashjob.c +SRCS= main.c applypatch.c mkpatch.c support.c hashjob.c WARNS?= 4 WFORMAT?= 1 ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#10 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#10 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/main.c#11 (text+ko) ==== @@ -32,6 +32,7 @@ #define PKG_PATCH_MAIN #include "pkg_patch.h" #include "mkpatch.h" +#include "applypatch.h" int argc; @@ -49,7 +50,9 @@ static void usage_short() { - printf("usage: %s -c [-b] package_file_1 package_file_2\n", argv[0]); + printf("usage:\n"); + printf("\t%s -c [-b] package_file_1 package_file_2 patch_file\n", argv[0]); + printf("\t%s -a patch_file\n", argv[0]); } @@ -59,6 +62,9 @@ while ((ch = getopt(argc, argv, "bchv")) != -1) { switch (ch) { + case 'a': + patch_op = PP_APPLY; + break; case 'b': flag_bsdiff = 1; break; @@ -92,7 +98,9 @@ if (access(_PATH_RM, X_OK) != 0) errx(1, "Cannot execute %s", _PATH_RM); if (access(_PATH_TAR, X_OK) != 0) - errx(1, "Cannot execute %s", _PATH_TAR); + errx(1, "Cannot execute %s", _PATH_TAR); + if (access(_PATH_BSDIFF, X_OK) != 0) + errx(1, "Cannot execute %s", _PATH_BSDIFF); asprintf(&my_tmp, "%spkg_patch.%d.%d", _PATH_TMP, getpid(), time(NULL)); if (mkdir(my_tmp, 0700) != 0) errx(1, "Cannot create working directory: %s", my_tmp); @@ -130,6 +138,9 @@ case PP_MKPATCH: perform_mkpatch(); break; + case PP_APPLY: + perform_applypatch(); + break; default: errx(1, "This should not happen - unknown patch_op"); } ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#9 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#9 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#9 (text+ko) ==== @@ -30,7 +30,7 @@ #define PKGPATCH_FNAME "+PKGPATCH" #define PKGPATCH_VERSION "1.0" -enum PP_OP { PP_NONE, PP_MKPATCH }; +enum PP_OP { PP_NONE, PP_MKPATCH, PP_APPLY }; struct pkgxjob { char *filename; ==== //depot/projects/soc2010/pkg_patch/src/patch/support.c#8 (text+ko) ====