From owner-p4-projects@FreeBSD.ORG Sun Jul 11 22:24:30 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 27C601065670; Sun, 11 Jul 2010 22:24:30 +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 E033B106566B for ; Sun, 11 Jul 2010 22:24:29 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id CE1388FC0A for ; Sun, 11 Jul 2010 22:24:29 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o6BMOTbm016227 for ; Sun, 11 Jul 2010 22:24:29 GMT (envelope-from ivoras@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o6BMOTJ9016225 for perforce@freebsd.org; Sun, 11 Jul 2010 22:24:29 GMT (envelope-from ivoras@FreeBSD.org) Date: Sun, 11 Jul 2010 22:24:29 GMT Message-Id: <201007112224.o6BMOTJ9016225@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ivoras@FreeBSD.org using -f From: Ivan Voras To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180784 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: Sun, 11 Jul 2010 22:24:30 -0000 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) ====