Skip to content

Commit

Permalink
Merge 1e5d561 into 1423135
Browse files Browse the repository at this point in the history
  • Loading branch information
GMishx committed Jun 7, 2018
2 parents 1423135 + 1e5d561 commit 9a0982f
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 43 deletions.
2 changes: 1 addition & 1 deletion debian/control
Expand Up @@ -62,7 +62,7 @@ Description: architecture for analyzing software, web interface

Package: fossology-scheduler
Architecture: any
Depends: fossology-common, ${shlibs:Depends}, ${misc:Depends}, heirloom-mailx
Depends: fossology-common, ${shlibs:Depends}, ${misc:Depends}, heirloom-mailx | s-nail
Conflicts: fossology-scheduler-single
Description: architecture for analyzing software, scheduler
The FOSSology project is a web based framework that allows you to
Expand Down
2 changes: 1 addition & 1 deletion src/nomos/agent/DMalloc.c
Expand Up @@ -309,7 +309,7 @@ DMnotfreed()
*/
DMtrigger()
{
int i;
int i = 0;
i++;
}

6 changes: 4 additions & 2 deletions src/nomos/agent/licenses.c
Expand Up @@ -568,13 +568,15 @@ char* createRelativePath(item_t *p, scanres_t *scp)
char* cp;
if (*(p->str) == '/')
{
(void) strcpy(scp->fullpath, p->str);
strcpy(scp->fullpath, p->str);
scp->nameOffset = (size_t) (cur.targetLen + 1);
cp = scp->fullpath; /* full pathname */
}
else
{
(void) sprintf(scp->fullpath, "%s/%s", cur.cwd, p->str);
strncpy(scp->fullpath, cur.cwd, sizeof(scp->fullpath)-1);
strncat(scp->fullpath, "/", sizeof(scp->fullpath)-1);
strncat(scp->fullpath, p->str, sizeof(scp->fullpath)-1);
scp->nameOffset = (size_t) (cur.cwdLen + 1);
cp = p->str; /* relative path == faster open() */
}
Expand Down
2 changes: 1 addition & 1 deletion src/nomos/agent/nomos_utils.c
Expand Up @@ -483,7 +483,7 @@ FUNCTION void parseLicenseList()
}

