diff options
author | 2009-04-22 22:23:01 +0000 | |
---|---|---|
committer | 2009-04-22 22:23:01 +0000 | |
commit | e34270adb34e7d365d864cc8bf4ed936356a4091 (patch) | |
tree | 463a3c9e856a4098983ff329918a1042f62bd1ea /dev-util/lafilefixer | |
parent | Add policykit optional dependencies, bug #267100. Clean up old ebuilds. (diff) | |
download | historical-e34270adb34e7d365d864cc8bf4ed936356a4091.tar.gz historical-e34270adb34e7d365d864cc8bf4ed936356a4091.tar.bz2 historical-e34270adb34e7d365d864cc8bf4ed936356a4091.zip |
Drop dependency on grep, sed and coreutils to stop the forkbomb. Use find to parse inputs and find .la files. Each file is now opened only twice. Once to read, once to write. Add --license, --justfixit and --help options.
Package-Manager: portage-2.2_rc28/cvs/Linux x86_64
Diffstat (limited to 'dev-util/lafilefixer')
-rw-r--r-- | dev-util/lafilefixer/ChangeLog | 11 | ||||
-rw-r--r-- | dev-util/lafilefixer/Manifest | 4 | ||||
-rw-r--r-- | dev-util/lafilefixer/files/lafilefixer-0.5 | 200 | ||||
-rw-r--r-- | dev-util/lafilefixer/lafilefixer-0.5.ebuild | 36 |
4 files changed, 249 insertions, 2 deletions
diff --git a/dev-util/lafilefixer/ChangeLog b/dev-util/lafilefixer/ChangeLog index 92c3d52a8504..a725f24f6fe6 100644 --- a/dev-util/lafilefixer/ChangeLog +++ b/dev-util/lafilefixer/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for dev-util/lafilefixer # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-util/lafilefixer/ChangeLog,v 1.2 2009/04/20 04:03:38 loki_val Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-util/lafilefixer/ChangeLog,v 1.3 2009/04/22 22:23:01 loki_val Exp $ + +*lafilefixer-0.5 (22 Apr 2009) + + 22 Apr 2009; Peter Alfredsen <loki_val@gentoo.org> +files/lafilefixer-0.5, + +lafilefixer-0.5.ebuild: + Drop dependency on grep, sed and coreutils to stop the forkbomb. Use find + to parse inputs and find .la files. Each file is now opened only twice. + Once to read, once to write. Add --license, --justfixit and --help + options. 20 Apr 2009; Peter Alfredsen <loki_val@gentoo.org> lafilefixer-0.0.1: Properly escape. Thanks to Nathan Brink <ohnobinki@ohnopublishing.net> of diff --git a/dev-util/lafilefixer/Manifest b/dev-util/lafilefixer/Manifest index de850c009e0b..ef5baf973ef9 100644 --- a/dev-util/lafilefixer/Manifest +++ b/dev-util/lafilefixer/Manifest @@ -1,4 +1,6 @@ AUX lafilefixer-0.0.1 2589 RMD160 0144f1fc86151301e200d49472464122a4414aa1 SHA1 b4901bf51ef89e975ecd011a26fc1ad3bb381b5b SHA256 85e1049a155a923b3fa76906b55cf68b1f5225358954dd7f68d7bb4e0e38c3c0 +AUX lafilefixer-0.5 6350 RMD160 b82f8943b3c0b7e6b836d1745f329177f3d0f16c SHA1 777c8c0dc2869212ddd39f7c11b699a0c9792d7d SHA256 f88a5fea8edfe33a7f743156c37d792c141ae6b390ea2dd9aededfdd96f5a546 EBUILD lafilefixer-0.0.1.ebuild 1469 RMD160 c6eba71e4147ce42320440f9f4a8fdd21a9413a1 SHA1 0078f34ecc33f24ade01abb380cf236cfbc987bc SHA256 118c090868b7d8bd6776a8305b0809ec06ddfd810847771433c427e8b0241547 -MISC ChangeLog 624 RMD160 a1be7a875c19b405422a9c4ca52f7c5674b50f9d SHA1 60ddb42c85bf626cc8a268eac47c8d9c4f35dfa1 SHA256 b4ebf3dd76c84167b903ff81ccb087a6a238cc39ec03bcd40f79ab51cd95e1b7 +EBUILD lafilefixer-0.5.ebuild 1126 RMD160 80039caca9597bea9108b5aacda21fecf7e56159 SHA1 bdd8c4c87094c8f83742c0865652377886706f71 SHA256 9a66f830f0e49d790fd49facd644ff4f3f712b2b871fc0a2fb06d24d5a12acb4 +MISC ChangeLog 991 RMD160 479941801821003abc39ee441164a28fe24928d0 SHA1 98e7c6883784e8894eed4e0cc48df99eab66f8e7 SHA256 a89cfb9710f8a17c8192a83ec9abdb038d2d451f7ac78117ff602e50f3ed3202 MISC metadata.xml 253 RMD160 141d5f2eda759e5ee13530882de850132d515b25 SHA1 c6cda2f9e6dee3b32f89eb86fbfc3c0f53443029 SHA256 f36bc5b0238c1fb1fbaa0469f628b7f09e86699d7cf9e95864e1ef153c70f265 diff --git a/dev-util/lafilefixer/files/lafilefixer-0.5 b/dev-util/lafilefixer/files/lafilefixer-0.5 new file mode 100644 index 000000000000..ae56e5a44b93 --- /dev/null +++ b/dev-util/lafilefixer/files/lafilefixer-0.5 @@ -0,0 +1,200 @@ +#!/bin/bash + +# Libtool does not support spaces in dependency_libs entries so we won't worry +# overly about them either. + +NEWLINE=" +" + +has() { + [[ " ${*:2} " == *" $1 "* ]] +} + +fix_la_files() { + local lafile + for lafile in "${@:2}" + do + local has_inh_link_flags="no" + local new_inh_link_flags="" + local dependency_libs="" + local inh_link_flags="" + local has_dep_libs="no" + local new_dep_libs="" + local remove_lib="" + local contents="$(<"${lafile}")" + local libladir="" + local librpath="" + local dep_libs="" + local line="" + local lib="" + + + save_IFS="${IFS}" + IFS="$NEWLINE" + for line in $contents + do + if [[ "${line#dependency_libs=\'}" != "${line}" ]] + then + [[ "$has_dep_libs" == "no" ]] || { echo "dependency_libs= assigned more than once in $lafile" && return 1 ; } + line="${line#dependency_libs=\'}" + dep_libs="${line%\'}" + has_dep_libs="yes" + + elif [[ "${line#inherited_linker_flags=\'}" != "${line}" ]] + then + + [[ "$has_inh_link_flags" == "no" ]] || { echo "inherited_linker_flags= assigned more than once in $lafile" && return 1 ; } + line="${line#inherited_linker_flags=\'}" + inh_link_flags="${line%\'}" + new_inh_link_flags="${inh_link_flags}" + has_inh_link_flags="yes" + fi + done + IFS="$save_IFS" + + if [[ "$has_dep_libs" == "no" ]] + then + printf '%s\n' "$lafile is not a .la file. Skipping." + continue + fi + + for entry in $dep_libs + do + case $entry in + -l*) + has ${entry} ${new_dep_libs} || new_dep_libs="${new_dep_libs} ${entry}" + ;; + *.la) + + if [[ "${entry##*\/lib}" == "${entry}" ]] + then + has ${entry} ${new_dep_libs} || new_dep_libs="${new_dep_libs} ${entry}" + else + lib="${entry##*\/lib}" + lib="${lib%.la}" + lib="-l${lib}" + has ${lib} ${new_dep_libs} || new_dep_libs="${new_dep_libs} ${lib}" + has -L${entry%/*.la} ${libladir} || libladir="${libladir} -L${entry%/*.la}" + fi + ;; + -L*) + [[ ${entry/X11R6\/lib} != ${entry} ]] && entry="${entry/X11R6\/}" + [[ ${entry/local\/lib} != ${entry} ]] && entry="${entry/local\/}" + [[ ${entry/usr\/lib*\/pkgconfig\/..\/..} != ${entry} ]] && entry="${entry/\/lib*\/pkgconfig\/..\/..}" + [[ ${entry/usr\/lib*\/pkgconfig\/..} != ${entry} ]] && entry="${entry/\/pkgconfig\/..}" + has ${entry} ${libladir} || libladir="${libladir} ${entry}" + ;; + -R*) + has ${entry} ${librpath} || librpath="${librpath} ${entry}" + ;; + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + if [[ "${has_inh_link_flags}" == "yes" ]] + then + has ${entry} ${new_inh_link_flags} || new_inh_link_flags="${new_inh_link_flags} ${entry}" + else + has ${entry} ${new_dep_libs} || new_dep_libs="${new_dep_libs} ${entry}" + fi + ;; + *) + echo "Debug information:" + echo $lafile + echo "${entry}" + echo "Holy Moley, Dorothy, we ain't in Kansas and Luke, I'm not your father" + return 1 + ;; + esac + done + + [[ "${dep_libs}" == "${librpath}${libladir}${new_dep_libs}" && "${new_inh_link_flags}" == "${inh_link_flags}" ]] && { echo "$lafile already clean, skipping update."; continue; } + echo "${lafile}: Updating..." + contents="${contents/${NEWLINE}dependency_libs=\'${dep_libs}\'${NEWLINE}/${NEWLINE}dependency_libs='${librpath}${libladir}${new_dep_libs}'${NEWLINE}}" + [[ "${has_inh_link_flags}" == "yes" ]] && \ + contents="${contents/${NEWLINE}inherited_linker_flags=\'${inh_link_flags}\'${NEWLINE}/${NEWLINE}inherited_linker_flags='${new_inh_link_flags}'${NEWLINE}}" + + printf '%s' "$contents" > "${lafile}" + done +} + +case "$1" in + -h|--help) + cat <<- EOF + lafilefixer (C) 2009 Peter Alfredsen <loki_val@gentoo.org> + Released under the MIT/X11 license. + + Usage: lafilefixer [OPTION] [FILE|DIR]... + Fix .la libtool archives to list libraries, not .la files in dependency_libs and + do some minor fixups, moving -pthread to inherited_linker_flags if available and + eliminating duplicate library listings. + + By default, lafilefixer is recursive, fixing all .la files in all subdirectories + so if you want to fix only a single file, it must be specified in full. + + Options: + -h, --help Display this text and exit. + --justfixit Choose some reasonable dirs, such as /usr/lib*, etc. , + find all .la files and fix them to not use .la files + for linking + --license Display the license and exit. + EOF + ;; + --justfixit) + declare dirlist="" + declare files=() + for dir in {/usr/lib,/usr/qt/3/lib,/usr/kde/3.5/lib,/opt/lib,/lib}{,32,64} + do + [[ -d "${dir}" ]] && dirlist="${dirlist} ${dir}" + done + + while read -r line + do + files+=( "$line" ) + done< <( find ${dirlist} -name '*.la' -type f ) + + fix_la_files --cleanup "${files[@]}" + ;; + --license) + cat <<- EOF + Copyright (c) 2009 Peter Alfredsen <loki_val@gentoo.org> + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is furnished to + do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + EOF + ;; + *) + declare arglist=() + declare files=() + declare arg="" + + for arg in "${@}" + do + if [[ -d "${arg}" || -f "${arg}" ]] + then + arglist+=( "${arg}" ) + else + printf '%s\n' "${arg} is not a valid directory or file, skipping." + fi + done + + while read -r line + do + files+=( "$line" ) + done< <( find "${arglist[@]}" -name '*.la' -type f ) + + fix_la_files --cleanup "${files[@]}" + ;; +esac + diff --git a/dev-util/lafilefixer/lafilefixer-0.5.ebuild b/dev-util/lafilefixer/lafilefixer-0.5.ebuild new file mode 100644 index 000000000000..94f31c5ef7d1 --- /dev/null +++ b/dev-util/lafilefixer/lafilefixer-0.5.ebuild @@ -0,0 +1,36 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-util/lafilefixer/lafilefixer-0.5.ebuild,v 1.1 2009/04/22 22:23:01 loki_val Exp $ + +EAPI=2 + +DESCRIPTION="Utility to fix your .la files" +HOMEPAGE="http://www.gentoo.org/" +SRC_URI="" +LICENSE="MIT" +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="" +DEPEND="" +RDEPEND=">=app-shells/bash-3.2 + elibc_glibc? ( >=sys-apps/findutils-4.4.0 )" + +S="" + +src_unpack() { : ; } +src_prepare() { : ; } +src_configure() { : ; } +src_unpack() { : ; } +src_install() { newbin "${FILESDIR}/${P}" ${PN} ; } + +pkg_postinst() { + elog "This simple utility will fix your .la files to not point to other .la files." + elog "This is desirable because it will ensure your packages are not broken when" + elog ".la files are removed from other packages." + elog "" + elog "For most uses, lafilefixer --justfixit should 'just work'. This will" + elog "recurse through the most commonly used library folders and fix all .la" + elog "files it encounters." + elog "" + elog "Read lafilefixer --help for a full description of all options." +} |