core/rebuildlist-generate.sh

97 lines
2.2 KiB
Bash
Raw Normal View History

2010-03-22 01:35:58 +08:00
#! /bin/bash
2010-03-25 05:41:23 +08:00
# based on
2010-03-22 01:35:58 +08:00
# rebuildlist - list packages needing rebuilt for a soname bump
#
# Copyright (c) 2009 by Allan McRae <allan@archlinux.org>
2010-03-27 02:49:51 +08:00
# (some destructive) modifications: <jan.mette@berlin.de>
2010-03-22 01:35:58 +08:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
2010-03-24 04:48:27 +08:00
# along with this program. If not, see <http://www.gnu.org/licenses/>
2010-03-22 01:35:58 +08:00
2010-03-24 01:47:47 +08:00
#
# setup
#
curdir=`pwd`
repodir="_repo/repo"
_script_name="GEN REBUILD LIST"
_build_arch="$_arch"
_cur_repo=`pwd | awk -F '/' '{print $NF}'`
_needed_functions="config_handling messages"
# load functions
for subroutine in ${_needed_functions}
do
source _buildscripts/functions/${subroutine}
done
2010-03-22 01:35:58 +08:00
2010-03-24 01:47:47 +08:00
#
# startup
#
title "${_script_name}"
check_configs
load_configs
if [ -z "$1" ]; then
error "Usage: $0 <name of the package to be rebuilt>"
newline
2010-03-22 01:35:58 +08:00
exit
fi
2010-03-24 01:47:47 +08:00
package="$1"
2010-03-24 02:08:32 +08:00
liblist=`pacman -Ql $package | grep "\.so" | cut -d " " -f 2 | awk 'BEGIN {FS="/"} {print $NF}' | cut -d "." -f 1 | uniq | tr '\n' ' '`
2010-03-24 01:47:47 +08:00
2010-03-24 02:08:32 +08:00
#directory="$curdir/$repodir"
directory="/var/cache/pacman/pkg"
2010-03-22 01:35:58 +08:00
2010-03-24 01:47:47 +08:00
for solib in $liblist; do
grepexpr="$grepexpr -e ${solib%%.so}.so"
2010-03-22 01:35:58 +08:00
done
startdir=$(pwd)
tmpdir=$(mktemp -d)
cd $tmpdir
2010-03-24 01:47:47 +08:00
newline
title2 "Scanning packages"
for pkg in $(ls $directory/*.pkg.*); do
2010-03-22 01:35:58 +08:00
pkg=${pkg##*\/}
2010-03-24 01:47:47 +08:00
status_start "Scanning $pkg"
2010-03-22 01:35:58 +08:00
mkdir $tmpdir/extract
cp $directory/$pkg $tmpdir/extract
cd $tmpdir/extract
2010-03-25 05:41:23 +08:00
tar -xf $directory/$pkg 2>/dev/null
2010-03-22 01:35:58 +08:00
rm $pkg
found=$(readelf --dynamic $(find -type f) 2>/dev/null | grep $grepexpr | wc -l)
if [ $found -ne 0 ]; then
2010-03-24 01:47:47 +08:00
echo ${pkg%-*-*-*} >> ../rebuildlist-$package.txt
2010-03-22 01:35:58 +08:00
fi
cd ..
rm -rf extract
2010-03-24 01:47:47 +08:00
status_done
2010-03-22 01:35:58 +08:00
done
2010-03-25 05:41:23 +08:00
status_start "saving rebuildlist-$package.txt"
cp $tmpdir/rebuildlist-$package.txt $startdir
status_done
newline
title2 "All done"
newline