Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1562157
  • 博文数量: 290
  • 博客积分: 3468
  • 博客等级: 中校
  • 技术积分: 3461
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-28 22:21
文章分类

全部博文(290)

文章存档

2016年(13)

2015年(3)

2014年(42)

2013年(67)

2012年(90)

2011年(75)

分类: Python/Ruby

2012-03-11 13:55:03


http://sns.akaedu.org/home/space.php?uid=2&do=blog&id=756

我一直想知道apt里一个包的依赖关系。
我认为编译龙芯ubuntu版本这个是必须的。
今天终于写了一个,里面逻辑关系混乱。。。我都晕了。
get_depend.sh
-------------------------------
#!/bin/bash

save_package ()

{
    cat $1|
    while read tline
    do
    #delete repeat ,and delete "<>" package
    #we don't need "<>" package
    sed '/'$tline'/d' depend.txt >depend1.txt
    sed '/depend.txt

    echo $tline >>depend.txt
    echo " |-$tline" >>depend.log
    done
}

cat "depend.txt"|

while read line
do
echo "$line depend" >>depend.log
echo "search $line depend ...."
apt-cache depends $line 2>/dev/null|grep "依赖" |awk '{print $2}' >depend_tmp.tx
t
save_package depend_tmp.txt

#delete have done package

sed '/'$line'/d' depend.txt >depend2.txt
mv depend2.txt depend.txt
echo "$line" >>depend_done.txt
echo "  " >>depend.log
echo "----" >>depend.log
done

#delete have done package

cat "depend_done.txt"|
while read line
do
    sed '/'$line'/d' depend.txt >depend3.txt
    mv depend3.txt depend.txt
done
---------------
测试结果
echo "upstart" >depend.txt
./get_depend.sh
这个要重复执行的。

upstart

libc6
libdbus-1-3
libnih-dbus1
libnih1
libudev0
sysvinit-utils
sysv-rc
initscripts
mountall
ifupdown
libc-bin
libgcc1
tzdata
findutils
libselinux1
libsepol1
insserv
mount
debianutils
passwd
makedev
udev
plymouth
coreutils
libplymouth2
net-tools
debconf
lsb-base
netbase
gcc-4.4-base
libblkid1
libuuid1
sensible-utils
libpam0g
libpam-modules
libglib2.0-0
libusb-0.1-4
module-init-tools
procps
adduser
util-linux
libdrm-intel1
libdrm-nouveau1
libdrm-radeon1
libdrm2
initramfs-tools
libacl1
libattr1
libpng12-0
perl-base
sed
ncurses-bin
base-files
libdb4.8
libpcre3
libslang2
klibc-utils
busybox-initramfs
cpio
zlib1g
dpkg
install-info
libncurses5
libklibc
lzma
libstdc++6
关系图
upstart depend
|-libc6
|-libdbus-1-3
|-libnih-dbus1
|-libnih1
|-libudev0
|-sysvinit-utils
|-sysv-rc
|-initscripts
|-mountall
|-ifupdown
  
----
libc6 depend
|-libc-bin
|-debconf
|-
|-libgcc1
|-tzdata
|-findutils
  
----
libdbus-1-3 depend
|-libc6
  
----
libnih-dbus1 depend
|-libnih1
|-libc6
|-libdbus-1-3
  
----
libnih1 depend
|-libc6
|-libc6
  
----
libudev0 depend
|-libc6
  
----
sysvinit-utils depend
|-libc6
|-libselinux1
|-libsepol1
  
----
sysv-rc depend
|-debconf
|-
|-sysvinit-utils
|-insserv
  
----
initscripts depend
|-libc6
|-mount
|-debianutils
|-lsb-base
|-sysvinit-utils
|-sysv-rc
|-
|-passwd
|-upstart
  
----
mountall depend
|-makedev
|-udev
|-plymouth
|-coreutils
|-libc6
|-libdbus-1-3
|-libnih-dbus1
|-libnih1
|-libplymouth2
|-libudev0
  
----
ifupdown depend
|-net-tools
|-libc6
|-debconf
|-
|-
|-lsb-base
|-netbase
  
----
libc-bin depend
  
----
libgcc1 depend
|-gcc-4.4-base
|-libc6
  
