Skip to content

Commit

Permalink
Hide the strpool-related rpmts/rpmfi/rpmds interfaces out of sight fo…
Browse files Browse the repository at this point in the history
…r now

- In the package/transaction related things the strpool is more of
  an internal implementation detail than an end-goal in itself, move
  string pool related interfaces of rpmts, rpmfi and rpmds to
  internal-only APIs for now. The kind interfaces we'll want to eventually
  export a) dont exist yet and b) are likely to be something very different.
- The string pool itself remains exported however, its a handy data
  structure for all sorts of things and both librpm and librpmbuild
  heavily use it already.
  • Loading branch information
pmatilai committed Nov 1, 2012
1 parent 5ecfdce commit 3ff6fdd
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 113 deletions.
1 change: 1 addition & 0 deletions lib/depends.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "lib/rpmts_internal.h"
#include "lib/rpmte_internal.h"
#include "lib/rpmds_internal.h"
#include "lib/misc.h"

#include "debug.h"
Expand Down
75 changes: 0 additions & 75 deletions lib/rpmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,6 @@ rpmds rpmdsFree(rpmds ds);
*/
rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags);

/** \ingroup rpmds
* Create and load a dependency set.
* @param pool shared string pool (or NULL for private pool)
* @param h header
* @param tagN type of dependency
* @param flags unused
* @return new dependency set
*/
rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags);

/** \ingroup rpmds
* Return new formatted dependency string.
* @param dspfx formatted dependency string prefix
Expand All @@ -135,17 +125,6 @@ char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds);
*/
rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags);

/** \ingroup rpmds
* Create, load and initialize a dependency for this header.
* @param pool string pool (or NULL for private pool)
* @param h header
* @param tagN type of dependency
* @param Flags comparison flags
* @return new dependency set
*/
rpmds rpmdsThisPool(rpmstrPool pool,
Header h, rpmTagVal tagN, rpmsenseFlags Flags);

/** \ingroup rpmds
* Create, load and initialize a dependency set of size 1.
* @param tagN type of dependency
Expand All @@ -156,18 +135,6 @@ rpmds rpmdsThisPool(rpmstrPool pool,
*/
rpmds rpmdsSingle(rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags);

/** \ingroup rpmds
* Create, load and initialize a dependency set of size 1.
* @param pool string pool (or NULL for private pool)
* @param tagN type of dependency
* @param N name
* @param EVR epoch:version-release
* @param Flags comparison flags
* @return new dependency set
*/
rpmds rpmdsSinglePool(rpmstrPool pool, rpmTagVal tagN,
const char * N, const char * EVR, rpmsenseFlags Flags);

/** \ingroup rpmds
* Return a new dependency set of size 1 from the current iteration index
* @param ds dependency set
Expand Down Expand Up @@ -204,20 +171,6 @@ int rpmdsSetIx(rpmds ds, int ix);
*/
const char * rpmdsDNEVR(const rpmds ds);

/** \ingroup rpmds
* Return current dependency name pool id.
* @param ds dependency set
* @return current dependency name id, 0 on invalid
*/
rpmsid rpmdsNId(rpmds ds);

/** \ingroup rpmds
* Return current dependency epoch-version-release pool id.
* @param ds dependency set
* @return current dependency EVR id, 0 on invalid
*/
rpmsid rpmdsEVRId(rpmds ds);

/** \ingroup rpmds
* Return current dependency name.
* @param ds dependency set
Expand Down Expand Up @@ -377,18 +330,6 @@ int rpmdsMatchesDep (const Header h, int ix, const rpmds req, int nopromote);
*/
int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote);

/** \ingroup rpmds
* Swiss army knife dependency matching function.
* @param pool string pool (or NULL for private pool)
* @param h header
* @param prix index to provides (or -1 or any)
* @param req dependency set
* @param selfevr only look at package EVR?
* @param nopromote dont promote epoch in comparison?
* @return 1 if dependency overlaps, 0 otherwise
*/
int rpmdsMatches(rpmstrPool pool, Header h, int prix,
rpmds req, int selfevr, int nopromote);
/**
* Load rpmlib provides into a dependency set.
* @retval *dsp (loaded) depedency set
Expand All @@ -397,22 +338,6 @@ int rpmdsMatches(rpmstrPool pool, Header h, int prix,
*/
int rpmdsRpmlib(rpmds * dsp, const void * tblp);

