rpm
5.2.1
|
#include "system.h"
#include <rpmio_internal.h>
#include <fts.h>
#include <argv.h>
#include <mire.h>
#include <poptIO.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.
Data Structures | |
struct | rpmrfile_s |
Repository metadata file. More... | |
struct | rpmrepo_s |
Repository. More... | |
Typedefs | |
typedef struct rpmrepo_s * | rpmrepo |
typedef struct rpmrfile_s * | rpmrfile |
Functions | |
static void | repo_error (int lvl, const char *fmt,...) |
Print an error message and exit (if requested). | |
static void | repoProgress (rpmrepo repo, const char *item, int current, int total) |
Display progress. | |
static int | rpmioExists (const char *fn, struct stat *st) |
Return stat(2) for a file. | |
static time_t | rpmioCtime (const char *fn) |
Return stat(2) creation time of a file. | |
static const char * | repoRealpath (const char *lpath) |
Return realpath(3) canonicalized absolute path. | |
static int | repoMkdir (rpmrepo repo, const char *dn) |
Create directory path. | |
static const char * | repoGetPath (rpmrepo repo, const char *dir, const char *type, int compress) |
Return /repository/directory/component.markup.compression path. | |
static int | repoTestSetupDirs (rpmrepo repo) |
Test for repository sanity. | |
static int | chkSuffix (const char *fn, const char *suffix) |
Check file name for a suffix. | |
static const char ** | repoGetFileList (rpmrepo repo, const char *roots[], const char *ext) |
Walk file/directory trees, looking for files with an extension. | |
static int | repoCheckTimeStamps (rpmrepo repo) |
Check that repository time stamp is newer than any contained package. | |
static int | rfileXMLWrite (rpmrfile rfile, const char *spew) |
Write to a repository metadata file. | |
static int | repoFclose (rpmrepo repo, FD_t fd) |
Close an I/O stream, accumulating uncompress/digest statistics. | |
static int | repoOpenMDFile (const rpmrepo repo, rpmrfile rfile) |
Open a repository metadata file. | |
static Header | repoReadHeader (rpmrepo repo, const char *path) |
Read a header from a repository package file, computing package file digest. | |
static const char * | rfileHeaderSprintf (Header h, const char *qfmt) |
Return header query. | |
static int | repoWriteMDFile (rpmrepo repo, rpmrfile rfile, Header h) |
Export a single package's metadata to repository metadata file(s). | |
static int | repoWriteMetadataDocs (rpmrepo repo, const char **pkglist) |
Export all package metadata to repository metadata file(s). | |
static int | repoRfileDigest (const rpmrepo repo, rpmrfile rfile, const char **digestp) |
Compute digest of a file. | |
static int | repoCloseMDFile (const rpmrepo repo, rpmrfile rfile) |
Close a repository metadata file. | |
static int | repoDoPkgMetadata (rpmrepo repo) |
Write repository metadata files. | |
static const char * | algo2tagname (uint32_t algo) |
static const char * | repoMDExpand (rpmrepo repo, rpmrfile rfile) |
Return a repository metadata file item. | |
static int | repoDoRepoMetadata (rpmrepo repo) |
Write repository manifest. | |
static int | repoDoFinalMove (rpmrepo repo) |
Rename temporary repository to final paths. | |
static void | repoArgCallback (poptContext con, enum poptCallbackReason reason, const struct poptOption *opt, const char *arg, void *data) |
int | main (int argc, char *argv[]) |
Variables | |
static int | _repo_debug |
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 | __rpmrepo |
static rpmrepo | _rpmrepo = &__rpmrepo |
static int | compression = -1 |
static struct poptOption | repoCompressionPoptTable [] |
static struct poptOption | optionsTable [] |
typedef struct rpmrfile_s* rpmrfile |
|
static |
Definition at line 1471 of file rpmrepo.c.
References 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.
Referenced by repoDoRepoMetadata(), and repoMDExpand().
|
static |
Check file name for a suffix.
fn | file name |
suffix | suffix |
Definition at line 758 of file rpmrepo.c.
Referenced by repoGetFileList().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 1945 of file rpmrepo.c.
References _, __progname, _free(), _rpmrepo, _rpmsw_stats, _rpmts_stats, _RPMVSF_NOSIGNATURES, rpmrepo_s::algo, argvAdd(), argvAppend(), argvCount(), argvFree(), argvPrint(), argvSort(), rpmrepo_s::basedir, rpmrepo_s::checkts, rpmrepo_s::compression, rpmrfile_s::digest, rpmrepo_s::directories, rpmrepo_s::dryrun, errno, rpmrepo_s::exclude_patterns, rpmrepo_s::excludeMire, rpmrepo_s::filelists, FTS_LOGICAL, FTS_PHYSICAL, rpmrepo_s::ftsoptions, rpmrepo_s::include_patterns, rpmrepo_s::includeMire, rpmrepo_s::manifests, MAXPATHLEN, mireFreeAll(), mireLoadPatterns(), rpmrepo_s::nexcludes, rpmrepo_s::nincludes, rpmrepo_s::other, rpmrepo_s::outputdir, PGPHASHALGO_SHA1, rpmrepo_s::pkgcount, rpmrepo_s::pkglist, rpmrepo_s::primary, repo_error(), repoCheckTimeStamps(), repoDoFinalMove(), repoDoPkgMetadata(), repoDoRepoMetadata(), repoGetFileList(), rpmrepo_s::repomd, repoRealpath(), repoTestSetupDirs(), rpmExpand(), rpmGenPath(), rpmGetPath(), rpmioDigestHashAlgo, rpmioFini(), rpmioFtsOpts, rpmioInit(), RPMMIRE_GLOB, rpmtsCreate(), rpmtsFree(), rpmtsSetVSFlags(), rpmrepo_s::split, Stat(), rpmrepo_s::suffix, tagClean(), rpmrepo_s::ts, URL_IS_DASH, URL_IS_UNKNOWN, urlPath(), rpmrepo_s::wmode, xstrdup(), and rpmrfile_s::Zdigest.
|
static |
Print an error message and exit (if requested).
lvl | error level (non-zero exits) |
fmt | msg format |
Definition at line 526 of file rpmrepo.c.
References __progname, and EXIT_FAILURE.
Referenced by main(), repoCheckTimeStamps(), repoCloseMDFile(), repoDoFinalMove(), repoDoRepoMetadata(), repoGetFileList(), repoMkdir(), repoOpenMDFile(), repoTestSetupDirs(), repoWriteMetadataDocs(), rfileHeaderSprintf(), and rfileXMLWrite().
|
static |
Definition at line 1830 of file rpmrepo.c.
References _, __progname, _rpmrepo, EXIT_FAILURE, and rpmrepo_s::verbose.
|
static |
Check that repository time stamp is newer than any contained package.
repo | repository |
Definition at line 840 of file rpmrepo.c.
References _, rpmrepo_s::checkts, rpmrepo_s::mdtimestamp, rpmrepo_s::pkglist, repo_error(), and rpmioExists().
Referenced by main().
Close a repository metadata file.
repo | repository |
rfile | repository metadata file |
Definition at line 1342 of file rpmrepo.c.
References _, _free(), rpmrepo_s::algo, rpmrfile_s::ctime, rpmrfile_s::digest, rpmrfile_s::fd, fdFiniDigest(), fdGetOPath(), rpmrepo_s::outputdir, rpmrepo_s::quiet, repo_error(), repoFclose(), repoRfileDigest(), rfileXMLWrite(), rpmGetPath(), rpmioCtime(), rpmrepo_s::tempdir, rpmrfile_s::type, rpmrfile_s::xml_fini, xstrdup(), and rpmrfile_s::Zdigest.
Referenced by repoDoPkgMetadata().
|
static |
Rename temporary repository to final paths.
repo | repository |
Definition at line 1724 of file rpmrepo.c.
References _, _free(), Closedir(), dirent, errno, rpmrepo_s::finaldir, rpmrepo_s::markup, rpmrepo_s::olddir, Opendir(), rpmrepo_s::outputdir, Readdir(), Rename(), repo_error(), Rmdir(), rpmGetPath(), rpmioExists(), rpmrepo_s::suffix, rpmrepo_s::tempdir, and Unlink().
Referenced by main().
|
static |
Write repository metadata files.
repo | repository |
Definition at line 1391 of file rpmrepo.c.
References _free(), argvAdd(), argvCount(), argvFree(), rpmrepo_s::basedir, rpmrepo_s::baseurl, rpmrepo_s::current, rpmrepo_s::directories, rpmrepo_s::filelists, rpmrepo_s::other, rpmrepo_s::pkgcount, rpmrepo_s::pkglist, rpmrepo_s::primary, rpmrepo_s::quiet, Realpath(), repoCloseMDFile(), repoGetFileList(), repoOpenMDFile(), repoWriteMetadataDocs(), rpmGetPath(), and xstrdup().
Referenced by main().
|
static |
Write repository manifest.
repo | repository |
Definition at line 1531 of file rpmrepo.c.
References _, _free(), rpmrepo_s::algo, algo2tagname(), rpmrepo_s::baseurl, rpmrfile_s::fd, rpmrepo_s::filelists, rpmrepo_s::finaldir, Fopen(), rpmrepo_s::markup, rpmrepo_s::other, rpmrepo_s::outputdir, rpmrepo_s::primary, rpmrepo_s::quiet, Rename(), repo_error(), repoFclose(), repoGetPath(), rpmrepo_s::repomd, repoMDExpand(), rfileXMLWrite(), rpmExpand(), rpmGetPath(), rpmioExists(), rpmrepo_s::suffix, rpmrepo_s::tempdir, rpmrfile_s::type, rpmrepo_s::uniquemdfilenames, Unlink(), rpmrepo_s::verbose, rpmrfile_s::xml_fini, rpmrfile_s::xml_init, and xstrdup().
Referenced by main().
Close an I/O stream, accumulating uncompress/digest statistics.
repo | repository |
fd | I/O stream |
Definition at line 894 of file rpmrepo.c.
References Fclose(), FDSTAT_DIGEST, fdstat_op(), FDSTAT_READ, rpmswAdd(), RPMTS_OP_DIGEST, RPMTS_OP_UNCOMPRESS, rpmtsOp(), and rpmrepo_s::ts.
Referenced by repoCloseMDFile(), repoDoRepoMetadata(), and repoRfileDigest().
|
static |
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 774 of file rpmrepo.c.
References _, argvAdd(), argvPrint(), chkSuffix(), errno, rpmrepo_s::excludeMire, 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, rpmrepo_s::ftsoptions, rpmrepo_s::includeMire, mireApply(), rpmrepo_s::nexcludes, rpmrepo_s::nincludes, rpmrepo_s::nofollow, and repo_error().
Referenced by main(), and repoDoPkgMetadata().
|
static |
Return /repository/directory/component.markup.compression path.
repo | repository |
dir | directory |
type | file |
Definition at line 657 of file rpmrepo.c.
References rpmrepo_s::markup, rpmrepo_s::outputdir, rpmGetPath(), and rpmrepo_s::suffix.
Referenced by repoDoRepoMetadata(), repoOpenMDFile(), repoRfileDigest(), and repoTestSetupDirs().
Return a repository metadata file item.
repo | repository |
Definition at line 1509 of file rpmrepo.c.
References rpmrepo_s::algo, algo2tagname(), rpmrfile_s::ctime, rpmrfile_s::digest, rpmrepo_s::finaldir, rpmrepo_s::markup, rpmExpand(), snprintf(), rpmrepo_s::suffix, rpmrfile_s::type, and rpmrfile_s::Zdigest.
Referenced by repoDoRepoMetadata().
|
static |
Create directory path.
repo | repository |
dn | directory path |
Definition at line 629 of file rpmrepo.c.
References _, _free(), errno, Mkdir(), rpmrepo_s::outputdir, repo_error(), rpmGetPath(), rpmioMkpath(), URL_IS_UNKNOWN, and urlPath().
Referenced by repoTestSetupDirs().
Open a repository metadata file.
repo | repository |
rfile | repository metadata file |
Definition at line 917 of file rpmrepo.c.
References _, _free(), rpmrepo_s::algo, rpmrfile_s::fd, fdInitDigest(), Fopen(), Fstrerror(), Fwrite(), rpmrepo_s::outputdir, PGPHASHALGO_NONE, rpmrepo_s::pkgcount, repo_error(), repoGetPath(), rpmGetPath(), snprintf(), rpmrfile_s::sql_init, rpmrepo_s::tempdir, rpmrfile_s::type, rpmrepo_s::wmode, and rpmrfile_s::xml_init.
Referenced by repoDoPkgMetadata().
|
static |
Display progress.
repo | repository |
item | repository item (usually a file path) |
current | current iteration index |
total | maximum iteration index |
Definition at line 549 of file rpmrepo.c.
References __progname.
Referenced by repoWriteMetadataDocs().
Read a header from a repository package file, computing package file digest.
repo | repository |
path | package file path |
Definition at line 982 of file rpmrepo.c.
References _, __progname, _free(), rpmrepo_s::baseurl, Fclose(), fdFiniDigest(), fdInitDigest(), Ferror(), Fopen(), Fread(), Fstrerror(), headerFree(), headerSetBaseURL(), headerSetDigest(), PGPHASHALGO_NONE, rpmrepo_s::pkgalgo, RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTFOUND, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile(), and rpmrepo_s::ts.
Referenced by repoWriteMetadataDocs().
|
static |
Return realpath(3) canonicalized absolute path.
lpath | file path canonicalized absolute path |
Definition at line 607 of file rpmrepo.c.
References MAXPATHLEN, Realpath(), and xstrdup().
Referenced by main().
Compute digest of a file.
Definition at line 1273 of file rpmrepo.c.
References _free(), rpmrepo_s::algo, fdFiniDigest(), fdInitDigest(), Ferror(), Fileno(), Fopen(), Fread(), repoFclose(), repoGetPath(), RPMDIGEST_NONE, rpmDigestFinal(), rpmDigestInit(), rpmDigestUpdate(), rpmioExists(), rpmswEnter(), rpmswExit(), RPMTS_OP_DIGEST, rpmtsOp(), rpmrepo_s::tempdir, rpmrepo_s::ts, rpmrfile_s::type, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().
Referenced by repoCloseMDFile().
|
static |
Test for repository sanity.
repo | repository |
Definition at line 672 of file rpmrepo.c.
References _, _free(), Access(), rpmrepo_s::checkts, rpmrepo_s::directories, rpmrepo_s::finaldir, rpmrepo_s::mdtimestamp, rpmrepo_s::olddir, rpmrepo_s::outputdir, repo_error(), repoGetPath(), repoMkdir(), rpmGetPath(), rpmioExists(), rpmrepo_s::split, rpmrepo_s::tempdir, and W_OK.
Referenced by main().
Export a single package's metadata to repository metadata file(s).
repo | repository |
rfile | repository metadata file |
h | header |
Definition at line 1194 of file rpmrepo.c.
References rfileHeaderSprintf(), rfileXMLWrite(), rpmrfile_s::sql_qfmt, and rpmrfile_s::xml_qfmt.
Referenced by repoWriteMetadataDocs().
|
static |
Export all package metadata to repository metadata file(s).
repo | repository |
pkglist | repository packages |
Definition at line 1221 of file rpmrepo.c.
References _, rpmrepo_s::basedir, rpmrepo_s::baseurl, rpmrepo_s::current, rpmrepo_s::directories, errno, rpmrepo_s::filelists, headerFree(), headerSetInstance(), rpmrepo_s::other, rpmrepo_s::pkgcount, rpmrepo_s::primary, rpmrepo_s::quiet, repo_error(), repoProgress(), repoReadHeader(), repoWriteMDFile(), rpmGetPath(), and rpmrepo_s::verbose.
Referenced by repoDoPkgMetadata().
|
static |
Return header query.
h | header |
qfmt | query format |
Definition at line 1044 of file rpmrepo.c.
References _, headerSprintf(), and repo_error().
Referenced by repoWriteMDFile().
|
static |
Write to a repository metadata file.
rfile | repository metadata file |
spew | contents |
Definition at line 870 of file rpmrepo.c.
References _, _free(), rpmrfile_s::fd, Fstrerror(), Fwrite(), and repo_error().
Referenced by repoCloseMDFile(), repoDoRepoMetadata(), and repoWriteMDFile().
|
static |
Return stat(2) creation time of a file.
fn | file path |
Definition at line 589 of file rpmrepo.c.
References rpmioExists().
Referenced by repoCloseMDFile().
|
static |
Return stat(2) for a file.
st | stat(2) buffer |
Definition at line 577 of file rpmrepo.c.
References Stat().
Referenced by repoCheckTimeStamps(), repoDoFinalMove(), repoDoRepoMetadata(), repoRfileDigest(), repoTestSetupDirs(), and rpmioCtime().
Definition at line 516 of file rpmrepo.c.
Referenced by main(), and repoArgCallback().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |