AptSourcesList

AptSourcesList — Parse sources.list files and create AptSource objects.

Synopsis

#include <apt.h>

                    AptSourcesList;
AptSourcesList *    apt_sources_list_new                (AptSystem *system);
AptSourcesList *    apt_sources_list_ref                (AptSourcesList *list);
void                apt_sources_list_unref              (AptSourcesList *list);

                    AptSource;
GList *             apt_sources_list_get_list           (AptSourcesList *list);

gboolean            apt_sources_list_parse_dir          (AptSourcesList *list,
                                                         const gchar *dir,
                                                         GError **error);
gboolean            apt_sources_list_parse_file         (AptSourcesList *list,
                                                         const gchar *file,
                                                         GError **error);
gboolean            apt_sources_list_parse_line         (AptSourcesList *list,
                                                         const gchar *line,
                                                         GError **error);

Description

AptSourcesList parses sources.list files and creates the corresponding AptSource instance for each entry, if such entry is supported by the underlying AptSystem.

Details

AptSourcesList

typedef struct _AptSourcesList AptSourcesList;

A list of AptSource objects.


apt_sources_list_new ()

AptSourcesList *    apt_sources_list_new                (AptSystem *system);

Creates a new AptSourcesList.

system :

The AptSystem used for the sources.

Returns :

A newly allocated AptSourcesList.

apt_sources_list_ref ()

AptSourcesList *    apt_sources_list_ref                (AptSourcesList *list);

Increments the reference count of list by one.

list :

An AptSourcesList

Returns :

list

apt_sources_list_unref ()

void                apt_sources_list_unref              (AptSourcesList *list);

Decrements the reference count of list by one. If the reference count drops to 0, frees all memory used by list.

list :

An AptSourcesList

AptSource

typedef struct _AptSource AptSource;

AptSource is a data structure that describes a single entry in a sources.list file.


apt_sources_list_get_list ()

GList *             apt_sources_list_get_list           (AptSourcesList *list);

Gets a list of unowned references to AptSource objects. The list is ordered according to the time the sources were entered. This means that the first source is the source added first and the last source has been added last.

list :

An AptSourcesList

Returns :

A GList of unowned AptSource references. You must call g_list_free() on the list once you do not need it anymore.

apt_sources_list_parse_dir ()

gboolean            apt_sources_list_parse_dir          (AptSourcesList *list,
                                                         const gchar *dir,
                                                         GError **error);

Parses the files in dir until an error occurs. In such a case, FALSE is returned and error is set (if it is not NULL).

list :

An AptSourcesList

dir :

Path to the directory from which the files should be parsed

error :

Return location for an error

Returns :

TRUE if all files could be parsed. Otherwise, FALSE.

apt_sources_list_parse_file ()

gboolean            apt_sources_list_parse_file         (AptSourcesList *list,
                                                         const gchar *file,
                                                         GError **error);

Parses the file at file. If an error occured, FALSE is returned and error is set (if it is not NULL).

list :

An AptSourcesList

file :

Path to the file that should be parsed

error :

Return location for an error

Returns :

TRUE if the file could be parsed. Otherwise, FALSE.

apt_sources_list_parse_line ()

gboolean            apt_sources_list_parse_line         (AptSourcesList *list,
                                                         const gchar *line,
                                                         GError **error);

Parses line which shall describe a single AptSource in the format described in sources.list(5). If an error occured, FALSE is returned and error is set (if it is not NULL).

list :

An AptSourcesList

line :

A line in the sources.list(5) format that shall be parsed

error :

Return location for an error

Returns :

TRUE if the line could be parsed. Otherwise, FALSE.