Date: Sun, 11 Jul 2010 22:24:29 GMT From: Ivan Voras <ivoras@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 180784 for review Message-ID: <201007112224.o6BMOTJ9016225@repoman.freebsd.org>
index | next in thread | raw e-mail
http://p4web.freebsd.org/@@180784?ac=10 Change 180784 by ivoras@betelgeuse on 2010/07/11 22:24:03 Patch download step completed Affected files ... .. //depot/projects/soc2010/pkg_patch/src/patch/Makefile#26 edit .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#16 edit .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#16 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#25 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#25 edit .. //depot/projects/soc2010/pkg_patch/src/patch/main.c#26 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#24 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#24 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.c#9 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.h#8 edit .. //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#24 edit .. //depot/projects/soc2010/pkg_patch/src/patch/support.c#23 edit .. //depot/projects/soc2010/pkg_patch/src/patch/updateweb.c#4 edit .. //depot/projects/soc2010/pkg_patch/src/patch/updateweb.h#4 edit Differences ... ==== //depot/projects/soc2010/pkg_patch/src/patch/Makefile#26 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#16 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#16 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#25 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#25 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/main.c#26 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#24 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#24 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.c#9 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatchdir.h#8 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#24 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/support.c#23 (text+ko) ==== @@ -634,7 +634,7 @@ void baton_twirl() { - static char bpos[4] = { '-', '\\', '|', '/' }; + static const char bpos[4] = { '-', '\\', '|', '/' }; static unsigned int counter = 0; fprintf(stdout, "%c\b", bpos[counter++ % 4]); ==== //depot/projects/soc2010/pkg_patch/src/patch/updateweb.c#4 (text+ko) ==== @@ -41,6 +41,7 @@ char target[PKGNAME_MAX]; char patch_name[PATH_MAX]; time_t patch_timestamp; + Boolean match; STAILQ_ENTRY(patchrec) linkage; }; @@ -135,11 +136,11 @@ return (-1); buf = malloc(bs); while (bs > 0) { + if (Verbose) + baton_twirl(); bs = fread(buf, 1, bs, fin); if (bs > 0) fwrite(buf, 1, bs, fout); - if (Verbose) - baton_twirl(); } free(buf); er = ferror(fin); @@ -160,6 +161,8 @@ char local_index[PATH_MAX]; struct patchrec_list prlist; struct patchrec *pr; + char **instpkg; + int er, i, pcount = 0; if (in_url == NULL) in_url = PKGPATCH_SITE_URL; @@ -209,5 +212,56 @@ printf("Available: %s to %s via %s\n", pr->source, pr->target, pr->patch_name); + instpkg = matchinstalled(MATCH_ALL, NULL, &er); + if (instpkg == NULL || er != 0) + err(1, "Error getting a list of installed packages"); + for (i = 0; instpkg[i] != NULL; i++) { + if (Verbose > 2) + printf("Installed: %s\n", instpkg[i]); + STAILQ_FOREACH(pr, &prlist, linkage) + if (strncmp(instpkg[i], pr->source, PKGNAME_MAX) == 0) { + pr->match = TRUE; + pcount++; + break; + } + } + if (pcount == 0) { + if (Verbose) + printf("No package update candidates.\n"); + return; + } + printf("Patch candidates:\n"); + STAILQ_FOREACH(pr, &prlist, linkage) { + if (pr->match) + printf("%s\t", pr->source); + } + printf("\n"); + if (!Force) { + if (!y_or_n(FALSE, "Continue with patching %d packages", pcount)) + return; + } + /* Ok now, fetch the patches */ + if (Verbose) + printf("Downloading: "); + STAILQ_FOREACH(pr, &prlist, linkage) { + char local_file[PATH_MAX], remote_file[PATH_MAX]; + + if (pr->match) { + if (Verbose) { + printf("%s\t", pr->patch_name); + fflush(stdout); + } + snprintf(local_file, PATH_MAX, "%s/%s", my_tmp, + pr->patch_name); + snprintf(remote_file, PATH_MAX, "%s/%s", + url_base, pr->patch_name); + if (Verbose > 3) + printf("%s to %s", remote_file, local_file); + if (download_file(remote_file, local_file) != 0) + err(1, "Cannot download %s", remote_file); + } + } + if (Verbose) + printf(".\n"); } ==== //depot/projects/soc2010/pkg_patch/src/patch/updateweb.h#4 (text+ko) ====home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007112224.o6BMOTJ9016225>
