Switch to rpm 4 and cmake build tool
This commit is contained in:
parent
8083cad05b
commit
51cf5cacb6
5
.gitignore
vendored
5
.gitignore
vendored
@ -6,9 +6,8 @@ config.log
|
|||||||
config.status
|
config.status
|
||||||
configure
|
configure
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
src/include/config.h*
|
|
||||||
src/distromatic
|
src/distromatic
|
||||||
src/distroquery
|
src/distroquery
|
||||||
src/include/globaldefs.h
|
|
||||||
src/include/stamp-h1
|
src/include/stamp-h1
|
||||||
src/.deps
|
src/.deps
|
||||||
|
build/
|
7
CMakeLists.txt
Normal file
7
CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
project(distromatic)
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.10.0 FATAL_ERROR)
|
||||||
|
|
||||||
|
set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
|
||||||
|
|
||||||
|
add_subdirectory(src)
|
65
src/CMakeLists.txt
Normal file
65
src/CMakeLists.txt
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
find_package(PkgConfig)
|
||||||
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
pkg_check_modules(RPM REQUIRED rpm)
|
||||||
|
pkg_check_modules(SQLITE3 REQUIRED sqlite3)
|
||||||
|
find_library(LIBIBERTY NAMES iberty)
|
||||||
|
|
||||||
|
include_directories(include)
|
||||||
|
|
||||||
|
string(REPLACE "." ";" VERSION_LIST ${RPM_VERSION})
|
||||||
|
list(GET VERSION_LIST 0 RPM_VERSION_MAJOR)
|
||||||
|
list(GET VERSION_LIST 1 RPM_VERSION_MINOR)
|
||||||
|
list(GET VERSION_LIST 2 RPM_VERSION_MICRO)
|
||||||
|
|
||||||
|
add_compile_definitions(
|
||||||
|
PACKAGE="Distromatic"
|
||||||
|
PACKAGE_VERSION="1.5.0"
|
||||||
|
DEFAULT_CONFIGFILE="/etc/distromatic.conf"
|
||||||
|
off64_t=__off64_t
|
||||||
|
RPM_VERSION_MAJOR=${RPM_VERSION_MAJOR}
|
||||||
|
RPM_VERSION_MINOR=${RPM_VERSION_MINOR}
|
||||||
|
RPM_VERSION_MICRO=${RPM_VERSION_MICRO}
|
||||||
|
LOCALEDIR="${LOCALEDIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(distromatic
|
||||||
|
buildtools.c
|
||||||
|
changelog.c
|
||||||
|
distromatic.c
|
||||||
|
functions.c
|
||||||
|
reports.c
|
||||||
|
headerlist.c
|
||||||
|
requirelist.c
|
||||||
|
rpmfunctions.c
|
||||||
|
backend-sqlite3.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(distromatic
|
||||||
|
Threads::Threads
|
||||||
|
${RPM_LIBRARIES}
|
||||||
|
${ZLIB_LIBRARIES}
|
||||||
|
${SQLITE3_LIBRARIES}
|
||||||
|
${LIBIBERTY}
|
||||||
|
)
|
||||||
|
target_include_directories(distromatic PUBLIC ${RPM_INCLUDE_DIRS})
|
||||||
|
target_compile_options(distromatic PUBLIC ${RPM_CFLAGS_OTHER})
|
||||||
|
|
||||||
|
add_executable(distroquery
|
||||||
|
distroquery.c
|
||||||
|
functions.c
|
||||||
|
headerlist.c
|
||||||
|
requirelist.c
|
||||||
|
rpmfunctions.c
|
||||||
|
changelog.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(distroquery
|
||||||
|
Threads::Threads
|
||||||
|
${RPM_LIBRARIES}
|
||||||
|
${ZLIB_LIBRARIES}
|
||||||
|
${SQLITE3_LIBRARIES}
|
||||||
|
${LIBIBERTY}
|
||||||
|
)
|
||||||
|
target_include_directories(distroquery PUBLIC ${RPM_INCLUDE_DIRS})
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2015 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2013-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
* the terms of version 2 of the GNU General Public License as published by the
|
* the terms of version 2 of the GNU General Public License as published by the
|
||||||
@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
#include "config.h"
|
|
||||||
#include "headerlist.h"
|
#include "headerlist.h"
|
||||||
#include "changelog.h"
|
#include "changelog.h"
|
||||||
#include "backend-sqlite3.h"
|
#include "backend-sqlite3.h"
|
||||||
@ -56,7 +55,7 @@ int SQLite_begin_transaction(sqlite3 *db) {
|
|||||||
|
|
||||||
int SQLite_commit_transaction(sqlite3 *db) {
|
int SQLite_commit_transaction(sqlite3 *db) {
|
||||||
if (sqlite3_exec(db, "COMMIT;", 0, 0, 0)) {
|
if (sqlite3_exec(db, "COMMIT;", 0, 0, 0)) {
|
||||||
fprintf(stderr, "ERROR: SQLite: (COMMIT) %s\n", sqlite3_errmsg(db));
|
fprintf(stderr, "ERROR: SQLite: (COMMIT) %s\n", sqlite3_errmsg(db));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
sqlite3_transaction_size = 0;
|
sqlite3_transaction_size = 0;
|
||||||
@ -64,8 +63,8 @@ int SQLite_commit_transaction(sqlite3 *db) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int SQLite_print_contents_subtree(sqlite3 *db,
|
int SQLite_print_contents_subtree(sqlite3 *db,
|
||||||
struct fileTree* ft,
|
struct fileTree* ft,
|
||||||
struct configTag* ct,
|
struct configTag* ct,
|
||||||
int arch) {
|
int arch) {
|
||||||
|
|
||||||
int thisrep, i;
|
int thisrep, i;
|
||||||
@ -268,7 +267,7 @@ int generateSQLite_packagers(sqlite3 *db) {
|
|||||||
packager->packages_count);
|
packager->packages_count);
|
||||||
|
|
||||||
if (sqlite3_prepare_v2(db, sqlite3_query, -1, &stmt, NULL)) {
|
if (sqlite3_prepare_v2(db, sqlite3_query, -1, &stmt, NULL)) {
|
||||||
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
|
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
|
||||||
}
|
}
|
||||||
sqlite3_bind_text(stmt, 1, packager->name, -1, SQLITE_STATIC);
|
sqlite3_bind_text(stmt, 1, packager->name, -1, SQLITE_STATIC);
|
||||||
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
||||||
@ -295,7 +294,7 @@ long generateSQLite_add_changelog(sqlite3 *db, struct changeLog* firstchangelog,
|
|||||||
changelog->pkg->id);
|
changelog->pkg->id);
|
||||||
|
|
||||||
if (sqlite3_prepare_v2(db, sqlite3_query, -1, &stmt, NULL)) {
|
if (sqlite3_prepare_v2(db, sqlite3_query, -1, &stmt, NULL)) {
|
||||||
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
|
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
|
||||||
}
|
}
|
||||||
sqlite3_bind_text(stmt, 1, changelog->release, -1, SQLITE_STATIC);
|
sqlite3_bind_text(stmt, 1, changelog->release, -1, SQLITE_STATIC);
|
||||||
sqlite3_bind_text(stmt, 2, changelog->text, -1, SQLITE_STATIC);
|
sqlite3_bind_text(stmt, 2, changelog->text, -1, SQLITE_STATIC);
|
||||||
@ -468,7 +467,7 @@ generateSQLite_sources(struct configTag *ct, sqlite3 *db) {
|
|||||||
currsource->size,
|
currsource->size,
|
||||||
(currsource->changelog?nextchangelogid:0));
|
(currsource->changelog?nextchangelogid:0));
|
||||||
if (sqlite3_prepare_v2(db, sqlite3_query, -1, &stmt, NULL)) {
|
if (sqlite3_prepare_v2(db, sqlite3_query, -1, &stmt, NULL)) {
|
||||||
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
|
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3_bind_text(stmt, 1, currsource->name, -1, SQLITE_STATIC);
|
sqlite3_bind_text(stmt, 1, currsource->name, -1, SQLITE_STATIC);
|
||||||
@ -518,7 +517,7 @@ generateSQLite_sources(struct configTag *ct, sqlite3 *db) {
|
|||||||
currsource->id);
|
currsource->id);
|
||||||
|
|
||||||
if (sqlite3_prepare_v2(db, sqlite3_query, -1, &stmt, NULL)) {
|
if (sqlite3_prepare_v2(db, sqlite3_query, -1, &stmt, NULL)) {
|
||||||
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
|
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
|
||||||
}
|
}
|
||||||
sqlite3_bind_text(stmt, 1, currsource->patch[i], -1, SQLITE_STATIC);
|
sqlite3_bind_text(stmt, 1, currsource->patch[i], -1, SQLITE_STATIC);
|
||||||
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
||||||
@ -555,7 +554,7 @@ generateSQLite_sources(struct configTag *ct, sqlite3 *db) {
|
|||||||
currsource->required[i]->id);
|
currsource->required[i]->id);
|
||||||
|
|
||||||
if (sqlite3_prepare_v2(db, sqlite3_query, -1, &stmt, NULL)) {
|
if (sqlite3_prepare_v2(db, sqlite3_query, -1, &stmt, NULL)) {
|
||||||
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
|
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
|
||||||
}
|
}
|
||||||
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
||||||
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
|
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2006 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -18,10 +18,6 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_STRING_H
|
#if HAVE_STRING_H
|
||||||
# if !STDC_HEADERS && HAVE_MEMORY_H
|
# if !STDC_HEADERS && HAVE_MEMORY_H
|
||||||
# include <memory.h>
|
# include <memory.h>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -18,10 +18,6 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if TIME_WITH_SYS_TIME
|
#if TIME_WITH_SYS_TIME
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <time.h>
|
# include <time.h>
|
||||||
@ -44,6 +40,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "distromatic.h"
|
#include "distromatic.h"
|
||||||
|
#include "config.h"
|
||||||
#include "changelog.h"
|
#include "changelog.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
|
||||||
@ -85,7 +82,7 @@ getPackagerByName(char *name, int create)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!match) {
|
if (!match) {
|
||||||
lastpackager = currpackager;
|
lastpackager = currpackager;
|
||||||
currpackager = currpackager->next;
|
currpackager = currpackager->next;
|
||||||
@ -127,7 +124,7 @@ getPackageChangelog(Header h, struct headerSourceList* headersource)
|
|||||||
struct Packager *currpackager = NULL;
|
struct Packager *currpackager = NULL;
|
||||||
char **changelogtext, **changelogrelease;
|
char **changelogtext, **changelogrelease;
|
||||||
char *endp;
|
char *endp;
|
||||||
int_32 *changelogtime;
|
uint_32 *changelogtime;
|
||||||
char changelogname[255];
|
char changelogname[255];
|
||||||
|
|
||||||
changelogtime = headerGetUIntArrayEntry(h, RPMTAG_CHANGELOGTIME, &count);
|
changelogtime = headerGetUIntArrayEntry(h, RPMTAG_CHANGELOGTIME, &count);
|
||||||
@ -254,7 +251,7 @@ printChangelogSince(FILE *fout, struct configTag *ct,
|
|||||||
changeLogTimeStr(strdate, changelogfull->changelog));
|
changeLogTimeStr(strdate, changelogfull->changelog));
|
||||||
lasttime=changelogfull->changelog->time;
|
lasttime=changelogfull->changelog->time;
|
||||||
}
|
}
|
||||||
fprintf(fout,"<p><a href=\"%stag=%s&pkg=%s.source\">%s</a> %s - ",
|
fprintf(fout,"<p><a href=\"%stag=%s&pkg=%s.source\">%s</a> %s - ",
|
||||||
ct->configdefaults->url_prefix,
|
ct->configdefaults->url_prefix,
|
||||||
ct->tag,
|
ct->tag,
|
||||||
changelogfull->source->name,
|
changelogfull->source->name,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2015 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -18,8 +18,6 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
/* Tell glibc's <time.h> to provide a prototype for strptime() */
|
/* Tell glibc's <time.h> to provide a prototype for strptime() */
|
||||||
#ifndef __USE_XOPEN
|
#ifndef __USE_XOPEN
|
||||||
# define __USE_XOPEN
|
# define __USE_XOPEN
|
||||||
@ -114,8 +112,8 @@ int compareRequiredList(const void *ptr1, const void *ptr2);
|
|||||||
int handleObsoletedPackages(struct configTag *ct, int arch);
|
int handleObsoletedPackages(struct configTag *ct, int arch);
|
||||||
|
|
||||||
static const char *copyright[] = {
|
static const char *copyright[] = {
|
||||||
PROGRAMNAME " version " PROGRAMVERSION,
|
PACKAGE " version " PACKAGE_VERSION,
|
||||||
"Copyright (C) 2004-2015 by Silvan Calarco <silvan.calarco@mambasoft.it>",
|
"Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>",
|
||||||
"Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>",
|
"Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>",
|
||||||
(char *)0
|
(char *)0
|
||||||
};
|
};
|
||||||
@ -228,10 +226,10 @@ compareRequiredList(const void *ptr1, const void *ptr2)
|
|||||||
if (!require1 && !require2) return 0;
|
if (!require1 && !require2) return 0;
|
||||||
if (!require1 || !require1->name) return 1;
|
if (!require1 || !require1->name) return 1;
|
||||||
if (!require2 || !require2->name) return -1;
|
if (!require2 || !require2->name) return -1;
|
||||||
/* if (require1->resolved->numproviders != require2->resolved->numproviders)
|
/* if (require1->resolved->numproviders != require2->resolved->numproviders)
|
||||||
return require2->resolved->numproviders - require1->resolved->numproviders;
|
return require2->resolved->numproviders - require1->resolved->numproviders;
|
||||||
|
|
||||||
if (require1->resolved->numproviders == 1)
|
if (require1->resolved->numproviders == 1)
|
||||||
return strcmp(require1->resolved->provider[0]->name,require2->resolved->provider[0]->name);
|
return strcmp(require1->resolved->provider[0]->name,require2->resolved->provider[0]->name);
|
||||||
else*/
|
else*/
|
||||||
return strcmp(require1->name,require2->name);
|
return strcmp(require1->name,require2->name);
|
||||||
@ -371,7 +369,7 @@ handleObsoletedPackages(struct configTag *ct, int archidx)
|
|||||||
prov->provider[i]->arch,
|
prov->provider[i]->arch,
|
||||||
ct->repository[prov->provider[i]->altrepository]->tag);
|
ct->repository[prov->provider[i]->altrepository]->tag);
|
||||||
} else {
|
} else {
|
||||||
snprintf(buf, PATH_MAX, "%s(%s,%s) obsoletes %s provided by %s(%s,%s)",
|
snprintf(buf, PATH_MAX, "%s(%s,%s) obsoletes %s provided by %s(%s,%s)",
|
||||||
currheader->name,
|
currheader->name,
|
||||||
currheader->arch,
|
currheader->arch,
|
||||||
ct->repository[currheader->altrepository]->tag,
|
ct->repository[currheader->altrepository]->tag,
|
||||||
@ -590,7 +588,7 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (provided->numproviders > 0) {
|
if (provided->numproviders > 0) {
|
||||||
if (strcmp(currheader->require[i]->version,"") &&
|
if (strcmp(currheader->require[i]->version,"") &&
|
||||||
(currheader->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL))) {
|
(currheader->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL))) {
|
||||||
|
|
||||||
found = 0;
|
found = 0;
|
||||||
@ -663,7 +661,7 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
|
|||||||
ct->repository[currheader->altrepository]->tag);
|
ct->repository[currheader->altrepository]->tag);
|
||||||
logmsg(LOG_WARNING,"%s", warning);
|
logmsg(LOG_WARNING,"%s", warning);
|
||||||
for (k = 0; k < provided->numproviders; k++) {
|
for (k = 0; k < provided->numproviders; k++) {
|
||||||
if (provided->provider[k]->sourceheader &&
|
if (provided->provider[k]->sourceheader &&
|
||||||
(provided->provider[k]->altrepository == ct->repository_level)) {
|
(provided->provider[k]->altrepository == ct->repository_level)) {
|
||||||
addWarning(provided->provider[k]->sourceheader, warning);
|
addWarning(provided->provider[k]->sourceheader, warning);
|
||||||
}
|
}
|
||||||
@ -674,7 +672,7 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currheader->require[i]->resolved=provided;
|
currheader->require[i]->resolved=provided;
|
||||||
@ -721,7 +719,7 @@ resolveFirstLevelSourceDependencies(struct configTag *ct, int archidx)
|
|||||||
provided=findOrCreateProvidedListEntry((struct providedList**) &ct->providedlist_idx[archidx],
|
provided=findOrCreateProvidedListEntry((struct providedList**) &ct->providedlist_idx[archidx],
|
||||||
currsourceheader->require[i]->name,1,archidx);
|
currsourceheader->require[i]->name,1,archidx);
|
||||||
if (provided->numbuildproviders == 0) {
|
if (provided->numbuildproviders == 0) {
|
||||||
// check if require[i]->name requirement is met
|
// check if require[i]->name requirement is met
|
||||||
|
|
||||||
if ((currsourceheader->require[i]->name)[0] == '/') {
|
if ((currsourceheader->require[i]->name)[0] == '/') {
|
||||||
/* requirement is a file, find who provides it */
|
/* requirement is a file, find who provides it */
|
||||||
@ -768,7 +766,7 @@ resolveFirstLevelSourceDependencies(struct configTag *ct, int archidx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (provided->numbuildproviders > 0) {
|
if (provided->numbuildproviders > 0) {
|
||||||
if (strcmp(currsourceheader->require[i]->version,"") &&
|
if (strcmp(currsourceheader->require[i]->version,"") &&
|
||||||
(currsourceheader->require[i]->flags & (RPMSENSE_LESS+RPMSENSE_GREATER+RPMSENSE_EQUAL))) {
|
(currsourceheader->require[i]->flags & (RPMSENSE_LESS+RPMSENSE_GREATER+RPMSENSE_EQUAL))) {
|
||||||
found = 0;
|
found = 0;
|
||||||
for (j = 0; j < provided->numproviders; j++) {
|
for (j = 0; j < provided->numproviders; j++) {
|
||||||
@ -790,7 +788,7 @@ resolveFirstLevelSourceDependencies(struct configTag *ct, int archidx)
|
|||||||
if (currsourceheader->require[i]->flags & RPMSENSE_EQUAL) fprintf(stderr,"=");
|
if (currsourceheader->require[i]->flags & RPMSENSE_EQUAL) fprintf(stderr,"=");
|
||||||
fprintf(stderr," %s (failing build provider(s):", currsourceheader->require[i]->version);
|
fprintf(stderr," %s (failing build provider(s):", currsourceheader->require[i]->version);
|
||||||
for (j = 0; j < provided->numbuildproviders; j++) {
|
for (j = 0; j < provided->numbuildproviders; j++) {
|
||||||
fprintf(stderr," %s#%s",
|
fprintf(stderr," %s#%s",
|
||||||
provided->provider[j]->name, provided->buildprovider[j]->version);
|
provided->provider[j]->name, provided->buildprovider[j]->version);
|
||||||
/* printrpmversion(buffer,PATH_MAX,
|
/* printrpmversion(buffer,PATH_MAX,
|
||||||
provided->provider[j]->epoch,
|
provided->provider[j]->epoch,
|
||||||
@ -800,7 +798,7 @@ resolveFirstLevelSourceDependencies(struct configTag *ct, int archidx)
|
|||||||
fprintf(stderr,")\n");
|
fprintf(stderr,")\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currsourceheader->require[i]->resolved=provided;
|
currsourceheader->require[i]->resolved=provided;
|
||||||
@ -1174,7 +1172,7 @@ main(int argc, char *argv[])
|
|||||||
for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
|
for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
|
||||||
pthread_join(pth[i], NULL);
|
pthread_join(pth[i], NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!passed_arch) { // can't do missing builds and ports check in single arch mode
|
if (!passed_arch) { // can't do missing builds and ports check in single arch mode
|
||||||
if (!quietmode)
|
if (!quietmode)
|
||||||
fprintf(stdout, "Checking for SRPMS with no builds and missing ports...\n");
|
fprintf(stdout, "Checking for SRPMS with no builds and missing ports...\n");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* distroquery - tool for querying data generated by distromatic
|
* distroquery - tool for querying data generated by distromatic
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2015 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2013-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
* the terms of version 2 of the GNU General Public License as published by the
|
* the terms of version 2 of the GNU General Public License as published by the
|
||||||
@ -17,8 +17,6 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -36,6 +34,9 @@
|
|||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#if HAVE_STRING_H
|
#if HAVE_STRING_H
|
||||||
# if !STDC_HEADERS && HAVE_MEMORY_H
|
# if !STDC_HEADERS && HAVE_MEMORY_H
|
||||||
@ -73,6 +74,8 @@
|
|||||||
|
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
#include "distromatic.h"
|
#include "distromatic.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "rpmfunctions.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
|
||||||
// must be as big as ARCHS_MAX (5)
|
// must be as big as ARCHS_MAX (5)
|
||||||
@ -115,11 +118,11 @@ char to_hex(char code) {
|
|||||||
char *url_encode(char *str) {
|
char *url_encode(char *str) {
|
||||||
char *pstr = str, *buf = malloc(strlen(str) * 3 + 1), *pbuf = buf;
|
char *pstr = str, *buf = malloc(strlen(str) * 3 + 1), *pbuf = buf;
|
||||||
while (*pstr) {
|
while (*pstr) {
|
||||||
if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~')
|
if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~')
|
||||||
*pbuf++ = *pstr;
|
*pbuf++ = *pstr;
|
||||||
else if (*pstr == ' ')
|
else if (*pstr == ' ')
|
||||||
*pbuf++ = '+';
|
*pbuf++ = '+';
|
||||||
else
|
else
|
||||||
*pbuf++ = '%', *pbuf++ = to_hex(*pstr >> 4), *pbuf++ = to_hex(*pstr & 15);
|
*pbuf++ = '%', *pbuf++ = to_hex(*pstr >> 4), *pbuf++ = to_hex(*pstr & 15);
|
||||||
pstr++;
|
pstr++;
|
||||||
}
|
}
|
||||||
@ -138,7 +141,7 @@ char *url_decode(char *str) {
|
|||||||
*pbuf++ = from_hex(pstr[1]) << 4 | from_hex(pstr[2]);
|
*pbuf++ = from_hex(pstr[1]) << 4 | from_hex(pstr[2]);
|
||||||
pstr += 2;
|
pstr += 2;
|
||||||
}
|
}
|
||||||
} else if (*pstr == '+') {
|
} else if (*pstr == '+') {
|
||||||
*pbuf++ = ' ';
|
*pbuf++ = ' ';
|
||||||
} else {
|
} else {
|
||||||
*pbuf++ = *pstr;
|
*pbuf++ = *pstr;
|
||||||
@ -157,7 +160,7 @@ int sqlite3_find_column_id(sqlite3_stmt *stmt, const char* table, const char* na
|
|||||||
if (!strcmp(colname, name)) {
|
if (!strcmp(colname, name)) {
|
||||||
if (table) {
|
if (table) {
|
||||||
if (!strcmp(sqlite3_column_table_name(stmt, id), table)) return id;
|
if (!strcmp(sqlite3_column_table_name(stmt, id), table)) return id;
|
||||||
} else {
|
} else {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,7 +316,7 @@ void detachRepositoryDatabases(struct configTag* ct, sqlite3 *db, char* arch, in
|
|||||||
|
|
||||||
void printInputForm() {
|
void printInputForm() {
|
||||||
struct configTag *ct = firstconfigtag;
|
struct configTag *ct = firstconfigtag;
|
||||||
|
|
||||||
const char ajax_call[] = "distroquery_request("
|
const char ajax_call[] = "distroquery_request("
|
||||||
// "'repository='+getElementById('repository').value"
|
// "'repository='+getElementById('repository').value"
|
||||||
"'query='+getElementById('query').value+"
|
"'query='+getElementById('query').value+"
|
||||||
@ -467,7 +470,7 @@ void printFileBrowser() {
|
|||||||
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")));
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")));
|
||||||
} else {
|
} else {
|
||||||
printf("<tr><td style=\"font-family:courier\">%s</td><td style=\"font-family:courier\">%s</td>"
|
printf("<tr><td style=\"font-family:courier\">%s</td><td style=\"font-family:courier\">%s</td>"
|
||||||
"<td style=\"font-family:courier\">%s</td><td width=50%% style=\"font-family:courier\">%s</td>",
|
"<td style=\"font-family:courier\">%s</td><td width=50%% style=\"font-family:courier\">%s</td>",
|
||||||
sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "fileusers", "name")),
|
sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "fileusers", "name")),
|
||||||
sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "filegroups", "name")),
|
sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "filegroups", "name")),
|
||||||
expandFileFlags(flags, sql),
|
expandFileFlags(flags, sql),
|
||||||
@ -855,7 +858,7 @@ void printQueryResponse() {
|
|||||||
printf("%s '%s' :: %s", _("Search results for"), query, firstconfigtag->configdefaults->distribution_name);
|
printf("%s '%s' :: %s", _("Search results for"), query, firstconfigtag->configdefaults->distribution_name);
|
||||||
printf("]]></title>");
|
printf("]]></title>");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; query_repositories[i] != NULL; i++) {
|
for (i = 0; query_repositories[i] != NULL; i++) {
|
||||||
for (a = 0; a <= ARCHS_MAX && query_repositories[i]->arch[a]; a++) {
|
for (a = 0; a <= ARCHS_MAX && query_repositories[i]->arch[a]; a++) {
|
||||||
if (query_repositories[i]->db[a]) {
|
if (query_repositories[i]->db[a]) {
|
||||||
@ -1321,7 +1324,7 @@ void printPackageData() {
|
|||||||
" packages_files_rel.id_group=filegroups.id", query_package);
|
" packages_files_rel.id_group=filegroups.id", query_package);
|
||||||
if (sqlite3_prepare_v2(dbf, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
if (sqlite3_prepare_v2(dbf, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
||||||
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
||||||
printf("<tr><td style=\"font-family:courier\">%s</td><td style=\"font-family:courier\">%s</td><td style=\"font-family:courier\">%s</td><td>%s</td></tr>",
|
printf("<tr><td style=\"font-family:courier\">%s</td><td style=\"font-family:courier\">%s</td><td style=\"font-family:courier\">%s</td><td>%s</td></tr>",
|
||||||
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "fileusers", "name")),
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "fileusers", "name")),
|
||||||
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "filegroups", "name")),
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "filegroups", "name")),
|
||||||
expandFileFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "flags")), sql),
|
expandFileFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "flags")), sql),
|
||||||
@ -1659,7 +1662,7 @@ main(int argc, char *argv[])
|
|||||||
} else if (query_path) {
|
} else if (query_path) {
|
||||||
printFileBrowser();
|
printFileBrowser();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!responsed || (responsed && searchbox)) printInputForm();
|
if (!responsed || (responsed && searchbox)) printInputForm();
|
||||||
|
|
||||||
if (!reply_plain) printf("</distroquery>\n");
|
if (!reply_plain) printf("</distroquery>\n");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -18,10 +18,6 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if STDC_HEADERS
|
#if STDC_HEADERS
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
@ -50,10 +46,6 @@
|
|||||||
# include <libiberty.h>
|
# include <libiberty.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FUNCTIONS_H
|
|
||||||
# include "functions.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Tell glibc's <time.h> to provide a prototype for strptime() */
|
/* Tell glibc's <time.h> to provide a prototype for strptime() */
|
||||||
#ifndef __USE_XOPEN
|
#ifndef __USE_XOPEN
|
||||||
# define __USE_XOPEN
|
# define __USE_XOPEN
|
||||||
@ -70,8 +62,9 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "functions.h"
|
|
||||||
#include "distromatic.h"
|
#include "distromatic.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "functions.h"
|
||||||
#include "changelog.h"
|
#include "changelog.h"
|
||||||
|
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
@ -496,22 +489,22 @@ char *humanSize(long long sbytes, sizeString *s) {
|
|||||||
|
|
||||||
if (sbytes < 1024) {
|
if (sbytes < 1024) {
|
||||||
snprintf((char *)s, SSSIZE, "%lld B", sbytes);
|
snprintf((char *)s, SSSIZE, "%lld B", sbytes);
|
||||||
return (char *)s;
|
return (char *)s;
|
||||||
}
|
}
|
||||||
if ((sbytes / 1024) < 1024) {
|
if ((sbytes / 1024) < 1024) {
|
||||||
snprintf((char *)s, SSSIZE, "%.2f KB", sbytes / 1024.0);
|
snprintf((char *)s, SSSIZE, "%.2f KB", sbytes / 1024.0);
|
||||||
return (char*)s;
|
return (char*)s;
|
||||||
}
|
}
|
||||||
if ((sbytes / 1024 / 1024 ) < 1024) {
|
if ((sbytes / 1024 / 1024 ) < 1024) {
|
||||||
snprintf((char *)s, SSSIZE, "%.2f MB", sbytes / 1024.0 / 1024.0);
|
snprintf((char *)s, SSSIZE, "%.2f MB", sbytes / 1024.0 / 1024.0);
|
||||||
return (char*)s;
|
return (char*)s;
|
||||||
}
|
}
|
||||||
if ((sbytes / 1024 / 1024 / 1024 ) < 1024) {
|
if ((sbytes / 1024 / 1024 / 1024 ) < 1024) {
|
||||||
snprintf((char *)s, SSSIZE, "%.2f GB", sbytes / 1024.0 / 1024.0 / 1024.0);
|
snprintf((char *)s, SSSIZE, "%.2f GB", sbytes / 1024.0 / 1024.0 / 1024.0);
|
||||||
return (char*)s;
|
return (char*)s;
|
||||||
}
|
}
|
||||||
snprintf((char *)s, SSSIZE, "%.2f TB", sbytes / 1024.0 / 1024.0 / 1024.0 / 1024.0);
|
snprintf((char *)s, SSSIZE, "%.2f TB", sbytes / 1024.0 / 1024.0 / 1024.0 / 1024.0);
|
||||||
return (char*)s;
|
return (char*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -519,7 +512,7 @@ const char *htmlclean(const char *source,char *dest,unsigned int max)
|
|||||||
{
|
{
|
||||||
unsigned int i=0,j=0;
|
unsigned int i=0,j=0;
|
||||||
char subst[10];
|
char subst[10];
|
||||||
|
|
||||||
while (source[i] && i<max) {
|
while (source[i] && i<max) {
|
||||||
switch (source[i]) {
|
switch (source[i]) {
|
||||||
case '<': strcpy(subst,"<"); break;
|
case '<': strcpy(subst,"<"); break;
|
||||||
@ -535,7 +528,7 @@ const char *htmlclean(const char *source,char *dest,unsigned int max)
|
|||||||
} else {
|
} else {
|
||||||
fprintf(stderr,"Warning: can't tidy HTML string due to limited buffer.\n");
|
fprintf(stderr,"Warning: can't tidy HTML string due to limited buffer.\n");
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return dest;
|
return dest;
|
||||||
@ -545,7 +538,7 @@ const char *htmlcleanNoBr(const char *source,char *dest,unsigned int max)
|
|||||||
{
|
{
|
||||||
unsigned int i=0,j=0;
|
unsigned int i=0,j=0;
|
||||||
char subst[10];
|
char subst[10];
|
||||||
|
|
||||||
while (source[i] && i<max) {
|
while (source[i] && i<max) {
|
||||||
switch (source[i]) {
|
switch (source[i]) {
|
||||||
case '<': strcpy(subst,"<"); break;
|
case '<': strcpy(subst,"<"); break;
|
||||||
@ -560,7 +553,7 @@ const char *htmlcleanNoBr(const char *source,char *dest,unsigned int max)
|
|||||||
} else {
|
} else {
|
||||||
fprintf(stderr,"Warning: can't tidy HTML string due to limited buffer.\n");
|
fprintf(stderr,"Warning: can't tidy HTML string due to limited buffer.\n");
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return dest;
|
return dest;
|
||||||
@ -569,7 +562,7 @@ const char *htmlcleanNoBr(const char *source,char *dest,unsigned int max)
|
|||||||
/*
|
/*
|
||||||
scansdir is like scandir with the difference that it uses stat()
|
scansdir is like scandir with the difference that it uses stat()
|
||||||
to get entry file types
|
to get entry file types
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int scansdir(const char *dir, struct dirent ***namelist,
|
int scansdir(const char *dir, struct dirent ***namelist,
|
||||||
int (*sel)(const struct dirent *),
|
int (*sel)(const struct dirent *),
|
||||||
@ -618,7 +611,7 @@ int scansdir(const char *dir, struct dirent ***namelist,
|
|||||||
if (closedir(d)) return(-1);
|
if (closedir(d)) return(-1);
|
||||||
// if (i == 0) return(-1);
|
// if (i == 0) return(-1);
|
||||||
if (compar != NULL)
|
if (compar != NULL)
|
||||||
qsort((void *)(*namelist), (size_t)i, sizeof(struct dirent *),
|
qsort((void *)(*namelist), (size_t)i, sizeof(struct dirent *),
|
||||||
(__compar_fn_t) compar);
|
(__compar_fn_t) compar);
|
||||||
|
|
||||||
return(i);
|
return(i);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2015 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -18,7 +18,6 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
@ -52,6 +51,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "distromatic.h"
|
#include "distromatic.h"
|
||||||
|
#include "config.h"
|
||||||
#include "changelog.h"
|
#include "changelog.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "headerlist.h"
|
#include "headerlist.h"
|
||||||
@ -165,13 +165,13 @@ findSourcePackage(struct headerSourceList *list, char *name, char *version,
|
|||||||
while (currheaderlist) {
|
while (currheaderlist) {
|
||||||
if (!strcmp(name, currheaderlist->name)) {
|
if (!strcmp(name, currheaderlist->name)) {
|
||||||
if (((!release) || !strcmp(release, currheaderlist->release)) &&
|
if (((!release) || !strcmp(release, currheaderlist->release)) &&
|
||||||
((!version) || !strcmp(version, currheaderlist->version)) &&
|
((!version) || !strcmp(version, currheaderlist->version)) &&
|
||||||
((altrepository < 0) || (altrepository == currheaderlist->altrepository)))
|
((altrepository < 0) || (altrepository == currheaderlist->altrepository)))
|
||||||
return currheaderlist;
|
return currheaderlist;
|
||||||
oldheaderlist = currheaderlist->old;
|
oldheaderlist = currheaderlist->old;
|
||||||
while (oldheaderlist) {
|
while (oldheaderlist) {
|
||||||
if (((!release) || !strcmp(release, oldheaderlist->release)) &&
|
if (((!release) || !strcmp(release, oldheaderlist->release)) &&
|
||||||
((!version) || !strcmp(version, oldheaderlist->version)) &&
|
((!version) || !strcmp(version, oldheaderlist->version)) &&
|
||||||
((altrepository < 0) || (altrepository == oldheaderlist->altrepository)))
|
((altrepository < 0) || (altrepository == oldheaderlist->altrepository)))
|
||||||
return oldheaderlist;
|
return oldheaderlist;
|
||||||
oldheaderlist = oldheaderlist->old;
|
oldheaderlist = oldheaderlist->old;
|
||||||
@ -338,7 +338,7 @@ generateHeaderSourceStats(struct configTag *ct)
|
|||||||
if (currheadersourcelist->altrepository == altrepository) {
|
if (currheadersourcelist->altrepository == altrepository) {
|
||||||
stats->headersourcelistvec[c] = currheadersourcelist;
|
stats->headersourcelistvec[c] = currheadersourcelist;
|
||||||
c++;
|
c++;
|
||||||
if (currheadersourcelist->packager &&
|
if (currheadersourcelist->packager &&
|
||||||
(currheadersourcelist->packager->role & PACKAGER_ROLE_MAINTAINER)) {
|
(currheadersourcelist->packager->role & PACKAGER_ROLE_MAINTAINER)) {
|
||||||
currheadersourcelist->packager->packages_count++;
|
currheadersourcelist->packager->packages_count++;
|
||||||
}
|
}
|
||||||
@ -394,7 +394,7 @@ sourcerpmselector(const struct dirent *entry)
|
|||||||
ptr = strstr(entry->d_name, ".src.rpm");
|
ptr = strstr(entry->d_name, ".src.rpm");
|
||||||
|
|
||||||
if (entry->d_type != DT_REG) return 0; /* skip if not a file */
|
if (entry->d_type != DT_REG) return 0; /* skip if not a file */
|
||||||
|
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
logmsg(LOG_WARNING,"file %s has not src.rpm extension; skipping.",entry->d_name);
|
logmsg(LOG_WARNING,"file %s has not src.rpm extension; skipping.",entry->d_name);
|
||||||
return 0;
|
return 0;
|
||||||
@ -541,7 +541,7 @@ findOrCreateFileTreeEntry(struct fileTree* *first,char* findname, int arch)
|
|||||||
pstart = findname+1; /* skip trailing slash */
|
pstart = findname+1; /* skip trailing slash */
|
||||||
pend = findname+1;
|
pend = findname+1;
|
||||||
l = strlen(findname);
|
l = strlen(findname);
|
||||||
|
|
||||||
while (pend-findname < l) {
|
while (pend-findname < l) {
|
||||||
pend=strchr(pstart,'/');
|
pend=strchr(pstart,'/');
|
||||||
if (pend == 0) pend=findname+l; /* not final slash, it should be a file */
|
if (pend == 0) pend=findname+l; /* not final slash, it should be a file */
|
||||||
@ -555,7 +555,7 @@ findOrCreateFileTreeEntry(struct fileTree* *first,char* findname, int arch)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
currdir = findOrCreateFileTreeBrother(first,f,arch);
|
currdir = findOrCreateFileTreeBrother(first,f,arch);
|
||||||
|
|
||||||
if (!*first)
|
if (!*first)
|
||||||
*first = currdir;
|
*first = currdir;
|
||||||
prevdir = currdir;
|
prevdir = currdir;
|
||||||
@ -629,7 +629,7 @@ addToSourceHeaderList(struct headerSourceList **headersourcelist, struct configT
|
|||||||
char **requireversion, **requirename;
|
char **requireversion, **requirename;
|
||||||
uint_32 *requireflags;
|
uint_32 *requireflags;
|
||||||
char warning[PATH_MAX];
|
char warning[PATH_MAX];
|
||||||
#if RPM_VERSION >= 0x040100
|
#if RPM_VERSION >= 0x050000
|
||||||
rpmts ts = rpmtsCreate();
|
rpmts ts = rpmtsCreate();
|
||||||
#else
|
#else
|
||||||
rpmts ts = NULL;
|
rpmts ts = NULL;
|
||||||
@ -720,7 +720,7 @@ addToSourceHeaderList(struct headerSourceList **headersourcelist, struct configT
|
|||||||
newheadersourcelist->require[j]->resolved = NULL;
|
newheadersourcelist->require[j]->resolved = NULL;
|
||||||
}
|
}
|
||||||
newheadersourcelist->requirecount = requirecount;
|
newheadersourcelist->requirecount = requirecount;
|
||||||
|
|
||||||
if (mode & GENHEADER_CHANGELOG) {
|
if (mode & GENHEADER_CHANGELOG) {
|
||||||
changelog = getPackageChangelog(h, newheadersourcelist);
|
changelog = getPackageChangelog(h, newheadersourcelist);
|
||||||
while (changelog) {
|
while (changelog) {
|
||||||
@ -813,7 +813,9 @@ addToSourceHeaderList(struct headerSourceList **headersourcelist, struct configT
|
|||||||
} // for
|
} // for
|
||||||
|
|
||||||
free(namelist);
|
free(namelist);
|
||||||
|
#if RPM_VERSION >= 0x050000
|
||||||
rpmtsFree(ts);
|
rpmtsFree(ts);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -868,18 +870,18 @@ addToHeaderList(struct configTag *ct,
|
|||||||
char filepath[bufsize + 1], currname[bufsize + 1];
|
char filepath[bufsize + 1], currname[bufsize + 1];
|
||||||
char *filename=NULL;
|
char *filename=NULL;
|
||||||
long i ,j , k, n, altn[ALT_REPS_MAX];
|
long i ,j , k, n, altn[ALT_REPS_MAX];
|
||||||
int altrepository=0, obsoletecount, providecount, requirecount,
|
int altrepository=0, obsoletecount, providecount, requirecount,
|
||||||
filenamecount, dirnamecount,
|
filenamecount, dirnamecount,
|
||||||
*dirindex;
|
*dirindex;
|
||||||
int_16 *fileflags;
|
int_16 *fileflags;
|
||||||
char **obsoletename, **obsoleteversion,
|
char **obsoletename, **obsoleteversion,
|
||||||
**providename, **provideversion,
|
**providename, **provideversion,
|
||||||
**requirename, **requireversion,
|
**requirename, **requireversion,
|
||||||
**basename, **dirname, **newversion,
|
**basename, **dirname, **newversion,
|
||||||
**fileusername, **filegroupname;
|
**fileusername, **filegroupname;
|
||||||
const char* errstr;
|
const char* errstr;
|
||||||
uint_32 *requireflags, *obsoleteflags, *provideflags;
|
uint_32 *requireflags, *obsoleteflags, *provideflags;
|
||||||
#if RPM_VERSION >= 0x040100
|
#if RPM_VERSION >= 0x050000
|
||||||
rpmts ts = rpmtsCreate();
|
rpmts ts = rpmtsCreate();
|
||||||
#else
|
#else
|
||||||
rpmts ts = NULL;
|
rpmts ts = NULL;
|
||||||
@ -959,7 +961,7 @@ addToHeaderList(struct configTag *ct,
|
|||||||
altrepository=i+1;
|
altrepository=i+1;
|
||||||
altcnt[i]++;
|
altcnt[i]++;
|
||||||
/* check for duplicates in alternate repository */
|
/* check for duplicates in alternate repository */
|
||||||
if ((altcnt[i] < altn[i] - 1) &&
|
if ((altcnt[i] < altn[i] - 1) &&
|
||||||
(!rpmnamecmp(altnamelist[i][altcnt[i]]->d_name,altnamelist[i][altcnt[i]+1]->d_name,0))) {
|
(!rpmnamecmp(altnamelist[i][altcnt[i]]->d_name,altnamelist[i][altcnt[i]+1]->d_name,0))) {
|
||||||
if (i == ct->repository_level-1) {
|
if (i == ct->repository_level-1) {
|
||||||
logmsg(LOG_WARNING, "%s: duplicated RPM package (skipped)",
|
logmsg(LOG_WARNING, "%s: duplicated RPM package (skipped)",
|
||||||
@ -973,9 +975,10 @@ addToHeaderList(struct configTag *ct,
|
|||||||
|
|
||||||
/* break while loop when no more packages are found */
|
/* break while loop when no more packages are found */
|
||||||
if (currname[0] == '\0') { break; }
|
if (currname[0] == '\0') { break; }
|
||||||
/* process package */
|
/* process package */
|
||||||
logmsg(LOG_DEBUG, "getting header for %s", filepath);
|
logmsg(LOG_DEBUG, "getting header for %s", filepath);
|
||||||
|
|
||||||
|
sem_t rpm_mutex;
|
||||||
sem_wait(&rpm_mutex);
|
sem_wait(&rpm_mutex);
|
||||||
if (getHeader(&ts, filepath, &h)) {
|
if (getHeader(&ts, filepath, &h)) {
|
||||||
sem_post(&rpm_mutex);
|
sem_post(&rpm_mutex);
|
||||||
@ -1011,7 +1014,7 @@ addToHeaderList(struct configTag *ct,
|
|||||||
(void) headerFree(h);
|
(void) headerFree(h);
|
||||||
free(newheaderlist);
|
free(newheaderlist);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
if (getPackageNameFromFile(newheaderlist->sourcename)) {
|
if (getPackageNameFromFile(newheaderlist->sourcename)) {
|
||||||
logmsg(LOG_WARNING,
|
logmsg(LOG_WARNING,
|
||||||
"file %s doesn't have a standard format; skipping package.");
|
"file %s doesn't have a standard format; skipping package.");
|
||||||
@ -1046,14 +1049,14 @@ addToHeaderList(struct configTag *ct,
|
|||||||
currheaderlist->next = newheaderlist;
|
currheaderlist->next = newheaderlist;
|
||||||
}
|
}
|
||||||
currheaderlist = newheaderlist;
|
currheaderlist = newheaderlist;
|
||||||
|
|
||||||
if (!ct->headerlist[arch]) {
|
if (!ct->headerlist[arch]) {
|
||||||
/* set first pointer of the list */
|
/* set first pointer of the list */
|
||||||
ct->headerlist[arch] = newheaderlist;
|
ct->headerlist[arch] = newheaderlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (newheaderlist->sourcename) /* missing source header */ {
|
} else if (newheaderlist->sourcename) /* missing source header */ {
|
||||||
|
|
||||||
if ((!newheaderlist->sourceheader) ||
|
if ((!newheaderlist->sourceheader) ||
|
||||||
(newheaderlist->sourceheader->altrepository) <= altrepository)
|
(newheaderlist->sourceheader->altrepository) <= altrepository)
|
||||||
{
|
{
|
||||||
@ -1173,7 +1176,9 @@ addToHeaderList(struct configTag *ct,
|
|||||||
free(altnamelist[altrepository-1][altcnt[altrepository-1]-1]); }
|
free(altnamelist[altrepository-1][altcnt[altrepository-1]-1]); }
|
||||||
else free(namelist[cnt-1]);
|
else free(namelist[cnt-1]);
|
||||||
} // main while
|
} // main while
|
||||||
|
#if RPM_VERSION >= 0x050000
|
||||||
rpmtsFree(ts);
|
rpmtsFree(ts);
|
||||||
|
#endif
|
||||||
free(namelist);
|
free(namelist);
|
||||||
createProvidedListIndex((struct providedList **)&(ct->providedlist_idx[arch]), arch);
|
createProvidedListIndex((struct providedList **)&(ct->providedlist_idx[arch]), arch);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -8,9 +8,7 @@
|
|||||||
#ifndef BUILDTOOLS_H
|
#ifndef BUILDTOOLS_H
|
||||||
#define BUILDTOOLS_H
|
#define BUILDTOOLS_H
|
||||||
|
|
||||||
#ifndef DISTROMATIC_H
|
#include "config.h"
|
||||||
# include "distromatic.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int generateBuildInfo(struct configTag *configtag, int arch);
|
int generateBuildInfo(struct configTag *configtag, int arch);
|
||||||
|
|
||||||
|
@ -1,17 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CHANGELOG_H
|
#ifndef CHANGELOG_H
|
||||||
#define CHANGELOG_H
|
#define CHANGELOG_H
|
||||||
|
|
||||||
#ifndef RPMFUNCTIONS_H
|
|
||||||
# include "rpmfunctions.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if TIME_WITH_SYS_TIME
|
#if TIME_WITH_SYS_TIME
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <time.h>
|
# include <time.h>
|
||||||
@ -23,8 +19,9 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PACKAGER_MAXALIASES 5
|
#include "distromatic.h"
|
||||||
#define PACKAGER_ROLE_MAINTAINER 1
|
#include "config.h"
|
||||||
|
#include "rpmfunctions.h"
|
||||||
|
|
||||||
struct changeLog {
|
struct changeLog {
|
||||||
long time;
|
long time;
|
||||||
|
48
src/include/config.h
Normal file
48
src/include/config.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* distromatic - tool for RPM based repositories
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#include "distromatic.h"
|
||||||
|
#include "headerlist.h"
|
||||||
|
|
||||||
|
struct configDefaults {
|
||||||
|
char *html_basedir;
|
||||||
|
char *distribution_name;
|
||||||
|
char *url_address;
|
||||||
|
char *url_prefix;
|
||||||
|
char *url_search_prefix;
|
||||||
|
char *url_dir;
|
||||||
|
char *favicon_search_prefix;
|
||||||
|
char *arch[ARCHS_MAX];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct configTag {
|
||||||
|
struct configDefaults *configdefaults;
|
||||||
|
char *tag;
|
||||||
|
char *description;
|
||||||
|
char *repository_dir;
|
||||||
|
char *repository_source_dir;
|
||||||
|
struct configTag *repository[ALT_REPS_MAX+1];
|
||||||
|
int repository_level;
|
||||||
|
char *html_dir;
|
||||||
|
char *download_prefix;
|
||||||
|
char *download_dir;
|
||||||
|
char *showfile_prefix;
|
||||||
|
char *arch[ARCHS_MAX];
|
||||||
|
struct headerList *headerlist[ARCHS_MAX];
|
||||||
|
struct headerSourceList *headersourcelist;
|
||||||
|
struct providedList *providedlist_idx[ARCHS_MAX][PROVIDEDLIST_IDX_SIZE];
|
||||||
|
struct fileTree *filetree[ARCHS_MAX];
|
||||||
|
struct fileUserList *fileuserlist[ARCHS_MAX];
|
||||||
|
struct fileGroupList *filegrouplist[ARCHS_MAX];
|
||||||
|
struct headerStats stats;
|
||||||
|
struct configTag *next;
|
||||||
|
void *db[ARCHS_MAX + 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -1,51 +1,27 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef DISTROMATIC_H
|
#ifndef DISTROMATIC_H
|
||||||
#define DISTROMATIC_H
|
#define DISTROMATIC_H
|
||||||
|
|
||||||
#include "globaldefs.h"
|
#define PACKAGE_BUGREPORT "silvan.calarco@mambasoft.it"
|
||||||
#include "headerlist.h"
|
|
||||||
|
|
||||||
|
#define ARCHS_MAX 5
|
||||||
#define OBSOLETE_MAX 16384
|
#define OBSOLETE_MAX 16384
|
||||||
|
#define DEFAULT_ARCH "i586"
|
||||||
struct configDefaults {
|
#define CONF_DEFAULTS_SECTION 1
|
||||||
char *html_basedir;
|
#define CONF_REP_SECTION 0
|
||||||
char *distribution_name;
|
#define CONF_MAINTAINERS_SECTION 2
|
||||||
char *url_address;
|
#define GENHEADER_CHANGELOG 1
|
||||||
char *url_prefix;
|
#define GENHEADER_BASE 2
|
||||||
char *url_search_prefix;
|
#define GENHEADER_REQUIREMENTS 4
|
||||||
char *url_dir;
|
#define GENHEADER_STATS 8
|
||||||
char *favicon_search_prefix;
|
#define ALT_REPS_MAX 10
|
||||||
char *arch[ARCHS_MAX];
|
#define PACKAGER_MAXALIASES 5
|
||||||
};
|
#define PACKAGER_ROLE_MAINTAINER 1
|
||||||
|
|
||||||
struct configTag {
|
|
||||||
struct configDefaults *configdefaults;
|
|
||||||
char *tag;
|
|
||||||
char *description;
|
|
||||||
char *repository_dir;
|
|
||||||
char *repository_source_dir;
|
|
||||||
struct configTag *repository[ALT_REPS_MAX+1];
|
|
||||||
int repository_level;
|
|
||||||
char *html_dir;
|
|
||||||
char *download_prefix;
|
|
||||||
char *download_dir;
|
|
||||||
char *showfile_prefix;
|
|
||||||
char *arch[ARCHS_MAX];
|
|
||||||
struct headerList *headerlist[ARCHS_MAX];
|
|
||||||
struct headerSourceList *headersourcelist;
|
|
||||||
struct providedList *providedlist_idx[ARCHS_MAX][PROVIDEDLIST_IDX_SIZE];
|
|
||||||
struct fileTree *filetree[ARCHS_MAX];
|
|
||||||
struct fileUserList *fileuserlist[ARCHS_MAX];
|
|
||||||
struct fileGroupList *filegrouplist[ARCHS_MAX];
|
|
||||||
struct headerStats stats;
|
|
||||||
struct configTag *next;
|
|
||||||
void *db[ARCHS_MAX + 1];
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FUNCTIONS_H
|
#ifndef FUNCTIONS_H
|
||||||
#define FUNCTIONS_H
|
#define FUNCTIONS_H
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
#define HDSIZE 16
|
#define HDSIZE 16
|
||||||
#define SSSIZE 16
|
#define SSSIZE 16
|
||||||
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* globaldefs.h - global definitions for distromatic
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef GLOBALDEFS_H
|
|
||||||
#define GLOBALDEFS_H
|
|
||||||
|
|
||||||
#define PROGRAMNAME "@PACKAGE_NAME@"
|
|
||||||
#define PROGRAMVERSION "@PACKAGE_VERSION@"
|
|
||||||
#define DEFAULT_CONFIGFILE "@sysconfdir@/@PACKAGE_NAME@.conf"
|
|
||||||
#define DEFAULT_ARCH "@DEFAULT_ARCH@"
|
|
||||||
#define ARCHS_MAX 5
|
|
||||||
|
|
||||||
#define CONF_REP_SECTION 0
|
|
||||||
#define CONF_DEFAULTS_SECTION 1
|
|
||||||
#define CONF_MAINTAINERS_SECTION 2
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -10,17 +10,11 @@
|
|||||||
|
|
||||||
#define PROVIDEDLIST_IDX_SIZE 20
|
#define PROVIDEDLIST_IDX_SIZE 20
|
||||||
|
|
||||||
#include "globaldefs.h"
|
|
||||||
|
|
||||||
#ifndef RPMFUNCTIONS_H
|
#ifndef RPMFUNCTIONS_H
|
||||||
# include "rpmfunctions.h"
|
#include "rpmfunctions.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GENHEADER_CHANGELOG 1
|
#include "distromatic.h"
|
||||||
#define GENHEADER_BASE 2
|
|
||||||
#define GENHEADER_REQUIREMENTS 4
|
|
||||||
#define GENHEADER_STATS 8
|
|
||||||
#define ALT_REPS_MAX 10
|
|
||||||
|
|
||||||
struct providedList {
|
struct providedList {
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -1,19 +1,40 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RPMFUNCTIONS_H
|
#ifndef RPMFUNCTIONS_H
|
||||||
#define RPMFUNCTIONS_H
|
#define RPMFUNCTIONS_H
|
||||||
|
|
||||||
|
/* Define to the RPM version */
|
||||||
|
#define RPM_VERSION ((RPM_VERSION_MAJOR<<16)|(RPM_VERSION_MINOR<<8)|RPM_VERSION_MICRO)
|
||||||
|
|
||||||
|
#if RPM_VERSION_MAJOR == 4
|
||||||
|
#define uint_32 uint32_t
|
||||||
|
#define int_16 rpmFlags
|
||||||
|
#define HE_t rpmTagVal
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef H_RPMLIB
|
#ifndef H_RPMLIB
|
||||||
# include <rpm/rpmlib.h>
|
# include <rpm/rpmlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if RPM_VERSION >= 0x040100
|
||||||
|
#include <rpm/rpmts.h>
|
||||||
|
#else
|
||||||
|
#define rpmReadPackageFile(a,b,c,d) rpmReadPackageHeader(b,d,0,NULL,NULL)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if RPM_VERSION >= 0x050000
|
||||||
|
#ifndef H_RPMEVR
|
||||||
|
#include <rpm/rpmevr.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include "headerlist.h"
|
#include <dirent.h>
|
||||||
|
|
||||||
#define HEADERS_BUFFER_SIZE 2000000
|
#define HEADERS_BUFFER_SIZE 2000000
|
||||||
|
|
||||||
@ -21,8 +42,6 @@ unsigned int checkVersionWithFlags(const char* cmp1, const uint_32 flags, const
|
|||||||
|
|
||||||
void rpminit(void);
|
void rpminit(void);
|
||||||
|
|
||||||
//int myHeaderGetEntry(Header h, int_32 tag, int *type, void** p, int *c);
|
|
||||||
|
|
||||||
char *headerGetStringEntry(Header h, const int tag);
|
char *headerGetStringEntry(Header h, const int tag);
|
||||||
|
|
||||||
char **headerGetStringArrayEntry(Header h, const int tag, int* count);
|
char **headerGetStringArrayEntry(Header h, const int tag, int* count);
|
||||||
@ -58,6 +77,4 @@ int scanrpmnamecmp(const struct dirent **f1, const struct dirent **f2);
|
|||||||
|
|
||||||
char* printrpmversion(char *s, int bufsize, long epoch, char *version, char *release);
|
char* printrpmversion(char *s, int bufsize, long epoch, char *version, char *release);
|
||||||
|
|
||||||
sem_t rpm_mutex;
|
|
||||||
|
|
||||||
#endif // RPMFUNCTIONS_H
|
#endif // RPMFUNCTIONS_H
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2015 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -18,10 +18,6 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_STRING_H
|
#if HAVE_STRING_H
|
||||||
# if !STDC_HEADERS && HAVE_MEMORY_H
|
# if !STDC_HEADERS && HAVE_MEMORY_H
|
||||||
# include <memory.h>
|
# include <memory.h>
|
||||||
@ -32,6 +28,7 @@
|
|||||||
# include <strings.h>
|
# include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "distromatic.h"
|
||||||
#include "changelog.h"
|
#include "changelog.h"
|
||||||
#include "reports.h"
|
#include "reports.h"
|
||||||
#include "rpmfunctions.h"
|
#include "rpmfunctions.h"
|
||||||
@ -71,7 +68,7 @@ comparePackagers(const void *ptr1, const void *ptr2)
|
|||||||
else {
|
else {
|
||||||
ret=strcasecmp((*(struct headerSourceList **)ptr1)->packager->name,
|
ret=strcasecmp((*(struct headerSourceList **)ptr1)->packager->name,
|
||||||
(*(struct headerSourceList **)ptr2)->packager->name);
|
(*(struct headerSourceList **)ptr2)->packager->name);
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret=strcasecmp((*(struct headerSourceList **)ptr1)->name,
|
ret=strcasecmp((*(struct headerSourceList **)ptr1)->name,
|
||||||
(*(struct headerSourceList **)ptr2)->name);
|
(*(struct headerSourceList **)ptr2)->name);
|
||||||
@ -235,7 +232,7 @@ generateMaintainersPages(struct configTag *configtag)
|
|||||||
comparePackagers);
|
comparePackagers);
|
||||||
|
|
||||||
snprintf(outfile, PATH_MAX, "%smaintainers", configtag->html_dir);
|
snprintf(outfile, PATH_MAX, "%smaintainers", configtag->html_dir);
|
||||||
if (stat(outfile,&buf)) {
|
if (stat(outfile,&buf)) {
|
||||||
if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
|
if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
|
||||||
logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile);
|
logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -263,7 +260,7 @@ generateMaintainersPages(struct configTag *configtag)
|
|||||||
|
|
||||||
if ((unmaint = fopen(unmaintfile, "w")) == NULL) {
|
if ((unmaint = fopen(unmaintfile, "w")) == NULL) {
|
||||||
perror(unmaintfile);
|
perror(unmaintfile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(unmaint,
|
fprintf(unmaint,
|
||||||
@ -279,7 +276,7 @@ generateMaintainersPages(struct configTag *configtag)
|
|||||||
|
|
||||||
if ((i == 0) ||
|
if ((i == 0) ||
|
||||||
((configtag->stats.headersourcelistvec[i-1])->packager != (configtag->stats.headersourcelistvec[i])->packager)) {
|
((configtag->stats.headersourcelistvec[i-1])->packager != (configtag->stats.headersourcelistvec[i])->packager)) {
|
||||||
|
|
||||||
if ((configtag->stats.headersourcelistvec[i])->packager->role &
|
if ((configtag->stats.headersourcelistvec[i])->packager->role &
|
||||||
PACKAGER_ROLE_MAINTAINER) {
|
PACKAGER_ROLE_MAINTAINER) {
|
||||||
|
|
||||||
@ -289,7 +286,7 @@ generateMaintainersPages(struct configTag *configtag)
|
|||||||
|
|
||||||
if ((out = fopen(outfile, "w")) == NULL) {
|
if ((out = fopen(outfile, "w")) == NULL) {
|
||||||
perror(outfile);
|
perror(outfile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(out,
|
fprintf(out,
|
||||||
@ -299,7 +296,7 @@ generateMaintainersPages(struct configTag *configtag)
|
|||||||
} // new maintainer file created
|
} // new maintainer file created
|
||||||
|
|
||||||
} // check for changed packager
|
} // check for changed packager
|
||||||
|
|
||||||
if ((configtag->stats.headersourcelistvec[i])->packager->role & PACKAGER_ROLE_MAINTAINER) {
|
if ((configtag->stats.headersourcelistvec[i])->packager->role & PACKAGER_ROLE_MAINTAINER) {
|
||||||
fprintf(out,
|
fprintf(out,
|
||||||
"<a href=\"%stag=%s&pkg=%s.source\">%s</a>: %s<br>\n",
|
"<a href=\"%stag=%s&pkg=%s.source\">%s</a>: %s<br>\n",
|
||||||
@ -311,7 +308,7 @@ generateMaintainersPages(struct configTag *configtag)
|
|||||||
pkgnum++;
|
pkgnum++;
|
||||||
|
|
||||||
if ((i+1 >= configtag->stats.headersourcecount) ||
|
if ((i+1 >= configtag->stats.headersourcecount) ||
|
||||||
((configtag->stats.headersourcelistvec[i])->packager !=
|
((configtag->stats.headersourcelistvec[i])->packager !=
|
||||||
(configtag->stats.headersourcelistvec[i+1])->packager)) {
|
(configtag->stats.headersourcelistvec[i+1])->packager)) {
|
||||||
|
|
||||||
fprintf(idx,
|
fprintf(idx,
|
||||||
@ -419,7 +416,7 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
|
|
||||||
/* create groups directory */
|
/* create groups directory */
|
||||||
snprintf(outfile, PATH_MAX, "%sgroups",configtag->html_dir);
|
snprintf(outfile, PATH_MAX, "%sgroups",configtag->html_dir);
|
||||||
if (stat(outfile,&buf)) {
|
if (stat(outfile,&buf)) {
|
||||||
if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
|
if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
|
||||||
logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile);
|
logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -442,13 +439,13 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
|
|
||||||
if (pkgnum==0) {
|
if (pkgnum==0) {
|
||||||
|
|
||||||
snprintf(outfile, PATH_MAX, "%sgroups/%s",
|
snprintf(outfile, PATH_MAX, "%sgroups/%s",
|
||||||
configtag->html_dir,
|
configtag->html_dir,
|
||||||
groupdirname(configtag->stats.headersourcelistvec[i]->group,buffer,PATH_MAX));
|
groupdirname(configtag->stats.headersourcelistvec[i]->group,buffer,PATH_MAX));
|
||||||
|
|
||||||
if (stat(outfile,&buf)) {
|
if (stat(outfile,&buf)) {
|
||||||
if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
|
if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
|
||||||
logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile);
|
logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -505,7 +502,7 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
if ((htmlout = fopen(outfile, "w")) == NULL) {
|
if ((htmlout = fopen(outfile, "w")) == NULL) {
|
||||||
perror(outfile);
|
perror(outfile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*else {
|
/*else {
|
||||||
fprintf(htmlout, "<a href=\"%s/%s/recent.rss\">"
|
fprintf(htmlout, "<a href=\"%s/%s/recent.rss\">"
|
||||||
"<img src=\"%s/feed-icon.png\" "
|
"<img src=\"%s/feed-icon.png\" "
|
||||||
@ -543,7 +540,7 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
//fprintf(rssout," <description></description>\n");
|
//fprintf(rssout," <description></description>\n");
|
||||||
fprintf(rssout," <language>en-us</language>\n");
|
fprintf(rssout," <language>en-us</language>\n");
|
||||||
fprintf(rssout," <docs>http://blogs.law.harvard.edu/tech/rss</docs>");
|
fprintf(rssout," <docs>http://blogs.law.harvard.edu/tech/rss</docs>");
|
||||||
fprintf(rssout," <generator>Distromatic %s</generator>\n",VERSION);
|
fprintf(rssout," <generator>Distromatic %s</generator>\n",PACKAGE_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sort headersourcelistvec by BuildDate */
|
/* sort headersourcelistvec by BuildDate */
|
||||||
@ -613,7 +610,7 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
(configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->version,
|
(configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->version,
|
||||||
(configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->release);
|
(configtag->stats.headersourcelistvec)[configtag->stats.headersourcecount-1-i]->release);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < RSSSTATS_NUM) {
|
if (i < RSSSTATS_NUM) {
|
||||||
// RSS recent packages
|
// RSS recent packages
|
||||||
fprintf(rssout," <item>\n");
|
fprintf(rssout," <item>\n");
|
||||||
@ -652,7 +649,7 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
perror(outfile);
|
perror(outfile);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* remove final slashes from download_prefix as required by apt */
|
/* remove final slashes from download_prefix as required by apt */
|
||||||
strncpy(buffer, configtag->download_dir, PATH_MAX);
|
strncpy(buffer, configtag->download_dir, PATH_MAX);
|
||||||
|
|
||||||
@ -882,7 +879,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
|||||||
|
|
||||||
// create warnings directory
|
// create warnings directory
|
||||||
snprintf(warningsdir,PATH_MAX,"%swarnings",configtag->html_dir);
|
snprintf(warningsdir,PATH_MAX,"%swarnings",configtag->html_dir);
|
||||||
if (stat(warningsdir,&buf)) {
|
if (stat(warningsdir,&buf)) {
|
||||||
if (mkdir(warningsdir,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
|
if (mkdir(warningsdir,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
|
||||||
logmsg(LOG_ERROR,"cannot create %s directory; aborting.",warningsdir);
|
logmsg(LOG_ERROR,"cannot create %s directory; aborting.",warningsdir);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -964,7 +961,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
|||||||
buffer2,
|
buffer2,
|
||||||
currheadersourcelist->name,
|
currheadersourcelist->name,
|
||||||
htmlclean(currheadersourcelist->summary,buffer,PATH_MAX));
|
htmlclean(currheadersourcelist->summary,buffer,PATH_MAX));
|
||||||
|
|
||||||
fprintf(fout,"<p>");
|
fprintf(fout,"<p>");
|
||||||
printHTMLWarnings(fout,configtag,currheadersourcelist,1);
|
printHTMLWarnings(fout,configtag,currheadersourcelist,1);
|
||||||
|
|
||||||
@ -996,7 +993,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
|||||||
fprintf(fout,
|
fprintf(fout,
|
||||||
"<tr><td>Maintainer:</td><td>");
|
"<tr><td>Maintainer:</td><td>");
|
||||||
|
|
||||||
if (currheadersourcelist->packager &&
|
if (currheadersourcelist->packager &&
|
||||||
(currheadersourcelist->packager->role & PACKAGER_ROLE_MAINTAINER)) {
|
(currheadersourcelist->packager->role & PACKAGER_ROLE_MAINTAINER)) {
|
||||||
fprintf(fout,
|
fprintf(fout,
|
||||||
"<a href=\"%stag=%s&maintainer=%s\">%s</a></td></tr>\n",
|
"<a href=\"%stag=%s&maintainer=%s\">%s</a></td></tr>\n",
|
||||||
@ -1010,7 +1007,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
|||||||
"<a href=\"%stag=%s&maintainer=unmaintained\"><b>unmaintained</b></a></td></tr>\n",
|
"<a href=\"%stag=%s&maintainer=unmaintained\"><b>unmaintained</b></a></td></tr>\n",
|
||||||
configtag->configdefaults->url_prefix,
|
configtag->configdefaults->url_prefix,
|
||||||
configtag->tag);
|
configtag->tag);
|
||||||
|
|
||||||
fprintf(fout,
|
fprintf(fout,
|
||||||
"<tr><td>Description:</td><td><font size=\"-1\">%s</font></td></tr>\n",
|
"<tr><td>Description:</td><td><font size=\"-1\">%s</font></td></tr>\n",
|
||||||
htmlclean(currheadersourcelist->description,buffer,PATH_MAX));
|
htmlclean(currheadersourcelist->description,buffer,PATH_MAX));
|
||||||
@ -1061,7 +1058,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
|||||||
|
|
||||||
fprintf(fout,"</font></td></tr>\n");
|
fprintf(fout,"</font></td></tr>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currheadersourcelist->patch) {
|
if (currheadersourcelist->patch) {
|
||||||
fprintf(fout,"<tr><td>Patches:</td><td><font size=\"-1\">");
|
fprintf(fout,"<tr><td>Patches:</td><td><font size=\"-1\">");
|
||||||
|
|
||||||
@ -1196,7 +1193,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// multiple providers
|
// multiple providers
|
||||||
if (i == 0 ||
|
if (i == 0 ||
|
||||||
strcmp(currheadersourcelist->require[i-1]->resolved->name,
|
strcmp(currheadersourcelist->require[i-1]->resolved->name,
|
||||||
currheadersourcelist->require[i]->resolved->name))
|
currheadersourcelist->require[i]->resolved->name))
|
||||||
fprintf(fout,"<i>%s</i>(",currheadersourcelist->require[i]->resolved->name);
|
fprintf(fout,"<i>%s</i>(",currheadersourcelist->require[i]->resolved->name);
|
||||||
@ -1236,9 +1233,9 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
|||||||
(humanDate *) & strdate);
|
(humanDate *) & strdate);
|
||||||
|
|
||||||
if (currchangelog->pkg) {
|
if (currchangelog->pkg) {
|
||||||
if ((currchangelog->pkg->role & PACKAGER_ROLE_MAINTAINER) &&
|
if ((currchangelog->pkg->role & PACKAGER_ROLE_MAINTAINER) &&
|
||||||
(currchangelog->pkg->packages_count)) {
|
(currchangelog->pkg->packages_count)) {
|
||||||
fprintf(fout, "%s - <a href=\"%stag=%s&maintainer=%s\">%s</a> (%s)<br>%s<br>",
|
fprintf(fout, "%s - <a href=\"%stag=%s&maintainer=%s\">%s</a> (%s)<br>%s<br>",
|
||||||
&strdate[0],
|
&strdate[0],
|
||||||
configtag->configdefaults->url_prefix,
|
configtag->configdefaults->url_prefix,
|
||||||
configtag->tag,
|
configtag->tag,
|
||||||
@ -1248,15 +1245,15 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
|||||||
htmlclean(currchangelog->text,buffer,PATH_MAX));
|
htmlclean(currchangelog->text,buffer,PATH_MAX));
|
||||||
// currchangelog->pkg->changes_count++;
|
// currchangelog->pkg->changes_count++;
|
||||||
} else {
|
} else {
|
||||||
fprintf(fout, "%s - %s (%s)<br>%s<br>",
|
fprintf(fout, "%s - %s (%s)<br>%s<br>",
|
||||||
&strdate[0],
|
&strdate[0],
|
||||||
currchangelog->pkg->name,
|
currchangelog->pkg->name,
|
||||||
currchangelog->release,
|
currchangelog->release,
|
||||||
htmlclean(currchangelog->text,buffer,PATH_MAX));
|
htmlclean(currchangelog->text,buffer,PATH_MAX));
|
||||||
// currchangelog->pkg->changes_count++;
|
// currchangelog->pkg->changes_count++;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
fprintf(fout, "%s - (noname) (%s)<br>%s<br>",
|
fprintf(fout, "%s - (noname) (%s)<br>%s<br>",
|
||||||
&strdate[0],
|
&strdate[0],
|
||||||
currchangelog->release,
|
currchangelog->release,
|
||||||
htmlclean(currchangelog->text,buffer,PATH_MAX));
|
htmlclean(currchangelog->text,buffer,PATH_MAX));
|
||||||
@ -1585,7 +1582,7 @@ generateHTMLFiles(struct configTag *ct, int arch)
|
|||||||
fprintf(fout,"<b>%s(unresolved)</b> ",currheaderlist->require[i]->resolved->name);
|
fprintf(fout,"<b>%s(unresolved)</b> ",currheaderlist->require[i]->resolved->name);
|
||||||
} else if (currheaderlist->require[i]->resolved->numproviders == 1) {
|
} else if (currheaderlist->require[i]->resolved->numproviders == 1) {
|
||||||
// single provider
|
// single provider
|
||||||
if ((i == 0 ||
|
if ((i == 0 ||
|
||||||
!currheaderlist->require[i-1]->resolved ||
|
!currheaderlist->require[i-1]->resolved ||
|
||||||
!currheaderlist->require[i-1]->resolved->numproviders ||
|
!currheaderlist->require[i-1]->resolved->numproviders ||
|
||||||
strcmp(currheaderlist->require[i-1]->resolved->provider[0]->name,
|
strcmp(currheaderlist->require[i-1]->resolved->provider[0]->name,
|
||||||
@ -1613,7 +1610,7 @@ generateHTMLFiles(struct configTag *ct, int arch)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// multiple providers
|
// multiple providers
|
||||||
if (i == 0 ||
|
if (i == 0 ||
|
||||||
!currheaderlist->require[i-1]->resolved ||
|
!currheaderlist->require[i-1]->resolved ||
|
||||||
!currheaderlist->require[i-1]->resolved->numproviders ||
|
!currheaderlist->require[i-1]->resolved->numproviders ||
|
||||||
strcmp(currheaderlist->require[i-1]->resolved->name,
|
strcmp(currheaderlist->require[i-1]->resolved->name,
|
||||||
@ -1699,7 +1696,7 @@ generateHTMLFiles(struct configTag *ct, int arch)
|
|||||||
fprintf(fout,
|
fprintf(fout,
|
||||||
"<tr><td>Filenames:</td><td><font size=\"-1\">");
|
"<tr><td>Filenames:</td><td><font size=\"-1\">");
|
||||||
for (i = 0; i < currheaderlist->filenamecount; i++) {
|
for (i = 0; i < currheaderlist->filenamecount; i++) {
|
||||||
ftname((currheaderlist->file)[i],
|
ftname((currheaderlist->file)[i],
|
||||||
buffer, PATH_MAX);
|
buffer, PATH_MAX);
|
||||||
|
|
||||||
fprintf(fout, "/%s ",buffer);
|
fprintf(fout, "/%s ",buffer);
|
||||||
@ -1735,9 +1732,9 @@ char *ftname(struct fileTree* ft, char* buf, unsigned int bufsize) {
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_contents_subtree(FILE *f,
|
void print_contents_subtree(FILE *f,
|
||||||
struct fileTree* ft,
|
struct fileTree* ft,
|
||||||
struct configTag* ct,
|
struct configTag* ct,
|
||||||
char* buf, int bufsize) {
|
char* buf, int bufsize) {
|
||||||
int i,j,k;
|
int i,j,k;
|
||||||
|
|
||||||
@ -2145,7 +2142,7 @@ generateSrcPkgList(struct configTag *ct)
|
|||||||
|
|
||||||
currheadersourcelist = ct->headersourcelist;
|
currheadersourcelist = ct->headersourcelist;
|
||||||
while (currheadersourcelist != NULL) {
|
while (currheadersourcelist != NULL) {
|
||||||
fprintf(fd, "%s %s %s %s %ld %s ",
|
fprintf(fd, "%s %s %s %s %ld %s ",
|
||||||
currheadersourcelist->name,
|
currheadersourcelist->name,
|
||||||
currheadersourcelist->version,
|
currheadersourcelist->version,
|
||||||
(char *)simpleTimeToTemplate(currheadersourcelist->buildtime,"%Y%m%d",&strdate),
|
(char *)simpleTimeToTemplate(currheadersourcelist->buildtime,"%Y%m%d",&strdate),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -18,10 +18,6 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if STDC_HEADERS
|
#if STDC_HEADERS
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* distromatic - tool for RPM based repositories
|
* distromatic - tool for RPM based repositories
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2006 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
* Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
* Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -18,10 +18,6 @@
|
|||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_STRING_H
|
#if HAVE_STRING_H
|
||||||
# if !STDC_HEADERS && HAVE_MEMORY_H
|
# if !STDC_HEADERS && HAVE_MEMORY_H
|
||||||
# include <memory.h>
|
# include <memory.h>
|
||||||
@ -34,22 +30,6 @@
|
|||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#ifndef H_RPMLIB
|
|
||||||
# include <rpm/rpmlib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if RPM_VERSION >= 0x040100
|
|
||||||
#include <rpm/rpmts.h>
|
|
||||||
#else
|
|
||||||
#define rpmReadPackageFile(a,b,c,d) rpmReadPackageHeader(b,d,0,NULL,NULL)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if RPM_VERSION >= 0x040409
|
|
||||||
#ifndef H_RPMEVR
|
|
||||||
#include <rpm/rpmevr.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#include <libiberty/libiberty.h>
|
#include <libiberty/libiberty.h>
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
@ -64,9 +44,9 @@
|
|||||||
* char **summary); */
|
* char **summary); */
|
||||||
|
|
||||||
unsigned int checkVersionWithFlags(const char* cmp1, uint_32 flags, const char* cmp2) {
|
unsigned int checkVersionWithFlags(const char* cmp1, uint_32 flags, const char* cmp2) {
|
||||||
|
int vercmp = 0;
|
||||||
|
#if RPM_VERSION_MAJOR >= 5
|
||||||
struct EVR_s evr1, evr2;
|
struct EVR_s evr1, evr2;
|
||||||
int vercmp = 0;
|
|
||||||
|
|
||||||
sem_wait(&rpm_mutex);
|
sem_wait(&rpm_mutex);
|
||||||
rpmEVRparse(cmp1, &evr1);
|
rpmEVRparse(cmp1, &evr1);
|
||||||
@ -79,6 +59,9 @@ unsigned int checkVersionWithFlags(const char* cmp1, uint_32 flags, const char*
|
|||||||
|
|
||||||
if (!vercmp) vercmp=rpmvercmp(evr1.F[RPMEVR_V], evr2.F[RPMEVR_V]);
|
if (!vercmp) vercmp=rpmvercmp(evr1.F[RPMEVR_V], evr2.F[RPMEVR_V]);
|
||||||
if (!vercmp && strlen(evr1.F[RPMEVR_R]) && strlen(evr2.F[RPMEVR_R])) vercmp=rpmvercmp(evr1.F[RPMEVR_R], evr2.F[RPMEVR_R]);
|
if (!vercmp && strlen(evr1.F[RPMEVR_R]) && strlen(evr2.F[RPMEVR_R])) vercmp=rpmvercmp(evr1.F[RPMEVR_R], evr2.F[RPMEVR_R]);
|
||||||
|
#else
|
||||||
|
vercmp=rpmvercmp(cmp1, cmp2);
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((vercmp == 0) && (flags & RPMSENSE_EQUAL)) return 1;
|
if ((vercmp == 0) && (flags & RPMSENSE_EQUAL)) return 1;
|
||||||
else if ((vercmp == 1) && (flags & RPMSENSE_LESS)) return 1;
|
else if ((vercmp == 1) && (flags & RPMSENSE_LESS)) return 1;
|
||||||
@ -126,13 +109,14 @@ getHeader(rpmts* ts, char *headerFile, Header * h)
|
|||||||
|
|
||||||
#if RPM_VERSION >= 0x040100
|
#if RPM_VERSION >= 0x040100
|
||||||
rc = rpmReadPackageFile(*ts, fd, headerFile, h);
|
rc = rpmReadPackageFile(*ts, fd, headerFile, h);
|
||||||
|
Fclose(fd);
|
||||||
#else
|
#else
|
||||||
rc = rpmReadPackageHeader(fd, h, NULL, NULL, NULL);
|
rc = rpmReadPackageHeader(fd, h, NULL, NULL, NULL);
|
||||||
#endif
|
|
||||||
fdClose(fd);
|
fdClose(fd);
|
||||||
|
#endif
|
||||||
#if RPM_VERSION >= 0x040100
|
#if RPM_VERSION >= 0x040100
|
||||||
if (rc != RPMRC_OK && rc != RPMRC_NOTTRUSTED && rc != RPMRC_NOKEY) {
|
if (rc != RPMRC_OK && rc != RPMRC_NOTTRUSTED && rc != RPMRC_NOKEY) {
|
||||||
// fprintf(stderr, "Error: Failed reading file %s\n", headerFile);
|
// fprintf(stderr, "Error: Failed reading file %s\n", headerFile);
|
||||||
#else
|
#else
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
#endif
|
#endif
|
||||||
@ -146,8 +130,9 @@ getHeader(rpmts* ts, char *headerFile, Header * h)
|
|||||||
char *
|
char *
|
||||||
headerGetStringEntry(Header h, const int tag)
|
headerGetStringEntry(Header h, const int tag)
|
||||||
{
|
{
|
||||||
char *st = NULL;
|
const char *st = NULL;
|
||||||
|
|
||||||
|
#if RPM_VERSION_MAJOR >= 0x050000
|
||||||
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
||||||
|
|
||||||
he->tag = tag;
|
he->tag = tag;
|
||||||
@ -157,7 +142,10 @@ headerGetStringEntry(Header h, const int tag)
|
|||||||
st = NULL;
|
st = NULL;
|
||||||
|
|
||||||
//printf(" headerGetStringEntry tag:%d st:%s\n", he->tag, st);
|
//printf(" headerGetStringEntry tag:%d st:%s\n", he->tag, st);
|
||||||
he->p.ptr = _free(he->p.ptr);
|
he->p.ptr = _free(he->p.ptr);
|
||||||
|
#else
|
||||||
|
st = headerGetString(h, tag);
|
||||||
|
#endif
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,6 +154,7 @@ headerGetStringArrayEntry(Header h, const int tag, int* count)
|
|||||||
{
|
{
|
||||||
char **st;
|
char **st;
|
||||||
|
|
||||||
|
#if RPM_VERSION_MAJOR >= 0x050000
|
||||||
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
||||||
|
|
||||||
he->tag = tag;
|
he->tag = tag;
|
||||||
@ -180,15 +169,20 @@ headerGetStringArrayEntry(Header h, const int tag, int* count)
|
|||||||
//for (i=0; i < he->c; i++) {
|
//for (i=0; i < he->c; i++) {
|
||||||
//fprintf(stderr," headerGetStringArrayEntry tag:%d string %d/%d:%s\n", he->tag, i+1, he->c, st[i]);
|
//fprintf(stderr," headerGetStringArrayEntry tag:%d string %d/%d:%s\n", he->tag, i+1, he->c, st[i]);
|
||||||
//}
|
//}
|
||||||
he->p.ptr = _free(he->p.ptr);
|
he->p.ptr = _free(he->p.ptr);
|
||||||
|
#else
|
||||||
|
st = headerGetString(h, tag);
|
||||||
|
#endif
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
long long headerGetUIntEntry(Header h, const int tag) {
|
long long headerGetUIntEntry(Header h, const int tag) {
|
||||||
|
|
||||||
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
|
||||||
unsigned long long ret = -1;
|
unsigned long long ret = -1;
|
||||||
|
|
||||||
|
#if RPM_VERSION_MAJOR >= 0x050000
|
||||||
|
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
||||||
|
|
||||||
he->tag = tag;
|
he->tag = tag;
|
||||||
if (headerGet(h, he, 0) && he->c == 1) {
|
if (headerGet(h, he, 0) && he->c == 1) {
|
||||||
switch (he->t) {
|
switch (he->t) {
|
||||||
@ -212,15 +206,19 @@ long long headerGetUIntEntry(Header h, const int tag) {
|
|||||||
|
|
||||||
//fprintf(stderr," headerGetUIntEntry tag:%d uint %lld\n", he->tag, ret);
|
//fprintf(stderr," headerGetUIntEntry tag:%d uint %lld\n", he->tag, ret);
|
||||||
|
|
||||||
he->p.ptr = _free(he->p.ptr);
|
he->p.ptr = _free(he->p.ptr);
|
||||||
|
#else
|
||||||
|
ret = headerGetNumber(h, tag);
|
||||||
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *headerGetUIntArrayEntry(Header h, const int tag, int *count) {
|
void *headerGetUIntArrayEntry(Header h, const int tag, int *count) {
|
||||||
|
|
||||||
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
|
||||||
void *ret = NULL;
|
void *ret = NULL;
|
||||||
|
|
||||||
|
#if RPM_VERSION_MAJOR >= 0x050000
|
||||||
|
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
||||||
he->tag = tag;
|
he->tag = tag;
|
||||||
if (headerGet(h, he, 0) && he->c >= 1) {
|
if (headerGet(h, he, 0) && he->c >= 1) {
|
||||||
*count = he->c;
|
*count = he->c;
|
||||||
@ -233,7 +231,7 @@ void *headerGetUIntArrayEntry(Header h, const int tag, int *count) {
|
|||||||
break;
|
break;
|
||||||
case RPM_UINT32_TYPE:
|
case RPM_UINT32_TYPE:
|
||||||
ret = memndup(he->p.ui32p, *count * 4);
|
ret = memndup(he->p.ui32p, *count * 4);
|
||||||
//int i;
|
//int i;
|
||||||
//for (i=0; i<he->c; i++) {
|
//for (i=0; i<he->c; i++) {
|
||||||
// printf("%d ",((int_32 *)ret)[i]);
|
// printf("%d ",((int_32 *)ret)[i]);
|
||||||
//}
|
//}
|
||||||
@ -251,7 +249,10 @@ void *headerGetUIntArrayEntry(Header h, const int tag, int *count) {
|
|||||||
for (i=0; i < he->c; i++) {
|
for (i=0; i < he->c; i++) {
|
||||||
fprintf(stderr," headerGetUIntArrayEntry tag:%d value:%ld\n", he->tag, ((rpmuint32_t*)ret)[i]);
|
fprintf(stderr," headerGetUIntArrayEntry tag:%d value:%ld\n", he->tag, ((rpmuint32_t*)ret)[i]);
|
||||||
}*/
|
}*/
|
||||||
he->p.ptr = _free(he->p.ptr);
|
he->p.ptr = _free(he->p.ptr);
|
||||||
|
#else
|
||||||
|
ret = headerGetNumber(h, tag);
|
||||||
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,15 +317,15 @@ int rpmnamecmp(char *filename1, char *filename2, int checkver) {
|
|||||||
|
|
||||||
/* find name end position assuming a "name-version-release" scheme */
|
/* find name end position assuming a "name-version-release" scheme */
|
||||||
for (i = strlen(filename1)-1; (i > 0) && (f < 2); i--) {
|
for (i = strlen(filename1)-1; (i > 0) && (f < 2); i--) {
|
||||||
if (filename1[i] == '-') {
|
if (filename1[i] == '-') {
|
||||||
f++;
|
f++;
|
||||||
end1=i-1;
|
end1=i-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f=0;
|
f=0;
|
||||||
for (i = strlen(filename2)-1; (i > 0) && (f < 2); i--) {
|
for (i = strlen(filename2)-1; (i > 0) && (f < 2); i--) {
|
||||||
if (filename2[i] == '-') {
|
if (filename2[i] == '-') {
|
||||||
f++;
|
f++;
|
||||||
end2=i-1;
|
end2=i-1;
|
||||||
}
|
}
|
||||||
@ -339,12 +340,12 @@ int rpmnamecmp(char *filename1, char *filename2, int checkver) {
|
|||||||
if (c1 < c2) return -1;
|
if (c1 < c2) return -1;
|
||||||
else if (c1 > c2) return 1;
|
else if (c1 > c2) return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end1 < end2) return -1;
|
if (end1 < end2) return -1;
|
||||||
else if (end1 > end2) return 1;
|
else if (end1 > end2) return 1;
|
||||||
|
|
||||||
/* same name, sort by version */
|
/* same name, sort by version */
|
||||||
if (checkver)
|
if (checkver)
|
||||||
i=rpmvercmp(&filename2[i+1],&filename1[i+1]) * -1;
|
i=rpmvercmp(&filename2[i+1],&filename1[i+1]) * -1;
|
||||||
else
|
else
|
||||||
i=0;
|
i=0;
|
||||||
@ -357,7 +358,7 @@ int scanrpmnamecmp(const struct dirent **f1, const struct dirent **f2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char* printrpmversion(char *s, int bufsize, long epoch, char *version, char *release) {
|
char* printrpmversion(char *s, int bufsize, long epoch, char *version, char *release) {
|
||||||
|
|
||||||
if (strcmp(release,"")) {
|
if (strcmp(release,"")) {
|
||||||
if (epoch)
|
if (epoch)
|
||||||
snprintf(s,bufsize,"%ld:%s-%s",epoch,version,release);
|
snprintf(s,bufsize,"%ld:%s-%s",epoch,version,release);
|
||||||
@ -378,5 +379,6 @@ void rpminit() {
|
|||||||
// ts = rpmtsCreate();
|
// ts = rpmtsCreate();
|
||||||
// rpmtsSetVSFlags(ts, (rpmVSFlags_e)-1);
|
// rpmtsSetVSFlags(ts, (rpmVSFlags_e)-1);
|
||||||
#endif
|
#endif
|
||||||
|
sem_t rpm_mutex;
|
||||||
sem_init(&rpm_mutex, 0, 1);
|
sem_init(&rpm_mutex, 0, 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user