Skip to content

Commit

Permalink
Merge pull request #349 from oliverkurth/topic/okurth/metalink-plugin
Browse files Browse the repository at this point in the history
move metalink functionality to a plugin
  • Loading branch information
oliverkurth authored Oct 10, 2022
2 parents 80dc503 + 7f67626 commit b3dc18f
Show file tree
Hide file tree
Showing 24 changed files with 1,541 additions and 669 deletions.
4 changes: 0 additions & 4 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ add_library(${LIB_TDNF} SHARED
rpmtrans.c
updateinfo.c
utils.c
metalink.c
list.c
history.c
)

Expand All @@ -51,9 +49,7 @@ target_link_libraries(${LIB_TDNF}
${RPM_LIBRARIES}
${LibSolv_LIBRARIES}
${CURL_LIBRARIES}
${METALINK_LIBRARIES}
${OPENSSL_LIBRARIES}
${LIBXML2_LIBRARIES}
${SQLITE3_LIBRARIES}
)

Expand Down
14 changes: 0 additions & 14 deletions client/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,6 @@ typedef enum
{ERROR_TDNF_CURLE_FAILED_INIT, "ERROR_TDNF_CURLE_FAILED_INIT", "Curl Init Failed"},\
{ERROR_TDNF_CURLE_URL_MALFORMAT, "ERROR_TDNF_CURLE_URL_MALFORMAT", "URL seems to be corrupted. Please clean all and makecache"},\
{ERROR_TDNF_SYSTEM_BASE, "ERROR_TDNF_SYSTEM_BASE", "unknown system error"},\
{ERROR_TDNF_ML_PARSER_INVALID_DOC_OBJECT, "ERROR_TDNF_ML_PARSER_INVALID_DOC_OBJECT", "Failed to parse and create document tree"},\
{ERROR_TDNF_ML_PARSER_INVALID_ROOT_ELEMENT, "ERROR_TDNF_ML_PARSER_INVALID_ROOT_ELEMENT", "Root element not found"},\
{ERROR_TDNF_ML_PARSER_MISSING_FILE_ATTR, "ERROR_TDNF_ML_PARSER_MISSING_FILE_ATTR", "Missing filename in metalink file"},\
{ERROR_TDNF_ML_PARSER_INVALID_FILE_NAME, "ERROR_TDNF_ML_PARSER_INVALID_FILE_NAME", "Invalid filename present"},\
{ERROR_TDNF_ML_PARSER_MISSING_FILE_SIZE, "ERROR_TDNF_ML_PARSER_MISSING_FILE_SIZE", "Missing file size in metalink file"},\
{ERROR_TDNF_ML_PARSER_MISSING_HASH_ATTR, "ERROR_TDNF_ML_PARSER_MISSING_HASH_ATTR", "Missing attribute in hash tag"},\
{ERROR_TDNF_ML_PARSER_MISSING_HASH_CONTENT, "ERROR_TDNF_ML_PARSER_MISSING_HASH_CONTENT", "Missing content in hash tag value"},\
{ERROR_TDNF_ML_PARSER_MISSING_URL_ATTR, "ERROR_TDNF_ML_PARSER_MISSING_URL_ATTR", "Missing attribute in url tag"},\
{ERROR_TDNF_ML_PARSER_MISSING_HASH_CONTENT, "ERROR_TDNF_ML_PARSER_MISSING_URL_CONTENT", "Missing content in url tag value"},\
{ERROR_TDNF_HISTORY_NODB, "ERROR_TDNF_HISTORY_ERROR", "History database error"},\
{ERROR_TDNF_HISTORY_NODB, "ERROR_TDNF_HISTORY_NODB", "History database does not exist"},\
};
Expand All @@ -276,8 +267,3 @@ typedef void (*TDNF_ML_FREE_FUNC) (void* data);
#define TAG_NAME_HASH "hash"
#define TAG_NAME_URL "url"

#define ATTR_NAME (xmlChar*)"name"
#define ATTR_PROTOCOL (xmlChar*)"protocol"
#define ATTR_TYPE (xmlChar*)"type"
#define ATTR_LOCATION (xmlChar*)"location"
#define ATTR_PREFERENCE (xmlChar*)"preference"
1 change: 0 additions & 1 deletion client/includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

//libcurl
#include <curl/curl.h>
#include <libxml/parser.h>

#include "../history/history.h"

Expand Down
80 changes: 1 addition & 79 deletions client/prototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,32 +225,13 @@ TDNFFreeHistoryInfoItems(
int nCount
);

//remoterepo.c
uint32_t
TDNFCheckHexDigest(
const char *hex_digest,
int digest_length
);

uint32_t
TDNFChecksumFromHexDigest(
const char *hex_digest,
unsigned char *ppdigest
);

uint32_t
TDNFCheckRepoMDFileHashFromMetalink(
char *pszFile,
TDNF_ML_CTX *ml_ctx
);

uint32_t
TDNFParseAndGetURLFromMetalink(
PTDNF pTdnf,
const char *pszFile,
TDNF_ML_CTX *ml_ctx
);

//remoterepo.c
uint32_t
TDNFDownloadFileFromRepo(
PTDNF pTdnf,
Expand Down Expand Up @@ -1189,65 +1170,6 @@ TDNFListInternal(
TDNF_PKG_DETAIL nDetail
);

// metalink.c

uint32_t
TDNFMetalinkParseFile(
TDNF_ML_CTX *ml_ctx,
int fd,
const char *filename
);

void
TDNFMetalinkFree(
TDNF_ML_CTX *ml_ctx
);

uint32_t
TDNFXmlParseData(
TDNF_ML_CTX *ml_ctx,
xmlNode *node,
const char *filename
);

uint32_t
TDNFParseFileTag(
TDNF_ML_CTX *ml_ctx,
xmlNode *node,
const char *filename
);

uint32_t
TDNFParseHashTag(
TDNF_ML_CTX *ml_ctx,
xmlNode *node
);


uint32_t
TDNFParseUrlTag(
TDNF_ML_CTX *ml_ctx,
xmlNode *node
);

// list.c
void
TDNFSortListOnPreference(
TDNF_ML_LIST** headUrl
);

uint32_t
TDNFAppendList(
TDNF_ML_LIST** head_ref,
void *new_data
);

void
TDNFDeleteList(
TDNF_ML_LIST** head_ref,
TDNF_ML_FREE_FUNC free_func
);


uint32_t
TDNFGetHistoryCtx(
Expand Down
Loading

0 comments on commit b3dc18f

Please sign in to comment.