*.deb 版本依赖是在编译机器上根据编译机器的软件版本自动生成的,
所以,理论上都在低版本(ubuntu 8.04)上编译高版本(ubuntu 10.04)的发行包。
但我在龙芯上为了编译通过,我用test版本,也就意味着我使用了最高版本的软件,编译10.04。
因此有些依赖关系出问题了。
我需要参照10.04的发行依赖做修改,修改其中的control文件。
脚本如下:
#!/bin/bash
# version 0.3 ,add IFS=\n to reserve space and tab
# version 0.2 ,delete IFS=:,
IFS=$'\n'
get_value()
{
#$1 is filename
#$2 package name
#$3 name
cat "$1"|
while read p_line
do
name=${p_line%%:*}
value=${p_line#*:}
if [ "$name" == "Package" ]
then
Pack="$value"
fi
if [ $Pack == "$2" ]
then
if [ "$name" == "$3" ]
then
echo $p_line >>control
break;
fi
fi
done
}
change_package()
{
#$1 list-filename ,list all *.deb
#$2 depend Packages file from ubuntu 10.04 i386
cat $1|
while read line
do
echo do $line ...
cd temp
ar -x ../$line
mkdir -p control
tar xf control.tar.gz -C control
cd control
mv control control_old
#control file's format is name:value
#
cat "control_old"|
while read c_line
do
name=${c_line%%:*}
value=${c_line#*:}
if [ "$name" == "Package" ]
then
Pack="$value"
fi
if [ "$name" == "Depends" ]
then
get_value ../../$2 $Pack Depends
continue
fi
if [ "$name" == "Pre-Depends" ]
then
get_value ../../$2 $Pack Pre-Depends
continue
fi
echo $c_line >>control
done
rm control_old
tar czf ../control.tar.gz *
cd ..
rm control -fr
ar -r ../$line *
rm * -fr
cd ..
done
}
# split Package to 1,2
# to search fast...
change_package list1 Packages1
change_package list2 Packages2
阅读(1942) | 评论(0) | 转发(0) |