Determining the software list on machines in my network

Hi All, I am struggling to correctly define a search for a tool to help me list the software in my two machines, desktop and notebook, both running SUSE 12.3. As a consequence Google has been of no help. My two computers have different video handling set ups. desktop needs VLC to handle flash and avi files - nothing else works, whereas my notebook needs GnomeMPlayer only for the same tasks (VLC is useless) both machines are 64bit. I will soon be upgrading to SUSE 13.1 and I would like to have a consistent inventory in each machine. Apart from that, video in SUSE is hard to set up (go figure), so I would like to pre-specify the package list. Andrew Greig

On 24/11/13 09:15, Andrew Greig wrote:
Hi All,
I am struggling to correctly define a search for a tool to help me list the software in my two machines, desktop and notebook, both running SUSE 12.3. As a consequence Google has been of no help.
My two computers have different video handling set ups. desktop needs VLC to handle flash and avi files - nothing else works, whereas my notebook needs GnomeMPlayer only for the same tasks (VLC is useless) both machines are 64bit.
It sounds like a mime-types issue. Try rummaging around with gst-typefind, gvfs-mime, xdg-mime and friends. Also look at what is in the Desktop files for vlc and mplayer.

On Sun, 2013-11-24 at 16:56 +1100, Allan Duncan wrote:
On 24/11/13 09:15, Andrew Greig wrote:
Hi All,
I am struggling to correctly define a search for a tool to help me list the software in my two machines, desktop and notebook, both running SUSE 12.3. As a consequence Google has been of no help.
My two computers have different video handling set ups. desktop needs VLC to handle flash and avi files - nothing else works, whereas my notebook needs GnomeMPlayer only for the same tasks (VLC is useless) both machines are 64bit.
It sounds like a mime-types issue. Try rummaging around with gst-typefind, gvfs-mime, xdg-mime and friends.
Also look at what is in the Desktop files for vlc and mplayer.
Hi Allan, Thanks for the reply, I found a way to create the list of software for each machine using rpm -qa and then piped to a log file. I now have each log file copied into a spreadsheet side by side Column A and Column B (text in B is red), I appended Bito column A and then sorted the whole column. I can now visually detect where the extra files are, but there are 2100 of them, but the column is now 4000 cells deep. Is there any way in a spreadsheet to read the column and remove both instances of identical files leaving only the "orphans" which I can again sort physically into their respective colours? Once I get the machines consistent then I can run the upgrade. Hopefully Andrew Greig

On Sun, Nov 24, 2013 at 08:59:44PM +1100, Andrew Greig wrote:
Thanks for the reply, I found a way to create the list of software for each machine using rpm -qa and then piped to a log file.
I now have each log file copied into a spreadsheet side by side Column A and Column B (text in B is red), I appended Bito column A and then
the spreadsheet was probably a mistake. text files are easier to work with and compare. save the sorted data to two text files, one for each machine. ideal format would be one software package per line, with package name and version number. then use diff. comparing two text files is precisely what it is for. alternatively, write a simple program (perl or python would be ideal) which loads the packagename+version data into associative arrays, and then prints out the list of package/versions that are on computer A but not on B, and then the list of package/versions that are on computer B but not on A. either method will give you a much smaller set of data - packages & versions - to check and/or correct....dozens or hundreds of entries rather than thousands. the list would likely be even smaller if you cared only about package names, and didn't care about versions. craig -- craig sanders <cas@taz.net.au>

On Mon, 2013-11-25 at 07:54 +1100, Craig Sanders wrote:
On Sun, Nov 24, 2013 at 08:59:44PM +1100, Andrew Greig wrote:
Thanks for the reply, I found a way to create the list of software for each machine using rpm -qa and then piped to a log file.
I now have each log file copied into a spreadsheet side by side Column A and Column B (text in B is red), I appended Bito column A and then
the spreadsheet was probably a mistake. text files are easier to work with and compare.
save the sorted data to two text files, one for each machine. ideal format would be one software package per line, with package name and version number.
then use diff. comparing two text files is precisely what it is for.
alternatively, write a simple program (perl or python would be ideal) which loads the packagename+version data into associative arrays, and then prints out the list of package/versions that are on computer A but not on B, and then the list of package/versions that are on computer B but not on A.
either method will give you a much smaller set of data - packages & versions - to check and/or correct....dozens or hundreds of entries rather than thousands.
the list would likely be even smaller if you cared only about package names, and didn't care about versions.
craig
Thanks Craig, diff is what I will use, I will check out the man file tonight. Cheers Andrew

