From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6C577138BF3 for ; Tue, 18 Feb 2014 06:58:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 08F87E0C02; Tue, 18 Feb 2014 06:58:48 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8911AE0C02 for ; Tue, 18 Feb 2014 06:58:47 +0000 (UTC) Received: from flycatcher.gentoo.org (flycatcher.gentoo.org [81.93.255.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 90D3F33F8F4 for ; Tue, 18 Feb 2014 06:58:46 +0000 (UTC) Received: by flycatcher.gentoo.org (Postfix, from userid 559) id 638AD2004C; Tue, 18 Feb 2014 06:58:45 +0000 (UTC) From: "Mike Frysinger (vapier)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, vapier@gentoo.org Subject: [gentoo-commits] gentoo-projects commit in portage-utils: qmerge.c X-VCS-Repository: gentoo-projects X-VCS-Files: qmerge.c X-VCS-Directories: portage-utils X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Message-Id: <20140218065845.638AD2004C@flycatcher.gentoo.org> Date: Tue, 18 Feb 2014 06:58:45 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 6bdaa0fe-0d84-41cd-b55c-4f28b1399844 X-Archives-Hash: 04cbf809f07b4ace72112c30453fae69 vapier 14/02/18 06:58:45 Modified: qmerge.c Log: qmerge: auto fix local Packages files via `emaint binhost --fix` Revision Changes Path 1.137 portage-utils/qmerge.c file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qmerge.c?rev=1.137&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qmerge.c?rev=1.137&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qmerge.c?r1=1.136&r2=1.137 Index: qmerge.c =================================================================== RCS file: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v retrieving revision 1.136 retrieving revision 1.137 diff -u -r1.136 -r1.137 --- qmerge.c 18 Feb 2014 06:58:13 -0000 1.136 +++ qmerge.c 18 Feb 2014 06:58:45 -0000 1.137 @@ -1,7 +1,7 @@ /* * Copyright 2005-2010 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v 1.136 2014/02/18 06:58:13 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v 1.137 2014/02/18 06:58:45 vapier Exp $ * * Copyright 2005-2010 Ned Ludd - * Copyright 2005-2010 Mike Frysinger - @@ -65,7 +65,7 @@ COMMON_OPTS_HELP }; -static const char qmerge_rcsid[] = "$Id: qmerge.c,v 1.136 2014/02/18 06:58:13 vapier Exp $"; +static const char qmerge_rcsid[] = "$Id: qmerge.c,v 1.137 2014/02/18 06:58:45 vapier Exp $"; #define qmerge_usage(ret) usage(ret, QMERGE_FLAGS, qmerge_long_opts, qmerge_opts_help, lookup_applet_idx("qmerge")) char search_pkgs = 0; @@ -1378,7 +1378,7 @@ } if (access(buf, R_OK) == 0) { if (!pkg->SHA1[0] && !pkg->MD5[0]) { - warn("No checksum data for %s", buf); + warn("No checksum data for %s (try `emaint binhost --fix`)", buf); return; } else { if (pkg_verify_checksums(buf, pkg, atom, qmerge_strict, !quiet) == 0) { @@ -1520,20 +1520,51 @@ open_binpkg_index(void) { FILE *fp; - char buf[BUFSIZ]; + char *path; - snprintf(buf, sizeof(buf), "%s/portage/%s", port_tmpdir, Packages); - fp = fopen(buf, "r"); + xasprintf(&path, "%s/portage/%s", port_tmpdir, Packages); + fp = fopen(path, "r"); if (fp) - return fp; + goto done; + free(path); - snprintf(buf, sizeof(buf), "%s/%s", pkgdir, Packages); - fp = fopen(buf, "r"); + xasprintf(&path, "%s/%s", pkgdir, Packages); + fp = fopen(path, "r"); if (fp) - return fp; + goto done; - errp("Unable to open package file %s in %s/portage or %s", + /* This is normal when installing from local repo only. */ + warnp("Unable to open package file %s in %s/portage or %s", Packages, port_tmpdir, pkgdir); + warn("Attempting to manually regen via `emaint binhost`"); + + pid_t p; + int status; + + char argv_emaint[] = "emaint"; + char argv_binhost[] = "binhost"; + char argv_fix[] = "--fix"; + char *argv[] = { + argv_emaint, + argv_binhost, + argv_fix, + NULL, + }; + + p = vfork(); + switch (p) { + case 0: + _exit(execvp(argv[0], argv)); + case -1: + errp("vfork failed"); + } + waitpid(p, &status, 0); + + fp = fopen(path, "r"); + + done: + free(path); + return fp; } _q_static struct pkg_t * @@ -1812,7 +1843,7 @@ free(buf); fclose(fp); - return 0; + return EXIT_SUCCESS; } _q_static queue *