[Yum] Getting YUM output from Perl

Vadim Lvovsky vadim at psoft.od.ua
Mon Nov 13 11:38:07 UTC 2006


 Hello.
 
  When I have installed my rpm package from some YUM repository with simple 
PERL script:

#!/usr/bin/perl
$| = 1;
open (CMD, "yum -y install mypackage 2>&1 |");
while (<CMD>)
{
 print "$_";
}
close (CMD);

 Output of  script is displayed piece by piece (it is buffering). Output 
postinstall script  is displayed before output of information about package's 
installation.  See script output below. 
 But after installation of the package from the shell I had no such a problem.  

 How should I work with  YUM  output? Please advise something.


# ./test.pl
warning: /etc/named.conf saved as /etc/named.conf.rpmorig
Configuring Servers ...
=================================
Configuring BIND DNS Server ...
done

Configuring has been completed
=================================
Setting up Install Process
Setting up Repos
Reading repository metadata in from local files
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for mypackage to pack into transaction set.
---> Package mypackage.i586 0:1.0-c4 set to be updated
--> Running transaction check
--> Processing Dependency: bind for package: mypackage
--> Processing Dependency: caching-nameserver for package: mypackage
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for bind to pack into transaction set.
---> Package bind.i386 20:9.2.4-16.EL4 set to be updated
---> Downloading header for caching-nameserver to pack into transaction set.
---> Package caching-nameserver.noarch 0:7.3-3 set to be updated
--> Running transaction check

Dependencies Resolved
Transaction Listing:
  Install: mypackage.i586 0:1.0-c4 - test

Performing the following to resolve dependencies:
  Install: bind.i386 20:9.2.4-16.EL4 - base
  Install: caching-nameserver.noarch 0:7.3-3 - base
Total download size: 604 k
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction

Installed: mypackage.i586 0:1.0-c4
Dependency Installed: bind.i386 20:9.2.4-16.EL4 caching-nameserver.noarch 
0:7.3-3
Complete!


-- 
Vadim Lvovsky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.baseurl.org/pipermail/yum/attachments/20061113/a38b2f3a/attachment-0001.htm 


More information about the Yum mailing list