From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SZyDT-0006S6-Eg for garchives@archives.gentoo.org; Thu, 31 May 2012 05:46:35 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B17C5E075C; Thu, 31 May 2012 05:46:20 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id BEF7FE0730 for ; Thu, 31 May 2012 05:45:41 +0000 (UTC) Received: from pomiocik.lan (77-253-135-71.adsl.inetia.pl [77.253.135.71]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 306181B4029; Thu, 31 May 2012 05:45:39 +0000 (UTC) Date: Thu, 31 May 2012 07:46:41 +0200 From: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= To: gentoo-dev@lists.gentoo.org Cc: vapier@gentoo.org Subject: Re: [gentoo-dev] [PATCH eutils] Move remove_libtool_files() from autotools-utils for wider use. Message-ID: <20120531074641.73b93222@pomiocik.lan> In-Reply-To: <201205301719.50449.vapier@gentoo.org> References: <1338191936-2091-1-git-send-email-mgorny@gentoo.org> <201205301719.50449.vapier@gentoo.org> Organization: Gentoo X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.10; x86_64-pc-linux-gnu) 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 Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA256; boundary="Sig_/H5M7bO4REGkanBIOhS/.S0g"; protocol="application/pgp-signature" X-Archives-Salt: 7ee5e374-a54a-4908-b946-f9e57563d071 X-Archives-Hash: b779b7414731963d45e8d0e50421cc15 --Sig_/H5M7bO4REGkanBIOhS/.S0g Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, 30 May 2012 17:19:49 -0400 Mike Frysinger wrote: > On Monday 28 May 2012 03:58:56 Micha=C5=82 G=C3=B3rny wrote: > > +# @USAGE: [all] >=20 > this is incorrect. the usage is: > No, it's perfectly valid. Moreover, it even explains what the function actually does rather than your imagination. But if we're not interested in keeping it compatible, I'd probably start with making it '--all'. > > + local arg > > + for arg in $(find "${D}" -name '*.pc' -exec \ > > + sed -n -e 's;^Libs:;;p' {} > > +); do > > + [[ ${arg} =3D=3D -l* ]] && > > pc_libs+=3D(lib${arg#-l}.la) > > + done >=20 > let sed do the processing: > pc_libs=3D( > $(find "${D}" -name '*.pc' \ > -exec sed -n -e '/^Libs:/{s|^[^:]*:||;s: :\n:g;p}' {} > + | \ sed -n '/^-l/{s:^-l:lib:;s:$:.la:;p}') > ) Nope. My poor eyes are too weak to disband all those magical characters. > however, i'd point out that parsing these files directly doesn't > actually work. some .pc files use variables in the filename which > isn't expanded by using sed. thus your only recourse is to let > pkg-config expand things for you. Right. I'll have to think about this a little. > although, since we don't call die or anything, we can pipeline it to > speed things up a bit: > pc_libs=3D( $( > tpc=3D"${T}/.pc" > find "${D}" -name '*.pc' -type f | \ > while read pc ; do > sed -e '/^Requires:/d' "${pc}" > "${tpc}" > $(tc-getPKG_CONFIG) --libs "${tpc}" > done | tr ' ' '\n' | sort -u | \ > sed -n '/^-l/{s:^-l:lib:;s:$:.la:;p}' > rm -f "${tpc}" > ) ) Could you remind me, please, what performance-critical use of this function does justify making it so harsh? > > + local archivefile=3D${f/%.la/.a} >=20 > remove the suffix and it'll be faster i think: > local archivefile=3D"${f%.la}.a" Hmm, it's indeed inconsistent. > > + [[ "${f}" !=3D "${archivefile}" ]] || die 'regex > > sanity check failed' >=20 > no need to quote the ${f}, but eh Yep. > > + rm -f "${archivefile}" || die >=20 > `rm -f` almost never fails. in the edge cases where it does, you've > got bigger problems. And that problem is good enough to die here. > > + elif has "$(basename "${f}")" "${pc_libs[@]}"; then >=20 > use ${f##*/} rather than `basename` Hmm, yes. I'd split it out to a sep var as I see you used it already more than once. > > + removing=3D'covered by .pc' > > + elif [[ ! $(sed -n -e \ > > + "s/^\(dependency_libs\|inherited_linker_flags\)=3D'\(.*\)'$/\2/p" > > \ > > + "${f}") ]]; then removing=3D'no libs & flags' >=20 > unwrap that body, and use -r rather than escaping the (|) chars Will do. Expect a new version in next 12hrs. --=20 Best regards, Micha=C5=82 G=C3=B3rny --Sig_/H5M7bO4REGkanBIOhS/.S0g Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iJwEAQEIAAYFAk/HBcYACgkQfXuS5UK5QB0kFwP/SnpLbhX+dHxcfHYrfBWPgTUq fzuc2b7p3FaiMrM0DFUKXSLrpI5P9lNyUVHM0YqELv0ja0jgMEKJuBTnBWUnKFNY bJXOxXtnAz/2BmX34aKvRCojvdLj6wUmbZdtEalIupxZj8/L64b071VP0+jVz9Ke bEwYrxYDm4p7U6UYjsI= =babX -----END PGP SIGNATURE----- --Sig_/H5M7bO4REGkanBIOhS/.S0g--