You are not logged in.

#1 2009-07-19 20:06:00

Arm-the-Homeless
Member
Registered: 2008-12-22
Posts: 273

[REQUEST] Arch Linux vrms

http://linux.about.com/cs/linux101/g/vrms.htm

Vrms tells you what non-free packages you have on your system. So I was wondering if anyone made (or is/will make) a port of this to Arch.

I guess this could be done by having a little file that has the non-free packages listed in it and it greps the output of `pacman -Qqe` for them.

Last edited by Arm-the-Homeless (2009-07-19 20:07:16)

Offline

#2 2009-07-19 20:09:46

Square
Member
Registered: 2008-06-11
Posts: 429

Re: [REQUEST] Arch Linux vrms

Port it big_smile
I'll look into making a PKGBUILD if someone doesn't beat me to it.

EDIT: Err wait... I meant a port/PKGBUILD. You know...
EDIT2: The source has eluded me.

Last edited by Square (2009-07-19 20:28:58)


 

Offline

#3 2009-07-19 21:45:05

Arm-the-Homeless
Member
Registered: 2008-12-22
Posts: 273

Re: [REQUEST] Arch Linux vrms

I can't find source either.

Should be easy enough to recreate.
(If I had a list of all the non-free packages in the repos.)

Offline

#4 2009-07-21 03:01:53

ACoolie
Member
Registered: 2009-03-01
Posts: 3

Re: [REQUEST] Arch Linux vrms

Here is the list of "bad" packages from Debian Sid vrms v1.15

angband: No commercial distribution
autobook: Modifications limited
doc-html-w3: No modifications or derivatives allowed
font3d: No commercial use
gimp1.2-nonfree: (US only) Includes patent-encumbered algorithms
gimp1.3-nonfree: (US only) Includes patent-encumbered algorithms
gsfonts-other: Partly no modifications allowed, partly shareware
gsn-curses: No modifications allowed
gsn-jigsaw: No modifications allowed
human-icon-theme: Creative Commons Attribution-ShareAlike 2.5 License
hwb: No modifications allowed
ibm-j2re1.5: Proprietary licence, no source available
ibm-j2sdk1.4: Proprietary licence, no source available
ibm-j2sdk1.5: Proprietary licence, no source available
jdk1.1: Proprietary license
lha: No modifications allowed, non-network distributions problematic
mcvert: No commercial distribution
nvidia-glx: Proprietary license
nvidia-glx-dev: Proprietary license
povray: Distribution limitations, modifications limited
povray-doc: Distribution limitations, modifications limited
povray-misc: Distribution limitations, modifications limited
snes9x-common: No commercial use
snes9x-fx: No commercial use
snes9x-opengl: No commercial use
snes9x-svga: No commercial use
snes9x-x: No commercial use
sun-j2re1.3: Proprietary licence, no source available
sun-j2re1.4: Proprietary licence, no source available
sun-j2re1.5: Proprietary licence, no source available
sun-j2sdk1.3: Proprietary licence, no source available
sun-j2sdk1.4: Proprietary licence, no source available
sun-j2sdk1.5: Proprietary licence, no source available
unrar: Modifications problematic
xanim: No commercial distribution
xanim-modules: Highly restricting license terms
xfonts-scalable-nonfree: No modifications allowed
xmame: Distribution limitations, no commercial use
xmame-fx: Distribution limitations, no commercial use
xmame-gl: Distribution limitations, no commercial use
xmame-svga: Distribution limitations, no commercial use
xmame-x: Distribution limitations, no commercial use

and the Perl source

#!/usr/bin/perl
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#

use strict;
use warnings;

use Getopt::Long;

# Declaration of important/main variables.
my $quiet = 0;
my $sparse = 0;
my $help = 0;
my $explain = 1;
my $debug = 0;
my $reasondir = '/usr/share/vrms/reasons/';
my %reason = ();

#
# Auxiliary functions section (FIXME: put them in a file by themselves).
#

# sub usage:
# Input: nothing.
# Output: Messages to stdout telling the usage of the program.
sub usage() {
    print <<EOF;
Usage: vrms [OPTIONS] ...

--quiet, -q        Do nothing if there are no non-free packages installed.
--explain, -e        Give a brief explanation of why a package is non-free,
              if available.
--sparse, -s        Just list non-free packages, nothing else.
--reason-dir=DIR    Use DIR as the reason directory.
--help, -h        Display this help.
--debug, -d        Generate debugging information.

All options can be prefixed with "no" (eg: --noexplain) to turn them off.
EOF
}

