Skip to content

libxpkg Introduction

libxpkg is a set of standard libraries that help with writing xpkg package files. Using it allows convenient access to xlings runtime information and implementation of multi-version coexistence.

Main Goals

  • Cross-platform and portability, improving compatibility of xpkg package files
  • Provide easy-to-use interfaces for obtaining runtime information
  • Interfaces related to xlings tool modules
  • Some convenient functional modules for xpkg writing

Module Introduction

ModuleDescription
xim.libxpkg.pkginfoGet runtime package information
xim.libxpkg.xvmMulti-version manager API
xim.libxpkg.systemGet runtime-related system information and some system tools
xim.libxpkg.logLog printing module
xim.libxpkg.pkgmanagerPackage management module, providing installation and uninstallation dependency interfaces

Usage Example

lua
package = {
    -- ...
}

-- Import related modules
import("xim.libxpkg.pkginfo")
import("xim.libxpkg.log")

-- ...

function install()

    -- Use API to print the version of the currently requested installation package, and its expected installation directory
    log.warn("this is a debug...")
    log.info("version: %s", pkginfo.version())
    log.info("installdir: %s", pkginfo.install_dir())

    return true
end

--- ...