Changes

From Amahi Wiki
Jump to: navigation, search
2,117 bytes added ,  00:59, 27 September 2014
'''Code:'''
<!--<pre>
#!/usr/bin/python
#
gotUpdates = True
firstUpdate = True
</pre>--><pre>#!/usr/bin/python## Dump update information from /var/log/hda-updates.log#!/usr/bin/python## Display the date and files that were modified/installed.## Reads the hda-updates log file and parses out just the file updates/additions.# It helps to see what has been modified and when.## radioz# 11/8/2010# log = '/var/log/hda-updates.log' line = '==============================================================================='head = 'Package Arch Version Repository Size'cyan = '\033[1;36m'blue = '\033[1;34m'purple = '\033[1;35m'white = '\033[1;37m' print blue + line + whiteprint cyan + head + whiteprint blue + line + white f = open(log, 'r')lines = f.readlines()f.close() gotUpdates = FalsefirstUpdate = FalsedateInfo = ''for ll in lines : l = ll.strip() # Ignore dependency heading if l == 'Installing for dependencies:' : continue if l == '' : # A blank line terminates the updates for a particular date if gotUpdates : # Display a blank line between dates print gotUpdates = False continue if gotUpdates : if firstUpdate : # Display the date above the first update print '%s:' % dateInfo firstUpdate = False # Reformat the file info slightly updateInfo = l.split()# print ' %-16s %-6s %-20s %-16s %-5s %s' % (tuple(updateInfo)) print purple + l + white print blue + line + white if 'hda update attempt' in l : # This header appears once per hour in the log. Very few represent real updates. # Save the date information in case this is a real update. dateInfo = ' '.join(l.split()[5:]) if 'Updating:' in l : # This is a real update, set up the flags gotUpdates = True firstUpdate = True</pre>
Make the file executable:
Sun Nov 7 20:01:29 PST 2010:
hda-platform noarch 5.6-8 amahi 1.0 M
 
= YUM Updates =
<pre>#!/usr/bin/bash
head=' PACKAGE NAME\t\t\t\t\tDATE'
line='============================================= ==============================='
cyan='\033[1;36m'
blue='\033[1;34m'
purple='\033[1;35m'
white='\033[1;37m'
echo -e ${blue}${line}${white}
echo -e ${purple}${head}${white}
echo -e ${blue}${line}${cyan}
rpm -qa --last | head
echo -e ${white}</pre>
12,424

edits