From owner-p4-projects@FreeBSD.ORG Mon Aug 16 00:01:34 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 24A131065670; Mon, 16 Aug 2010 00:01:34 +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 DB1A0106564A for ; Mon, 16 Aug 2010 00:01:33 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id C7AD78FC1E for ; Mon, 16 Aug 2010 00:01:33 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o7G01Xsu008818 for ; Mon, 16 Aug 2010 00:01:33 GMT (envelope-from ivoras@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o7G01XTN008811 for perforce@freebsd.org; Mon, 16 Aug 2010 00:01:33 GMT (envelope-from ivoras@FreeBSD.org) Date: Mon, 16 Aug 2010 00:01:33 GMT Message-Id: <201008160001.o7G01XTN008811@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to ivoras@FreeBSD.org using -f From: Ivan Voras To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 182448 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: Mon, 16 Aug 2010 00:01:34 -0000 http://p4web.freebsd.org/@@182448?ac=10 Change 182448 by ivoras@ursaminor on 2010/08/16 00:01:00 Avoid shuffling dependancies if already shuffled, add more optional verbose messages. Affected files ... .. //depot/projects/soc2010/pkg_patch/src/patch/Makefile#37 edit .. //depot/projects/soc2010/pkg_patch/src/patch/Notes.txt#7 edit .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#27 edit .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#27 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#36 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#36 edit .. //depot/projects/soc2010/pkg_patch/src/patch/main.c#38 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#35 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#35 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.c#20 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.h#19 edit .. //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.1#9 edit .. //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#35 edit .. //depot/projects/soc2010/pkg_patch/src/patch/support.c#34 edit .. //depot/projects/soc2010/pkg_patch/src/patch/updateweb.c#15 edit .. //depot/projects/soc2010/pkg_patch/src/patch/updateweb.h#15 edit Differences ... ==== //depot/projects/soc2010/pkg_patch/src/patch/Makefile#37 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/Notes.txt#7 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#27 (text+ko) ==== @@ -307,7 +307,7 @@ if (access(fpatch, R_OK) != 0) err(1, "Access error reading file: %s", fpatch); snprintf(dpatch, PATH_MAX, "%s/patch", my_tmp); - if (access(dpatch, R_OK) != 0) + if (access(dpatch, R_OK) == 0) rm_rf(dpatch); if (mkdir(dpatch, 0700) != 0) err(1, "Cannot create directory: %s", dpatch); @@ -346,6 +346,9 @@ * Step 2 - read the existing (live system) package data and the new * package data. */ + memset(&pkg_live, 0, sizeof(pkg_live)); + memset(&pkg_new, 0, sizeof(pkg_new)); + memset(&xpatch, 0, sizeof(xpatch)); if (read_package_by_name(pp.source, &pkg_live) != 0) err(1, "Cannot read package information for %s", pp.source); snprintf(tmp, PATH_MAX, "%s/%s", dpatch, CONTENTS_FNAME); @@ -360,6 +363,9 @@ printf("Verifying live system and patch data consistency...\n"); /* Check that files to be added don't exist already. */ STAILQ_FOREACH(pl, &pp.pp_add, linkage) { + snprintf(tmp, PATH_MAX, "%s/%s", dpatch, pl->filename); + if (isdir(tmp)) + continue; if (pkg_to_live_filename(tmp, pl->filename, &pkg_new, "pp_add") != 0) { err_count++; @@ -435,6 +441,8 @@ baton_twirl(); /* Step 4 - backup the existing package */ + if (Verbose > 1) + printf("Backing up the old package to %s...\n", backup_pkg); if (pkg_backup(pp.source, backup_pkg) != 0) err(1, "Cannot backup package: %s", pp.source); @@ -443,6 +451,8 @@ * existing files and patches, then verifying all of them match expected * checksum, then rename()-ing them to the expected files. */ + if (Verbose > 1) + printf("Applying patches...\n"); snprintf(pext, sizeof(pext), ".p%u", getpid()); fpvect = calloc(pplist_count(&pp.pp_patch), sizeof(*fpvect)); n_patched_files = 0; @@ -492,6 +502,8 @@ if (pclose(fpvect[i]) != 0) err(1, "pclose() failed"); /* Verify patched files are correct */ + if (Verbose > 1) + printf("Verifying patched files...\n"); STAILQ_FOREACH(pl, &pp.pp_patch, linkage) { char live_md5[33], target_md5[33], newfile[PATH_MAX]; @@ -534,6 +546,8 @@ baton_twirl(); } /* All is well, we can rename() the new files to the live ones. */ + if (Verbose > 1) + printf("Finishing...\n"); STAILQ_FOREACH(pl, &pp.pp_patch, linkage) { char newfile[PATH_MAX], livefile[PATH_MAX]; ==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#27 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#36 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#36 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/main.c#38 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#35 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#35 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.c#20 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.h#19 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.1#9 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#35 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/support.c#34 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/updateweb.c#15 (text+ko) ==== @@ -45,6 +45,7 @@ Package *plist; Boolean match; Boolean found_deps; + Boolean shuffled; TAILQ_ENTRY(patchrec) linkage; }; @@ -401,15 +402,18 @@ pl = pl->next; continue; } - /* Reshuffle the found (depended-on) package to - * the front. */ assert(pr2 != NULL); - if (Verbose > 2) - printf("Shuffling %s to head of queue\n", - pr2->target); - TAILQ_REMOVE(&pindex.prlist, pr2, linkage); - TAILQ_INSERT_HEAD(&pindex.prlist, pr2, linkage); - scount++; + if (!pr2->shuffled) { + if (Verbose > 2) + printf("Shuffling %s to head " + "of queue\n", pr2->target); + TAILQ_REMOVE(&pindex.prlist, pr2, + linkage); + TAILQ_INSERT_HEAD(&pindex.prlist, pr2, + linkage); + pr2->shuffled = TRUE; + scount++; + } pl = pl->next; } } ==== //depot/projects/soc2010/pkg_patch/src/patch/updateweb.h#15 (text+ko) ====