FOSSology  4.4.0
Open Source License Compliance by Open Source Software
walk.c File Reference
#include "buckets.h"
Include dependency graph for walk.c:

Go to the source code of this file.

Functions

FUNCTION int walkTree (PGconn *pgConn, pbucketdef_t bucketDefArray, int agent_pk, int uploadtree_pk, int skipProcessedCheck, int hasPrules)
 This function does a recursive depth first walk through a file tree (uploadtree). More...
 
FUNCTION int processFile (PGconn *pgConn, pbucketdef_t bucketDefArray, puploadtree_t puploadtree, int agent_pk, int hasPrules)
 Process a file. More...
 

Variables

int debug
 

Detailed Description

Processing a given file

Definition in file walk.c.

Function Documentation

◆ processFile()

FUNCTION int processFile ( PGconn *  pgConn,
pbucketdef_t  bucketDefArray,
puploadtree_t  puploadtree,
int  agent_pk,
int  hasPrules 
)

Process a file.

The file might be a single file, a container, an artifact, a package, ..., in other words, an uploadtree record.
Need to process container artifacts as a regular directory so that buckets cascade up without interruption.
There is one small caveat. If the container is a package AND the bucketDefArray has rules that apply to packages (applies_to='p') THEN process the package as both a leaf since the bucket pool has its own rules for packages, and as a container (the pkg is in each of its childrens buckets).

Parameters
pgConnThe database connection object.
bucketDefArrayBucket Definitions
puoloadtreeUploadtree record
agent_pkThe agent_pk
hasPrules1=bucketDefArray contains at least one rule that only apply to packages. 0=No package rules.
Returns
0 on OK, -1 on failure.
Note
Errors are written to stdout.

Definition at line 167 of file walk.c.

◆ walkTree()

FUNCTION int walkTree ( PGconn *  pgConn,
pbucketdef_t  bucketDefArray,
int  agent_pk,
int  uploadtree_pk,
int  skipProcessedCheck,
int  hasPrules 
)

This function does a recursive depth first walk through a file tree (uploadtree).

Parameters
pgConnThe database connection object.
bucketDefArrayBucket Definitions
agent_pkThe agent_pk
uploadtree_pk
skipProcessedChecktrue if it is ok to skip the initial processed() call. The call is unnecessary during recursion and it's an DB query, so best to avoid doing an unnecessary call.
hasPrules1=bucketDefArray contains at least one rule that only apply to packages. 0=No package rules.
Returns
0 on OK, -1 on failure.
Note
Errors are written to stdout.

Definition at line 34 of file walk.c.

Variable Documentation

◆ debug

int debug
extern

Print debug messages

Definition at line 57 of file buckets.c.