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 EC13F1381F3 for ; Mon, 29 Apr 2013 06:30:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F0F29E0B48; Mon, 29 Apr 2013 06:29:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 92A5AE0B48 for ; Mon, 29 Apr 2013 06:29:58 +0000 (UTC) Received: from flycatcher.gentoo.org (flycatcher.gentoo.org [81.93.255.6]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 058EB33DF8B for ; Mon, 29 Apr 2013 06:29:57 +0000 (UTC) Received: by flycatcher.gentoo.org (Postfix, from userid 559) id C01C32171D; Mon, 29 Apr 2013 06:29:55 +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: <20130429062955.C01C32171D@flycatcher.gentoo.org> Date: Mon, 29 Apr 2013 06:29:55 +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: c2213334-08c1-4db5-8ce2-d44648be4e3f X-Archives-Hash: bb9e0069307a9678fc600fc8d7d6c6dd vapier 13/04/29 06:29:55 Modified: qmerge.c Log: qmerge: clean up init logic slightly -- only run mkdir/chdir once, and avoicd access() when we know we wont be downloading anything Revision Changes Path 1.123 portage-utils/qmerge.c file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qmerge.c?rev=1.123&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qmerge.c?rev=1.123&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qmerge.c?r1=1.122&r2=1.123 Index: qmerge.c =================================================================== RCS file: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v retrieving revision 1.122 retrieving revision 1.123 diff -u -r1.122 -r1.123 --- qmerge.c 29 Apr 2013 06:28:21 -0000 1.122 +++ qmerge.c 29 Apr 2013 06:29:55 -0000 1.123 @@ -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.122 2013/04/29 06:28:21 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v 1.123 2013/04/29 06:29:55 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.122 2013/04/29 06:28:21 vapier Exp $"; +static const char qmerge_rcsid[] = "$Id: qmerge.c,v 1.123 2013/04/29 06:29:55 vapier Exp $"; #define qmerge_usage(ret) usage(ret, QMERGE_FLAGS, qmerge_long_opts, qmerge_opts_help, lookup_applet_idx("qmerge")) char search_pkgs = 0; @@ -184,20 +184,21 @@ errp("could not setup PKGDIR: %s", pkgdir); } - mkdir_p(port_tmpdir, 0755); - xchdir(port_tmpdir); - mkdir_p("portage", 0755); - xchdir("portage"); - - if (force_download && force_download != 2) - unlink(Packages); - - if ((access(Packages, R_OK) != 0) && (force_download != 2)) { - char *tbuf = NULL; - xasprintf(&tbuf, "%s/portage/", port_tmpdir); - if (access(Packages, R_OK) != 0) - fetch(tbuf, Packages); - free(tbuf); + char *buf; + xasprintf(&buf, "%s/portage", port_tmpdir); + mkdir_p(buf, 0755); + xchdir(buf); + + if (force_download != 2) { + if (force_download) + unlink(Packages); + + if (access(Packages, R_OK) != 0) { + xasprintf(&buf, "%s/portage/", port_tmpdir); + if (access(Packages, R_OK) != 0) + fetch(buf, Packages); + free(buf); + } } }