PERFORCE change 182374 for review
Ivan Voras
ivoras at FreeBSD.org
Fri Aug 13 23:26:56 UTC 2010
http://p4web.freebsd.org/@@182374?ac=10
Change 182374 by ivoras at ursaminor on 2010/08/13 23:26:46
Fix infinite loop, add more diagnostic verbosity
Affected files ...
.. //depot/projects/soc2010/pkg_patch/src/patch/Makefile#35 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/Notes.txt#5 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#25 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#25 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#34 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#34 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/main.c#36 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#33 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#33 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.c#18 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.h#17 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.1#7 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#33 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/support.c#32 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/updateweb.c#13 edit
.. //depot/projects/soc2010/pkg_patch/src/patch/updateweb.h#13 edit
Differences ...
==== //depot/projects/soc2010/pkg_patch/src/patch/Makefile#35 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/Notes.txt#5 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#25 (text+ko) ====
@@ -595,7 +595,7 @@
} else {
char newpkgdir[PATH_MAX];
- /* Rename package directory */
+ /* Rename package db directory */
snprintf(tmp, PATH_MAX, "%s/%s", LOG_DIR, pp.source);
snprintf(newpkgdir, PATH_MAX, "%s/%s", LOG_DIR, pp.target);
if (rename(tmp, newpkgdir) != 0) {
==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#25 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#34 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#34 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/main.c#36 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#33 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#33 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.c#18 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.h#17 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.1#7 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#33 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/support.c#32 (text+ko) ====
==== //depot/projects/soc2010/pkg_patch/src/patch/updateweb.c#13 (text+ko) ====
@@ -204,7 +204,8 @@
}
if (Verbose > 1)
- printf("Patching from %s (index file: %s)\n", url_base, url_index);
+ printf("Patching from %s (index file: %s)\n", url_base,
+ url_index);
extract_filename(url_index, index_fname, PATH_MAX);
snprintf(local_index, PATH_MAX, "%s/%s", my_tmp, index_fname);
@@ -228,6 +229,9 @@
TAILQ_INIT(&pindex.prlist);
if (read_pkgpatchindex_file(&pindex, local_index) != 0)
err(1, "Cannot read pkgpatchindex: %s", local_index);
+ if (pindex.ver_major == 0)
+ errx(1, "Missing version number. Patch index %s corrupted?",
+ url_index);
if (pindex.ver_major != PKGPATCH_VERSION_MAJOR)
errx(1, "Major version mismatch: got %d expected %d",
pindex.ver_major, PKGPATCH_VERSION_MAJOR);
@@ -318,6 +322,8 @@
pr->source, instpkg[er-1]);
}
}
+ if (Verbose > 3)
+ printf("Pondering dependancies...\n");
scount = 1;
while (scount != 0) {
@@ -328,15 +334,18 @@
/* Sort the package patches by dependancies */
TAILQ_FOREACH(pr, &pindex.prlist, linkage) {
struct patchrec *pr2 = NULL;
- int foundit = FALSE;
+ int foundit;
if (!pr->match)
continue;
pl = pr->plist->head;
while (pl != NULL) {
- if (pl->type != PLIST_PKGDEP)
+ if (pl->type != PLIST_PKGDEP) {
+ pl = pl->next;
continue;
+ }
ndeps++;
+ foundit = FALSE;
/* Search deps in installed live packages */
for (i = 0; instpkg[i] != NULL; i++)
if (strncmp(pl->name, instpkg[i],
@@ -346,6 +355,9 @@
break;
}
if (foundit) {
+ if (Verbose > 2)
+ printf("[live] Found %s -> %s\n",
+ pr->target, instpkg[i]);
pl = pl->next;
continue;
}
@@ -354,12 +366,18 @@
PKGNAME_MAX) == 0) {
ndeps_found++;
foundit = TRUE;
+ if (Verbose > 2)
+ printf("[patch] "
+ "Found %s -> %s\n",
+ pr->target,
+ pr2->target);
break;
}
}
if (!foundit) {
printf("Dependancy cannot be satisfied "
- "%s -> %s\n", pr->target, pl->name);
+ "%s -> %s -trying to install\n",
+ pr->target, pl->name);
if (pkg_add(&pindex, pl->name) != 0)
err(1, "Cannot install %s\n",
pl->name);
@@ -369,6 +387,9 @@
/* 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++;
@@ -380,6 +401,16 @@
ndeps_found);
}
+ if (Verbose > 1) {
+ printf("Applying patches in the following order:\t");
+ TAILQ_FOREACH(pr, &pindex.prlist, linkage) {
+ if (!pr->match)
+ continue;
+ printf("%s\t", pr->patch_name);
+ }
+ printf("\n");
+ }
+
/* Ok, apply the gathered patches now */
TAILQ_FOREACH(pr, &pindex.prlist, linkage) {
char local_file[PATH_MAX];
==== //depot/projects/soc2010/pkg_patch/src/patch/updateweb.h#13 (text+ko) ====
More information about the p4-projects
mailing list