FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
Miscellaneous utility functions for maintagent. More...
#include "maintagent.h"
Go to the source code of this file.
Functions | |
FUNCTION void | exitNow (int exitVal) |
Exit function. This does all cleanup and should be used instead of calling exit() or main() return. More... | |
FUNCTION char * | strtoupper (char *s) |
Helper function to upper case a string. More... | |
FUNCTION void | recurseDir (const char *type, char *path, int level) |
Recursively read directory till level is 0. More... | |
FUNCTION void | checkPFileExists (char *sha1, char *md5, long fsize, const char *type) |
Check if given checksums exists in DB, if not call deleteRepoFile() More... | |
FUNCTION void | deleteRepoFile (char *sha1, char *md5, long fsize, const char *type) |
Take a file checksum, generate repo path and call unlink() More... | |
Miscellaneous utility functions for maintagent.
Definition in file utils.c.
FUNCTION void checkPFileExists | ( | char * | sha1, |
char * | md5, | ||
long | fsize, | ||
const char * | type | ||
) |
Check if given checksums exists in DB, if not call deleteRepoFile()
sha1 | SHA1 of the file |
md5 | MD5 of the file |
fsize | size of the file |
type | Type of file |
FUNCTION void deleteRepoFile | ( | char * | sha1, |
char * | md5, | ||
long | fsize, | ||
const char * | type | ||
) |
Take a file checksum, generate repo path and call unlink()
sha1 | SHA1 of the file |
md5 | MD5 of the file |
fsize | size of the file |
type | Type of file (gold/files) |
FUNCTION void exitNow | ( | int | exitVal | ) |
FUNCTION void recurseDir | ( | const char * | type, |
char * | path, | ||
int | level | ||
) |
Recursively read directory till level is 0.
Since files in repository are stored in following format, we need to iterate on path for 3 levels before we reach a file.
* /srv/fossology/repository/localhost/gold * ├── fc * │ └── 49 * │ └── 77 * │ └── fc49776c2a..... < the actual file *
The function will iteratively go to deper level till it reaches level 0, i.e. the file level. Once at file level, will call checkPFileExists() with individual pfile elements.
type | Type of repo file (gold/files) |
path | Root of path to traverse |
level | How many more levels to go (0 if we've reached file level) |