FOSSology  4.4.0
Open Source License Compliance by Open Source Software
pkgagent.c File Reference

Local function of pkgagent. More...

#include "pkgagent.h"
Include dependency graph for pkgagent.c:

Go to the source code of this file.

Functions

void EscapeString (char *sourceString, char *escString, int esclen)
 Escaping special characters(single quote) More...
 
char * GetFieldValue (char *Sin, char *Field, int FieldMax, char *Value, int ValueMax, char Separator)
 Given a string that contains field='value' pairs, save the items. More...
 
int ProcessUpload (long upload_pk)
 Get all pfile need to processed use upload_pk. More...
 
void ReadHeaderInfo (Header header, struct rpmpkginfo *pi)
 Get RPM package info from rpm file header use rpm library. More...
 
int GetMetadata (char *pkg, struct rpmpkginfo *pi)
 Get RPM package info. More...
 
int RecordMetadataRPM (struct rpmpkginfo *pi)
 Store rpm package info into database. More...
 
char * ParseDebFile (char *Sin, char *Field, char *Value)
 Parse Debian binary control file with Field/Value pairs. More...
 
int GetMetadataDebBinary (long upload_pk, struct debpkginfo *pi)
 Get debian binary package info. More...
 
int RecordMetadataDEB (struct debpkginfo *pi)
 Store debian package info into database. More...
 
int GetMetadataDebSource (char *repFile, struct debpkginfo *pi)
 Get debian source package info from .dsc file. More...
 
void Usage (char *Name)
 Say how to run this program. More...
 

Variables

int Verbose = 0
 Verbose level. More...
 
PGconn * db_conn = NULL
 The connection to Database. More...
 
int tag [15]
 

Detailed Description

Local function of pkgagent.

The package metadata agent puts data about each package (rpm and deb) into the database.

Pkgagent get RPM package info from rpm files using rpm library, Build pkgagent.c need "rpm" and "librpm-dev", running binary just need "rpm".

Pkgagent get Debian binary package info from .deb binary control file.

Pkgagent get Debian source package info from .dsc file.

Definition in file pkgagent.c.

Function Documentation

◆ EscapeString()

void EscapeString ( char *  sourceString,
char *  escString,
int  esclen 
)

Escaping special characters(single quote)

Escaping special characters, so that they cannot cause any harm.

Parameters
[in]sourceStringThe source string need to escape
[out]escStringThe string after excape
[in]esclenThe string length need to escape

Definition at line 51 of file pkgagent.c.

◆ GetFieldValue()

char* GetFieldValue ( char *  Sin,
char *  Field,
int  FieldMax,
char *  Value,
int  ValueMax,
char  Separator 
)

Given a string that contains field='value' pairs, save the items.

Parameters
[in]SinString to parse
[out]FieldField string
[in]FieldMaxField capacity
[out]ValueValue string
[in]ValueMaxValue capacity
[in]SeparatorSeparator to use
Returns
pointer to start of next field, or NULL at \0.

Definition at line 101 of file pkgagent.c.

◆ GetMetadata()

int GetMetadata ( char *  pkg,
struct rpmpkginfo pi 
)

Get RPM package info.

Parameters
pkgPath of repo pfile
[out]pirpmpkginfo global pointer
Returns
0 on OK, -1 on failure.

Definition at line 505 of file pkgagent.c.

◆ GetMetadataDebBinary()

int GetMetadataDebBinary ( long  upload_pk,
struct debpkginfo pi 
)

Get debian binary package info.

Parameters
upload_pkthe upload_pk
pithe global pointor of debpkginfo
Returns
0 on OK, -1 on failure.

Definition at line 670 of file pkgagent.c.

◆ GetMetadataDebSource()

int GetMetadataDebSource ( char *  repFile,
struct debpkginfo pi 
)

Get debian source package info from .dsc file.

Parameters
repFilethe pfile path name
[out]pithe global pointor of debpkginfo
Returns
0 on OK, -1 on failure.
Todo:
Check if file is really Debian source

Definition at line 892 of file pkgagent.c.

◆ ParseDebFile()

char* ParseDebFile ( char *  Sin,
char *  Field,
char *  Value 
)

Parse Debian binary control file with Field/Value pairs.

Parameters
Sinthe string to parse
[out]Fieldthe Field part of pairs
[out]Valuethe Value part of pairs
Returns
the string after parse

Definition at line 629 of file pkgagent.c.

◆ ProcessUpload()

int ProcessUpload ( long  upload_pk)

Get all pfile need to processed use upload_pk.

Parameters
upload_pkThe upload_pk send from scheduler
Returns
0 on OK, -1 on failure.

Definition at line 162 of file pkgagent.c.

◆ ReadHeaderInfo()

void ReadHeaderInfo ( Header  header,
struct rpmpkginfo pi 
)

Get RPM package info from rpm file header use rpm library.

Parameters
headerrpm header
[out]pirpmpkginfo global pointer

Definition at line 402 of file pkgagent.c.

◆ RecordMetadataDEB()

int RecordMetadataDEB ( struct debpkginfo pi)

Store debian package info into database.

Parameters
pithe global pointor of debpkginfo
Returns
0 on OK, -1 on failure.

Definition at line 818 of file pkgagent.c.

◆ RecordMetadataRPM()

int RecordMetadataRPM ( struct rpmpkginfo pi)

Store rpm package info into database.

Parameters
pi
Returns
0 on OK, -1 on failure.

Definition at line 563 of file pkgagent.c.

◆ Usage()

void Usage ( char *  Name)

Say how to run this program.

Print usage of bucket agent

Parameters
NameAbsolute path of agent

Many agents permit running from the command-line for testing. At minimum, you need "-i" to initialize the DB and exit.

Say how to run this program.

Parameters
Name- the name of the executable, usually it is mimetype

Say how to run this program.

Parameters
NamePath to nomos binary

Definition at line 980 of file pkgagent.c.

Variable Documentation

◆ db_conn

PGconn* db_conn = NULL

The connection to Database.

the connection to Database

Definition at line 22 of file pkgagent.c.

◆ tag

int tag[15]
Initial value:
= { RPMTAG_NAME,
RPMTAG_EPOCH,
RPMTAG_ARCH,
RPMTAG_VERSION,
RPMTAG_LICENSE,
RPMTAG_GROUP,
RPMTAG_PACKAGER,
RPMTAG_RELEASE,
RPMTAG_BUILDTIME,
RPMTAG_VENDOR,
RPMTAG_URL,
RPMTAG_SOURCERPM,
RPMTAG_SUMMARY,
RPMTAG_DESCRIPTION,
RPMTAG_REQUIRENAME
}

Array of RPMTAG

Definition at line 25 of file pkgagent.c.

◆ Verbose

int Verbose = 0

Verbose level.

Global verbose level.

Contains all the functions supported by delagent

Verbosity level

Definition at line 21 of file pkgagent.c.