LinuxSir.Org  
| 网站首页 | 注册账号 | 论坛帮助 |

欢迎来到LinuxSir.Org!
您还未登录,请登录后查看论坛,或者点击论坛上方的注册链接注册新账号。


发表新主题 回复
精华主题  
主题工具
旧 04-12-23, 17:27 第 1 帖
小锁 帅哥
 
小锁 的头像
 
 
注册会员  
  注册日期: May 2003
  我的住址: 天津
  帖子: 1,604
  精华: 5
 

标题: glc系列脚本之glc_list,glc_sync_kw


1.glc_list:
glc_list
查询glc的所有ebuild。
glc_list glc
查询glc自己的(官方没有的build)
glc_list new
glc没有升级的ebuild或者是缺少旧的build版本
glc_list old
过期的需要删除的glc ebuild
glc_list package1 package2 .....
列出package1 , package2的所有版本的ebuild
2.glc_sync_kw
因为glc cvs可能没有及时的更改ebuild的keywords,用这个脚本可以实现和官方的ebuild同步。
glc_sync_kw
同步所有的ebuild
glc_sync_kw [package list]
同步制定的ebuild。

PHP 代码:
xiaosuo@center glc cat glc_sync_kw
#!/bin/bash
###
###sync KEYWORDS with the official portage
###

source /etc/glc.conf
if [ X${PORTAGE} = ]
then
        PORTAGE
="/usr/portage"
fi

function re_sync_kw()
{
        
local ebuild
        local glcebuild
        local keywords
        local glckeywords
        
while read glcebuild
        
do
                
ebuild=${glcebuild/${GLCPORTAGE}/${PORTAGE}}
                if [ -
f $ebuild ]
                
then
                        keywords
=`grep ^KEYWORDS $ebuild`
                        
glckeywords=`grep ^KEYWORDS $glcebuild`
                        if [ 
"X$glckeywords" "X" ]
                        
then
                                
echo "KEYWORDS of $glcebuild not defined"
                        
fi
                        
if [ "X$keywords" "X" ]
                        
then
                                
echo "KEYWORDS of $ebuild not defined"
                        
fi
                        
if [[  X$keywords != X$glckeywords ]]
                        
then
                                
echo $glcebuild
                                sed 
-"s/^KEYWORDS.*$/$keywords/" $glcebuild
                        fi
                fi
        done
}