# sub parse_reason_file:
# Input: the name of a reason file and the global hash %reason
# Output: the hash %reason filled with reasons from the input file
# (FIXME: %reason shouldn't be global)
sub parse_reason_file {
    my $file = shift;
    print "Parsing reason file $file\n" if $debug >= 1;
    open(REASON, "<", $file) or
    die "Can't open FILE [$file]: $!\n";
    
    while (my $line = <REASON>) {
    chomp $line;
    # Grab a line of the form 'package: reason', skip if we don't match
    my ($pkg, $reason) = ($line =~ /^(\S+):\s+(.*)\s*$/) or next;
    print "'$pkg' because '$reason'\n" if ($debug >= 1);
    
    # If this is _our_ master file, then prefer anything
    # else (so that package maintainers can override)
    next if exists $reason{$pkg} and $file =~ /\/vrms$/;
    
    $reason{$pkg} = $reason;
    }
    
    close REASON or
    die "Can't close FILE [$file]: $!\n";
}

#
# Main program starts here.
#
GetOptions('q|quiet' => \$quiet,
       's|sparse' => \$sparse,
       'e|explain!' => \$explain,
       'reason-dir=s' => \$reasondir,
       'd|debug+' => \$debug,
       'h|help' => \$help);

if ($help) {
    usage();
    exit 0;
}

opendir(REASONDIR, $reasondir) or
    die "Can't open DIR [$reasondir]: $!\n";
# Parse all the reason files in $reasondir except those beginning with
#  a . or ending with a ~
parse_reason_file("$reasondir/$_")
    foreach (grep {!/~$/ && !/^\./} readdir(REASONDIR));
closedir REASONDIR or
    die "Can't close DIR [$reasondir]: $!\n";

my $statusfile = '/var/lib/dpkg/status';
my $is_nonfree = 0;        ###  preset none found, yet
my %nonfree = ();
my $is_other_nonfree = 0;    ###  preset none found, yet
my %other_nonfree = ();
my $is_contrib = 0;        ###  preset none found, yet
my %contrib = ();
my $is_other_contrib = 0;    ###  preset none found, yet
my %other_contrib = ();
my %pkg_status = ();
my $pkgcnt = 0;
my $clumpcnt = 0;
my $dontcarelines = 5;        ### no. of lines a non-installed entry may have in the statusfile


my $sysname = "";
chop($sysname = `uname -n`);

open(PKG_SOURCE, "< $statusfile") or 
    die "Can't open FILE [$statusfile]: $!\n";

