rpm
5.4.14
|
#include "system.h"
#include <rpmio_internal.h>
#include <rpmiotypes.h>
#include <rpmio.h>
#include <rpmlog.h>
#include <rpmurl.h>
#include <poptIO.h>
#include <rpmrepo.h>
#include <rpmtypes.h>
#include <rpmtag.h>
#include <pkgio.h>
#include <rpmts.h>
#include "debug.h"
#include "yum_primary_xml"
#include "yum_filelists_xml"
#include "yum_other_xml"
#include "wnh_primary_yaml"
#include "wnh_filelists_yaml"
#include "wnh_other_yaml"
#include "deb_Packages"
#include "deb_Sources"
#include "yum_primary_sqlite"
#include "yum_filelists_sqlite"
#include "yum_other_sqlite"
Go to the source code of this file.
Macros | |
#define | _RPMREPO_INTERNAL |
#define | REPODBG(_l) if (_rpmrepo_debug) fprintf _l |
Functions | |
static int | rpmioExists (const char *fn, struct stat *st) |
Return stat(2) for a file. More... | |
static time_t | rpmioCtime (const char *fn) |
Return stat(2) creation time of a file. More... | |
void | rpmrepoError (int lvl, const char *fmt,...) |
Print an error message and exit (if requested). More... | |
static const char * | rpmrepoGetPath (rpmrepo repo, const char *dir, const char *type, int compress) |
Return /repository/directory/component.markup.compression path. More... | |
static void | rpmrepoProgress (rpmrepo repo, const char *item, int current, int total) |
Display progress. More... | |
static int | rpmrepoMkdir (rpmrepo repo, const char *dn) |
Create directory path. More... | |
const char * | rpmrepoRealpath (const char *lpath) |
Return realpath(3) canonicalized absolute path. More... | |
int | rpmrepoTestSetupDirs (rpmrepo repo) |
Test for repository sanity. More... | |
static int | chkSuffix (const char *fn, const char *suffix) |
Check file name for a suffix. More... | |
const char ** | rpmrepoGetFileList (rpmrepo repo, const char *roots[], const char *ext) |
Walk file/directory trees, looking for files with an extension. More... | |
int | rpmrepoCheckTimeStamps (rpmrepo repo) |
Check that repository time stamp is newer than any contained package. More... | |
static int | rpmrfileXMLWrite (rpmrfile rfile, const char *spew) |
Write to a repository metadata file. More... | |
static int | rpmrepoFclose (rpmrepo repo, FD_t fd) |
Close an I/O stream, accumulating uncompress/digest statistics. More... | |
static int | rpmrepoOpenMDFile (const rpmrepo repo, rpmrfile rfile) |
Open a repository metadata file. More... | |
static int | rpmrepoRfileDigest (const rpmrepo repo, rpmrfile rfile, const char **digestp) |
Compute digest of a file. More... | |
static int | rpmrepoCloseMDFile (const rpmrepo repo, rpmrfile rfile) |
Close a repository metadata file. More... | |
static const char * | switch (algo) |
static const char * | rpmrepoMDExpand (rpmrepo repo, rpmrfile rfile) |
Return a repository metadata file item. More... | |
int | rpmrepoDoRepoMetadata (rpmrepo repo) |
Write repository manifest. More... | |
int | rpmrepoDoFinalMove (rpmrepo repo) |
Rename temporary repository to final paths. More... | |
static Header | rpmrepoReadHeader (rpmrepo repo, const char *path) |
Read a header from a repository package file, computing package file digest. More... | |
static const char * | rfileHeaderSprintf (Header h, const char *qfmt) |
Return header query. More... | |
static int | rpmrepoWriteMDFile (rpmrepo repo, rpmrfile rfile, Header h) |
Export a single package's metadata to repository metadata file(s). More... | |
static int | repoWriteMetadataDocs (rpmrepo repo) |
Export all package metadata to repository metadata file(s). More... | |
int | rpmrepoDoPkgMetadata (rpmrepo repo) |
Write repository metadata files. More... | |
static int | rpmrepoInitPopt (rpmrepo repo, char **av) |
static void | rpmrepoFini (void *_repo) |
static rpmrepo | rpmrepoGetPool (rpmioPool pool) |
rpmrepo | rpmrepoNew (char **av, int flags) |
Create and load a repo wrapper. More... | |
Variables | |
int | _rpmrepo_debug = 0 |
static const char | primary_xml_init [] |
static const char | primary_xml_fini [] = "</metadata>\n" |
static const char | filelists_xml_init [] |
static const char | filelists_xml_fini [] = "</filelists>\n" |
static const char | other_xml_init [] |
static const char | other_xml_fini [] = "</otherdata>\n" |
static const char | repomd_xml_init [] |
static const char | repomd_xml_fini [] = "</repomd>\n" |
static const char | primary_xml_qfmt [] = |
static const char | filelists_xml_qfmt [] = |
static const char | other_xml_qfmt [] = |
static const char | primary_yaml_qfmt [] = |
static const char | filelists_yaml_qfmt [] = |
static const char | other_yaml_qfmt [] = |
static const char | Packages_qfmt [] = |
static const char | Sources_qfmt [] = |
static const char * | primary_sql_init [] |
static const char * | filelists_sql_init [] |
static const char * | other_sql_init [] |
static const char | primary_sql_qfmt [] = |
static const char | filelists_sql_qfmt [] = |
static const char | other_sql_qfmt [] = |
static struct rpmrepo_s | __repo |
static rpmrepo | _repo = &__repo |
return | tagname |
static int | compression = -1 |
static struct poptOption | repoCompressionPoptTable [] |
static struct poptOption | _rpmrepoOptions [] |
static struct poptOption | rpmrepoOptionsTable [] |
rpmioPool | _rpmrepoPool = NULL |
#define REPODBG | ( | _l | ) | if (_rpmrepo_debug) fprintf _l |
|
static |
Check file name for a suffix.
fn | file name |
suffix | suffix |
Definition at line 614 of file rpmrepo.c.
References strcmp().
Referenced by rpmrepoGetFileList().
Export all package metadata to repository metadata file(s).
repo | repository |
Definition at line 1522 of file rpmrepo.c.
References headerFree, NULL, rc, rpmGetPath(), rpmrepoError(), rpmrepoProgress(), rpmrepoReadHeader(), rpmrepoWriteMDFile(), and void.
Referenced by rpmrepoDoPkgMetadata().
|
static |
Return header query.
h | header |
qfmt | query format |
Definition at line 1424 of file rpmrepo.c.
References _, assert(), headerSprintf(), NULL, rpmrepoError(), and s.
Referenced by rpmrepoWriteMDFile().
|
static |
Return stat(2) creation time of a file.
fn | file path |
Definition at line 412 of file rpmrepo.c.
References rpmioExists().
Referenced by rpmrepoCloseMDFile().
|
static |
Return stat(2) for a file.
st | stat(2) buffer |
Definition at line 400 of file rpmrepo.c.
References Stat().
Referenced by rpmioCtime(), rpmrepoCheckTimeStamps(), rpmrepoDoFinalMove(), rpmrepoDoRepoMetadata(), rpmrepoRfileDigest(), and rpmrepoTestSetupDirs().
Check that repository time stamp is newer than any contained package.
repo | repository |
Definition at line 681 of file rpmrepo.c.
References _, NULL, rc, rpmioExists(), rpmrepoError(), and st.
Referenced by if().
Close a repository metadata file.
repo | repository |
rfile | repository metadata file |
Definition at line 976 of file rpmrepo.c.
References _, _free(), fdFiniDigest(), fdGetOPath(), NULL, rc, rpmGetPath(), rpmioCtime(), rpmrepoError(), rpmrepoFclose(), rpmrepoRfileDigest(), rpmrfileXMLWrite(), void, xstrdup(), and xx.
Referenced by rpmrepoDoPkgMetadata().
Rename temporary repository to final paths.
repo | repository |
Definition at line 1264 of file rpmrepo.c.
References _, _free(), errno, _ftsent::fts_accpath, Fts_close(), FTS_DP, FTS_F, _ftsent::fts_info, _ftsent::fts_level, _ftsent::fts_name, FTS_NOCHDIR, Fts_open(), _ftsent::fts_path, FTS_PHYSICAL, Fts_read(), FTS_SL, FTS_SLNONE, FTS_XDEV, int, NULL, p, Rename(), Rmdir(), rpmGetPath(), rpmioExists(), rpmrepoError(), st, t, Unlink(), and xx.
Write repository metadata files.
repo | repository |
Definition at line 1569 of file rpmrepo.c.
References _free(), argvAdd(), argvCount(), argvFree(), fprintf(), NULL, path, rc, Realpath(), repoWriteMetadataDocs(), rpmGetPath(), rpmrepoCloseMDFile(), rpmrepoGetFileList(), rpmrepoOpenMDFile(), and xstrdup().
Write repository manifest.
repo | repository |
Definition at line 1078 of file rpmrepo.c.
References _, _free(), fn, Fopen(), NULL, rc, Rename(), rpmExpand(), rpmGetPath(), rpmioExists(), rpmrepoError(), rpmrepoFclose(), rpmrepoGetPath(), rpmrepoMDExpand(), rpmrfileXMLWrite(), st, strcmp(), Unlink(), void, and xstrdup().
Print an error message and exit (if requested).
lvl | error level (non-zero exits) |
fmt | msg format |
Definition at line 427 of file rpmrepo.c.
References __progname, exit, EXIT_FAILURE, fprintf(), NULL, and void.
Referenced by if(), repoWriteMetadataDocs(), rfileHeaderSprintf(), rpmrepoCheckTimeStamps(), rpmrepoCloseMDFile(), rpmrepoDoFinalMove(), rpmrepoDoRepoMetadata(), rpmrepoGetFileList(), rpmrepoInitPopt(), rpmrepoMkdir(), rpmrepoOpenMDFile(), rpmrepoTestSetupDirs(), and rpmrfileXMLWrite().
Close an I/O stream, accumulating uncompress/digest statistics.
repo | repository |
fd | I/O stream |
Definition at line 733 of file rpmrepo.c.
References Fclose(), FDSTAT_DIGEST, fdstat_op(), FDSTAT_READ, NULL, rc, rpmswAdd(), RPMTS_OP_DIGEST, RPMTS_OP_UNCOMPRESS, rpmtsOp(), and void.
Referenced by rpmrepoCloseMDFile(), rpmrepoDoRepoMetadata(), and rpmrepoRfileDigest().
Definition at line 1849 of file rpmrepo.c.
References _free(), _repo, argvFree(), mireFreeAll(), and repo.
Referenced by rpmrepoGetPool().
const char** rpmrepoGetFileList | ( | rpmrepo | repo, |
const char * | roots[], | ||
const char * | ext | ||
) |
Walk file/directory trees, looking for files with an extension.
repo | repository |
roots | file/directory trees to search |
ext | file extension to match (usually ".rpm") |
Definition at line 622 of file rpmrepo.c.
References _, argvAdd(), argvPrint(), chkSuffix(), errno, Fts_close(), FTS_D, FTS_DP, FTS_F, _ftsent::fts_info, _ftsent::fts_level, _ftsent::fts_name, _ftsent::fts_namelen, Fts_open(), _ftsent::fts_path, Fts_read(), FTS_SL, mireApply(), NULL, p, rpmrepoError(), t, void, and xx.
Referenced by rpmrepoDoPkgMetadata().
|
static |
Return /repository/directory/component.markup.compression path.
repo | repository |
dir | directory |
type | file |
Definition at line 448 of file rpmrepo.c.
References NULL, and rpmGetPath().
Referenced by rpmrepoDoRepoMetadata(), rpmrepoOpenMDFile(), rpmrepoRfileDigest(), and rpmrepoTestSetupDirs().
Definition at line 1881 of file rpmrepo.c.
References _rpmrepoPool, memset(), NULL, repo, rpmioGetPool(), rpmioNewPool(), and rpmrepoFini().
Referenced by rpmrepoNew().
Definition at line 1730 of file rpmrepo.c.
References _, _free(), _repo, ac, argvAdd(), argvCount(), assert(), errno, FTS_LOGICAL, FTS_PHYSICAL, fullpath, i, MAXPATHLEN, nb, NULL, PGPHASHALGO_SHA1, poptContext, rc, rpmExpand(), rpmGenPath(), rpmGetPath(), rpmioDigestHashAlgo, rpmioFtsOpts, rpmioInit(), rpmIsDebug, rpmIsVerbose, rpmrepoError(), rpmrepoRealpath(), Stat(), strncpy(), URL_IS_DASH, URL_IS_UNKNOWN, urlPath(), and xx.
Referenced by rpmrepoNew().
Return a repository metadata file item.
repo | repository |
Definition at line 1061 of file rpmrepo.c.
References NULL, rpmExpand(), snprintf(), unsigned, and void.
Referenced by rpmrepoDoRepoMetadata().
Create directory path.
repo | repository |
dn | directory path |
Definition at line 494 of file rpmrepo.c.
References _, _free(), errno, Mkdir(), NULL, rc, rpmGetPath(), rpmioMkpath(), rpmrepoError(), URL_IS_UNKNOWN, and urlPath().
Referenced by rpmrepoTestSetupDirs().
Create and load a repo wrapper.
av | repo argv |
flags | repo flags |
Definition at line 1897 of file rpmrepo.c.
References repo, rpmrepoGetPool(), rpmrepoInitPopt(), rpmrepoLink(), and xx.
Open a repository metadata file.
repo | repository |
rfile | repository metadata file |
Definition at line 759 of file rpmrepo.c.
References _, _free(), assert(), buf, fdInitDigest(), fn, Fopen(), Fstrerror(), Fwrite(), msg, nb, NULL, PGPHASHALGO_NONE, rc, rpmGetPath(), rpmrepoError(), rpmrepoGetPath(), snprintf(), and xx.
Referenced by rpmrepoDoPkgMetadata().
Display progress.
repo | repository |
item | repository item (usually a file path) |
current | current iteration index |
total | maximum iteration index |
Definition at line 465 of file rpmrepo.c.
References __progname, fprintf(), nb, NULL, and void.
Referenced by repoWriteMetadataDocs().
Read a header from a repository package file, computing package file digest.
repo | repository |
path | package file path |
Definition at line 1360 of file rpmrepo.c.
References _, __progname, _free(), headerToken_s::baseurl, digest, Fclose(), fd, fdFiniDigest(), fdInitDigest(), Ferror(), Fopen(), fprintf(), Fread(), Fstrerror(), h, headerFree, headerSetBaseURL(), headerSetDigest(), headerSetInstance(), nb, nr, NULL, PGPHASHALGO_NONE, rpmrc, RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTFOUND, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile(), and void.
Referenced by repoWriteMetadataDocs().
const char* rpmrepoRealpath | ( | const char * | lpath | ) |
Return realpath(3) canonicalized absolute path.
lpath | file path |
Definition at line 515 of file rpmrepo.c.
References fullpath, MAXPATHLEN, NULL, Realpath(), and xstrdup().
Referenced by if(), and rpmrepoInitPopt().
Compute digest of a file.
Definition at line 902 of file rpmrepo.c.
References _free(), buf, ctx, exit, fd, fdFiniDigest(), fdInitDigest(), Ferror(), Fileno(), fn, Fopen(), Fread(), memset(), nb, NULL, op, path, rc, RPMDIGEST_NONE, rpmDigestFinal(), rpmDigestInit(), rpmDigestUpdate(), rpmioExists(), rpmrepoFclose(), rpmrepoGetPath(), rpmswEnter(), rpmswExit(), RPMTS_OP_DIGEST, rpmtsOp(), st, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), and xx.
Referenced by rpmrepoCloseMDFile().
Test for repository sanity.
repo | repository |
Definition at line 530 of file rpmrepo.c.
References _, _free(), Access(), fn, NULL, rc, rpmGetPath(), rpmioExists(), rpmrepoError(), rpmrepoGetPath(), rpmrepoMkdir(), st, strcmp(), and W_OK.
Export a single package's metadata to repository metadata file(s).
repo | repository |
rfile | repository metadata file |
h | header |
Definition at line 1496 of file rpmrepo.c.
References NULL, rc, rfileHeaderSprintf(), and rpmrfileXMLWrite().
Referenced by repoWriteMetadataDocs().
Write to a repository metadata file.
rfile | repository metadata file |
spew | contents |
Definition at line 709 of file rpmrepo.c.
References _, _free(), Fstrerror(), Fwrite(), nb, NULL, rc, and rpmrepoError().
Referenced by rpmrepoCloseMDFile(), rpmrepoDoRepoMetadata(), and rpmrepoWriteMDFile().
static const char* switch | ( | algo | ) |
Definition at line 1028 of file rpmrepo.c.
References NULL, PGPHASHALGO_ADLER32, PGPHASHALGO_CRC32, PGPHASHALGO_CRC64, PGPHASHALGO_HAVAL_5_160, PGPHASHALGO_JLU32, PGPHASHALGO_MD2, PGPHASHALGO_MD4, PGPHASHALGO_MD5, PGPHASHALGO_NONE, PGPHASHALGO_RIPEMD128, PGPHASHALGO_RIPEMD160, PGPHASHALGO_RIPEMD256, PGPHASHALGO_RIPEMD320, PGPHASHALGO_SALSA10, PGPHASHALGO_SALSA20, PGPHASHALGO_SHA1, PGPHASHALGO_SHA224, PGPHASHALGO_SHA256, PGPHASHALGO_SHA384, PGPHASHALGO_SHA512, and PGPHASHALGO_TIGER192.
Definition at line 391 of file rpmrepo.c.
Referenced by rpmrepoFini(), and rpmrepoInitPopt().
Definition at line 1879 of file rpmrepo.c.
Referenced by rpmrepoGetPool().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
return tagname |
Definition at line 1053 of file rpmrepo.c.
Referenced by addRpmTags().