/**
* Load rpmlib provides into a dependency set.
* @param pool shared string pool (or NULL for private pool)
* @retval *dsp (loaded) depedency set
* @param tblp rpmlib provides table (NULL uses internal table)
* @return 0 on success
*/
int rpmdsRpmlibPool(rpmstrPool pool, rpmds * dsp, const void * tblp);

/** \ingroup rpmds
* Return dependency set string pool handle
* @param ds dependency set
* @return string pool handle (weak reference)
*/
rpmstrPool rpmdsPool(rpmds ds);

#ifdef __cplusplus
}
#endif
Expand Down
84 changes: 84 additions & 0 deletions lib/rpmds_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,90 @@
extern "C" {
#endif

/** \ingroup rpmds
* Create and load a dependency set.
* @param pool shared string pool (or NULL for private pool)
* @param h header
* @param tagN type of dependency
* @param flags unused
* @return new dependency set
*/
RPM_GNUC_INTERNAL
rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags);

/** \ingroup rpmds
* Create, load and initialize a dependency for this header.
* @param pool string pool (or NULL for private pool)
* @param h header
* @param tagN type of dependency
* @param Flags comparison flags
* @return new dependency set
*/
RPM_GNUC_INTERNAL
rpmds rpmdsThisPool(rpmstrPool pool,
Header h, rpmTagVal tagN, rpmsenseFlags Flags);

/** \ingroup rpmds
* Create, load and initialize a dependency set of size 1.
* @param pool string pool (or NULL for private pool)
* @param tagN type of dependency
* @param N name
* @param EVR epoch:version-release
* @param Flags comparison flags
* @return new dependency set
*/
RPM_GNUC_INTERNAL
rpmds rpmdsSinglePool(rpmstrPool pool, rpmTagVal tagN,
const char * N, const char * EVR, rpmsenseFlags Flags);

/**
* Load rpmlib provides into a dependency set.
* @param pool shared string pool (or NULL for private pool)
* @retval *dsp (loaded) depedency set
* @param tblp rpmlib provides table (NULL uses internal table)
* @return 0 on success
*/
RPM_GNUC_INTERNAL
int rpmdsRpmlibPool(rpmstrPool pool, rpmds * dsp, const void * tblp);

/** \ingroup rpmds
* Swiss army knife dependency matching function.
* @param pool string pool (or NULL for private pool)
* @param h header
* @param prix index to provides (or -1 or any)
* @param req dependency set
* @param selfevr only look at package EVR?
* @param nopromote dont promote epoch in comparison?
* @return 1 if dependency overlaps, 0 otherwise
*/
RPM_GNUC_INTERNAL
int rpmdsMatches(rpmstrPool pool, Header h, int prix,
rpmds req, int selfevr, int nopromote);

/** \ingroup rpmds
* Return current dependency name pool id.
* @param ds dependency set
* @return current dependency name id, 0 on invalid
*/
RPM_GNUC_INTERNAL
rpmsid rpmdsNId(rpmds ds);

/** \ingroup rpmds
* Return current dependency epoch-version-release pool id.
* @param ds dependency set
* @return current dependency EVR id, 0 on invalid
*/
RPM_GNUC_INTERNAL
rpmsid rpmdsEVRId(rpmds ds);

/** \ingroup rpmds
* Return dependency set string pool handle
* @param ds dependency set
* @return string pool handle (weak reference)
*/
RPM_GNUC_INTERNAL
rpmstrPool rpmdsPool(rpmds ds);

RPM_GNUC_INTERNAL
rpmsid rpmdsNIdIndex(rpmds ds, int i);

Expand Down
31 changes: 0 additions & 31 deletions lib/rpmfi.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,6 @@ int rpmfiDX(rpmfi fi);
*/
int rpmfiSetDX(rpmfi fi, int dx);

/** \ingroup rpmfi
* Return current base name pool id from file info set.
* @param fi file info set
* @return current base name id, 0 on invalid
*/
rpmsid rpmfiBNId(rpmfi fi);

/** \ingroup rpmfi
* Return current directory name pool id from file info set.
* @param fi file info set
* @return current base name id, 0 on invalid
*/
rpmsid rpmfiDNId(rpmfi fi);

