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 000741381F3 for ; Sat, 13 Apr 2013 14:43:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 35E19E08A1; Sat, 13 Apr 2013 14:43:21 +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 696ADE089D for ; Sat, 13 Apr 2013 14:43:20 +0000 (UTC) Received: from pomiocik.lan (178-37-171-226.adsl.inetia.pl [178.37.171.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id C18A633DEFB; Sat, 13 Apr 2013 14:43:18 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH eutils] Support recursive operation in edos2unix. Date: Sat, 13 Apr 2013 16:44:20 +0200 Message-Id: <1365864260-1606-1-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 1.8.1.5 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: 5f99ba29-9496-4832-8aa7-127ef2757dee X-Archives-Hash: 42002f59aebc928cc88795e33043db20 The edos2unix is quite useful when handling DOS-sourced packages. But since it's a bash function, you can't reasonably use it from within find invocation. And often you hit packages which are all flooded with CRLFs that you need to convert. That's why I'm suggesting to make edos2unix recursive. The posted patch changes the function to use find+sed for the substitution, passing given paths as the 'path' arguments to find. Whenever files are passed, nothing changes for ebuilds. If a directory is passed, find converts it recursively. The only potential breakage is when a non-file was passed and something weird was expected of it. Any thoughts? If nobody opposes, I will commit the patch in 7 days. --- gx86/eclass/eutils.eclass | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass index 467cf17..9e3a347 100644 --- a/gx86/eclass/eutils.eclass +++ b/gx86/eclass/eutils.eclass @@ -651,15 +651,16 @@ emktemp() { } # @FUNCTION: edos2unix -# @USAGE: [more files ...] +# @USAGE: [...] # @DESCRIPTION: # A handy replacement for dos2unix, recode, fixdos, etc... This allows you # to remove all of these text utilities from DEPEND variables because this -# is a script based solution. Just give it a list of files to convert and -# they will all be changed from the DOS CRLF format to the UNIX LF format. +# is a script based solution. Just give it a list of files or directories +# to convert and they will all be changed from the DOS CRLF format +# to the UNIX LF format recursively. edos2unix() { [[ $# -eq 0 ]] && return 0 - sed -i 's/\r$//' -- "$@" || die + find "$@" -type f -exec sed -i 's/\r$//' -- {} + || die } # @FUNCTION: make_desktop_entry -- 1.8.1.5