From owner-p4-projects@FreeBSD.ORG Mon Aug 16 01:06:21 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1FA1310656A5; Mon, 16 Aug 2010 01:06:21 +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 BCFA51065696 for ; Mon, 16 Aug 2010 01:06:20 +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 8E2218FC08 for ; Mon, 16 Aug 2010 01:06:20 +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 o7G16Ki2024187 for ; Mon, 16 Aug 2010 01:06:20 GMT (envelope-from ivoras@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o7G16Kp8024184 for perforce@freebsd.org; Mon, 16 Aug 2010 01:06:20 GMT (envelope-from ivoras@FreeBSD.org) Date: Mon, 16 Aug 2010 01:06:20 GMT Message-Id: <201008160106.o7G16Kp8024184@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 182452 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 01:06:21 -0000 http://p4web.freebsd.org/@@182452?ac=10 Change 182452 by ivoras@ursaminor on 2010/08/16 01:05:16 Fix directory name translation and handling Affected files ... .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#28 edit Differences ... ==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#28 (text+ko) ==== @@ -153,6 +153,7 @@ int pdirlen; Boolean found = FALSE; + *adirname = '\0'; pdirlen = strlen(pdirname); pli = pkg->head; while (pli != NULL) { @@ -175,7 +176,7 @@ warnx("Failure to detect package cwd info [%s]", msg); return (-1); } - snprintf(adirname, PATH_MAX, "%s/%s", last_cwd, pli->name); + snprintf(adirname, PATH_MAX, "%s/%s", last_cwd, pdirname); return (0); } @@ -373,7 +374,7 @@ } if (access(tmp, F_OK) == 0) { warnx("File exists but shouldn't: %s", tmp); - err_count++; + /* err_count++; */ } } /* Check that files to be removed actually exist. */ @@ -442,7 +443,7 @@ baton_twirl(); /* Step 4 - backup the existing package */ if (Verbose > 1) - printf("Backing up the old package to %s...\n", backup_pkg); + printf("Backing up the old package...\n"); if (pkg_backup(pp.source, backup_pkg) != 0) err(1, "Cannot backup package: %s", pp.source); @@ -493,7 +494,7 @@ err(1, "Cannot symlink %s to %s", patchfile, newfile); } else { - if (cp(patchfile, newfile) != 0) + if (copy_file_absolute(patchfile, newfile) != 0) err(1, "Cannot copy %s to %s", patchfile, newfile); } @@ -566,15 +567,21 @@ /* Step 6 - apply other cases - files to add, remove, dirs to rmdir */ STAILQ_FOREACH(pl, &pp.pp_add, linkage) { char livefile[PATH_MAX]; + int er; snprintf(tmp, PATH_MAX, "%s/%s", dpatch, pl->filename); - if (pkg_to_live_filename(livefile, pl->filename, &pkg_new, - "pp_add2") != 0) { + if (!isdir(tmp)) + er = pkg_to_live_filename(livefile, pl->filename, + &pkg_new, "pp_add2"); + else + er = pkg_to_live_dirname(livefile, pl->filename, + &pkg_new, "pp_add2"); + if (er != 0) { warnx("Cannot resolve %s in new pkg", pl->filename); goto error_cleanup; } if (copy_file_absolute(tmp, livefile) != 0) { - warn("Cannot copy %s to %s", tmp, livefile); + warn("Cannot copy %s to %s [pp_add]", tmp, livefile); goto error_cleanup; } }