Since you are using rpms, you could use rpm -qa --qf '%{name}\t%{version}\t%{release}\t%{arch}\n' | sort >pkg-list to keep the name away from the version etc. Substitute ',' for '\t' and you get a csv format. Of course you can delete all the version stuff if you want to just compare what packages you have, and then worry about version differences. Diff output can be hard to read, so I would use the -u diff option to get the context of the changes - more lines in the output but easier to see what is in or out.

On Mon, 2013-11-25 at 07:54 +1100, Craig Sanders wrote:
On Sun, Nov 24, 2013 at 08:59:44PM +1100, Andrew Greig wrote:
Thanks for the reply, I found a way to create the list of software for each machine using rpm -qa and then piped to a log file.
I now have each log file copied into a spreadsheet side by side Column A and Column B (text in B is red), I appended Bito column A and then
the spreadsheet was probably a mistake. text files are easier to work with and compare.
save the sorted data to two text files, one for each machine. ideal format would be one software package per line, with package name and version number.
then use diff. comparing two text files is precisely what it is for.
alternatively, write a simple program (perl or python would be ideal) which loads the packagename+version data into associative arrays, and then prints out the list of package/versions that are on computer A but not on B, and then the list of package/versions that are on computer B but not on A.
either method will give you a much smaller set of data - packages & versions - to check and/or correct....dozens or hundreds of entries rather than thousands.
the list would likely be even smaller if you cared only about package names, and didn't care about versions.
craig
OK. I used the log files I had generated from each machine as output from rpm -qa, the output was not alphabetical ascending so line for line the lists were in no way parallel. I used diff --normal software.log software2.log and got a difference of 1700 files, my expectation was around 100 files difference but I have to go through a few thousand to find them in an analog way. Should I pre-sort the files alphabetically ascending before trying Cheers Andrew again?

On Mon, Nov 25, 2013, at 18:57, Andrew Greig wrote:
On Mon, 2013-11-25 at 07:54 +1100, Craig Sanders wrote:
On Sun, Nov 24, 2013 at 08:59:44PM +1100, Andrew Greig wrote:
Thanks for the reply, I found a way to create the list of software for each machine using rpm -qa and then piped to a log file. ... I used diff --normal software.log software2.log and got a difference of 1700 files, my expectation was around 100 files difference but I have to go through a few thousand to find them in an analog way.
Should I pre-sort the files alphabetically ascending before trying
Yeah, for this sort of thing, you really need to have the data sorted (by the 'sort' utility) before running it through 'diff' or 'join'. It doesn't have to be alphabetically -- it just matters that it's sorted in some sort of consistent order. I think, by default, 'sort' sorts in ASCII lexicographical order, which will be close enough to alphabetical (except capitals sort before lower-case letters). This, though, can be affected by your locale settings. -- Smiles, Les. -- Les Kitchen (LUV) ljk+luv at domain ljk.id.au via fastmail.fm

