#!/usr/bin/perl -w # Libraries use strict; use Number::Bytes::Human qw(format_bytes); use Parse::DebianChangelog; # My values my $data_file=""; my @lines; my @line; my $line; my $desktop; my $action; my $package; my $version; my $newversion; my $source; my $component; my $size; my $workingdirectory; # Main # Data file is the first argument $data_file=$ARGV[0]; # Create a directory as a working-area and store in a simple variable $workingdirectory=`mktemp -d /tmp/lliurex-up-working-area.XXXXX`; chomp($workingdirectory); # Open the file open(DAT, $data_file) || die("Could not open file!"); @lines = ; # Foreach line in file it will be processed to extract the values that are needed # to make the list. # The format of the line is : # #Inst libreoffice-l10n-es [1:3.5.0-2ubuntu1~lucid1] (1:3.5.1-1ubuntu1~lucid1 LibreOffice PPA:10.04/lucid) # # Action , package, version installed, new version, Source of package and component # Now for each line extract and print the data on standar foreach $line(@lines) { chomp($line); ($action,$package,$version,$newversion,$source,$component) = split(" ",$line); if ( $action eq "Inst" ) { $desktop=""; # Print package name print "$package"; print ";"; # Print new version of the package $newversion =~ s/\(//; print "$newversion"; print ";"; # Print size of package $size = format_bytes(1024*`apt-cache show $package |grep "Installed-Size:" |cut -d" " -f2 |head -1`); print $size; print ";"; # Print desktop file print($desktop); $desktop = `dpkg -L $package| grep ".desktop\$" | head -1`; chomp($desktop); if ( $desktop ne "") { print "$desktop"; } print ";"; # Print changelog my $filechglog = `dpkg -L $package| grep "angelog.gz\$" | head -1`; chomp($filechglog); if ($filechglog ne "") { my $result=`zcat $filechglog| head -n 100`; open (TEMPORALFILE, ">>$workingdirectory/$package.llog"); print TEMPORALFILE $result; close (TEMPORALFILE); print "$workingdirectory/$package.llog"; } print ";"; # Print new line print "\n"; } }