diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | lib/rpmcli.h | 77 | ||||
-rw-r--r-- | lib/rpmvf.h | 94 | ||||
-rw-r--r-- | preinstall.am | 4 |
4 files changed, 100 insertions, 76 deletions
diff --git a/Makefile.am b/Makefile.am index 4fc6c5000..1913e9450 100644 --- a/Makefile.am +++ b/Makefile.am @@ -68,6 +68,7 @@ pkginclude_HEADERS += lib/rpmtag.h pkginclude_HEADERS += lib/rpmte.h pkginclude_HEADERS += lib/rpmts.h pkginclude_HEADERS += lib/rpmtypes.h +pkginclude_HEADERS += lib/rpmvf.h pkginclude_HEADERS += build/rpmbuild.h pkginclude_HEADERS += build/rpmfc.h diff --git a/lib/rpmcli.h b/lib/rpmcli.h index 425fde0ff..3936f15c1 100644 --- a/lib/rpmcli.h +++ b/lib/rpmcli.h @@ -12,6 +12,7 @@ #include <rpm/rpmcallback.h> #include <rpm/rpmts.h> #include <rpm/rpmfi.h> +#include <rpm/rpmvf.h> #include <rpm/argv.h> #ifdef __cplusplus @@ -101,32 +102,6 @@ typedef enum rpmQVSources_e { } rpmQVSources; /** \ingroup rpmcli - * Bit(s) for rpmVerifyFile() attributes and result. - */ -typedef enum rpmVerifyAttrs_e { - RPMVERIFY_NONE = 0, /*!< */ - RPMVERIFY_MD5 = (1 << 0), /*!< from %verify(md5) */ - RPMVERIFY_FILESIZE = (1 << 1), /*!< from %verify(size) */ - RPMVERIFY_LINKTO = (1 << 2), /*!< from %verify(link) */ - RPMVERIFY_USER = (1 << 3), /*!< from %verify(user) */ - RPMVERIFY_GROUP = (1 << 4), /*!< from %verify(group) */ - RPMVERIFY_MTIME = (1 << 5), /*!< from %verify(mtime) */ - RPMVERIFY_MODE = (1 << 6), /*!< from %verify(mode) */ - RPMVERIFY_RDEV = (1 << 7), /*!< from %verify(rdev) */ - /* bits 8-14 unused, reserved for rpmVerifyAttrs */ - RPMVERIFY_CONTEXTS = (1 << 15), /*!< verify: from --nocontexts */ - /* bits 16-22 used in rpmVerifyFlags */ - /* bits 23-27 used in rpmQueryFlags */ - RPMVERIFY_READLINKFAIL= (1 << 28), /*!< readlink failed */ - RPMVERIFY_READFAIL = (1 << 29), /*!< file read failed */ - RPMVERIFY_LSTATFAIL = (1 << 30), /*!< lstat failed */ - RPMVERIFY_LGETFILECONFAIL = (1 << 31) /*!< lgetfilecon failed */ -} rpmVerifyAttrs; -#define RPMVERIFY_ALL ~(RPMVERIFY_NONE) -#define RPMVERIFY_FAILURES \ - (RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL|RPMVERIFY_LGETFILECONFAIL) - -/** \ingroup rpmcli * Bit(s) to control rpmQuery() operation, stored in qva_flags. * @todo Merge rpmQueryFlags, rpmVerifyFlags, and rpmVerifyAttrs?. */ @@ -166,44 +141,6 @@ typedef enum rpmQueryFlags_e { extern rpmQueryFlags rpmcliQueryFlags; /** \ingroup rpmcli - * Bit(s) to control rpmVerify() operation, stored in qva_flags. - * @todo Merge rpmQueryFlags, rpmVerifyFlags, and rpmVerifyAttrs values?. - */ -typedef enum rpmVerifyFlags_e { - VERIFY_DEFAULT = 0, /*!< */ - VERIFY_MD5 = (1 << 0), /*!< from --nomd5 */ - VERIFY_SIZE = (1 << 1), /*!< from --nosize */ - VERIFY_LINKTO = (1 << 2), /*!< from --nolinkto */ - VERIFY_USER = (1 << 3), /*!< from --nouser */ - VERIFY_GROUP = (1 << 4), /*!< from --nogroup */ - VERIFY_MTIME = (1 << 5), /*!< from --nomtime */ - VERIFY_MODE = (1 << 6), /*!< from --nomode */ - VERIFY_RDEV = (1 << 7), /*!< from --nodev */ - /* bits 8-14 unused, reserved for rpmVerifyAttrs */ - VERIFY_CONTEXTS = (1 << 15), /*!< verify: from --nocontexts */ - VERIFY_FILES = (1 << 16), /*!< verify: from --nofiles */ - VERIFY_DEPS = (1 << 17), /*!< verify: from --nodeps */ - VERIFY_SCRIPT = (1 << 18), /*!< verify: from --noscripts */ - VERIFY_DIGEST = (1 << 19), /*!< verify: from --nodigest */ - VERIFY_SIGNATURE = (1 << 20), /*!< verify: from --nosignature */ - VERIFY_PATCHES = (1 << 21), /*!< verify: from --nopatches */ - VERIFY_HDRCHK = (1 << 22), /*!< verify: from --nohdrchk */ - VERIFY_FOR_LIST = (1 << 23), /*!< query: from --list */ - VERIFY_FOR_STATE = (1 << 24), /*!< query: from --state */ - VERIFY_FOR_DOCS = (1 << 25), /*!< query: from --docfiles */ - VERIFY_FOR_CONFIG = (1 << 26), /*!< query: from --configfiles */ - VERIFY_FOR_DUMPFILES= (1 << 27) /*!< query: from --dump */ - /* bits 28-31 used in rpmVerifyAttrs */ -} rpmVerifyFlags; - -#define VERIFY_ATTRS \ - ( VERIFY_MD5 | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \ - VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV | VERIFY_CONTEXTS ) -#define VERIFY_ALL \ - ( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST |\ - VERIFY_SIGNATURE | VERIFY_HDRCHK ) - -/** \ingroup rpmcli */ typedef struct rpmQVKArguments_s * QVA_t; @@ -342,18 +279,6 @@ int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_t argv); int rpmcliQuery(rpmts ts, QVA_t qva, const char ** argv); /** \ingroup rpmcli - * Verify file attributes (including MD5 sum). - * @todo gnorpm and python bindings prevent this from being static. - * @param ts transaction set - * @param fi file info (with linked header and current file index) - * @retval *res bit(s) returned to indicate failure - * @param omitMask bit(s) to disable verify checks - * @return 0 on success (or not installed), 1 on error - */ -int rpmVerifyFile(const rpmts ts, rpmfi fi, - rpmVerifyAttrs * res, rpmVerifyAttrs omitMask); - -/** \ingroup rpmcli * Display results of package verify. * @param qva parsed query/verify options * @param ts transaction set diff --git a/lib/rpmvf.h b/lib/rpmvf.h new file mode 100644 index 000000000..ff3ebc676 --- /dev/null +++ b/lib/rpmvf.h @@ -0,0 +1,94 @@ +#ifndef _RPMVF_H +#define _RPMVF_H + +/** \ingroup rpmvf + * \file lib/rpmvf.h + * @todo Add a more complete API... + */ +#include <rpm/rpmtypes.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** \ingroup rpmvf + * Bit(s) for rpmVerifyFile() attributes and result. + */ +typedef enum rpmVerifyAttrs_e { + RPMVERIFY_NONE = 0, /*!< */ + RPMVERIFY_MD5 = (1 << 0), /*!< from %verify(md5) */ + RPMVERIFY_FILESIZE = (1 << 1), /*!< from %verify(size) */ + RPMVERIFY_LINKTO = (1 << 2), /*!< from %verify(link) */ + RPMVERIFY_USER = (1 << 3), /*!< from %verify(user) */ + RPMVERIFY_GROUP = (1 << 4), /*!< from %verify(group) */ + RPMVERIFY_MTIME = (1 << 5), /*!< from %verify(mtime) */ + RPMVERIFY_MODE = (1 << 6), /*!< from %verify(mode) */ + RPMVERIFY_RDEV = (1 << 7), /*!< from %verify(rdev) */ + /* bits 8-14 unused, reserved for rpmVerifyAttrs */ + RPMVERIFY_CONTEXTS = (1 << 15), /*!< verify: from --nocontexts */ + /* bits 16-22 used in rpmVerifyFlags */ + /* bits 23-27 used in rpmQueryFlags */ + RPMVERIFY_READLINKFAIL= (1 << 28), /*!< readlink failed */ + RPMVERIFY_READFAIL = (1 << 29), /*!< file read failed */ + RPMVERIFY_LSTATFAIL = (1 << 30), /*!< lstat failed */ + RPMVERIFY_LGETFILECONFAIL = (1 << 31) /*!< lgetfilecon failed */ +} rpmVerifyAttrs; +#define RPMVERIFY_ALL ~(RPMVERIFY_NONE) +#define RPMVERIFY_FAILURES \ + (RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL|RPMVERIFY_LGETFILECONFAIL) + +/** \ingroup rpmvf + * Bit(s) to control rpmVerify() operation + */ +typedef enum rpmVerifyFlags_e { + VERIFY_DEFAULT = 0, /*!< */ + VERIFY_MD5 = (1 << 0), /*!< from --nomd5 */ + VERIFY_SIZE = (1 << 1), /*!< from --nosize */ + VERIFY_LINKTO = (1 << 2), /*!< from --nolinkto */ + VERIFY_USER = (1 << 3), /*!< from --nouser */ + VERIFY_GROUP = (1 << 4), /*!< from --nogroup */ + VERIFY_MTIME = (1 << 5), /*!< from --nomtime */ + VERIFY_MODE = (1 << 6), /*!< from --nomode */ + VERIFY_RDEV = (1 << 7), /*!< from --nodev */ + /* bits 8-14 unused, reserved for rpmVerifyAttrs */ + VERIFY_CONTEXTS = (1 << 15), /*!< verify: from --nocontexts */ + VERIFY_FILES = (1 << 16), /*!< verify: from --nofiles */ + VERIFY_DEPS = (1 << 17), /*!< verify: from --nodeps */ + VERIFY_SCRIPT = (1 << 18), /*!< verify: from --noscripts */ + VERIFY_DIGEST = (1 << 19), /*!< verify: from --nodigest */ + VERIFY_SIGNATURE = (1 << 20), /*!< verify: from --nosignature */ + VERIFY_PATCHES = (1 << 21), /*!< verify: from --nopatches */ + VERIFY_HDRCHK = (1 << 22), /*!< verify: from --nohdrchk */ + VERIFY_FOR_LIST = (1 << 23), /*!< query: from --list */ + VERIFY_FOR_STATE = (1 << 24), /*!< query: from --state */ + VERIFY_FOR_DOCS = (1 << 25), /*!< query: from --docfiles */ + VERIFY_FOR_CONFIG = (1 << 26), /*!< query: from --configfiles */ + VERIFY_FOR_DUMPFILES= (1 << 27) /*!< query: from --dump */ + /* bits 28-31 used in rpmVerifyAttrs */ +} rpmVerifyFlags; + +#define VERIFY_ATTRS \ + ( VERIFY_MD5 | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \ + VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV | VERIFY_CONTEXTS ) +#define VERIFY_ALL \ + ( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST |\ + VERIFY_SIGNATURE | VERIFY_HDRCHK ) + +/** \ingroup rpmvf + * Verify file attributes (including MD5 sum). + * @todo gnorpm and python bindings prevent this from being static. + * @param ts transaction set + * @param fi file info (with linked header and current file index) + * @retval *res bit(s) returned to indicate failure + * @param omitMask bit(s) to disable verify checks + * @return 0 on success (or not installed), 1 on error + */ +int rpmVerifyFile(const rpmts ts, rpmfi fi, + rpmVerifyAttrs * res, rpmVerifyAttrs omitMask); + + +#ifdef __cplusplus +} +#endif + +#endif /* _RPMTYPES_H */ diff --git a/preinstall.am b/preinstall.am index 647002810..0ef8b71ee 100644 --- a/preinstall.am +++ b/preinstall.am @@ -102,6 +102,10 @@ include/rpm/rpmtypes.h: lib/rpmtypes.h include/rpm/$(dirstamp) $(INSTALL_DATA) $(top_srcdir)/lib/rpmtypes.h include/rpm/rpmtypes.h BUILT_SOURCES += include/rpm/rpmtypes.h CLEANFILES += include/rpm/rpmtypes.h +include/rpm/rpmvf.h: lib/rpmvf.h include/rpm/$(dirstamp) + $(INSTALL_DATA) $(top_srcdir)/lib/rpmvf.h include/rpm/rpmvf.h +BUILT_SOURCES += include/rpm/rpmvf.h +CLEANFILES += include/rpm/rpmvf.h include/rpm/rpmbuild.h: build/rpmbuild.h include/rpm/$(dirstamp) $(INSTALL_DATA) $(top_srcdir)/build/rpmbuild.h include/rpm/rpmbuild.h BUILT_SOURCES += include/rpm/rpmbuild.h |