----
tzdata depend
|-debconf
|-
  
----
findutils depend
|-libc6
  
----
libselinux1 depend
|-libc6
  
----
libsepol1 depend
|-libc6
  
----
insserv depend
|-libc6
  
----
mount depend
|-libblkid1
|-libc6
|-libselinux1
|-libsepol1
|-libuuid1
  
----
debianutils depend
|-sensible-utils
|-libc6
  
----
passwd depend
|-libc6
|-libpam0g
|-libselinux1
|-libpam-modules
|-debianutils
  
----
makedev depend
|-base-passwd
  
----
udev depend
|-libacl1
|-libc6
|-libglib2.0-0
|-libselinux1
|-libusb-0.1-4
|-
|-module-init-tools
|-initramfs-tools
|-procps
|-adduser
|-util-linux
  
----
plymouth depend
|-libc6
|-libdrm-intel1
|-libdrm-nouveau1
|-libdrm-radeon1
|-libdrm2
|-libplymouth2
|-
|-udev
|-mountall
|-initramfs-tools
  
----
coreutils depend
|-libacl1
|-libattr1
|-libc6
|-libselinux1
  
----
libplymouth2 depend
|-libc6
|-libpng12-0
  
----
net-tools depend
|-libc6
  
----
debconf depend
|-debconf-i18n
|-debconf-english
|-perl-base
  
----
lsb-base depend
|-sed
|-ncurses-bin
  
----
netbase depend
|-lsb-base
|-
  
----
gcc-4.4-base depend
  
----
libblkid1 depend
|-libc6
|-libuuid1
  
----
libuuid1 depend
|-passwd
|-libc6
  
----
sensible-utils depend
  
----
libpam0g depend
|-libc6
|-debconf
|-
  
----
libpam-modules depend
|-base-files
|-libc6
|-libdb4.8
|-libpam0g
|-libselinux1
|-debconf
|-
  
----
libglib2.0-0 depend
|-libc6
|-libpcre3
|-libselinux1
|-zlib1g
  
----
libusb-0.1-4 depend
|-libc6
  
----
module-init-tools depend
|-libc6
|-
  
----
procps depend
|-libc6
|-libncurses5
|-
|-lsb-base
  
----
adduser depend
|-perl-base
|-passwd
|-debconf
|-
  
----
util-linux depend
|-
|-lsb-base
|-tzdata
|-dpkg
|-install-info
|-libblkid1
|-libc6
|-libncurses5
|-libselinux1
|-libslang2
|-libuuid1
|-zlib1g
  
----
libdrm-intel1 depend
|-libc6
|-libdrm2
  
----
libdrm-nouveau1 depend
|-libc6
|-libdrm2
  
----
libdrm-radeon1 depend
|-libc6
|-libdrm2
  
----
libdrm2 depend
|-libc6
  
----
initramfs-tools depend
|-initramfs-tools-bin
|-klibc-utils
|-busybox-initramfs
|-cpio
|-module-init-tools
|-udev
|-findutils
|-util-linux
  
----
libacl1 depend
|-libattr1
|-libc6
  
----
libattr1 depend
|-libc6
  
----
libpng12-0 depend
|-libc6
|-zlib1g
  
----
perl-base depend
|-libc6
|-dpkg
  
----
sed depend
|-dpkg
|-install-info
|-libc6
|-libselinux1
  
----
ncurses-bin depend
|-libc6
|-libncurses5
  
----
base-files depend
|-base-passwd
|-libpam-modules
|-
  
----
libdb4.8 depend
|-libc6
  
----
libpcre3 depend
|-libc6
  
----
libslang2 depend
|-libc6
  
----
klibc-utils depend
|-libklibc
  
----
busybox-initramfs depend
|-libc6
  
----
cpio depend
|-libc6
  
----
zlib1g depend
|-libc6
  
----
dpkg depend
|-libc6
|-coreutils
|-lzma
  
----
install-info depend
|-libc6
  
----
libncurses5 depend
|-libc6
  
----
libklibc depend
  
----
lzma depend
|-libc6
|-libgcc1
|-libstdc++6
  
----
libstdc++6 depend
|-gcc-4.4-base
|-libc6
|-libgcc1
阅读(881) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~