|
功能:
自动编译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] |
|