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 36B301381F3 for ; Mon, 22 Jul 2013 09:34:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 13DBCE0A82; Mon, 22 Jul 2013 09:34:33 +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 89CAAE0A82 for ; Mon, 22 Jul 2013 09:34:32 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 26DA033DAB0 for ; Mon, 22 Jul 2013 09:34:31 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id BE457E5458 for ; Mon, 22 Jul 2013 09:34:29 +0000 (UTC) From: "Sven Eden" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Eden" Message-ID: <1374485706.09baec6ff972e6b7f7c7ac4d99dd58566637fe48.yamakuzure@gentoo> Subject: [gentoo-commits] proj/ufed:master commit in: / X-VCS-Repository: proj/ufed X-VCS-Files: Portage.pm X-VCS-Directories: / X-VCS-Committer: yamakuzure X-VCS-Committer-Name: Sven Eden X-VCS-Revision: 09baec6ff972e6b7f7c7ac4d99dd58566637fe48 X-VCS-Branch: master Date: Mon, 22 Jul 2013 09:34:29 +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: b756ecb1-7a22-4b09-9074-ba7c19102e0c X-Archives-Hash: 407fd02566d514308ea0a0ff95f2b97a commit: 09baec6ff972e6b7f7c7ac4d99dd58566637fe48 Author: Sven Eden gmx net> AuthorDate: Mon Jul 22 09:35:06 2013 +0000 Commit: Sven Eden gmx de> CommitDate: Mon Jul 22 09:35:06 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=09baec6f Changed the search for files if make.conf is a directory to be done by a recursive function. Known items to skip are now skipped correctly: --- Portage.pm | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/Portage.pm b/Portage.pm index 8d37c38..e8c3c15 100644 --- a/Portage.pm +++ b/Portage.pm @@ -20,7 +20,7 @@ BEGIN { # --- public members --- # Set this to 1 to get debugging output -Readonly our $DEBUG => 1; +Readonly our $DEBUG => 0; # $use_flags - hashref that represents the combined and # consolidated data about all valid use flags @@ -100,6 +100,7 @@ sub _determine_profiles; sub _final_cleaning; sub _fix_flags; sub _gen_use_flags; +sub _get_files_from_dir; sub _merge; sub _merge_env; sub _noncomments; @@ -214,7 +215,7 @@ sub _add_flag die ("\n\"$flag\" ($pkg) Description Hash Key\n \"$descKey\"\nis illegal!\n"); } - return; + return 1; } @@ -505,6 +506,56 @@ sub _gen_use_flags } +# Get an alphabetical case insensitive list of files +# from a path (_not_ depth first!) and return it +# Param 1: the path to search in +# Param 2: recursive calls should set this to 1 +sub _get_files_from_dir { + my ($search_path, $isRecursive) = @_; + my @result = (); + + # Nothing to do if the search path is empty + ( defined($search_path) + && length($search_path) ) + or return @result; + + defined($isRecursive) or $isRecursive = 0; + + for my $confFile (glob("$search_path/*")) { + # Skip hidden, backup and temporary files + if ( (-f $confFile ) + && ( ($confFile =~ /(?:\.bak|~|\.old|\.tmp)$/) + || ($confFile =~ /^\./) ) ) { + debugMsg("Skipping file $confFile"); + next; + } + + # Skip special directories CVS, RCS and SCCS + if ( (-d $confFile) + && ($confFile =~ /\/(?:CVS|RCS|SCCS)$/ ) ) { + debugMsg("Skipping directory $confFile"); + next; + } + + # recurse if this is a directory: + if (-d $confFile) { + push @result, _get_files_from_dir($confFile, 1); + next; + } + + # Otherwise just add to result list + push @result, $confFile; + } + + # return plain list if this is a recursive call + $isRecursive and return @result; + + # return an alphabetically sorted list: + my @sorted = sort {lc($a) cmp lc($b)} @result; + return @sorted; +} + + # merges two hashes into the first. # Parameter 1: reference of the destination hash # Parameter 2: reference of the source hash @@ -654,12 +705,8 @@ sub _read_make_conf { for my $confPath ($stOldPath, $stNewPath) { if ( -d $confPath) { - for my $confFile (sort {lc($a) cmp lc($b)} glob("$confPath/*")) { - # Skip backup and temporary files - $confFile =~ /(?:\.bak|~|\.old|\.tmp)$/ - and next; - - # Now read the file and merge its content + my @confFileList = _get_files_from_dir($confPath); + for my $confFile (@confFileList) { debugMsg("Reading $confFile"); %newEnv = _read_sh($confFile); _merge (\%oldEnv, \%newEnv);