$/ = "";  ###  snarf a paragraph at a time
while(<PKG_SOURCE>) {
    my $clump = $_;
    $clumpcnt++;
    my (@pkglines) = split(/\n/, $clump);
    ###  iff more than $dontcarelines lines, package is installed, so process it
    ###   (speed-up by skipping don't-care entries)
    if (@pkglines > $dontcarelines) {
    my $pkg = "";        ###  name of this package
    my $pkgstatus = "";    ###  status
    my $plan = "";        ###  install plan (hold, deinstall, purge, install, etc.)
    my $state = "";        ###  state (ok or ???)
    my $status = "";    ###  status (installed, not-installed, etc.)
    my $section = "";    ###  section this is where non-free is marked
    my $shortdescr = "";    ###  one-liner description of pkg
    my $linenbr = 0;    ###  current line number of this pkackag's info
    my $label = "";        ###  junk field (not used, except to catch split values)
    my $has_pkg = 0;    ###  reset the markers
    my $has_status = 0;
    my $has_section = 0;
    foreach (@pkglines) {
        chomp;
        $linenbr++;
        if (/^Package:/) {
        ($label, $pkg) =  split(/:\s+/,$_,2);
        $pkgcnt++;
        printf "pkg(%4.4d) pkg=[%s]\n",$pkgcnt,$pkg if $debug >= 1;
        $has_pkg = 1;    ###  we have necessary section
        next;
        }
        if (/^Status:/) {
        my $label = "";
        ($label,  $pkgstatus) = split(/:\s+/,$_,2);
        print "\tpkgstatus=[$pkgstatus]\n" if $debug >= 1;
        $pkg_status{$pkg} = $pkgstatus;
        ($plan, $state, $status) = split(/\s+/,$pkgstatus);
        print "\t\tplan=[$plan]\n" if $debug >= 1;
        print "\t\tstate=[$state]\n" if $debug >= 1;
        print "\t\tstatus=[$status]\n" if $debug >= 1;
        $has_status = 1;    ###  we have necessary section
        next;
        }
        if (/^Section:/) {
        my $label = "";
        ($label, $section) = split(/:\s+/,$_,2);
        print "\tsection=[$section]\n" if $debug >= 1;
        $has_section = 1;    ###  we have necessary section
        if ($section =~ /contrib|non-free|restricted|multiverse/) {
            ###  read thru rest of array to find descr instead of waiting for it
            my $found_descr =0;
            while (! $found_descr) {
            if ($linenbr > $#pkglines) {
                ###  iff badly formed entry ensure blank description
                print "\tEEEE shortdescr=[$shortdescr]\n" if $debug >= 1;
                last;
            }
            my $dline = $pkglines[$linenbr++];
            if($dline =~ /^Description:/) {
                ($label, $shortdescr) = split(/:\s+/,$dline,2);
                print "\tshortdescr=[$shortdescr]\n" if $debug >= 1;
                $found_descr = 1;
            }
            }
            if ($section =~ /contrib/) {
            if (lc $status eq 'installed') {
                $is_contrib = 1;
                $contrib{$pkg} = $shortdescr;
            } else {
                $is_other_contrib = 1;
                $other_contrib{$pkg} = $shortdescr;
            }
            } else {
            if (lc $status eq 'installed') {
                $is_nonfree = 1;
                $nonfree{$pkg} = $shortdescr;
            } else {
                $is_other_nonfree = 1;
                $other_nonfree{$pkg} = $shortdescr;
            }
            }
        }
        last;    ### this is last desriptor of package we care about so end loop
        } else {
        ###  un-processed lines from package info
        if($debug >= 1) {
            print "\t\t--- $_\n";
        }
        }
    }
    if (!$has_status or !$has_pkg) {
        print STDERR "vrms: ERROR- Badly formed dpkg-status entry #$clumpcnt!\n";
        print STDERR "             pkg=[$pkg], pkgstatus=[$pkgstatus], section=[$section] \n";
    }
    } else {
    ###  Entries which are 2 or 4 lines are not-installed 
    if ($debug >= 1) {
        ###  emit debug so can veryify parsing
        my $lineCt = @pkglines;
        print " SKIPPED <5: $lineCt lines\n";
        foreach (@pkglines) {
        my $spacer = ($_ =~ /Package:/) ? "" : "   ";
        print " SKIPPED <5:$spacer [$_]\n";
        }
    }
    }
}
close (PKG_SOURCE) or
    die "Can't close FILE [$statusfile]: $!\n";

#print "$pkgcnt packages installed\n";

my $nfcnt = 0;
my $pkgname = "";

my $nonfreecnt = (keys %nonfree);

if($is_nonfree) {
    if($sparse) {
    foreach $pkgname (sort keys (%nonfree)) {
        $nfcnt++;
        print "$pkgname\n";
    }
    } else {
    $~ = "nonfree_head";
    write ;
    $~ = "nfp";
    foreach $pkgname (sort keys(%nonfree) ) {
        $nfcnt++;
        write ;
        print "  Reason: $reason{$pkgname}\n"
        if (exists $reason{$pkgname} and $explain);
    }
    }
}

my $pnfcnt = 0;
my $other_nonfreecnt = (keys %other_nonfree);
if($is_other_nonfree) {
    if($sparse) {
    foreach $pkgname (sort keys(%other_nonfree)) {
        $pnfcnt++;
        print "$pkgname\n";
    }
    } else {
    $~ = "nonfree_partialhead";
    write;
    $~ = "pnf";
    foreach $pkgname (sort keys(%other_nonfree)) {
        $pnfcnt++;
        write;
        print "  Reason: $reason{$pkgname}\n"
        if (exists $reason{$pkgname} and $explain);
    }
    }
}

my $cbcnt = 0;

my $contribcnt = (keys %contrib);

if($is_contrib) {
    print "\n";
    if($sparse) {
    foreach $pkgname (sort keys (%contrib)) {
        $cbcnt++;
        print "$pkgname\n";
    }
    } else {
    $~ = "contrib_head";
    write ;
    $~ = "cbp";
    foreach $pkgname (sort keys(%contrib) ) {
        $cbcnt++;
        write ;
        print "  Reason: $reason{$pkgname}\n"
        if (exists $reason{$pkgname} and $explain);
    }
    }
}