/* check for a single name FIX THIS!*/
if (strstr(cur.compLic, ",") == NULL_CHAR)
if (strstr(cur.compLic, ",") == NULL)
{
cur.licenseList[0] = cur.compLic;
cur.licenseList[1] = NULL;
Expand Down
3 changes: 2 additions & 1 deletion src/nomos/agent/util.c
Expand Up @@ -908,7 +908,8 @@ void printRegexMatch(int n, int cached)
#endif /* PROC_TRACE */

if (*debugStr == NULL_CHAR) {
(void) sprintf(debugStr, "%s/Nomos.strings.txt", gl.initwd);
strncpy(debugStr, gl.initwd, sizeof(debugStr)-1);
strncat(debugStr, "/Nomos.strings.txt", sizeof(debugStr)-1);
#ifdef DEBUG
printf("File: %s\n", debugStr);
#endif /* DEBUG */
Expand Down
11 changes: 8 additions & 3 deletions src/pkgagent/agent/Makefile
Expand Up @@ -27,6 +27,7 @@ LDFLAGS_LOCAL = $(FO_LDFLAGS) -lpq -lrpm -lrpmio
EXE = pkgagent
HDRS = pkgagent.h
CFLAGS_LOCAL_RPM_4_4 = $(CFLAGS_LOCAL) -D_RPM_4_4
CFLAGS_LOCAL_RPM_4_14 = $(CFLAGS_LOCAL) -D_RPM_4_14
CFLAGS_LOCAL_RPM = $(CFLAGS_LOCAL) -D_RPM_4_4_COMPAT

all: $(EXE)
Expand All @@ -35,13 +36,17 @@ $(EXE): main.c $(FOLIB) pkgagent.o $(VARS) $(HDRS)
$(CC) main.c pkgagent.o $(LDFLAGS_LOCAL) $(CFLAGS_LOCAL) $(DEFS) -o $@

pkgagent.o: pkgagent.c pkgagent.h
if expr `rpm --version|awk '{print $$3}'|awk -F. '{print $$1"."$$2}'` \>= 4.5 >/dev/null; then \
$(CC) -c $< $(CFLAGS_LOCAL_RPM); \
if expr `rpm --version|awk '{print $$3}'|awk -F. '{print $$1"."$$2}'` \>= 4.14 >/dev/null; then \
$(CC) -c $< $(CFLAGS_LOCAL_RPM_4_14); \
else \
if expr `rpm --version|awk '{print $$3}'|awk -F. '{print $$1"."$$2}'` \>= 4.10 >/dev/null; then \
$(CC) -c $< $(CFLAGS_LOCAL_RPM); \
else \
$(CC) -c $< $(CFLAGS_LOCAL_RPM_4_4); \
if expr `rpm --version|awk '{print $$3}'|awk -F. '{print $$1"."$$2}'` \>= 4.5 >/dev/null; then \
$(CC) -c $< $(CFLAGS_LOCAL_RPM); \
else \
$(CC) -c $< $(CFLAGS_LOCAL_RPM_4_4); \
fi \
fi \
fi

Expand Down
20 changes: 16 additions & 4 deletions src/pkgagent/agent/pkgagent.c
Expand Up @@ -431,24 +431,36 @@ void ReadHeaderInfo(Header header, struct rpmpkginfo *pi)

#ifdef _RPM_4_4
void* pointer;
int_32 type, data_size;
gint32 type, data_size;
#endif /* RPM4.4 version*/

#ifdef _RPM_4_4_COMPAT
#if defined(_RPM_4_4_COMPAT) || defined(_RPM_4_14)
struct rpmtd_s req;
rpm_count_t data_size;
#endif /* After RPM4.4 version*/

for (i = 0; i < 14; i++) {
memset(fmt, 0, sizeof(fmt));
strcat( fmt, "%{");
#ifdef _RPM_4_14
strcat( fmt, rpmTagGetName(tag[i]));
#else
strcat( fmt, tagName(tag[i]));
#endif
strcat( fmt, "}\n");

msgstr = headerSprintf(header, fmt, rpmTagTable, rpmHeaderFormats, &errstr);
#ifdef _RPM_4_14
msgstr = headerFormat(header, fmt, &errstr);
#else
msgstr = headerSprintf(header, fmt, NULL, NULL, &errstr);
#endif
if (msgstr != NULL){
trim(msgstr);
#ifdef _RPM_4_14
printf("%s:%s\n",rpmTagGetName(tag[i]),msgstr);
#else
printf("%s:%s\n",tagName(tag[i]),msgstr);
#endif
switch (tag[i]) {
case RPMTAG_NAME:
EscapeString(msgstr, pi->pkgName, sizeof(pi->pkgName));
Expand Down Expand Up @@ -510,7 +522,7 @@ void ReadHeaderInfo(Header header, struct rpmpkginfo *pi)
}
}
#endif/* RPM4.4 version*/
#ifdef _RPM_4_4_COMPAT
#if defined(_RPM_4_4_COMPAT) || defined(_RPM_4_14)
header_status = headerGet(header, tag[14], &req, HEADERGET_DEFAULT);
if (header_status) {
data_size = rpmtdCount(&req);
Expand Down
11 changes: 8 additions & 3 deletions src/pkgagent/agent_tests/Unit/Makefile
Expand Up @@ -16,6 +16,7 @@ LDFLAGS_LOCAL = -lrpm $(FO_LDFLAGS) -lcunit $(CUNIT_LIB) $(TEST_LIB) -lrpmio
EXE = test_pkgagent
CFLAGS_LOCAL_RPM_4_4 = $(CFLAGS_LOCAL) -D_RPM_4_4
CFLAGS_LOCAL_RPM = $(CFLAGS_LOCAL) -D_RPM_4_4_COMPAT
CFLAGS_LOCAL_RPM_4_14 = $(CFLAGS_LOCAL) -D_RPM_4_14
TEST_OBJ = testRun.o testGetFieldValue.o testRecordMetadataRPM.o testRecordMetadataDEB.o testGetMetadataDebSource.o testGetMetadataDebBinary.o

all: $(EXE)
Expand All @@ -36,13 +37,17 @@ $(TEST_OBJ): %.o: %.c
$(CC) -c $(CFLAGS_LOCAL) $<

testGetMetadata.o: testGetMetadata.c
if expr `rpm --version|awk '{print $$3}'|awk -F. '{print $$1"."$$2}'` \>= 4.5 >/dev/null; then \
$(CC) -c $< $(CFLAGS_LOCAL_RPM); \
if expr `rpm --version|awk '{print $$3}'|awk -F. '{print $$1"."$$2}'` \>= 4.14 >/dev/null; then \
$(CC) -c $< $(CFLAGS_LOCAL_RPM_4_14); \
else \
if expr `rpm --version|awk '{print $$3}'|awk -F. '{print $$1"."$$2}'` \>= 4.10 >/dev/null; then \
$(CC) -c $< $(CFLAGS_LOCAL_RPM); \
else \
$(CC) -c $< $(CFLAGS_LOCAL_RPM_4_4); \
if expr `rpm --version|awk '{print $$3}'|awk -F. '{print $$1"."$$2}'` \>= 4.5 >/dev/null; then \
$(CC) -c $< $(CFLAGS_LOCAL_RPM); \
else \
$(CC) -c $< $(CFLAGS_LOCAL_RPM_4_4); \
fi \
fi \
fi

Expand Down
6 changes: 3 additions & 3 deletions src/pkgagent/agent_tests/Unit/testGetMetadata.c
Expand Up @@ -54,7 +54,7 @@ void test_GetMetadata_normal()
CU_ASSERT_STRING_EQUAL(pi->sourceRPM, "fossology-1.2.0-1.el5.src.rpm");
CU_ASSERT_EQUAL(pi->req_size, 44);
PQfinish(db_conn);
#ifdef _RPM_4_4_COMPAT
#if defined(_RPM_4_4_COMPAT) || defined(_RPM_4_14)
rpmFreeCrypto();
/* free memroy */
int i;
Expand Down Expand Up @@ -85,7 +85,7 @@ void test_GetMetadata_wrong_testfile()
int Result = GetMetadata(pkg, pi);
//printf("test_GetMetadata Result is:%d\n", Result);
PQfinish(db_conn);
#ifdef _RPM_4_4_COMPAT
#if defined(_RPM_4_4_COMPAT) || defined(_RPM_4_14)
rpmFreeCrypto();
#endif /* After RPM4.4 version*/
rpmFreeMacros(NULL);
Expand All @@ -112,7 +112,7 @@ void test_GetMetadata_no_testfile()
int Result = GetMetadata(pkg, pi);
//printf("test_GetMetadata Result is:%d\n", Result);
PQfinish(db_conn);
#ifdef _RPM_4_4_COMPAT
#if defined(_RPM_4_4_COMPAT) || defined(_RPM_4_14)
rpmFreeCrypto();
/* free memroy */
int i;
Expand Down
4 changes: 2 additions & 2 deletions src/scheduler/agent/database.c
Expand Up @@ -614,8 +614,8 @@ static void email_notification(scheduler_t* scheduler, job_t* job)
void email_init(scheduler_t* scheduler)
{
int email_notify, fd;
struct stat header_sb;
struct stat footer_sb;
struct stat header_sb = {};
struct stat footer_sb = {};
gchar* fname;
GError* error = NULL;

Expand Down
32 changes: 10 additions & 22 deletions utils/fo-installdeps
Expand Up @@ -107,16 +107,12 @@ if [ $BUILDTIME ]; then
POSTGRE=`dpkg --get-selections|grep postgresql-server-dev`
if [ -z "$POSTGRE" ]; then ## if postgresql-server-dev is installed
case "$CODENAME" in
lenny|hardy) apt-get $YesOpt install $YesOpt postgresql-server-dev-8.3;;
squeeze) apt-get $YesOpt install $YesOpt postgresql-server-dev-8.4;;
wheezy) apt-get $YesOpt install $YesOpt postgresql-server-dev-9.1;;
lucid|natty) apt-get $YesOpt install postgresql-server-dev-8.4;;
isadora) apt-get $YesOpt install postgresql-server-dev-8.4;;
precise|oneiric|quantal|raring|saucy) apt-get $YesOpt install postgresql-server-dev-9.1;;
trusty) apt-get $YesOpt install postgresql-server-dev-9.3;;
jessie) apt-get $YesOpt install postgresql-server-dev-9.4;;
xenial|yakkety) apt-get $YesOpt install postgresql-server-dev-9.5;;
xenial) apt-get $YesOpt install postgresql-server-dev-9.5;;
stretch|buster|sid|zesty|artful) apt-get $YesOpt install postgresql-server-dev-9.6;;
bionic) apt-get $YesOpt install postgresql-server-dev-10;;
*) echo "ERROR: Unknown or Unsupported $DISTRO release, please report to the mailing list"; exit 1;;
esac
fi
Expand Down Expand Up @@ -173,28 +169,20 @@ if [ $RUNTIME ]; then
poppler-utils upx-ucl \
unrar-free unzip p7zip-full p7zip wget \
subversion git \
dpkg-dev heirloom-mailx
dpkg-dev
POSTGRE=`dpkg --get-selections|grep postgresql-8.4`
if [ -z "$POSTGRE" ]; then ## if postgresql-server-dev is installed
case "$CODENAME" in
squeeze)
apt-get $YesOpt install postgresql-8.4 libapache2-mod-php5 php5 php5-pgsql php5-cli php5-curl;;
wheezy)
apt-get $YesOpt install postgresql-9.1 libapache2-mod-php5 php5 php5-pgsql php5-cli php5-curl;;
lucid|natty)
apt-get $YesOpt install postgresql-8.4 libapache2-mod-php5 php5 php5-pgsql php5-cli php5-curl;;
isadora)
apt-get $YesOpt install postgresql-8.4 libapache2-mod-php5 php5 php5-pgsql php5-cli php5-curl;;
precise|oneiric|quantal|raring|saucy)
apt-get $YesOpt install postgresql-9.1 libapache2-mod-php5 php5 php5-pgsql php5-cli php5-curl;;
trusty)
apt-get $YesOpt install postgresql-9.3 libapache2-mod-php5 php5 php5-pgsql php5-cli php5-curl;;
apt-get $YesOpt install postgresql-9.3 libapache2-mod-php5 php5 php5-pgsql php5-cli php5-curl heirloom-mailx;;
jessie)
apt-get $YesOpt install postgresql-9.4 libapache2-mod-php5 php5 php5-pgsql php5-cli php5-curl;;
xenial|yakkety)
apt-get $YesOpt install postgresql-9.5 php7.0 libapache2-mod-php7.0 php7.0-pgsql php7.0-cli php7.0-curl php7.0-zip;;
apt-get $YesOpt install postgresql-9.4 libapache2-mod-php5 php5 php5-pgsql php5-cli php5-curl heirloom-mailx;;
xenial)
apt-get $YesOpt install postgresql-9.5 php7.0 libapache2-mod-php7.0 php7.0-pgsql php7.0-cli php7.0-curl php7.0-zip heirloom-mailx;;
stretch|buster|sid|zesty|artful)
apt-get $YesOpt install postgresql-9.6 php7.0 php7.0-pgsql php7.0-cli php7.0-curl php7.0-xml php7.0-zip;;
apt-get $YesOpt install postgresql-9.6 php7.0 php7.0-pgsql php7.0-cli php7.0-curl php7.0-xml php7.0-zip heirloom-mailx;;
bionic)
apt-get $YesOpt install postgresql-10 php7.2 php7.2-pgsql php7.2-cli php7.2-curl php7.2-xml php7.2-zip s-nail;;
*) echo "ERROR: Unknown or Unsupported $DISTRO release, please report to the mailing list"; exit 1;;
esac
fi
Expand Down

0 comments on commit 9a0982f

Please sign in to comment.