if [ $
# -eq 0 ]
then
        find 
${GLCPORTAGE} -name "*.ebuild" -maxdepth 3 -mindepth 3 
        
re_sync_kw
else
        for 
ebuild in $@
        do
                
find ${GLCPORTAGE} -name "$ebuild-[0-9]*.ebuild" -maxdepth 3 -mindepth 3 
                
re_sync_kw
        done
fi 
代码:
xiaosuo@center glc $ cat glc_list #!/bin/bash ### ###list the glc portage ### source /etc/glc.conf if [ X${PORTAGE} = X ] then PORTAGE="/usr/portage" fi if [ -z ${GLCPORTAGE} ] then echo /etc/glc.conf need to be configured exit fi #list the glc ebuilds not include in official function list_glc_ebuilds() { local ebuild while read ebuild do ebuild=${ebuild/${GLCPORTAGE}/${PORTAGE}} if [ ! -d $ebuild ] then echo ${ebuild##*/} fi done } #list the ebuilds not include in official #old ? newer ? function list_old_ebuilds() { local ebuild local ebuildpath while read ebuild_orig do ebuild=${ebuild_orig/${GLCPORTAGE}/${PORTAGE}} ebuildpath=${ebuild%/*} if [ -d $ebuildpath ] then if [ ! -f $ebuild ] then echo ${ebuild_orig} fi fi done } #list the ebuilds not include in glc portage #update ? not need glc ? function list_new_ebuilds() { local ebuild local ebuildpath while read ebuild_orig do ebuildpath=${ebuild_orig/${GLCPORTAGE}/${PORTAGE}} if [ -d $ebuildpath ] then for ebuild in $ebuildpath/*.ebuild do ebuild=${ebuild/${PORTAGE}/${GLCPORTAGE}} if [ ! -f $ebuild ] then echo $ebuild fi done fi done } #start this scripts if [ $# -gt 0 ] then if [ $1 = "glc" ] then find ${GLCPORTAGE} -type d -maxdepth 2 -mindepth 2 \ | list_glc_ebuilds elif [ $1 = "old" ] then find ${GLCPORTAGE} -name "*.ebuild" -maxdepth 3 -mindepth 3 \ | list_old_ebuilds elif [ $1 = "new" ] then find ${GLCPORTAGE} -type d -maxdepth 2 -mindepth 2 \ | list_new_ebuilds else for ebuild in $* do find ${GLCPORTAGE} -name "$ebuild-[0-9]*.ebuild" -maxdepth 3 -mindepth 3 -printf "%f\n" done fi else find ${GLCPORTAGE} -type d -maxdepth 2 -mindepth 2 -printf "%f\n" fi







__________________
Unix Program = Framework + Components
-----------------------------------------------------
My blog: http://xiaosuo.cublog.cn

此帖于 04-12-23 17:31 被 小锁 编辑.
  小锁 当前离线   回复时引用此帖
旧 04-12-24, 07:53 第 2 帖
hutigers
 
hutigers 的头像
 
 
资深版主  
  注册日期: Nov 2003
  我的住址: 辽宁沈阳
  帖子: 3,481
  精华: 15
 

建议出一个glc all in one吧。

因为我用esearch查软件包的。

有更新和同步的功能就好了。









__________________
家,台式:微星neo2-fr p35,E2160,1G*2 = 2G DDR2 800, 西数640G + 希捷250G SATA2, XFX Geforce 7900GS 256M,三星2253BW, Creative X-Fi ExtremeMusic(声卡)
笔记本:Acer4920G, 965M,T5550 1.83G, 160G,1G*2 = 2G DDR2 667, 2400XT, 802.11a/b/g
家-->&LinuxSir&<--单位
  hutigers 当前离线   回复时引用此帖
旧 04-12-24, 09:31 第 3 帖
小锁 帅哥
 
小锁 的头像
 
 
注册会员  
  注册日期: May 2003
  我的住址: 天津
  帖子: 1,604
  精华: 5
 

哈哈,我也正在考虑能,就是还没有想好怎么实现,等都齐了,放到glc里面,虎兄有什么好的想法嘛?
维护glc也是比较繁琐的工作啊,如果能自动化再好不过了。
  小锁 当前离线   回复时引用此帖
旧 04-12-24, 11:05 第 4 帖
hutigers
 
hutigers 的头像
 
 
资深版主  
  注册日期: Nov 2003
  我的住址: 辽宁沈阳
  帖子: 3,481
  精华: 15
 

引用:
作者: 小锁
哈哈,我也正在考虑能,就是还没有想好怎么实现,等都齐了,放到glc里面,虎兄有什么好的想法嘛?
维护glc也是比较繁琐的工作啊,如果能自动化再好不过了。
做一个ebuild,叫glctoolkit之类的,负责处理以后的东东。

以后也好更新。

:2cool :2cool
  hutigers 当前离线   回复时引用此帖
发表新主题 回复


主题工具

发帖规则
您 [不可以] 发表新主题
您 [不可以] 回复主题
您 [不可以] 上传附件
您 [不可以] 编辑您的帖子

已 [启用] BB 代码
已 [启用] 表情符号
已 [启用] IMG 代码
已 [禁用] HTML 代码
[论坛跳转…]


所有时间均为[北京时间]。现在的时间是 13:55


Powered by vBulletin 版本 3.6.8
版权所有 ©2000 - 2010, Jelsoft Enterprises Ltd.
官方中文技术支持: vBulletin 中文
版权所有 ©2002 - 2009, LinuxSir.Org