commit 621943d5469d34524d1ff05fe25b28a0751e18f3
Author: Elan Ruusamäe <g...@pld-linux.org>
Date:   Tue Oct 17 20:28:49 2017 +0300

    run findunusedbr for docker version

 cleanbuild-docker.sh |  5 +++++
 findunusedbr         | 10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/cleanbuild-docker.sh b/cleanbuild-docker.sh
index 6bb6a19..1775014 100755
--- a/cleanbuild-docker.sh
+++ b/cleanbuild-docker.sh
@@ -53,6 +53,9 @@ docker exec --user=root $name cleanbuild/cleanup-la
 while true; do
        docker exec $name cleanbuild/teeboth $buildlog builder -nn -bb -R 
$package --define 'clean exit 0' && rc=$? || rc=$?
 
+       # reset findunusedbr state after deps install
+       docker exec --user=root $name cleanbuild/findunusedbr -c / 
rpm/packages/$package/$package.spec
+
        findbr=$package.findbr.log
        builddir=$(docker exec $name sh -c 'test ! -d rpm/BUILD/* || echo 
rpm/BUILD/*')
        if [ -z "$builddir" ]; then
@@ -72,6 +75,8 @@ while true; do
        # go for another try
        $installed_something && continue
 
+       docker exec --user=root $name cleanbuild/findunusedbr / 
rpm/packages/$package/$package.spec
+
        if [ $rc -eq 0 ]; then
                # finished ok, cleanup
                docker kill $name >/dev/null && docker rm $name >/dev/null || :
diff --git a/findunusedbr b/findunusedbr
index 03c172a..daf4c37 100755
--- a/findunusedbr
+++ b/findunusedbr
@@ -79,9 +79,17 @@ sub check_files
        print "$rpm may be superfluous !\n";# unless $used;
 }
 
+sub rpm {
+       my @cmd = ("rpm", "--root=$chroot", @_);
+       open my $fh, '-|', @cmd or die "$!: @cmd";
+       my @data = <$fh>;
+       close $fh;
+       warn $! if $!;
+       return @data;
+}
 
 foreach my $rpm ( @rpms ) {
-       my @files = qx/rpm --root=$chroot -ql --what-provides "$rpm"/;
+       my @files = rpm("-ql", "--what-provides", "$rpm");
        next if $files[0] =~ /^no package provides/;
        #print "*** $rpm ***\n";
        if ( $clear ) {
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/cleanbuild.git/commitdiff/f5e5a14be45a4c3bb0a9b61887cab164c4c3fb72

_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to