User:Toofishes/libalpm interface

From ArchWiki

This started as Aaron's original list, put here for easy editing by us. Please don't touch this unless you know what you are doing.

python style - converted obviously to object style C

NOTE: we need to differentiate between string lists and pkg lists

classes:
package #include "virtual" packages
    is_provision()?? #for virtual packages
    get/set:
    str = name()
    str = version()
    str = release()
    pkglist = depends() #or string list?
    pkglist = requires()
    pkglist = provides()
    ...etc.. all other properties

database
    add_server(url)
    remove_server(url)
    sync() #download
    pkglist = get_packages()
    strlist = get_groups()

Specialized lists? package_list? database_list? server_list?
list (C only)
    node = next()
    node = prev()
    node = tail()
    obj = data()

alpm
    ignore_package(name)
    no_upgrade(name)
    set_option(name, value)
    value = get_option(name)
    db = register_db(name)
    add_server(db, url) #same as db.add_server(url)
    remove_server(db, url) #same as db.remove_server(url)

    parse_config(file) #convienance for above option calls

    pkglist = search([strA, strB, strC, ...]) #multi search
    package = find_package(name)
    pkglist = what_provides(provide_name)
    pkglist = check_updates()
    install_from_url(url)
    install_package(package)
    remove_package(package)
    install_packages(pkglist)
    remove_packages(pkglist)
    package = package_from_file(filename)
    pkglist = resolve_dependancies(pkglist) #return uninstalled deps
    sync_databases() #download
    sync_database(db) #same as db.sync()
    dblist = get_databases()
    clean_cache(bool_superclean!)
    log_message(level, message) #needs a C shim for printf-like syntax
    *misc output functions*

TODO callbacks


utils #maybe expose this stuff?
    database_backend - interface... maybe we can write some backends in python!
    string_match #using the "MatchType" option from alpm