my $pcbcnt = 0;
my $other_contribcnt = (keys %other_contrib);
if($is_other_contrib) {
    if($sparse) {
    foreach $pkgname (sort keys(%other_contrib)) {
        $pcbcnt++;
        print "$pkgname\n";
    }
    } else {
    $~ = "contrib_partialhead";
    write;
    $~ = "pcb";
    foreach $pkgname (sort keys(%other_contrib)) {
        $pcbcnt++;
        write;
        print "  Reason: $reason{$pkgname}\n"
        if (exists $reason{$pkgname} and $explain);
    }
    }
}

if (!$quiet and !$sparse) {
    printf "\n";
    if ($nfcnt != 0 or $pnfcnt != 0) {
    my $total_nonfree = $nonfreecnt + $other_nonfreecnt;
    my $total_installed = $pkgcnt;
    my $percentage = $total_nonfree * 100 / $total_installed;
    printf "  %d non-free packages, %2.1f%% of %d installed packages.\n", 
    $total_nonfree, $percentage, $total_installed;
    }
    if ($cbcnt != 0 or $pcbcnt != 0) {
    my $total_contrib = $contribcnt + $other_contribcnt;
    my $total_installed = $pkgcnt;
    my $percentage = $total_contrib * 100 / $total_installed;
    printf "  %d contrib packages, %2.1f%% of %d installed packages.\n", 
    $total_contrib, $percentage, $total_installed;
    }
}
if (!$quiet and $nfcnt == 0 and $pnfcnt == 0 and $cbcnt == 0 and $pcbcnt == 0) {
    print "No non-free or contrib packages installed on $sysname!  rms would be proud.\n"
}


format nonfree_head =
@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"Non-free packages installed on $sysname"

.
format nonfree_partialhead =

@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"Non-free packages with status other than installed on $sysname"

.

format contrib_head =
@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"Contrib packages installed on $sysname"

.
format contrib_partialhead =

@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"Contrib packages with status other than installed on $sysname"

.

format nfp =
@<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$pkgname, $nonfree{$pkgname}
.

format pnf =
@<<<<<<<<<<<<<<<<<<<<<<<< @<@<<@< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$pkgname, '(', $pkg_status{$pkgname},')', $other_nonfree{$pkgname}
.

format cbp =
@<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$pkgname, $contrib{$pkgname}
.

format pcb =
@<<<<<<<<<<<<<<<<<<<<<<<< @<@<<@< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$pkgname, '(', $pkg_status{$pkgname},')', $other_contrib{$pkgname}
.

Offline

#5 2009-07-21 03:17:35

Ranguvar
Member
From: Our collective subconscious
Registered: 2008-08-12
Posts: 2,515
Website

Re: [REQUEST] Arch Linux vrms

+1, this'd be cool (IMO, of course). Sadly, I know no Perl...

Offline

#6 2009-07-24 23:50:49

Arm-the-Homeless
Member
Registered: 2008-12-22
Posts: 273

Re: [REQUEST] Arch Linux vrms

I'm starting to make the program.

I'll be needing that non-free packages list. tongue

EDIT: All done with (base) program.

Last edited by Arm-the-Homeless (2009-07-25 01:18:36)

Offline

#7 2011-02-13 16:32:09

Demon
Member
From: Republic of Srpska, BA
Registered: 2008-03-02
Posts: 220

Re: [REQUEST] Arch Linux vrms

Is this still actual?!

Offline

#8 2011-02-14 20:42:11

fauno_
Member
Registered: 2008-06-24
Posts: 17

Re: [REQUEST] Arch Linux vrms

Demon wrote:

Is this still actual?!

kinda old, but you can find a list of unfree packages here: http://repo.parabolagnulinux.org/docs/blacklist.txt

(syntax is unfree:free replacement:reason)

Offline

#9 2011-02-15 05:42:12

chris-kun
Member
From: SF Bay Area
Registered: 2010-09-07
Posts: 235
Website

Re: [REQUEST] Arch Linux vrms

I have taken the above link and adapted it into a workable script, but as fauno_ said it's a bit old so I can't attest to it's quality. Feel free to post changes here and I'll update it. I'll upload it to the aur soon, as well.


[home page] -- [code / configs]

"Once you go Arch, you must remain there for life or else Allan will track you down and break you." -- Bregol

Offline

#10 2011-02-15 12:18:19