On Mon, Nov 25, 2013 at 06:57:14PM +1100, Andrew Greig wrote:
OK. I used the log files I had generated from each machine as output from rpm -qa, the output was not alphabetical ascending so line for line the lists were in no way parallel.
I used diff --normal software.log software2.log and got a difference of 1700 files, my expectation was around 100 files difference but I have to go through a few thousand to find them in an analog way.
btw, you may find the colordiff program useful. it nicely colourises diff output. you can use it in place of diff, or you can pipe output from diff into it. if you pipe colordiff into less, though, use less's -R option so that it properly interprets the ANSI color codes. also BTW, diff's -u or --unified output format tends to be more readable and shorter than the default (--normal). and is especially nice to read when colourised with colordiff.
Should I pre-sort the files alphabetically ascending before trying
yes. sorting both files will make them more similar to each other, so diff will find fewer uninteresting differences. the more similar you can make the files to each other, the better - so strip out any extraneous data. if all you care about is the package names then just have both files contain packages names (one per line) and nothing else. if you care about packagename+version then strip out everything except package names and version numbers (and either consistently use a single space or tab between the fields, or use diff's -b or --ignore-space-change option to ignore only whitespace differences). extraneous data is just extra irrelevant stuff for diff to notice is different. even with pre-sorting diff will still show more differences than you might expect because the two files aren't merely different versions of the same file (as is common when using diff for program source code), they're different files containing similar data. which is why i suggested a simple program comparing the packages, using associative arrays to store the package names & versions for each computer - so you're comparing the actual data rather than the text files. a very simple version in perl might look something like this: (warning, untested, written in this email and not executed. it does compile with 'perl -c' but expect bugs. intended more as an example of one simple way to approach the problem than as functioning code). #!/usr/bin/perl use strict; my $f1 = 'filename1.txt'; my $f2 = 'filename2.txt'; # format of both files is assumed to be one entry per line, with # fields separated by any amount of whitespace (spaces, tabs), # with the fields being: packagename version # e.g.: # #coreutils 8.21-1 #findutils 4.4.2-6 #psutils 1.17.dfsg-1 #sharutils 1:4.14-1 # declare associative arrays a and b: my %a = (); my %b = (); open(F1,"<",$f1) || die "couldn't open $f1: $!\n"; while(<F1>) { chomp; my ($package,$version) = split; $a{$package} = $version; }; close(F1); open(F2,"<",$f2) || die "couldn't open $f2: $!\n"; while(<F2>) { chomp; my ($package,$version) = split; $b{$package} = $version; }; close(F2); my $p; foreach $p (sort keys %a) { print "package $p is in a but not in b\n" unless defined($b{$p}); # if you don't care about version differences, comment out the next line print "a has $p $a{$p} but b has $p $b{$p}\n" unless $a{$p} eq $b{$p}; # note the 'eq' above is a string equality comparison which should # be adequate given that versions are strings not numbers. if you # need to do greater-than or less-than style comparisons on version # strings, there are several perl modules to choose from including # Sort::Versions. }; foreach $p (sort keys %b) { print "package $p is in b but not in a\n" unless defined($a{$p}); } craig -- craig sanders <cas@taz.net.au>

On Mon, 2013-11-25 at 21:47 +1100, Craig Sanders wrote:
On Mon, Nov 25, 2013 at 06:57:14PM +1100, Andrew Greig wrote:
OK. I used the log files I had generated from each machine as output from rpm -qa, the output was not alphabetical ascending so line for line the lists were in no way parallel.
I used diff --normal software.log software2.log and got a difference of 1700 files, my expectation was around 100 files difference but I have to go through a few thousand to find them in an analog way.
btw, you may find the colordiff program useful. it nicely colourises diff output. you can use it in place of diff, or you can pipe output from diff into it.
if you pipe colordiff into less, though, use less's -R option so that it properly interprets the ANSI color codes.
also BTW, diff's -u or --unified output format tends to be more readable and shorter than the default (--normal). and is especially nice to read when colourised with colordiff.
Should I pre-sort the files alphabetically ascending before trying
yes. sorting both files will make them more similar to each other, so diff will find fewer uninteresting differences. the more similar you can make the files to each other, the better - so strip out any extraneous data. if all you care about is the package names then just have both files contain packages names (one per line) and nothing else. if you care about packagename+version then strip out everything except package names and version numbers (and either consistently use a single space or tab between the fields, or use diff's -b or --ignore-space-change option to ignore only whitespace differences).
extraneous data is just extra irrelevant stuff for diff to notice is different.
even with pre-sorting diff will still show more differences than you might expect because the two files aren't merely different versions of the same file (as is common when using diff for program source code), they're different files containing similar data.
which is why i suggested a simple program comparing the packages, using associative arrays to store the package names & versions for each computer - so you're comparing the actual data rather than the text files.
a very simple version in perl might look something like this:
(warning, untested, written in this email and not executed. it does compile with 'perl -c' but expect bugs. intended more as an example of one simple way to approach the problem than as functioning code).
#!/usr/bin/perl
use strict;
my $f1 = 'filename1.txt'; my $f2 = 'filename2.txt';
# format of both files is assumed to be one entry per line, with # fields separated by any amount of whitespace (spaces, tabs), # with the fields being: packagename version # e.g.: # #coreutils 8.21-1 #findutils 4.4.2-6 #psutils 1.17.dfsg-1 #sharutils 1:4.14-1
# declare associative arrays a and b: my %a = (); my %b = ();
open(F1,"<",$f1) || die "couldn't open $f1: $!\n"; while(<F1>) { chomp; my ($package,$version) = split; $a{$package} = $version; }; close(F1);
open(F2,"<",$f2) || die "couldn't open $f2: $!\n"; while(<F2>) { chomp; my ($package,$version) = split; $b{$package} = $version; }; close(F2);
my $p;
foreach $p (sort keys %a) { print "package $p is in a but not in b\n" unless defined($b{$p});
# if you don't care about version differences, comment out the next line print "a has $p $a{$p} but b has $p $b{$p}\n" unless $a{$p} eq $b{$p};
# note the 'eq' above is a string equality comparison which should # be adequate given that versions are strings not numbers. if you # need to do greater-than or less-than style comparisons on version # strings, there are several perl modules to choose from including # Sort::Versions. };
foreach $p (sort keys %b) { print "package $p is in b but not in a\n" unless defined($a{$p}); }
craig
Wow! Thanks to all for the contributions, learning curve is steep but interesting. I do appreciate the program Craig, but as I lack understanding I will run it to see how I fare. Then I can make some of the changes you offered and see how that affects the outcome. The analog version of this pursuit is very labour intensive so it is worth my time to learn and do. I will work on this for a while now, and then hit the sack. Gratefully Andrew Greig

On Mon, Nov 25, 2013 at 09:47:02PM +1100, Craig Sanders wrote:
On Mon, Nov 25, 2013 at 06:57:14PM +1100, Andrew Greig wrote:
OK. I used the log files I had generated from each machine as output from rpm -qa, the output was not alphabetical ascending so line for line the lists were in no way parallel.
I used diff --normal software.log software2.log and got a difference of 1700 files, my expectation was around 100 files difference but I have to go through a few thousand to find them in an analog way.
btw, you may find the colordiff program useful. it nicely colourises diff output. you can use it in place of diff, or you can pipe output from diff into it.
if you pipe colordiff into less, though, use less's -R option so that it properly interprets the ANSI color codes.
also BTW, diff's -u or --unified output format tends to be more readable and shorter than the default (--normal). and is especially nice to read when colourised with colordiff.
Should I pre-sort the files alphabetically ascending before trying
yes. sorting both files will make them more similar to each other, so diff will find fewer uninteresting differences. the more similar you can make the files to each other, the better - so strip out any extraneous
Another option if going the 'diff' route is 'git diff --no-index'. One nice thing about git's diff (especially if you have really, really large files) is that it's clever enough to check whether the lines are in sorted order as it goes, providing a massive increase in speed. Also has all the usual goodies (colour, ignore whitespace, ignore case, patience algorithm etc.) Karl

On Mon, Nov 25, 2013, at 7:54, Craig Sanders wrote:
On Sun, Nov 24, 2013 at 08:59:44PM +1100, Andrew Greig wrote:
Thanks for the reply, I found a way to create the list of software for each machine using rpm -qa and then piped to a log file.
I now have each log file copied into a spreadsheet side by side Column A and Column B (text in B is red), I appended Bito column A and then
the spreadsheet was probably a mistake. text files are easier to work with and compare.
save the sorted data to two text files, one for each machine. ideal format would be one software package per line, with package name and version number.
then use diff. comparing two text files is precisely what it is for.
And the utility 'join' can also come in handy for tasks like this, especially if there's other data for each entry and a field that can act like a key. -- Smiles, Les. -- Les Kitchen (LUV) ljk+luv at domain ljk.id.au via fastmail.fm

https://github.com/furlongm/patchman Patchman should do what you want. Requires django, web based. Author is subbed to luv-main, if you want to give praise ;) cheers, / Brett On Sun, Nov 24, 2013 at 9:15 AM, Andrew Greig <pushin.linux@gmail.com>wrote:
Hi All,
I am struggling to correctly define a search for a tool to help me list the software in my two machines, desktop and notebook, both running SUSE 12.3. As a consequence Google has been of no help.
My two computers have different video handling set ups. desktop needs VLC to handle flash and avi files - nothing else works, whereas my notebook needs GnomeMPlayer only for the same tasks (VLC is useless) both machines are 64bit.
I will soon be upgrading to SUSE 13.1 and I would like to have a consistent inventory in each machine.
Apart from that, video in SUSE is hard to set up (go figure), so I would like to pre-specify the package list.
Andrew Greig
_______________________________________________ luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main

On Sun, 24 Nov 2013, 09:15, Andrew Greig wrote: } Hi All, } } I am struggling to correctly define a search for a tool to help me list } the software in my two machines, desktop and notebook, both running SUSE } 12.3. As a consequence Google has been of no help. } } My two computers have different video handling set ups. desktop needs } VLC to handle flash and avi files - nothing else works, whereas my } notebook needs GnomeMPlayer only for the same tasks (VLC is useless) } both machines are 64bit. } } I will soon be upgrading to SUSE 13.1 and I would like to have a } consistent inventory in each machine. } } Apart from that, video in SUSE is hard to set up (go figure), so I would } like to pre-specify the package list. Another way to skin this cat... machineA[/tmp]# rpm -qa | sort > machineA machineB[/tmp]# rpm -qa | sort > machineB $ cat machineA one two four five six $ cat machineB one two three five six seven What's in A, but not in B? $ grep -vf machineB machineA four What's in B, but not in A? $ grep -vf machineA machineB three seven It's not especially efficient, but if you want to let the hardware do the thinking while you wander off to have a powernap or coffee, it should do the trick. I'm assuming your software version numbers are mostly the same, and any that differ are of interest. T.

