Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
bee-files/scripts/check-installed
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
75 lines (66 sloc)
1.87 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
# This script can be used to compare the bee packages installed in the system with | |
# the bee files in the current working directory, which is assumend to be the checked | |
# out master branch of git@github.molgen.mpg.de:mariux64/bee-files.git | |
# | |
# git checkout master | |
# git pull --rebase | |
# scripts/check-installed | |
use strict; | |
use warnings; | |
sub scandir { | |
my ($dirname)=@_; | |
opendir my $dir,$dirname or die "$dirname: $!\n"; | |
return sort grep !/^\./,readdir $dir; | |
} | |
sub save_qx { | |
my (@cmd)=@_; | |
my $pid=open my $pipe,'-|'; | |
defined $pid or die "$!\n"; | |
unless ($pid) { | |
exec @cmd or die "$!"; | |
exit(1); | |
} | |
return join('',<$pipe>); | |
} | |
our %GIT_FILE; | |
for my $beefile (scandir('.')) { | |
$beefile=~/\.(bee|be0)$/ or next; | |
$beefile eq 'TEMPLATE.be0' and next; | |
-f $beefile or next; | |
my $pkg=save_qx('beeversion','--format','%A',$beefile); | |
chomp($pkg); | |
unless ($pkg) { | |
print "# can't parse version of $beefile\n"; | |
next; | |
} | |
unless ($pkg =~ /.x86_64$/) { | |
if ($pkg =~ '^(iana-etc-2.30-0|lesspipe-1-0)$') { | |
$pkg.='.noarch'; | |
} else { | |
$pkg.='.x86_64'; | |
} | |
} | |
if (exists($GIT_FILE{$pkg})) { | |
print "# bee file $beefile overwrites package $pkg from $GIT_FILE{$pkg}\n"; | |
} | |
$GIT_FILE{$pkg}=$beefile; | |
} | |
%GIT_FILE or die "no bee files here. Are you sitting in a checked out bee-files repository (git\@github.molgen.mpg.de:mariux64/bee-files.git) ?\n"; | |
for my $dir (scandir('/usr/share/bee')) { | |
my $pkg=$dir; | |
$pkg eq 'mxtools-0.0-0' and next; | |
my $beefile=save_qx('beeversion', '--format', '%F.bee', $pkg); | |
unless (-e "/usr/share/bee/$pkg/$beefile") { | |
print "# no such file /usr/share/bee/$pkg/$beefile\n"; | |
next; | |
} | |
unless (exists($GIT_FILE{$pkg})) { | |
print "# package in system but not in git: $pkg\n"; | |
} | |
delete $GIT_FILE{$pkg}; | |
} | |
for my $pkg (sort(keys(%GIT_FILE))) { | |
my $beefile=$GIT_FILE{$pkg}; | |
print "# package in git but not in system: $pkg ($beefile)\n"; | |
} |