LiPackage

LiPackage — Representation of a complete package

Functions

Signals

void progress Run Last
void stage-changed Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── LiPackage

Description

Functions

LI_TYPE_PACKAGE

#define LI_TYPE_PACKAGE (li_package_get_type ())


li_package_error_quark ()

GQuark
li_package_error_quark (void);

Returns

An error quark.


li_trust_level_to_text ()

const gchar *
li_trust_level_to_text (LiTrustLevel level);

Returns

A localized explanatory text for the LiTrustLevel value.


li_package_stage_to_string ()

const gchar *
li_package_stage_to_string (LiPackageStage stage);

Returns

A localized string for the LiPackageStage.


li_package_new ()

LiPackage *
li_package_new (void);

Creates a new LiPackage.

Returns

a LiPackage.

[transfer full]


li_package_open_file ()

gboolean
li_package_open_file (LiPackage *pkg,
                      const gchar *filename,
                      GError **error);

li_package_open_remote ()

gboolean
li_package_open_remote (LiPackage *pkg,
                        LiPkgCache *cache,
                        const gchar *pkid,
                        GError **error);

Open a package from a remote cache. The package will be downloaded when the install() or verify() methods are run.

Parameters

pkg

An instance of LiPackage

 

cache

The LiPkgCache to download the package from.

 

pkid

The id of the package to download.

 

error

A GError

 

li_package_is_remote ()

gboolean
li_package_is_remote (LiPackage *pkg);

Returns

TRUE if this package needs to be downloaded before it can be installed.


li_package_download ()

gboolean
li_package_download (LiPackage *pkg,
                     GError **error);

Downloads a package from the cache, in case we opened a remote package previously.


li_package_install ()

gboolean
li_package_install (LiPackage *pkg,
                    GError **error);

li_package_get_auto_verify ()

gboolean
li_package_get_auto_verify (LiPackage *pkg);

TRUE if the package should be automatically verified against the trusted keyring at install-time.


li_package_set_auto_verify ()

void
li_package_set_auto_verify (LiPackage *pkg,
                            gboolean verify);

Set if the package should be automatically verified against the default keyring at install-time. Defaults to TRUE. Do not disable this, unless you have already verified the package's origin (e.g. by checking the signature on the repository it originates from).

Parameters

verify

TRUE if automatic verification should be done

 

li_package_verify_signature ()

LiTrustLevel
li_package_verify_signature (LiPackage *pkg,
                             GError **error);

Verifies the signature of this package and returns a trust level.


li_package_get_install_root ()

const gchar *
li_package_get_install_root (LiPackage *pkg);

Get the installation root directory


li_package_set_install_root ()

void
li_package_set_install_root (LiPackage *pkg,
                             const gchar *dir);

Set the directory where the software should be installed to.

Parameters

dir

An absolute path to the installation root directory

 

li_package_get_id ()

const gchar *
li_package_get_id (LiPackage *pkg);

Get the unique name of this package


li_package_set_id ()

void
li_package_set_id (LiPackage *pkg,
                   const gchar *unique_name);

Set the unique name for this package.

Parameters

unique_name

A unique name, build from the package name and version

 

li_package_get_info ()

LiPkgInfo *
li_package_get_info (LiPackage *pkg);

Get the archive control metadata object.

Returns

An instance of LiPkgInfo.

[transfer none]


li_package_has_embedded_packages ()

gboolean
li_package_has_embedded_packages (LiPackage *pkg);

Returns

TRUE if this package has other packages embedded.


li_package_get_embedded_packages ()

GPtrArray *
li_package_get_embedded_packages (LiPackage *pkg);

Returns

Array of available embedded packages.

[transfer none][element-type LiPkgInfo]


li_package_extract_embedded_package ()

LiPackage *
li_package_extract_embedded_package (LiPackage *pkg,
                                     LiPkgInfo *pki,
                                     GError **error);

Return: (transfer full): A new package


li_package_get_appstream_data ()

gchar *
li_package_get_appstream_data (LiPackage *pkg);

Returns AppStream XML data


li_package_extract_contents ()

void
li_package_extract_contents (LiPackage *pkg,
                             const gchar *dest_dir,
                             GError **error);

Extracts the package contents into a directory. Useful to inspect the package structure manually.


li_package_extract_appstream_icons ()

void
li_package_extract_appstream_icons (LiPackage *pkg,
                                    const gchar *dest_dir,
                                    GError **error);

Extracts the icons of this package into a directory and name them after the package. This will only extract icons in the sizes mandated by the AppStream spec, 128x128 and 64x64.

Types and Values

struct LiPackageClass

struct LiPackageClass {
	GObjectClass		parent_class;
};


LI_IPK_MAGIC

#define LI_IPK_MAGIC "limba1\t\034"

Magic number for IPK packages.


enum LiPackageError

The error type.

Members

LI_PACKAGE_ERROR_FAILED

Generic failure

 

LI_PACKAGE_ERROR_NOT_FOUND

A required file or entity was not found

 

LI_PACKAGE_ERROR_ARCHIVE

Error in the archive structure

 

LI_PACKAGE_ERROR_DATA_MISSING

Some data is missing in the archive

 

LI_PACKAGE_ERROR_OVERRIDE

Could not override file

 

LI_PACKAGE_ERROR_EXTRACT

Could not extract data

 

LI_PACKAGE_ERROR_CHECKSUM_MISMATCH

A checksum did not match

 

LI_PACKAGE_ERROR_WRONG_ARCHITECTURE

The package was built for a different architecture

 

LI_PACKAGE_ERROR_SIGNATURE_BROKEN

The signature of this package is broken

 

LI_PACKAGE_ERROR_DOWNLOAD_NEEDED

Package needs to be downloaded first before we can perfom this operation.

 

LI_PACKAGE_ERROR

#define LI_PACKAGE_ERROR li_package_error_quark ()


enum LiTrustLevel

A simple indicator on how much we trust a software package.

Members

LI_TRUST_LEVEL_NONE

We don't trust that software at all (usually means no signature was found)

 

LI_TRUST_LEVEL_INVALID

The package could not be validated, its signature might be broken.

 

LI_TRUST_LEVEL_LOW

Low trust level (signed and validated, but no trusted author)

 

LI_TRUST_LEVEL_MEDIUM

Medium trust level (we already have software by this author installed and auto-trust him)

 

LI_TRUST_LEVEL_HIGH

High trust level (The software author is in our trusted database)

 

enum LiPackageStage

Stages emitted when performing actions on a LiPackage which consist of several smaller steps, like installing the package.

Members

LI_PACKAGE_STAGE_UNKNOWN

Unknown stage

 

LI_PACKAGE_STAGE_DOWNLOADING

Package is being downloaded

 

LI_PACKAGE_STAGE_VERIFYING

A signature is being verified

 

LI_PACKAGE_STAGE_INSTALLING

Package is being installed

 

LI_PACKAGE_STAGE_FINISHED

All tasks have finished

 

LiPackage

typedef struct _LiPackage LiPackage;

Signal Details

The “progress” signal

void
user_function (LiPackage *lipackage,
               guint      arg1,
               gpointer   user_data)

Parameters

lipackage

the object which received the signal.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “stage-changed” signal

void
user_function (LiPackage *lipackage,
               guint      arg1,
               gpointer   user_data)

Parameters

lipackage

the object which received the signal.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last