From: y0169.zhang@samsung Date: Thu, 1 Sep 2016 01:38:29 +0000 (+0800) Subject: Add config to make some packages not export sources for accel X-Git-Tag: submit/devel/20190730.074511~43^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a5ce0b64d8ab7e23b7c45dcb1661c51966909dd;p=tools%2Fdepanneur.git Add config to make some packages not export sources for accel Change-Id: Ie1cd0d70c10cfa11ccfaa1c3eb93b99b175e6d0a --- diff --git a/Makefile b/Makefile index c930a48..c619a41 100644 --- a/Makefile +++ b/Makefile @@ -25,3 +25,6 @@ install: install -m644 \ data/build-report.tmpl \ $(DESTDIR)$(datadir)/ + install -m644 \ + data/not-export \ + $(DESTDIR)$(datadir)/ diff --git a/data/not-export b/data/not-export new file mode 100644 index 0000000..854fe82 --- /dev/null +++ b/data/not-export @@ -0,0 +1,6 @@ +rinato-linux-kernel +chromium-efl +linux-kernel +odroid-linux-kernel +elementary +gdb diff --git a/depanneur b/depanneur index 8a1e499..7b0f32c 100755 --- a/depanneur +++ b/depanneur @@ -166,6 +166,8 @@ my %build_status_json = (); # final json report data my %workers = (); # build workers: { 'state' => 'idle'|'busy' , 'tid' => undef|$tid }; my @build_order = (); #The build order for all packages my $get_order = 0; #Bool : @build_order is empty +my $not_export_cf = "/usr/share/depanneur/not-export"; +my @not_export = (); GetOptions ( "repository=s" => \@repos, @@ -401,6 +403,21 @@ sub is_archive_filename { return 0; } +#--------------------------------------------------------------------- +# read packages that not need export for accel +#--------------------------------------------------------------------- +sub read_not_export { + my $file = shift; + + open (CF, "<", $file) or print "Error: open file: $file error!\n $!\n" and return; + while () { + chomp(); + next if (/^s*#/); + push @not_export, $_; + } + close (CF); +} + if ($incremental == 1 && $style ne 'git') { error("incremental build only support git style packages"); } @@ -1559,6 +1576,44 @@ sub resolve_skipped_packages() { } } +#--------------------------------------------------------------------- +# Get source base name +#--------------------------------------------------------------------- +sub get_source_base_name { + my $source_name = shift; + my $base_name = $source_name; + my @arhive_formats = ('tar', 'zip'); + my %archive_ext_aliases = ( 'tgz' => ['tar', 'gzip' ], + 'tbz2'=> ['tar', 'bzip2'], + 'tlz' => ['tar', 'lzma' ], + 'txz' => ['tar', 'xz' ] + ); + my %compressor_opts = ( 'gzip' => [['-n'], 'gz' ], + 'bzip2' => [[], 'bz2' ], + 'lzma' => [[], 'lzma'], + 'xz' => [[], 'xz' ] + ); + + my @split = split(/\./, $source_name); + if (scalar(@split) > 1) { + if (exists $archive_ext_aliases{$split[-1]}) { + $base_name = join(".", @split[0..scalar(@split)-2]); + } elsif (grep($_ eq $split[-1], @arhive_formats)) { + $base_name = join(".", @split[0..scalar(@split)-2]); + } else { + foreach my $value (values %compressor_opts) { + if ($value->[1] eq $split[-1]) { + $base_name = join(".", @split[0..scalar(@split)-2]); + if (scalar(@split) > 2 && grep($_ eq $split[-2], @arhive_formats)) { + $base_name = join(".", @split[0..scalar(@split)-3]); + } + } + } + } + } + + return $base_name; +} #--------------------------------------------------------------------- # the control func of thread @@ -1683,8 +1738,14 @@ sub build_package { my $spec_name = basename($to_build{$name}->{filename}); my $pkg_path = "$build_root/local/sources/$dist/$name-$version-$release"; my $srpm_filename = ""; + my $not_ex; if ( $style eq "git" && $incremental == 0 ) { - $srpm_filename = "$pkg_path/$spec_name"; + $not_ex = grep /^$name$/, @not_export; + if ($not_ex) { + $srpm_filename = $to_build{$name}->{filename}; + } else { + $srpm_filename = "$pkg_path/$spec_name"; + } } else { $srpm_filename = $to_build{$name}->{filename}; } @@ -1760,7 +1821,13 @@ sub build_package { } my $cmd = ""; - my $builddir = "$scratch/home/abuild/rpmbuild/BUILD/$name-$version"; + my $builddir; + if ($not_ex) { + my $base_source = get_source_base_name($to_build{$name}->{source}); + $builddir = "$scratch/home/abuild/rpmbuild/BUILD/$base_source"; + } else { + $builddir = "$scratch/home/abuild/rpmbuild/BUILD/$name-$version"; + } my $source_tar = ""; if (exists $to_build{$name}->{source}) { $source_tar = "$to_build{$name}->{project_base_path}/$packaging_dir/$to_build{$name}->{source}"; @@ -1801,7 +1868,24 @@ sub build_package { my_system("tar -zcf $source_tar $tmp_dir") if ($source_tar ne ""); } - push @args, "--stage=\"-bb\"" if ($skip_srcrpm == 1); + if ($not_ex) { + if ( -d "$builddir") { + my_system("rm -rf $builddir"); + } + my $project_base_path = $to_build{$name}->{project_base_path}; + my_system("sudo /bin/mkdir -p $builddir"); + my $mount = "sudo /bin/mount -o bind $project_base_path $builddir"; + my_system($mount); + my $packaing_files = dirname($to_build{$name}->{filename}); + my_system("cp -a $packaing_files/* $project_base_path/"); + my $tmp_dir = abs_path(tempdir(CLEANUP=>1)); + my_system("tar -zcf $source_tar $tmp_dir") if ($source_tar ne ""); + push @args, "--short-circuit --stage=\"-bs\""; + push @args, "--no-topdir-cleanup"; + } else { + push @args, "--stage=\"-bb\"" if ($skip_srcrpm == 1); + } + $cmd = join(" ", @args); debug($cmd); my $ret = my_system ($cmd); @@ -1811,6 +1895,10 @@ sub build_package { my_system("rm -f $source_tar") if ($source_tar ne ""); safe_umount($builddir) if ($incremental == 1); } + if ($not_ex) { + my_system("rm -f $source_tar") if ($source_tar ne ""); + safe_umount($builddir) + } # Save build config to build root for --noinit use my_system("sudo /bin/cp $dist_configs/$dist.conf $scratch/$dist.conf") if ($noinit == 0); @@ -2107,11 +2195,19 @@ if ($style eq 'git') { } if ($incremental == 0) { info("prepare sources..."); + read_not_export($not_export_cf); my $packs_queue = Thread::Queue->new(); my $data_queue = Thread::Queue->new(); foreach my $pack (@pre_packs) { - $data_queue->enqueue($pack); + my $name = basename($pack->{"project_base_path"}); + my $r = grep /^$name$/, @not_export; + if ($r) { + info("skip export $name for accel..."); + push @packs, $pack; + } else { + $data_queue->enqueue($pack); + } } my $thread_num = int(sysconf(SC_NPROCESSORS_ONLN)); diff --git a/packaging/depanneur.spec b/packaging/depanneur.spec index 47ce617..b06cef4 100644 --- a/packaging/depanneur.spec +++ b/packaging/depanneur.spec @@ -48,3 +48,4 @@ build mode and incremental build mode. %{_bindir}/depanneur %{_sysconfdir}/sudoers.d/gbs %{_datadir}/depanneur/build-report.tmpl +%{_datadir}/depanneur/not-export