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 43E68138A87 for ; Tue, 24 Feb 2015 01:26:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 50B68E08E2; Tue, 24 Feb 2015 01:26:16 +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 F3FB6E08D6 for ; Tue, 24 Feb 2015 01:26:09 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 27DF234096C for ; Tue, 24 Feb 2015 01:26:09 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3933E126BE for ; Tue, 24 Feb 2015 01:26:05 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1424737285.f23fa9375a936d3d7d565175dfe39a2dd209d45e.vapier@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qmerge.c X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: f23fa9375a936d3d7d565175dfe39a2dd209d45e X-VCS-Branch: master Date: Tue, 24 Feb 2015 01:26:05 +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: 62c036a9-aef6-4a42-8123-aa97130adf94 X-Archives-Hash: f60d5746be0b3aa0b27718bfb379798b commit: f23fa9375a936d3d7d565175dfe39a2dd209d45e Author: Mike Frysinger gentoo org> AuthorDate: Tue Feb 24 00:21:25 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Tue Feb 24 00:21:25 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage-utils.git;a=commit;h=f23fa937 qmerge: parse the binpkg header first This contains common details (like REPO) that are not repeated for every entry. We'll propagate that back out whenever we reset the Pkg state. Also seed the SLOT value with 0 every time. Its value is omitted when it is the default, so we have to do this ourselves. --- qmerge.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/qmerge.c b/qmerge.c index be28cb7..1bd860d 100644 --- a/qmerge.c +++ b/qmerge.c @@ -1675,13 +1675,40 @@ parse_packages(queue *todo) char *buf, *p; struct pkg_t Pkg; depend_atom *pkg_atom; + char repo[sizeof(Pkg.REPO)]; fp = open_binpkg_index(); + buf = NULL; + repo[0] = '\0'; + + /* First consume the header with the common data. */ + while (getline(&buf, &buflen, fp) != -1) { + if (*buf == '\n') + break; + + if ((p = strchr(buf, '\n')) != NULL) + *p = 0; + if ((p = strchr(buf, ':')) == NULL) + continue; + if (p[1] != ' ') + continue; + *p = 0; + p += 2; + + switch (*buf) { + case 'R': + if (!strcmp(buf, "REPO")) + strncpy(repo, p, sizeof(repo)); + break; + } + } + pkg_atom = NULL; memset(&Pkg, 0, sizeof(Pkg)); + strcpy(Pkg.SLOT, "0"); - buf = NULL; + /* Then walk all the package entries. */ while (getline(&buf, &buflen, fp) != -1) { if (*buf == '\n') { if (pkg_atom) { @@ -1706,6 +1733,8 @@ parse_packages(queue *todo) pkg_atom = NULL; } memset(&Pkg, 0, sizeof(Pkg)); + strcpy(Pkg.SLOT, "0"); + strcpy(Pkg.REPO, repo); continue; }