QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2588|回复: 7

自动编译安装e17的perl脚本(对于使用deb包的有用)

[复制链接]
发表于 2005-10-26 15:33:54 | 显示全部楼层 |阅读模式
功能:
自动编译e17包 并且打成deb 然后自动安装deb包

选项
my $autobuilddir = 1;#如果是真的,那编译所有的目录,不然会弹出提示问你要不要编译某个目录
my $autobuild = 1; # 如果是真的自动编译这个目录下所有包,如果=0 每次都会问你要不要编译
my $autoinstall= 1; # 所有安装所有编译出来的包

目录文件写在e17install.log
my @libdirlist=(配置需要编译的库文件目录(e17/libs下的子目录)
my @appdirlist=配置需要编译的可执行文件目录(e17/apps下的子目录)
my @miscdirlist=(配置misc目录下需要编译的子目录


方便debian或是其它使用deb的用户安装和管理E17

e17自己的源码中已经有debian目录 并且可以使用dpkg-buildepackage来创建debian包
这个脚本所做的只是把这一切自动化而已
一个命令就可以放在那里让它自己跑

使用方法:
保存成inse17.pl 然后放在

e17 misc同级的目录下
也就是
$ls
inse17.pl
e17/libs/....
e17/apps/e
e17/apps/....
misc/....
然后使用
perl inse17.pl运行

PS:10.20日后的e17的新功能:
增加了efm 另外觉得更稳定了
今天晚上继续更新看看效果
[code:1]
#!/usr/bin/perl
#
use strict;
use FileHandle;

my $logfilehandle = new FileHandle ">e17install.log";
my $autobuilddir = 1;#if true,then auto build all directory
my $autobuild = 1; # if true,auto build all packages in a directory
my $autoinstall= 1; # auto install deb packges
#chdir("./e17/libs/");
my @libdirlist=(
'edb',
'eet',
'imlib2',
'imlib2_loaders',
'evas',
'ecore',
'edje',
'epeg',
'epsilon',
'embryo',
'esmart',
'emotion',
'ewl',
'engrave');
#'etox',
chdir("../..") if(parsedirs(@libdirlist,"./e17/libs/"));


my @appdirlist=(
'e',
'e_utils',
'entice',
#'entrance',
'eclair',
'elicit',
#'erss',
'examine',
#'iconbar',
#'e_modules'
);
chdir("../..") if(parsedirs(@appdirlist,"./e17/apps/"));

my @miscdirlist=(
'engage',
#'elapse'
);
chdir("..") if(parsedirs(@miscdirlist,"./misc/"));
close($logfilehandle);







sub parsedirs()
{
my @dirlist=@_;
my $parentdir = pop(@dirlist);
return 0 if(! -d $parentdir);
return 0 if( (!$autobuilddir)
&& (!choseact("are you want to build dir:$parentdir\n")) );

chdir($parentdir);
system('rm -f *.deb *.dsc *.tar.gz *.changes');

my $dir;
foreach $dir (@dirlist) {
next if( !(-d $dir) );
chdir($dir);
parsedir($dir);
chdir("../");
system('rm -f *.dsc *.tar.gz *.changes');
}
return 1;
}

sub parsedir()
{
my $pkg = $_[0];
return if((!$autobuild) && (!choseact("are you want to build:$pkg\n")) );
my $curpwd = qx(pwd);
print "\n\n\n\t\tcur dir is:\n\t$curpwd\n";
print $logfilehandle "\n\n\n\t\tcur dir is:\n\t$curpwd\n";
chmod 755,'debian/rules' if(! -x 'debian/rules');
chmod 755,'autogen.sh' if(! -x 'autogen.sh');

#if you don't use deb,then you can call these two line
#system('./autogen.sh --prefix=/usr;make;make uninstall;make install');
#return ;
system("make distclean >/dev/null 2>&1");
system('cp debian/changelog.in debian/changelog >/dev/null 2>&1') if(! -f 'debian/changelog');

open(MAKEFI,"dpkg-buildpackage -us -uc -rfakeroot 2>&1|") || die "exec fail\n";
print $logfilehandle 'dpkg-buildpackage -us -uc -rfakeroot 2>&1'."\n";

my @pkgs;
my @devpkgs;
my @libpkgs;
my $line;
print "\n";
while($line=){
print $logfilehandle $line;
next if($line!~m/dpkg\-deb:\s+building\s+package\s+\`([^']+)\'\s+in\s+\`([^']+)\'/);

print "\tpkg:[$1:\t$2]\n";
my $pkg = $2;
if($pkg=~m/dev/){
push(@devpkgs,$pkg);
}
else{
if($pkg=~m/\blib/){
push(@libpkgs,$pkg);
}
else{
push(@pkgs,$pkg);
}
}
}
close(MAKEFI);

my @returnpkgs;
push(@returnpkgs,@libpkgs,@devpkgs,@pkgs);
if($#returnpkgs < 0){
print "error no package found,build message is:\n";
print $logfilehandle "error no package found,build message is:\n";
print "\n\n";
}
else{
my $pkgfile = join(" ",@returnpkgs);
print "\n\t>>>>>>>>>\tdpkg -i $pkgfile\n\n";
system("dpkg -i $pkgfile");
}
print "\n";
}

sub choseact()
{
print $_[0]."\nplease input yes or no [Y]\n";
my $in=;
if($in=~m/n/i){
print "cancel\n";
return 0;
}
print "\n";
return 1;
}
[/code:1]
发表于 2005-10-26 16:00:37 | 显示全部楼层

我顶。!!!
回复

使用道具 举报

 楼主| 发表于 2005-10-26 16:58:01 | 显示全部楼层
谢谢
回复

使用道具 举报

发表于 2005-10-26 18:07:48 | 显示全部楼层
因为我是新手,有太多概念不明白,不会用,学习中!
回复

使用道具 举报

 楼主| 发表于 2005-10-26 20:41:16 | 显示全部楼层
e17其实很简单 看get-e.org上的user guide会有一定帮助 然后是多看看~/.e目录下的东西就会慢慢理解e17然后学会自己修改配置文件



回复

使用道具 举报

发表于 2005-11-8 10:19:00 | 显示全部楼层
请问楼主怎么使用这个脚本?
回复

使用道具 举报

 楼主| 发表于 2005-11-8 13:08:06 | 显示全部楼层
使用方法:
保存成inse17.pl 然后放在

e17 misc同级的目录下
也就是
$ls
inse17.pl
e17/libs/....
e17/apps/e
e17/apps/....
misc/....
然后使用
perl inse17.pl运行



最新的更新
增加了CVS中check out功能
使一切全部自动化
只需要保存成inse17.pl
然后在这个目录下执行perl inse17.pl就会自动执行
对于debian 需要安装一些相关的程序
如fakeroot
还有下面是编译时必须的
m4
autoconf
automake (1.7 or greater)
libtool
pkg-config
texinfo
gettext

另外ecore需要libxcursoss-devel 编译ecore如果不成功的话可以把它装上

[code:1]
#!/usr/bin/perl
#
use strict;
use FileHandle;

my  $logfilehandle  = new FileHandle ">e17install.log";
my  $autobuilddir   = 1;#if true,then auto build all directory
my  $autobuild            = 1;#   if true,auto build all packages in a directory

my @compileobjs        =(
                  ['e17/libs','../..',
                  'edb',
                  'eet',
                  'imlib2',
                  'imlib2_loaders',
                  'evas',
                  'ecore',
                  'edje',
                  'epeg',
                  'epsilon',
                  'embryo',
                  'esmart',
                  'emotion',
                  'ewl',
                  'engrave'],
                  ['e17/apps','../..',
                  'e',
                  'e_utils',
                  'entice',
#'entrance',
                  'eclair',
                  'elicit',
#'erss',
                  'examine'
#'iconbar',
#'e_modules'
                  ],
                  ['misc','..',
                  'engage']
);

print   "get CVS source code\n";
print   "login CVS:,when need you input password,press return directly\n";
print   'cvs -d:pserver:[email protected]:/cvsroot/enlightenment login'."\n";
system('cvs -d:pserver:[email protected]:/cvsroot/enlightenment login');
print   'chech out E17:'."\n";
print   'cvs -z3 -d:pserver:[email protected]:/cvsroot/enlightenment co e17'."\n";
system('cvs -z3 -d:pserver:[email protected]:/cvsroot/enlightenment co e17');
print   'chech out Misc:'."\n";
print   'cvs -z3 -d:pserver:[email protected]:/cvsroot/enlightenment co misc'."\n";
system('cvs -z3 -d:pserver:[email protected]:/cvsroot/enlightenment co misc');

print   "start build debian packages\n\n";

my $objs;
foreach $objs (@compileobjs){
    my        @objarray   = @$objs;
    my        $dir            = shift(@objarray);
    my        $back_dir   = shift(@objarray);
    if( ! -d $dir ){
        print "dir:$dir not exist,will skip compile it\n";
        next;
    }
    next if( (!$autobuilddir)
                 && (!choseact("are you want to build dir:$dir\n")) );

    print   "start parse:<<<<<        $dir  >>>>>: back:$back_dir\n";
    chdir $dir;
    system('rm -f *.deb *.dsc *.tar.gz *.changes');

    my        $subdir;
    foreach $subdir (@objarray){
        if( !(-d $subdir) ){
            print "dir:$subdir not exist,skip compile it\n";
            next;
        }
        print        "\n\nenter directory:".$subdir."\n";
        chdir($subdir);
        parsedir($subdir);
        $logfilehandle->autoflush(1);
        print "\n";
        $logfilehandle->autoflush(0);
        chdir("../");
        system('rm -f *.dsc *.tar.gz *.changes');
    }
    chdir $back_dir;
}
close($logfilehandle);




sub parsedir()
{
    my $pkg        = $_[0];
    return if((!$autobuild) && (!choseact("are you want to build:$pkg\n")) );
    my $curpwd        = qx(pwd);
    chomp($curpwd);
    print "\tcur dir is:\n\t$curpwd\n";
    print "\trun:   dpkg-buildpackage -us -uc -rfakeroot 2>&1\n";
    print $logfilehandle "\n\t\tcur dir is:\n\t$curpwd\n";
    chmod 755,'debian/rules' if(! -x 'debian/rules');
    chmod 755,'autogen.sh' if(! -x 'autogen.sh');

#if you don't use deb,then you can call these two line
#system('./autogen.sh --prefix=/usr;make;make uninstall;make install');
#return ;
    system("make distclean >/dev/null 2>&1");
    system('cp debian/changelog.in debian/changelog >/dev/null 2>&1') if(! -f 'debian/changelog');

    open(MAKEFI,"dpkg-buildpackage -us -uc -rfakeroot 2>&1|") || die "exec fail\n";
    print $logfilehandle 'dpkg-buildpackage -us -uc -rfakeroot 2>&1'."\n";

    my @pkgs;
    my $line;
    print   "\n";
    while($line=<MAKEFI>){
        print $logfilehandle $line;
        print $line if($line=~m/\berror\b/i);
        next if($line!~m/dpkg\-deb:\s+building\s+package\s+\`([^']+)\'\s+in\s+\`([^']+)\'/);

        print "\tpkg:[$1:\t$2]\n";
        push(@pkgs,$2);
    }
    close(MAKEFI);

    if($#pkgs < 0){
        print "error no package found,build message is write to e17install.log file\n";
        print $logfilehandle "error no package found,please check build message\n";
    }
    else{
        my $pkgfile = join(" ",@pkgs);
        print  "\n>>>>>>>>>\n\tdpkg -i $pkgfile\n\n";
        system("dpkg -i $pkgfile");
    }
    print "\n";
}

sub choseact()
{
    print $_[0]."\nplease input yes or no [Y]\n";
    my $in=<STDIN>;
    if($in=~m/n/i){
        print "cancel\n";
        return 0;
    }
    print "\n";
    return 1;
}


[/code:1]
回复

使用道具 举报

 楼主| 发表于 2005-11-8 13:13:46 | 显示全部楼层
E17的新闻在这里
http://get-e.org/Main/News/index.html

增加了全屏模式 还有增加了mount 模块 可以方便的在桌面上选择需要mount的设备(如移动硬盘等 点一下就可以mount 再点一下就会umount 很方便 )

还有其它更新
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-5-23 22:39 , Processed in 0.103091 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表