From: jingui.ren Date: Thu, 9 Aug 2018 12:16:48 +0000 (+0800) Subject: add --style=tar feature, which can build with gbs export source X-Git-Tag: submit/devel/20190730.074511~2^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=524709277d8db24b6f0f3891fbf16c0a14228238;p=tools%2Fdepanneur.git add --style=tar feature, which can build with gbs export source Change-Id: Ib7a0764b29af886e9f611b8cbee77a1c9b7af397 --- diff --git a/depanneur b/depanneur index d219e2d..031cff1 100755 --- a/depanneur +++ b/depanneur @@ -85,6 +85,7 @@ my @repos= (); # rpm repositoies list my $arch = "i586"; # build arch, default is i586 my $path = ""; # build path, which contails packages git content my $style = "git"; # code style, git (default) or osc +#my $style = "tar"; # use pre-export source my $clean = 0; # clean build root for building if $clean == 1 my $binarylist = ""; # packages binay list to be built my $binary_from_file = ""; # file contains binary rpms to be built @@ -454,7 +455,7 @@ sub read_not_export { if ($incremental == 1 && $style ne 'git') { error("incremental build only support git style packages"); } -if ($style ne 'git' && $style ne 'obs') { +if ($style ne 'git' && $style ne 'obs' && $style ne 'tar') { error("style should be 'git' or 'obs'"); } @@ -1860,7 +1861,7 @@ sub build_package { my $pkg_path = "$build_root/local/sources/$dist/$name-$version-$release"; my $srpm_filename = ""; my $not_ex = 0; - if ( $style eq "git" && $incremental == 0 ) { + if ( ( $style eq "git" || $style eq "tar" ) && $incremental == 0 ) { if ($not_export_source == 1) { $not_ex = grep /^$name$/, @not_export; if ($vmtype eq "kvm") { @@ -2500,6 +2501,46 @@ sub generate_depends() { $index++; } } +#use pre-export source to analyse +sub fill_packs_from_dir { + my $name = shift; + my $base = dirname($name); + my $prj = basename($base); + + if ( (grep $_ eq $prj, @exclude) ) { + return; + } + debug("working on $base"); + my $l_packaging_dir = $packaging_dir; + + if (-e "$base/.gbs.conf") { + debug("use $base own gbs.conf"); + my $cfg_tiny = Config::Tiny->new; + $cfg_tiny = Config::Tiny->read("$base/.gbs.conf"); + my $v = $cfg_tiny->{general}->{packaging_dir}; + $l_packaging_dir = $v if (defined($v)); + } + # use pre-export source to find spec + my $pattern = "$base/$l_packaging_dir/*.spec"; + $pattern = "$base/$l_packaging_dir/$arg_spec" if $arg_spec ne ""; + my @spec_list = glob($pattern); + my $specs = ""; + foreach my $spec (@spec_list) { + push(@packs, {filename => "$spec", + project_base_path => $base, + packaging_dir => $l_packaging_dir + }); + } + +} + +sub dir_wanted { + if( -d "$name/packaging" ) + { + fill_packs_from_dir("$name/packaging"); + $prune = 1; + } +} # MAIN if ($depends) { @@ -2604,6 +2645,11 @@ if ($style eq 'git') { } } } +} elsif($style eq 'tar') { + File::Find::find({wanted => \&dir_wanted}, $package_path ); + if (@packs == 0) { + error("No source package found at $package_path"); + } } else { @packs = @ARGV; if (@packs == 0) {