Date: Fri, 13 Aug 2010 23:42:15 GMT From: Ivan Voras <ivoras@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 182375 for review Message-ID: <201008132342.o7DNgFso001970@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@182375?ac=10 Change 182375 by ivoras@ursaminor on 2010/08/13 23:41:38 Re-read pkg db after installing dependancies. Affected files ... .. //depot/projects/soc2010/pkg_patch/src/patch/Makefile#36 edit .. //depot/projects/soc2010/pkg_patch/src/patch/Notes.txt#6 edit .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#26 edit .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#26 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#35 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#35 edit .. //depot/projects/soc2010/pkg_patch/src/patch/main.c#37 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#34 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#34 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.c#19 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.h#18 edit .. //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.1#8 edit .. //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#34 edit .. //depot/projects/soc2010/pkg_patch/src/patch/support.c#33 edit .. //depot/projects/soc2010/pkg_patch/src/patch/updateweb.c#14 edit .. //depot/projects/soc2010/pkg_patch/src/patch/updateweb.h#14 edit Differences ... ==== //depot/projects/soc2010/pkg_patch/src/patch/Makefile#36 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/Notes.txt#6 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#26 (text+ko) ==== @@ -307,6 +307,8 @@ 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) + rm_rf(dpatch); if (mkdir(dpatch, 0700) != 0) err(1, "Cannot create directory: %s", dpatch); if (pkgxjob_start(&xpatch, dpatch, fpatch) != 0) ==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#26 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#35 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#35 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/main.c#37 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#34 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#34 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.c#19 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.h#18 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.1#8 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#34 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/support.c#33 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/updateweb.c#14 (text+ko) ==== @@ -165,12 +165,17 @@ pkg_add(struct patch_index *pindex, char *pkg_name) { char url[PATH_MAX]; + int exit_code; snprintf(url, sizeof(url), "%s/%s.%s", pindex->pkg_repo_url, pkg_name, PKG_FORMAT_EXT); if (Verbose > 1) printf("Trying to install %s.\n", url); - return vsystem("%s %s", _PATH_PKG_ADD, url); + exit_code = vsystem("%s %s", _PATH_PKG_ADD, url); + if (exit_code != 0) + printf("Exit code %d running %s %s\n", exit_code, + _PATH_PKG_ADD, url); + return (exit_code); } @@ -376,11 +381,23 @@ } if (!foundit) { printf("Dependancy cannot be satisfied " - "%s -> %s -trying to install\n", + "%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); + /* + * XXX: memory leak. libpkg doesn't have + * an API for freeing matchinstalled() + * data? + */ + instpkg = matchinstalled(MATCH_ALL, + NULL, &er); + if (instpkg == NULL || er != 0) + err(1, "Error getting a list of " + "installed packages"); + foundit = TRUE; + ndeps_found++; pl = pl->next; continue; } @@ -420,6 +437,8 @@ snprintf(local_file, PATH_MAX, "%s/%s", my_tmp, pr->patch_name); + if (Verbose > 2) + printf("Applying patch: %s\n", local_file); perform_applypatch(local_file); } } ==== //depot/projects/soc2010/pkg_patch/src/patch/updateweb.h#14 (text+ko) ====
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008132342.o7DNgFso001970>