apply some patch for pythons rpm from opensource
[platform/upstream/rpm.git] / lib / misc.h
index 9ad8483..74e94a2 100644 (file)
  *
  */
 
-#include <unistd.h>
-#include <sys/types.h>
+#include <string.h>
+#include <rpm/rpmtypes.h>
+#include <rpm/header.h>                /* for headerGetFlags typedef, duh.. */
+#include "lib/rpmfs.h"
 
-#include "header.h"
-#include "ugid.h"
+typedef const struct headerFmt_s * headerFmt;
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/**
- */
-/*@only@*/ char ** splitString(const char * str, int length, char sep)
-       /*@*/;
-
-/**
- */
-void freeSplitString( /*@only@*/ char ** list)
-       /*@modifies list @*/;
-
-/**
- * Remove occurences of trailing character from string.
- * @param s            string
- * @param c            character to strip
- * @return             string
- */
-/*@unused@*/ static inline
-/*@only@*/ char * stripTrailingChar(/*@only@*/ char * s, char c)
-       /*@modifies *s */
-{
-    char * t;
-    for (t = s + strlen(s) - 1; *t == c && t >= s; t--)
-       *t = '\0';
-    return s;
-}
-
-/**
- */
-int rpmfileexists(const char * urlfn)
-       /*@modifies fileSystem @*/;
+/* known arch? */
+RPM_GNUC_INTERNAL
+int rpmIsKnownArch(const char *name);
 
-/*
- * These are like the libc functions, but they malloc() the space which
- * is needed.
- */
+RPM_GNUC_INTERNAL
+char * rpmVerifyString(uint32_t verifyResult, const char *pad);
 
-/**
- */
-int dosetenv(const char * name, const char * value, int overwrite)
-       /*@modifies fileSystem @*/;
+RPM_GNUC_INTERNAL
+char * rpmFFlagsString(uint32_t fflags, const char *pad);
 
-/**
- */
-int doputenv(const char * str)
-       /*@modifies fileSystem @*/;
+typedef int (*headerTagTagFunction) (Header h, rpmtd td, headerGetFlags hgflags);
 
-/**
- * Return file handle for a temporaray file.
- * A unique temporaray file path will be generated using
- *     rpmGenPath(prefix, "%{_tmppath}/", "rpm-tmp.XXXXX")
- * where "XXXXXX" is filled in using rand(3). The file is opened, and
- * the link count and (dev,ino) location are verified after opening.
- * The file name and the open file handle are returned.
- *
- * @param prefix       leading part of temp file path
- * @retval fnptr       temp file name (or NULL)
- * @retval fdptr       temp file handle
- * @return             0 on success
- */
-int makeTempFile(/*@null@*/ const char * prefix,
-               /*@null@*/ /*@out@*/ const char ** fnptr,
-               /*@out@*/ FD_t * fdptr)
-       /*@modifies *fnptr, *fdptr, fileSystem @*/;
+RPM_GNUC_INTERNAL
+headerTagTagFunction rpmHeaderTagFunc(rpmTagVal tag);
 
-/**
- * Return (malloc'd) current working directory.
- * @return             current working directory (malloc'ed)
- */
-/*@only@*/ char * currentDirectory(void)
-       /*@modifies fileSystem @*/;
+RPM_GNUC_INTERNAL
+headerFmt rpmHeaderFormatByName(const char *fmt);
 
-/**
- */
-void compressFilelist(Header h)
-       /*@modifies h @*/;
+RPM_GNUC_INTERNAL
+headerFmt rpmHeaderFormatByValue(rpmtdFormats fmt);
 
-/**
- */
-void expandFilelist(Header h)
-       /*@modifies h @*/;
+RPM_GNUC_INTERNAL
+char * rpmHeaderFormatCall(headerFmt fmt, rpmtd td);
 
-/**
- */
-void buildOrigFileList(Header h, /*@out@*/ const char *** fileListPtr, 
-                       /*@out@*/ int * fileCountPtr)
-       /*@modifies *fileListPtr, *fileCountPtr @*/;
+RPM_GNUC_INTERNAL
+int headerFindSpec(Header h);
 
 /**
+ * Relocate files in header.
+ * @todo multilib file dispositions need to be checked.
+ * @param relocs               relocations
+ * @param numRelocations       number of relocations
+ * @param fs                   file state set
+ * @param h                    package header to relocate
  */
-int myGlobPatternP (const char *patternURL)    /*@*/;
+RPM_GNUC_INTERNAL
+void rpmRelocateFileList(rpmRelocation *relocs, int numRelocations, rpmfs fs, Header h);
 
-/**
- */
-int rpmGlob(const char * patterns, /*@out@*/ int * argcPtr,
-       /*@out@*/ const char *** argvPtr)
-               /*@modifies *argcPtr, *argvPtr, fileSystem @*/;
+RPM_GNUC_INTERNAL
+int rpmRelocateSrpmFileList(Header h, const char *rootDir);
 
-/**
- */
-void providePackageNVR(Header h)
-       /*@modifies h @*/;
+RPM_GNUC_INTERNAL
+void rpmRelocationBuild(Header h, rpmRelocation *rawrelocs,
+               int *rnrelocs, rpmRelocation **rrelocs, uint8_t **rbadrelocs);
 
+RPM_GNUC_INTERNAL
+void rpmAtExit(void);
 #ifdef __cplusplus
 }
 #endif