You'll probably have it easier starting out directly with QT4 instead of writing the bindings first. Since kde 4.1 will be released ... uhm .. some day this year (october? don't know, didn't look at the shedule discussions yet, since i'm currently busy discussing the qt4-port of TOra, as well as looking at new qt and kde technology - the new backends/libs look great - but yet unstable. I still got a bunch of library and interface descriptions to read ).
Also, for me, Python is great for developing plugins, scripts, tools and similar as with the new plugin interface for KDE applications. I see no real advantage developing whole projects in Python instead of C++ (most people say it's faster to develop, but I personally disagree on this).
]]>@shining: The parts we talked about, a year ago. List handling in general in alpm, unified data structures (instead of having 20 similar looking ones), getting rid of non type safe functions and pointers (as far as possible, but i think most void* got replaced by type safe structures before 3.0 already).
Also moving the download handling and similar out of alpm into pacman, since it's most likely not to consider as backend code (even when you can pass by this an elegant - or not so elegant way).
Oh, btw: the error structure (enum) is annoying "1..2..3...4...6... damn, again".
I had implemented installing, uninstalling and dependency checking already. I don't know if the version found it's way into svn before my notebook crashed.
Probably, the database handling changed lately, i remember that there was just one register function back then.
@nj: the problem is, that due to the design of alpm, you've to rebuild most structures manually, and implement the list functions again in pyrex - for every list available, since python / pyrex is quite restrictive about types. Therefore, wrapping different kinds of lists is quite a good choice, just "reading" the alpm list building up a own data structure internally, mapping your structure towards the alpm ones.
Yours,
STi
pacman.conf serves as configuration for both pacman and libalpm. Look at pacman.c around line 623. Any option that gets set via alpm_option* is a libalpm option, and options that get set using config->* is a pacman option (though be sure to read the comment in the __config_t structure about the path configs).
Probably the best way to configure your client would be to parse pacman.conf for the libalpm options, then have your own .conf file which has options for your client only.
]]>EDIT: I have an important question: pacman.conf is a configuration file for pacman only or also for libalpm?
]]>And to realize that what I say is true, just take a look at libalpm's amount of code and pacman's itself amount of code.
The pacman code is quite big in places, but alot of it due to error checking and handling of different command line arguments. To handle a simple case like 'pacman -S vim', there are only a handful of functions needed.
alpm_db_register_local() // register the local db
alpm_db_register_sync() // register a sync db ('core')
alpm_db_setserver() // add a server for a sync db
alpm_trans_init() // initialize the transaction, obtaining a lock
alpm_trans_addtarget() // add a target to the transaction ('vim')
alpm_trans_prepare() // check for missing dependencies or conflicts
alpm_trans_commit() // download and install
alpm_trans_release() // release the lock
There are probably a few more functions that I'm missing, but it's not too bad.
Good luck
]]>About using libalpm :
your best bet is to look at pacman as being a "reference"
That's taken a bit out of context, but I think it's still valid :
http://archlinux.org/pipermail/pacman-d … 08512.html
There is also this:
http://code.toofishes.net/pacman/doc/
Think they're quite buzzy at the moment...
I found this too...
http://wiki.archlinux.org/index.php/Use … _interface
This is the doxyfile I found:
# Doxyfile 1.5.2
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = libalpm
PROJECT_NUMBER =
OUTPUT_DIRECTORY = ./
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = YES
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../lib/libalpm/
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = NO
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = NO
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = YES
MAN_OUTPUT = .
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH = ../..
INCLUDE_FILE_PATTERNS = *.h
PREDEFINED = HAVE_CONFIG_H= SYMHIDDEN= SYMEXPORT=
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
And this could come in 'handy' (?!)
Pacman - Contributing
=====================
This file is meant to give you a brief overview of coding style and other
concerns when hacking on pacman. If you are interested in contributing, please
read link:submitting-patches.html[submitting-patches] and
link:translation-help.html[translation-help] as well.
Coding style
------------
1. All code should be indented with tabs. (Ignore the use of only spaces in
this file) By default, source files contain the following VIM modeline:
+
[C]
code~~~~~~~~~~
/* vim: set ts=2 sw=2 noet: */
code~~~~~~~~~~
2. When opening new blocks such as 'while', 'if', or 'for', leave the opening
brace on the same line as the beginning of the codeblock. The closing brace
gets its own line (the only exception being 'else'). Do not use extra
spaces around the parentheses of the block. ALWAYS use opening and closing
braces, even if it's just a one-line block. This reduces future error when
blocks are expanded beyond one line.
+
[C]
code~~~~~~~~~~
for(lp = list; lp; lp = lp->next) {
newlist = _alpm_list_add(newlist, strdup(lp->data));
}
while(it) {
ptr = it->next;
if(fn) {
fn(it->data);
} else {
return(1);
}
free(it);
it = ptr;
}
code~~~~~~~~~~
3. When declaring a new function, put the opening and closing braces on their
own line. Also, when declaring a pointer, do not put a space between the
asterisk and the variable name.
+
[C]
code~~~~~~~~~~
alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
{
alpm_list_t *ptr, *lp;
ptr = list;
if(ptr == NULL) {
...
}
...
}
code~~~~~~~~~~
4. Comments should be ANSI-C89 compliant. That means no `// Comment` style;
use only `/* Comment */` style.
/* This is a comment */
NOT
// This is a comment
5. Return statements should be written like a function call.
return(0);
NOT
return 0;
6. The sizeof() operator should accept a type, not a value. (TODO: in certain
cases, it may be better- should this be a set guideline? Read "The Practice
of Programming")
sizeof(alpm_list_t);
NOT
sizeof(*mylist);
7. When using strcmp() (or any function that returns 0 on success) in a
conditional statement, use != 0 or == 0 and not the negation (!) operator.
It reads much cleaner for humans (using a negative to check for success is
confusing) and the compiler will treat it correctly anyway.
if(strcmp(a, b) == 0)
NOT
if(!strcmp(a, b))
Other Concerns
--------------
Header Includes
~~~~~~~~~~~~~~~
Currently our #include usage is in messy shape, but this is no reason to
continue down this messy path. When adding an include to a file, follow this
general pattern, including blank lines:
[C]
code~~~~~~~~~~
#include "config.h"
#include <standardheader.h>
#include <another.h>
#include <...>
code~~~~~~~~~~
Follow this with some more headers, depending on whether the file is in libalpm
or pacman proper. For libalpm:
[C]
code~~~~~~~~~~
/* libalpm */
#include "yourfile.h"
#include "alpm_list.h"
#include "anythingelse.h"
code~~~~~~~~~~
For pacman:
[C]
code~~~~~~~~~~
#include <alpm.h>
#include <alpm_list.h>
/* pacman */
#include "yourfile.h"
#include "anythingelse.h"
code~~~~~~~~~~
/////
vim: set ts=2 sw=2 syntax=asciidoc et:
/////