FOSSology  4.4.0
Open Source License Compliance by Open Source Software
pkgagent.h
Go to the documentation of this file.
1 /*
2  SPDX-FileCopyrightText: © 2010-2011 Hewlett-Packard Development Company, L.P.
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
10 #ifndef _PKGAGENT_H
11 #define _PKGAGENT_H 1
12 
13 #include <stdlib.h>
14 #include <stdio.h>
15 #include <string.h>
16 #include <ctype.h>
17 #include <signal.h>
18 #include <libgen.h>
19 #include <time.h>
20 
21 #include <sys/wait.h>
22 
23 #include "rpm/rpmlib.h"
24 #include "rpm/rpmts.h"
25 #include "rpm/rpmlog.h"
26 #include "rpm/rpmmacro.h"
27 
28 #include <libfossology.h>
29 
30 #define MAXCMD 5000
31 #define MAXLENGTH 256
32 
37 struct rpmpkginfo
38 {
39  char pkgName[256];
40  char pkgAlias[256];
41  char pkgArch[64];
42  char version[64];
43  char rpmFilename[256];
44  char license[512];
45  char group[128];
46  char packager[1024];
47  char release[64];
48  char buildDate[128];
49  char vendor[128];
50  char url[256];
51  char sourceRPM[256];
52  char summary[MAXCMD];
53  char description[MAXCMD];
54  long pFileFk;
55  char pFile[MAXCMD];
56  char **requires;
57  int req_size;
58 };
59 
64 struct debpkginfo
65 {
66  char pkgName[MAXCMD];
67  char source[MAXCMD];
68  char version[MAXCMD];
69  char section[MAXCMD];
70  char priority[MAXCMD];
71  char pkgArch[MAXCMD];
73  char maintainer[MAXCMD];
74  char homepage[MAXCMD];
75  char summary[MAXCMD];
76  char description[MAXCMD];
77  long pFileFk;
78  char pFile[MAXCMD];
79  char **depends;
80  int dep_size;
81  char uploaders[MAXCMD];
82  char format[MAXCMD];
83  char standardsVersion[MAXCMD];
84 };
85 
86 extern int Verbose;
87 extern PGconn* db_conn;
88 
89 int ProcessUpload(long upload_pk);
90 
91 int GetMetadata(char *pkg, struct rpmpkginfo *pi);
92 
93 int RecordMetadataRPM(struct rpmpkginfo *pi);
94 
95 int GetMetadataDebBinary(long upload_pk, struct debpkginfo *pi);
96 
97 int RecordMetadataDEB(struct debpkginfo *pi);
98 
99 int GetMetadataDebSource(char *repFile, struct debpkginfo *pi);
100 
101 void Usage(char *Name);
102 
103 char *GetFieldValue(char *Sin, char *Field, int FieldMax,char *Value, int ValueMax, char Separator);
104 #endif /* _PKGAGENT_H */
The main FOSSology C library.
void Usage(char *Name)
Say how to run this program.
Definition: adj2nest.c:561
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.
Definition: pkgagent.c:101
int GetMetadata(char *pkg, struct rpmpkginfo *pi)
Get RPM package info.
Definition: pkgagent.c:505
int GetMetadataDebSource(char *repFile, struct debpkginfo *pi)
Get debian source package info from .dsc file.
Definition: pkgagent.c:892
int ProcessUpload(long upload_pk)
Get all pfile need to processed use upload_pk.
Definition: pkgagent.c:162
PGconn * db_conn
the connection to Database
Definition: pkgagent.c:22
int RecordMetadataDEB(struct debpkginfo *pi)
Store debian package info into database.
Definition: pkgagent.c:818
int Verbose
Verbose level.
Definition: util.c:19
int RecordMetadataRPM(struct rpmpkginfo *pi)
Store rpm package info into database.
Definition: pkgagent.c:563
int GetMetadataDebBinary(long upload_pk, struct debpkginfo *pi)
Get debian binary package info.
Definition: pkgagent.c:670
const char * upload_pk
Definition: sqlstatements.h:82
Holds meta info of Debian packages.
Definition: pkgagent.h:65
char section[MAXCMD]
Package section.
Definition: pkgagent.h:69
char priority[MAXCMD]
Package priority.
Definition: pkgagent.h:70
char standardsVersion[MAXCMD]
Package standards version.
Definition: pkgagent.h:83
long pFileFk
Package pfile in FOSSology.
Definition: pkgagent.h:77
char ** depends
Package dependency list.
Definition: pkgagent.h:79
char summary[MAXCMD]
Package summary.
Definition: pkgagent.h:75
char pFile[MAXCMD]
Package pfile hash.
Definition: pkgagent.h:78
char version[MAXCMD]
Package version.
Definition: pkgagent.h:68
char format[MAXCMD]
Package format.
Definition: pkgagent.h:82
char uploaders[MAXCMD]
Package contributors.
Definition: pkgagent.h:81
char maintainer[MAXCMD]
Package maintainer.
Definition: pkgagent.h:73
int installedSize
Size of package after install.
Definition: pkgagent.h:72
char pkgArch[MAXCMD]
Package architecture.
Definition: pkgagent.h:71
char description[MAXCMD]
Package description.
Definition: pkgagent.h:76
int dep_size
Package dependency list size.
Definition: pkgagent.h:80
char source[MAXCMD]
Package source.
Definition: pkgagent.h:67
char pkgName[MAXCMD]
Package name.
Definition: pkgagent.h:66
char homepage[MAXCMD]
Package link.
Definition: pkgagent.h:74
Definition: nomos.h:426
Holds meta info of rpm packages.
Definition: pkgagent.h:38
char buildDate[128]
Package build date.
Definition: pkgagent.h:48
char pFile[MAXCMD]
Package pfile hash.
Definition: pkgagent.h:55
char group[128]
Package group.
Definition: pkgagent.h:45
char version[64]
Package version.
Definition: pkgagent.h:42
char summary[MAXCMD]
Package summary.
Definition: pkgagent.h:52
char pkgName[256]
RPM package name.
Definition: pkgagent.h:39
char description[MAXCMD]
Package description.
Definition: pkgagent.h:53
char rpmFilename[256]
RPM file name.
Definition: pkgagent.h:43
char pkgArch[64]
Package architecture.
Definition: pkgagent.h:41
char sourceRPM[256]
Package source.
Definition: pkgagent.h:51
int req_size
Package dependency list size.
Definition: pkgagent.h:57
char pkgAlias[256]
Package alias.
Definition: pkgagent.h:40
char url[256]
Package link.
Definition: pkgagent.h:50
long pFileFk
Package pfile in FOSSology.
Definition: pkgagent.h:54
char release[64]
Package release.
Definition: pkgagent.h:47
char packager[1024]
Packager.
Definition: pkgagent.h:46
char ** requires
Package dependency list.
Definition: pkgagent.h:56
char vendor[128]
Package vendor.
Definition: pkgagent.h:49