/** \ingroup rpmfi
* Return current base name from file info set.
* @param fi file info set
Expand Down Expand Up @@ -434,16 +420,6 @@ typedef rpmFlags rpmfiFlags;
*/
rpmfi rpmfiNew(const rpmts ts, Header h, rpmTagVal tagN, rpmfiFlags flags);

/** \ingroup rpmfi
* Create and load a file info set.
* @param pool shared string pool (or NULL for private pool)
* @param h header
* @param tagN unused
* @param flags Flags to control what information is loaded.
* @return new file info set
*/
rpmfi rpmfiNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, rpmfiFlags flags);

/** \ingroup rpmfi
* Return file type from mode_t.
* @param mode file mode bits (from header)
Expand Down Expand Up @@ -475,13 +451,6 @@ rpmFileAction rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing);
*/
int rpmfiConfigConflict(const rpmfi fi);

/** \ingroup rpmfi
* Return file info set string pool handle
* @param fi file info
* @return string pool handle (weak reference)
*/
rpmstrPool rpmfiPool(rpmfi fi);

#ifdef __cplusplus
}
#endif
Expand Down
35 changes: 35 additions & 0 deletions lib/rpmfi_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,41 @@ struct rpmfi_s {
extern "C" {
#endif

/** \ingroup rpmfi
* Create and load a file info set.
* @param pool shared string pool (or NULL for private pool)
* @param h header
* @param tagN unused
* @param flags Flags to control what information is loaded.
* @return new file info set
*/
RPM_GNUC_INTERNAL
rpmfi rpmfiNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, rpmfiFlags flags);

/** \ingroup rpmfi
* Return file info set string pool handle
* @param fi file info
* @return string pool handle (weak reference)
*/
RPM_GNUC_INTERNAL
rpmstrPool rpmfiPool(rpmfi fi);

/** \ingroup rpmfi
* Return current base name pool id from file info set.
* @param fi file info set
* @return current base name id, 0 on invalid
*/
RPM_GNUC_INTERNAL
rpmsid rpmfiBNId(rpmfi fi);

/** \ingroup rpmfi
* Return current directory name pool id from file info set.
* @param fi file info set
* @return current base name id, 0 on invalid
*/
RPM_GNUC_INTERNAL
rpmsid rpmfiDNId(rpmfi fi);

RPM_GNUC_INTERNAL
int rpmfiDIIndex(rpmfi fi, int dx);

Expand Down
4 changes: 4 additions & 0 deletions lib/rpmte.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

#include "lib/rpmplugins.h"
#include "lib/rpmte_internal.h"
/* strpool-related interfaces */
#include "lib/rpmfi_internal.h"
#include "lib/rpmds_internal.h"
#include "lib/rpmts_internal.h"

#include "debug.h"

Expand Down
7 changes: 0 additions & 7 deletions lib/rpmts.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,13 +526,6 @@ int rpmtsSetNotifyCallback(rpmts ts,
*/
rpmts rpmtsCreate(void);

/** \ingroup rpmts
* Return transaction global string pool handle
* @param ts transaction set
* @return string pool handle (weak ref)
*/
rpmstrPool rpmtsPool(rpmts ts);

/** \ingroup rpmts
* Add package to be installed to transaction set.
*
Expand Down
8 changes: 8 additions & 0 deletions lib/rpmts_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ struct rpmts_s {
extern "C" {
#endif

/** \ingroup rpmts
* Return transaction global string pool handle
* @param ts transaction set
* @return string pool handle (weak ref)
*/
RPM_GNUC_INTERNAL
rpmstrPool rpmtsPool(rpmts ts);

RPM_GNUC_INTERNAL
tsMembers rpmtsMembers(rpmts ts);

Expand Down
1 change: 1 addition & 0 deletions lib/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "lib/misc.h"
#include "lib/rpmchroot.h"
#include "lib/rpmlock.h"
#include "lib/rpmds_internal.h"
#include "lib/rpmfi_internal.h" /* only internal apis */
#include "lib/rpmte_internal.h" /* only internal apis */
#include "lib/rpmts_internal.h"
Expand Down

0 comments on commit 3ff6fdd

Please sign in to comment.