Wednesday, December 26, 2012

how to check rpm license without installing?

Command to find out installed rpm license information
   1) Find out the installed rpm name by running
       rpm -qa|grep -i <name-of-rpm>
       Ex: rpm -qa|grep -i post
             O/P: postfix-2.7.2-12.3.x86_64
   2) Query for additional information on that package, with below command
        rpm -qi <name of the installed rpm>
       It provides lots of information like Version, Description, License, etc. We can grep for required information like
        Ex: rpm -qi postfix-2.7.2-12.3.x86_64|grep "License:"
           O/P: Size        : 2685020                          License: IBM Public License ..

       As you can see the above command provided some extra information along with License. Is there a better way to do this? Yes.
        rpm -q --queryformat '%{name},%{version},%{license}\n' postfix-2.7.2-12.3.x86_64
       O/P: postfix,2.7.2,IBM Public License ..
       To fetch only license
       rpm -q --queryformat '%{license}\n' postfix-2.7.2-12.3.x86_64
       O/p:      IBM Public License ..

Command to find out rpm license information without installing it?
Now I assume you have the rpm file of your interest (Ex: postfix-2.5.13-0.17.4.x86_64.rpm). To know the licesnse information from it, run below command
rpm -qp --queryformat '%{name},%{version},%{license}\n' <rpm-file-name>
Ex:  rpm -qp --queryformat '%{name},%{version},%{license}\n' postfix-2.5.13-0.17.4.x86_64.rpm

Wednesday, December 12, 2012

kiwi build failure Can't provide file from repository 'update'

Our Kiwi builds were failing inconsistently with the below error
Failed to provide Package users-1-1.x86_64. Do you want to retry retrieval? 
Can't provide file 
'./rpm/x86_64/users-1-1.x86_64.rpm' from repository 'update'

Though the message was clearly suggesting issue with rpm download from local Suse repository. But manually we were able to download it without any issues. Even we suspected something fishy with zypper cache.

Finally from the post
https://groups.google.com/group/kiwi-images/tree/browse_frm/month/2012-09/03256b31dffdacfc?rnum=151&_done=/group/kiwi-images/browse_frm/month/2012-09?&pli=1
we got to know that, we need to clean following folders in our build machine
rm -rf /var/cache/kiwi/packages/ 
rm -rf /var/cache/kiwi/zypper 

Now our builds are consistently passing.