fauno_
Member
Registered: 2008-06-24
Posts: 17

Re: [REQUEST] Arch Linux vrms

chris-kun wrote:

I have taken the above link and adapted it into a workable script, but as fauno_ said it's a bit old so I can't attest to it's quality. Feel free to post changes here and I'll update it. I'll upload it to the aur soon, as well.

cool! please take note some of the packages aren't unfree, but arch branded (filesystem, both grubs, aif...). and the list is updated regularly, so i think your vrms should download it.

something like this probably does the trick: http://repo.parabolagnulinux.org/files/check-nonfree

we also have a package called your-freedom that conflicts with every package on that list wink


Edit: I meant the thread was kinda old.

Last edited by fauno_ (2011-02-15 12:18:46)

Offline

#11 2011-02-16 03:50:01

chris-kun
Member
From: SF Bay Area
Registered: 2010-09-07
Posts: 235
Website

Re: [REQUEST] Arch Linux vrms

wow cool I hadn't heard about parabola! would love to help with anything if ya guys need it wink


[home page] -- [code / configs]

"Once you go Arch, you must remain there for life or else Allan will track you down and break you." -- Bregol

Offline

#12 2011-02-16 10:30:04

jelly
Trusted User (TU)
From: /dev/null
Registered: 2008-06-10
Posts: 711

Re: [REQUEST] Arch Linux vrms

you can package the script as vrms-archlinux smile

Offline

#13 2012-04-11 23:48:20

orium
Member
Registered: 2012-04-11
Posts: 1

Re: [REQUEST] Arch Linux vrms

Since none of the scripts mentioned are still available I post mine here. It takes into account the parabola GNU/Linux blacklist and they are a bit restrictive, so if you want to ignore some packages just add them to the ignore list.

#! /usr/bin/env python 
#
# Copyright (C) 2012 Diogo Sousa
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import subprocess
import urllib.request
import urllib.error

blacklist_url='http://repo.parabolagnulinux.org/docs/blacklist.txt'

# Packages that will be ignored. 
# eg: ignore=['pacman']
ignore=[]

def get_installed_packages():
    packages=str(subprocess.check_output(['pacman','-Q']),'utf-8')
    r=[]

    for line in packages.split('\n'):
        s=line.split(' ')
        if len(s) > 0 and len(s[0]) > 0:
            r.append(s[0])

    return r

def obtain_non_free_packages():
    try:
        sock=urllib.request.urlopen(blacklist_url)
    except urllib.error.HTTPError:
        print('Error downloading backlist packages')
        exit(-1)

    lines=sock.read().decode('utf-8').split('\n')

    sock.close()

    nonfree={}

    for line in lines:
        s=line.replace('::',':').split(':')
        package=s[0].strip()

        if package in ignore:
            continue

        desc=None
        ds=1
        if len(s) > 2:
            ds=2

        desc=' '.join([e.strip() for e in s[ds:]]).strip()

        nonfree[package]=desc

    return nonfree

def get_nonfree_packages(packages, nonfree):
    installed_nonfree=[]

    for package in packages:
        if package in nonfree:
            installed_nonfree.append((package,nonfree[package]))

    return installed_nonfree

def print_report(nonfree):
    if len(nonfree) == 0:
        print('No nonfree packages found :)')
        return

    print('Nonfree packages:')

    max_len=0

    for package, _ in nonfree:
        if len(package) > max_len:
            max_len=len(package)

    for package, desc in nonfree:
        left=' '.center(max_len-len(package))
        print('   '+package+left+'   ',end='')
        if desc != None:
            print(desc)
        else:
            print()

    print()
    print('Non-free packages: '+str(len(nonfree)))

def main():
    packages=get_installed_packages()
    nonfree=obtain_non_free_packages()
    nonfree_installed=get_nonfree_packages(packages, nonfree)
    print_report(nonfree_installed)
    return 0

exit(main())

Offline

#14 2013-02-08 13:36:42

hsngrms
Member
From: Turkey
Registered: 2012-03-06
Posts: 41
Website

Re: [REQUEST] Arch Linux vrms

We need Richard Matthew Stallman but don't need Virtual Richard Matthew Stallman. pacman is powerful and this commands are enough:

pacman -Qi | grep Name
pacman -Qi | grep License

c/p output to text editor (with row numbers) and find which packages are non-free. smile

Last edited by hsngrms (2013-02-08 14:01:01)

Offline

Board footer

Powered by FluxBB