On 2013-11-26 20:51, Craig Sanders wrote:
On Tue, Nov 26, 2013 at 02:53:28PM +1100, Tony Crisp wrote:
$ grep -vf machineB machineA four
What's in B, but not in A?
$ grep -vf machineA machineB three seven
nice solution. sometimes simplest is best.
This is what the 'comm' command is specifically designed for: $ comm -3 machineA machineB # suppress lines that appear in both files $ comm -13 machineA machineB # show only lines unique to file machineB -- Regards, Matthew Cengia

On Wed, 27 Nov 2013, 00:21, Matthew Cengia wrote: } On 2013-11-26 20:51, Craig Sanders wrote: } > On Tue, Nov 26, 2013 at 02:53:28PM +1100, Tony Crisp wrote: } > > } > > $ grep -vf machineB machineA } > > four } > > } > > What's in B, but not in A? } > > } > > $ grep -vf machineA machineB } > > three } > > seven } > } > nice solution. sometimes simplest is best. } } This is what the 'comm' command is specifically designed for: } } $ comm -3 machineA machineB } # suppress lines that appear in both files } } $ comm -13 machineA machineB } # show only lines unique to file machineB Good one =] T.
participants (9)
-
Allan D
-
Allan Duncan
-
Andrew Greig
-
Brett Pemberton
-
Craig Sanders
-
Karl Billeter
-
Les Kitchen (LUV)
-
Matthew Cengia
-
Tony Crisp