Using FOSSology from the Command Line

These command line utilities are helpful for sysadmins automating certain FOSSology tasks.

User Commands

cp2foss Copy files to a FOSSology server, and run scans.
fossjobs Queue up a FOSSology analysis job on an upload that is already in the repository.
fo_copyright_list Gets copyrights from an upload (or upload subtree)
fo_nomos_license_list Gets licenses from an upload (or upload subtree)
fo_antelink.php Prototype that tags open source files by using the commercial Antepedia server for identification
fo_tagfoss.php Prototype to do VERY basic foss discovery using the Antepedia public database server
fo_tagfile.php Prototype to tag files based on an input list of file paths

Stand alone agents

Most agents can be run stand alone, outside the FOSSology infrastructure. To see their command line options, use {command} --help. For example,

./nomos --help

ununpack Unpack an iso, tar, or any other archive file into its component files.
nomos Perform a license scan on files listed on the command line.
monk License scanner. Matches licenses in license_ref table
copyright Perform a copyright scan on files listed on the command line.
pkgagent Scan package headers in RPM's and debian packages listed on the command line.
mimetype Return file types for files listed on the command line.

If you want to run a command line agent in parallel to pick up the speed, try something like this:

export myagent=/usr/local/etc/fossology/mods-enabled/nomos/agent/nomos
or
export myagent=/etc/fossology/mods-enabled/nomos/agent/nomos

then run it in parallel:
find /home/users/me/myfiles/ -type f -print0 | parallel -0 -j8 -m 'stdbuf -o0 $myagent'

Web API

So what if you want to send a fossology server a file to do a license analysis on?

You can use wget to return a license (comma separated list of license names):

wget -qO - --post-file myfile.c http://myfossologyserver/?mod=agent_nomos_once

For example:

$ wget -qO - --post-file fo_tagfoss.php http://bobg.fc.hp.com/trunk/?mod=agent_nomos_once

GPL-2.0

Likewise, for copyright:

wget -qO - --post-file myfile.c http://myfossologyserver/?mod=agent_copyright_once

There was a proposal for a more extensive API but there was little interest so the idea was dropped.