PERFORCE change 182452 for review
Ivan Voras
ivoras at FreeBSD.org
Mon Aug 16 01:06:21 UTC 2010
http://p4web.freebsd.org/@@182452?ac=10
Change 182452 by ivoras at 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;
}
}
More information about the p4-projects
mailing list