Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=cfpm.git;a=commitdiff;h=b5e86c0d4e64909891ab65572017f012b2fc0de5

commit b5e86c0d4e64909891ab65572017f012b2fc0de5
Author: James Buren <r...@frugalware.org>
Date:   Tue Jul 28 18:49:10 2009 -0500

Pacman.pp
* initial draft

diff --git a/Pacman.pp b/Pacman.pp
new file mode 100644
index 0000000..3ff7472
--- /dev/null
+++ b/Pacman.pp
@@ -0,0 +1,345 @@
+Unit Pacman;
+
+Interface
+
+Uses CTypes;
+
+{$PACKRECORDS C}
+
+(* Const values *)
+Const
+    LibPacman                              = 'pacman';
+    PM_ROOT                                = '/';
+    PM_DBPATH                              = 'var/lib/pacman-g2';
+    PM_CACHEDIR                            = 'var/cache/pacman-g2/pkg';
+    PM_LOCK                                = '/tmp/pacman-g2.lck';
+    PM_HOOKSDIR                            = 'etc/pacman-g2/hooks';
+    PM_EXT_PKG                             = '.fpm';
+    PM_EXT_DB                              = '.fdb';
+    PM_LOG_DEBUG                           = $01;
+    PM_LOG_ERROR                           = $02;
+    PM_LOG_WARNING                         = $04;
+    PM_LOG_FLOW1                           = $08;
+    PM_LOG_FLOW2                           = $10;
+    PM_LOG_FUNCTION                        = $20;
+    PM_DLFNM_LEN                           = 1024;
+    PM_TRANS_FLAG_NODEPS                   = $0001;
+    PM_TRANS_FLAG_FORCE                    = $0002;
+    PM_TRANS_FLAG_NOSAVE                   = $0004;
+    PM_TRANS_FLAG_FRESHEN                  = $0008;
+    PM_TRANS_FLAG_CASCADE                  = $0010;
+    PM_TRANS_FLAG_RECURSE                  = $0020;
+    PM_TRANS_FLAG_DBONLY                   = $0040;
+    PM_TRANS_FLAG_DEPENDSONLY              = $0080;
+    PM_TRANS_FLAG_ALLDEPS                  = $0100;
+    PM_TRANS_FLAG_DOWNLOADONLY             = $0200;
+    PM_TRANS_FLAG_NOSCRIPTLET              = $0400;
+    PM_TRANS_FLAG_NOCONFLICTS              = $0800;
+    PM_TRANS_FLAG_PRINTURIS                = $1000;
+    PM_TRANS_FLAG_NOINTEGRITY              = $2000;
+    PM_TRANS_FLAG_NOARCH                   = $4000;
+    PM_PKG_REASON_EXPLICIT                 = 0;
+    PM_PKG_REASON_DEPEND                   = 1;
+    PM_PKG_WITHOUT_ARCH                    = 0;
+    PM_PKG_WITH_ARCH                       = 1;
+    PM_OPT_LOGCB                           = 1;
+    PM_OPT_LOGMASK                         = 2;
+    PM_OPT_USESYSLOG                       = 3;
+    PM_OPT_ROOT                            = 4;
+    PM_OPT_DBPATH                          = 5;
+    PM_OPT_CACHEDIR                        = 6;
+    PM_OPT_LOGFILE                         = 7;
+    PM_OPT_LOCALDB                         = 8;
+    PM_OPT_SYNCDB                          = 9;
+    PM_OPT_NOUPGRADE                       = 10;
+    PM_OPT_NOEXTRACT                       = 11;
+    PM_OPT_IGNOREPKG                       = 12;
+    PM_OPT_UPGRADEDELAY                    = 13;
+    PM_OPT_PROXYHOST                       = 14;
+    PM_OPT_PROXYPORT                       = 15;
+    PM_OPT_XFERCOMMAND                     = 16;
+    PM_OPT_NOPASSIVEFTP                    = 17;
+    PM_OPT_DLCB                            = 18;
+    PM_OPT_DLFNM                           = 19;
+    PM_OPT_DLOFFSET                        = 20;
+    PM_OPT_DLT0                            = 21;
+    PM_OPT_DLT                             = 22;
+    PM_OPT_DLRATE                          = 23;
+    PM_OPT_DLXFERED1                       = 24;
+    PM_OPT_DLETA_H                         = 25;
+    PM_OPT_DLETA_M                         = 26;
+    PM_OPT_DLETA_S                         = 27;
+    PM_OPT_HOLDPKG                         = 28;
+    PM_OPT_CHOMP                           = 29;
+    PM_OPT_NEEDLES                         = 30;
+    PM_OPT_MAXTRIES                        = 31;
+    PM_OPT_OLDDELAY                        = 32;
+    PM_OPT_DLREMAIN                        = 33;
+    PM_OPT_DLHOWMANY                       = 34;
+    PM_OPT_HOOKSDIR                        = 35;
+    PM_DB_TREENAME                         = 1;
+    PM_DB_FIRSTSERVER                      = 2;
+    PM_PKG_NAME                            = 1;
+    PM_PKG_VERSION                         = 2;
+    PM_PKG_DESC                            = 3;
+    PM_PKG_GROUPS                          = 4;
+    PM_PKG_URL                             = 5;
+    PM_PKG_LICENSE                         = 6;
+    PM_PKG_ARCH                            = 7;
+    PM_PKG_BUILDDATE                       = 8;
+    PM_PKG_BUILDTYPE                       = 9;
+    PM_PKG_INSTALLDATE                     = 10;
+    PM_PKG_PACKAGER                        = 11;
+    PM_PKG_SIZE                            = 12;
+    PM_PKG_USIZE                           = 13;
+    PM_PKG_REASON                          = 14;
+    PM_PKG_MD5SUM                          = 15;
+    PM_PKG_SHA1SUM                         = 16;
+    PM_PKG_DEPENDS                         = 17;
+    PM_PKG_REMOVES                         = 18;
+    PM_PKG_REQUIREDBY                      = 19;
+    PM_PKG_CONFLICTS                       = 20;
+    PM_PKG_PROVIDES                        = 21;
+    PM_PKG_REPLACES                        = 22;
+    PM_PKG_FILES                           = 23;
+    PM_PKG_BACKUP                          = 24;
+    PM_PKG_SCRIPLET                        = 25;
+    PM_PKG_DATA                            = 26;
+    PM_PKG_FORCE                           = 27;
+    PM_PKG_STICK                           = 28;
+    PM_GRP_NAME                            = 1;
+    PM_GRP_PKGNAMES                        = 2;
+    PM_SYNC_TYPE_REPLACE                   = 1;
+    PM_SYNC_TYPE_UPGRADE                   = 2;
+    PM_SYNC_TYPE_DEPEND                    = 3;
+    PM_SYNC_TYPE                           = 1;
+    PM_SYNC_PKG                            = 2;
+    PM_SYNC_DATA                           = 3;
+    PM_TRANS_TYPE_ADD                      = 1;
+    PM_TRANS_TYPE_REMOVE                   = 2;
+    PM_TRANS_TYPE_UPGRADE                  = 3;
+    PM_TRANS_TYPE_SYNC                     = 4;
+    PM_TRANS_EVT_CHECKDEPS_START           = 1;
+    PM_TRANS_EVT_CHECKDEPS_DONE            = 2;
+    PM_TRANS_EVT_FILECONFLICTS_START       = 3;
+    PM_TRANS_EVT_FILECONFLICTS_DONE        = 4;
+    PM_TRANS_EVT_CLEANUP_START             = 5;
+    PM_TRANS_EVT_CLEANUP_DONE              = 6;
+    PM_TRANS_EVT_RESOLVEDEPS_START         = 7;
+    PM_TRANS_EVT_RESOLVEDEPS_DONE          = 8;
+    PM_TRANS_EVT_INTERCONFLICTS_START      = 9;
+    PM_TRANS_EVT_INTERCONFLICTS_DONE       = 10;
+    PM_TRANS_EVT_ADD_START                 = 11;
+    PM_TRANS_EVT_ADD_DONE                  = 12;
+    PM_TRANS_EVT_REMOVE_START              = 13;
+    PM_TRANS_EVT_REMOVE_DONE               = 14;
+    PM_TRANS_EVT_UPGRADE_START             = 15;
+    PM_TRANS_EVT_UPGRADE_DONE              = 16;
+    PM_TRANS_EVT_EXTRACT_DONE              = 17;
+    PM_TRANS_EVT_INTEGRITY_START           = 18;
+    PM_TRANS_EVT_INTEGRITY_DONE            = 19;
+    PM_TRANS_EVT_SCRIPTLET_INFO            = 20;
+    PM_TRANS_EVT_SCRIPTLET_START           = 21;
+    PM_TRANS_EVT_SCRIPTLET_DONE            = 22;
+    PM_TRANS_EVT_PRINTURI                  = 23;
+    PM_TRANS_EVT_RETRIEVE_START            = 24;
+    PM_TRANS_EVT_RETRIEVE_LOCAL            = 25;
+    PM_TRANS_CONV_INSTALL_IGNOREPKG        = $01;
+    PM_TRANS_CONV_REPLACE_PKG              = $02;
+    PM_TRANS_CONV_CONFLICT_PKG             = $04;
+    PM_TRANS_CONV_CORRUPTED_PKG            = $08;
+    PM_TRANS_CONV_LOCAL_NEWER              = $10;
+    PM_TRANS_CONV_LOCAL_UPTODATE           = $20;
+    PM_TRANS_CONV_REMOVE_HOLDPKG           = $40;
+    PM_TRANS_PROGRESS_ADD_START            = 0;
+    PM_TRANS_PROGRESS_UPGRADE_START        = 1;
+    PM_TRANS_PROGRESS_REMOVE_START         = 2;
+    PM_TRANS_PROGRESS_CONFLICTS_START      = 3;
+    PM_TRANS_PROGRESS_INTERCONFLICTS_START = 4;
+    PM_TRANS_TYPE                          = 1;
+    PM_TRANS_FLAGS                         = 2;
+    PM_TRANS_TARGETS                       = 3;
+    PM_TRANS_PACKAGES                      = 4;
+    PM_CONFLICT_TYPE_TARGET                = 1;
+    PM_CONFLICT_TYPE_FILE                  = 2;
+    PM_CONFLICT_TARGET                     = 1;
+    PM_CONFLICT_TYPE                       = 2;
+    PM_CONFLICT_FILE                       = 3;
+    PM_CONFLICT_CTARGET                    = 4;
+    PM_DEP_MOD_ANY                         = 1;
+    PM_DEP_MOD_EQ                          = 2;
+    PM_DEP_MOD_GE                          = 3;
+    PM_DEP_MOD_LE                          = 4;
+    PM_DEP_MOD_GT                          = 5;
+    PM_DEP_MOD_LT                          = 6;
+    PM_DEP_TYPE_DEPEND                     = 1;
+    PM_DEP_TYPE_REQUIRED                   = 2;
+    PM_DEP_TYPE_CONFLICT                   = 3;
+    PM_DEP_TARGET                          = 1;
+    PM_DEP_TYPE                            = 2;
+    PM_DEP_MOD                             = 3;
+    PM_DEP_NAME                            = 4;
+    PM_DEP_VERSION                         = 5;
+
+
+(* Opaque record types *)
+Type
+    PM_LIST     = record end;
+    PM_DB       = record end;
+    PM_PKG      = record end;
+    PM_GRP      = record end;
+    PM_SYNCPKG  = record end;
+    PM_TRANS    = record end;
+    PM_DEPMISS  = record end;
+    PM_CONFLICT = record end;
+    PM_NETBUF   = record end;
+
+(* Pointers for opaque record types *)
+Type
+    PPM_LIST     = ^PM_LIST;
+    PPM_DB       = ^PM_DB;
+    PPM_PKG      = ^PM_PKG;
+    PPM_GRP      = ^PM_GRP;
+    PPM_SYNCPKG  = ^PM_SYNCPKG;
+    PPM_TRANS    = ^PM_TRANS;
+    PPM_DEPMISS  = ^PM_DEPMISS;
+    PPM_CONFLICT = ^PM_CONFLICT;
+    PPM_NETBUF   = ^PM_NETBUF;
+
+(* Pointers to pointers for opaque record types *)
+Type
+    PPPM_PKG     = ^PPM_PKG;
+    PPPM_LIST    = ^PPM_LIST;
+
+(* Callback types *)
+Type
+     pacman_cb_log            = Procedure (A:CUShort;B:PChar); Cdecl;
+     pacman_cb_db_register    = Procedure (A:PChar;B:PPM_DB); Cdecl;
+     pacman_trans_cb_event    = Procedure (A:CUChar;B,C:Pointer); Cdecl;
+     pacman_trans_cb_conv     = Procedure (A:CUChar;B,C,D:Pointer;E:PCInt); 
Cdecl;
+     pacman_trans_cb_progress = Procedure (A:CUChar;B:PChar;C,D,E:CInt); Cdecl;
+     pacman_trans_cb_download = Function  
(ctl:PPM_NETBUF;xfered:CInt;arg:Pointer) : CInt; Cdecl;
+
+(* Enumeration type for error variable *)
+Type
+    Tpm_errno = (
+                    PM_ERR_MEMORY := 1,
+                    PM_ERR_SYSTEM,
+                    PM_ERR_BADPERMS,
+                    PM_ERR_NOT_A_FILE,
+                    PM_ERR_WRONG_ARGS,
+                    PM_ERR_HANDLE_NULL,
+                    PM_ERR_HANDLE_NOT_NULL,
+                    PM_ERR_HANDLE_LOCK,
+                    PM_ERR_DB_OPEN,
+                    PM_ERR_DB_CREATE,PM_ERR_DB_NULL,
+                    PM_ERR_DB_NOT_NULL,
+                    PM_ERR_DB_NOT_FOUND,
+                    PM_ERR_DB_WRITE,
+                    PM_ERR_DB_REMOVE,
+                    PM_ERR_SERVER_BAD_LOCATION,
+                    PM_ERR_SERVER_PROTOCOL_UNSUPPORTED,
+                    PM_ERR_OPT_LOGFILE,
+                    PM_ERR_OPT_DBPATH,
+                    PM_ERR_OPT_LOCALDB,
+                    PM_ERR_OPT_SYNCDB,
+                    PM_ERR_OPT_USESYSLOG,
+                    PM_ERR_TRANS_NOT_NULL,
+                    PM_ERR_TRANS_NULL,
+                    PM_ERR_TRANS_DUP_TARGET,
+                    PM_ERR_TRANS_NOT_INITIALIZED,
+                    PM_ERR_TRANS_NOT_PREPARED,
+                    PM_ERR_TRANS_ABORT,
+                    PM_ERR_TRANS_TYPE,
+                    PM_ERR_TRANS_COMMITING,
+                    PM_ERR_PKG_NOT_FOUND,
+                    PM_ERR_PKG_INVALID,
+                    PM_ERR_PKG_OPEN,
+                    PM_ERR_PKG_LOAD,
+                    PM_ERR_PKG_INSTALLED,
+                    PM_ERR_PKG_CANT_FRESH,
+                    PM_ERR_PKG_INVALID_NAME,
+                    PM_ERR_PKG_CORRUPTED,
+                    PM_ERR_GRP_NOT_FOUND,
+                    PM_ERR_UNSATISFIED_DEPS,
+                    PM_ERR_CONFLICTING_DEPS,
+                    PM_ERR_FILE_CONFLICTS,
+                    PM_ERR_USER_ABORT,
+                    PM_ERR_INTERNAL_ERROR,
+                    PM_ERR_LIBARCHIVE_ERROR,
+                    PM_ERR_DISK_FULL,
+                    PM_ERR_DB_SYNC,PM_ERR_RETRIEVE,
+                    PM_ERR_PKG_HOLD,
+                    PM_ERR_CONF_BAD_SECTION,
+                    PM_ERR_CONF_LOCAL,
+                    PM_ERR_CONF_BAD_SYNTAX,
+                    PM_ERR_CONF_DIRECTIVE_OUTSIDE_SECTION,
+                    PM_ERR_INVALID_REGEX,
+                    PM_ERR_TRANS_DOWNLOADING,
+                    PM_ERR_CONNECT_FAILED,
+                    PM_ERR_FORK_FAILED,
+                    PM_ERR_NO_OWNER,
+                    PM_ERR_NO_CACHE_ACCESS,
+                    PM_ERR_CANT_REMOVE_CACHE,
+                    PM_ERR_CANT_CREATE_CACHE,
+                    PM_ERR_WRONG_ARCH
+                );
+
+(* External error variable *)
+Var
+    pm_errno : Tpm_errno ; CVar; External;
+
+
+(* Library Functions *)
+Function pacman_initialize (root:PChar) : CInt; Cdecl; External LibPacman;
+Function pacman_release : CInt; Cdecl; External LibPacman;
+Function pacman_logaction (fmt:PChar) : CInt; VarArgs; Cdecl; External 
LibPacman;
+Function pacman_set_option (parm:CUChar; data:CULong) : CInt; Cdecl; External 
LibPacman;
+Function pacman_get_option (parm:CUChar; data:PCLong) : CInt; Cdecl; External 
LibPacman;
+Function pacman_db_register (treename:PChar) : PPM_DB; Cdecl; External 
LibPacman;
+Function pacman_db_unregister (db:PPM_DB) : CInt; Cdecl; External LibPacman;
+Function pacman_db_getinfo (db:PPM_DB; parm:CUChar) : Pointer; Cdecl; External 
LibPacman;
+Function pacman_db_setserver (db:PPM_DB; url:PChar) : CInt; Cdecl; External 
LibPacman;
+Function pacman_db_update (level:CInt; db:PPM_DB) : CInt; Cdecl; External 
LibPacman;
+Function pacman_db_readpkg (db:PPM_DB; name:PChar) : PPM_PKG; Cdecl; External 
LibPacman;
+Function pacman_db_getpkgcache (db:PPM_DB) : PPM_LIST; Cdecl; External 
LibPacman;
+Function pacman_db_whatprovides (db:PPM_DB; name:PChar) : PPM_LIST; Cdecl; 
External LibPacman;
+Function pacman_db_readgrp (db:PPM_DB; name:PChar) : PPM_GRP; Cdecl; External 
LibPacman;
+Function pacman_db_getgrpcache (db:PPM_DB) : PPM_LIST; Cdecl; External 
LibPacman;
+Function pacman_db_search (db:PPM_DB) : PPM_LIST; Cdecl; External LibPacman;
+Function pacman_db_test (db:PPM_DB) : PPM_LIST; Cdecl; External LibPacman;
+Function pacman_pkg_getinfo (pkg:PPM_PKG; parm:CUChar) : Pointer; Cdecl; 
External LibPacman;
+Function pacman_pkg_getowners (filename:PChar) : PPM_LIST; Cdecl; External 
LibPacman;
+Function pacman_pkg_load (filename:PChar; pkg:PPPM_PKG) : CInt; Cdecl; 
External LibPacman;
+Function pacman_pkg_free (pkg:PPM_PKG) : CInt; Cdecl; External LibPacman;
+Function pacman_pkg_checkmd5sum (pkg:PPM_PKG) : CInt; Cdecl; External 
LibPacman;
+Function pacman_pkg_checksha1sum (pkg:PPM_PKG) : CInt; Cdecl; External 
LibPacman;
+Function pacman_fetch_pkgurl (url:PChar) : PChar; Cdecl; External LibPacman;
+Function pacman_parse_config (filename:PChar; callback:pacman_cb_db_register; 
this_section:PChar) : CInt; Cdecl; External LibPacman;
+Function pacman_pkg_vercmp (ver1:PChar; ver2:PChar) : CInt; Cdecl; External 
LibPacman;
+Function pacman_reg_match (_string:PChar; pattern:PChar) : CInt; Cdecl; 
External LibPacman;
+Function pacman_grp_getinfo (grp:PPM_GRP; parm:CUChar) : Pointer; Cdecl; 
External LibPacman;
+Function pacman_sync_getinfo (sync:PPM_SYNCPKG; parm:CUChar) : Pointer; Cdecl; 
External LibPacman;
+Function pacman_sync_cleancache (full:CInt) : CInt; Cdecl; External LibPacman;
+Function pacman_trans_getinfo (parm:CUChar) : Pointer; Cdecl; External 
LibPacman;
+Function pacman_trans_init (_type:CUChar; flags:CUInt; 
cb_event:pacman_trans_cb_event; conv:pacman_trans_cb_conv; 
cb_progress:pacman_trans_cb_progress) : CInt; Cdecl; External LibPacman;
+Function pacman_trans_sysupgrade : CInt; Cdecl; External LibPacman;
+Function pacman_trans_addtarget (target:PChar) : CInt; Cdecl; External 
LibPacman;
+Function pacman_trans_prepare (data:PPPM_LIST) : CInt; Cdecl; External 
LibPacman;
+Function pacman_trans_commit (data:PPPM_LIST) : CInt; Cdecl; External 
LibPacman;
+Function pacman_trans_release : CInt; Cdecl; External LibPacman;
+Function pacman_dep_getinfo (miss:PPM_DEPMISS; parm:CUChar) : Pointer; Cdecl; 
External LibPacman;
+Function pacman_conflict_getinfo (conflict:PPM_CONFLICT; parm:CUChar) : 
Pointer; Cdecl; External LibPacman;
+Function pacman_list_first (list:PPM_LIST) : PPM_LIST; Cdecl; External 
LibPacman;
+Function pacman_list_next (entry:PPM_LIST) : PPM_LIST; Cdecl; External 
LibPacman;
+Function pacman_list_getdata (entry:PPM_LIST) : Pointer; Cdecl; External 
LibPacman;
+Function pacman_list_free (entry:PPM_LIST) : CInt; Cdecl; External LibPacman;
+Function pacman_list_count (list:PPM_LIST) : CInt; Cdecl; External LibPacman;
+Function pacman_get_md5sum (name:PChar) : PChar; Cdecl; External LibPacman;
+Function pacman_get_sha1sum (name:PChar) : PChar; Cdecl; External LibPacman;
+Function pacman_strerror (err:Tpm_errno) : PChar; Cdecl; External LibPacman;
+
+Implementation
+End.
+
+(* -%- lang:pascal -%- *)
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to