1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
|
.TH "libalpm_packages" 3 "Tue Feb 6 2024 19:11:31" "libalpm" \" -*- nroff -*-
.ad l
.nh
.SH NAME
libalpm_packages \- Package Functions
.PP
\- Functions to manipulate libalpm packages
.SH SYNOPSIS
.br
.PP
.SS "Typedefs"
.in +1c
.ti -1c
.RI "typedef struct __alpm_pkg_t \fBalpm_pkg_t\fP"
.br
.RI "A package\&. "
.in -1c
.SS "Enumerations"
.in +1c
.ti -1c
.RI "enum \fBalpm_pkgreason_t\fP { \fBALPM_PKG_REASON_EXPLICIT\fP = 0, \fBALPM_PKG_REASON_DEPEND\fP = 1 }"
.br
.RI "Package install reasons\&. "
.ti -1c
.RI "enum \fBalpm_pkgfrom_t\fP { \fBALPM_PKG_FROM_FILE\fP = 1, \fBALPM_PKG_FROM_LOCALDB\fP, \fBALPM_PKG_FROM_SYNCDB\fP }"
.br
.RI "Location a package object was loaded from\&. "
.ti -1c
.RI "enum \fBalpm_pkgvalidation_t\fP { \fBALPM_PKG_VALIDATION_UNKNOWN\fP = 0, \fBALPM_PKG_VALIDATION_NONE\fP = (1 << 0), \fBALPM_PKG_VALIDATION_MD5SUM\fP = (1 << 1), \fBALPM_PKG_VALIDATION_SHA256SUM\fP = (1 << 2), \fBALPM_PKG_VALIDATION_SIGNATURE\fP = (1 << 3) }"
.br
.RI "Method used to validate a package\&. "
.in -1c
.SS "Functions"
.in +1c
.ti -1c
.RI "int \fBalpm_pkg_load\fP (\fBalpm_handle_t\fP *handle, const char *filename, int full, int level, \fBalpm_pkg_t\fP **pkg)"
.br
.RI "Create a package from a file\&. "
.ti -1c
.RI "int \fBalpm_fetch_pkgurl\fP (\fBalpm_handle_t\fP *handle, const \fBalpm_list_t\fP *urls, \fBalpm_list_t\fP **fetched)"
.br
.RI "Fetch a list of remote packages\&. "
.ti -1c
.RI "\fBalpm_pkg_t\fP * \fBalpm_pkg_find\fP (\fBalpm_list_t\fP *haystack, const char *needle)"
.br
.RI "Find a package in a list by name\&. "
.ti -1c
.RI "int \fBalpm_pkg_free\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Free a package\&. "
.ti -1c
.RI "int \fBalpm_pkg_checkmd5sum\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Check the integrity (with md5) of a package from the sync cache\&. "
.ti -1c
.RI "int \fBalpm_pkg_vercmp\fP (const char *a, const char *b)"
.br
.RI "Compare two version strings and determine which one is 'newer'\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_compute_requiredby\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Computes the list of packages requiring a given package\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_compute_optionalfor\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Computes the list of packages optionally requiring a given package\&. "
.ti -1c
.RI "int \fBalpm_pkg_should_ignore\fP (\fBalpm_handle_t\fP *handle, \fBalpm_pkg_t\fP *pkg)"
.br
.RI "Test if a package should be ignored\&. "
.in -1c
.SS "Package Property Accessors"
Any pointer returned by these functions points to internal structures allocated by libalpm\&.
.PP
They should not be freed nor modified in any way\&.
.PP
For loaded packages, they will be freed when \fBalpm_pkg_free\fP is called\&. For database packages, they will be freed when the database is unregistered\&.
.in +1c
.ti -1c
.RI "const char * \fBalpm_pkg_get_filename\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Gets the name of the file from which the package was loaded\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_base\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package base name\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_name\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package name\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_version\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package version as a string\&. "
.ti -1c
.RI "\fBalpm_pkgfrom_t\fP \fBalpm_pkg_get_origin\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the origin of the package\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_desc\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package description\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_url\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package URL\&. "
.ti -1c
.RI "\fBalpm_time_t\fP \fBalpm_pkg_get_builddate\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the build timestamp of the package\&. "
.ti -1c
.RI "\fBalpm_time_t\fP \fBalpm_pkg_get_installdate\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the install timestamp of the package\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_packager\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the packager's name\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_md5sum\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package's MD5 checksum as a string\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_sha256sum\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package's SHA256 checksum as a string\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_arch\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the architecture for which the package was built\&. "
.ti -1c
.RI "off_t \fBalpm_pkg_get_size\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the size of the package\&. "
.ti -1c
.RI "off_t \fBalpm_pkg_get_isize\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the installed size of the package\&. "
.ti -1c
.RI "\fBalpm_pkgreason_t\fP \fBalpm_pkg_get_reason\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the package installation reason\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_licenses\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of package licenses\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_groups\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of package groups\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_depends\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of package dependencies as \fBalpm_depend_t\fP\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_optdepends\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of package optional dependencies\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_checkdepends\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns a list of package check dependencies\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_makedepends\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns a list of package make dependencies\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_conflicts\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of packages conflicting with pkg\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_provides\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of packages provided by pkg\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_replaces\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of packages to be replaced by pkg\&. "
.ti -1c
.RI "\fBalpm_filelist_t\fP * \fBalpm_pkg_get_files\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of files installed by pkg\&. "
.ti -1c
.RI "\fBalpm_list_t\fP * \fBalpm_pkg_get_backup\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the list of files backed up when installing pkg\&. "
.ti -1c
.RI "\fBalpm_db_t\fP * \fBalpm_pkg_get_db\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the database containing pkg\&. "
.ti -1c
.RI "const char * \fBalpm_pkg_get_base64_sig\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the base64 encoded package signature\&. "
.ti -1c
.RI "int \fBalpm_pkg_get_sig\fP (\fBalpm_pkg_t\fP *pkg, unsigned char **sig, size_t *sig_len)"
.br
.RI "Extracts package signature either from embedded package signature or if it is absent then reads data from detached signature file\&. "
.ti -1c
.RI "int \fBalpm_pkg_get_validation\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns the method used to validate a package during install\&. "
.ti -1c
.RI "int \fBalpm_pkg_has_scriptlet\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Returns whether the package has an install scriptlet\&. "
.ti -1c
.RI "off_t \fBalpm_pkg_download_size\fP (\fBalpm_pkg_t\fP *newpkg)"
.br
.RI "Returns the size of the files that will be downloaded to install a package\&. "
.ti -1c
.RI "int \fBalpm_pkg_set_reason\fP (\fBalpm_pkg_t\fP *pkg, \fBalpm_pkgreason_t\fP reason)"
.br
.RI "Set install reason for a package in the local database\&. "
.in -1c
.SS "Changelog functions"
Functions for reading the changelog
.in +1c
.ti -1c
.RI "void * \fBalpm_pkg_changelog_open\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Open a package changelog for reading\&. "
.ti -1c
.RI "size_t \fBalpm_pkg_changelog_read\fP (void *ptr, size_t size, const \fBalpm_pkg_t\fP *pkg, void *fp)"
.br
.RI "Read data from an open changelog 'file stream'\&. "
.ti -1c
.RI "int \fBalpm_pkg_changelog_close\fP (const \fBalpm_pkg_t\fP *pkg, void *fp)"
.br
.RI "Close a package changelog for reading\&. "
.in -1c
.SS "Mtree functions"
Functions for reading the mtree
.in +1c
.ti -1c
.RI "struct archive * \fBalpm_pkg_mtree_open\fP (\fBalpm_pkg_t\fP *pkg)"
.br
.RI "Open a package mtree file for reading\&. "
.ti -1c
.RI "int \fBalpm_pkg_mtree_next\fP (const \fBalpm_pkg_t\fP *pkg, struct archive *archive, struct archive_entry **entry)"
.br
.RI "Read next entry from a package mtree file\&. "
.ti -1c
.RI "int \fBalpm_pkg_mtree_close\fP (const \fBalpm_pkg_t\fP *pkg, struct archive *archive)"
.br
.RI "Close a package mtree file\&. "
.in -1c
.SH "Detailed Description"
.PP
Functions to manipulate libalpm packages
.SH "Typedef Documentation"
.PP
.SS "typedef struct __alpm_pkg_t \fBalpm_pkg_t\fP"
.PP
A package\&. A package can be loaded from disk via \fBalpm_pkg_load\fP or retrieved from a database\&. Packages from databases are automatically freed when the database is unregistered\&. Packages loaded from a file must be freed manually\&.
.PP
Packages can then be queried for metadata or added to a \fBtransaction \fP to be added or removed from the system\&.
.SH "Enumeration Type Documentation"
.PP
.SS "enum \fBalpm_pkgfrom_t\fP"
.PP
Location a package object was loaded from\&.
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fIALPM_PKG_FROM_FILE \fP\fP
Loaded from a file via \fBalpm_pkg_load\fP\&.
.TP
\fB\fIALPM_PKG_FROM_LOCALDB \fP\fP
From the local database\&.
.TP
\fB\fIALPM_PKG_FROM_SYNCDB \fP\fP
From a sync database\&.
.SS "enum \fBalpm_pkgreason_t\fP"
.PP
Package install reasons\&.
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fIALPM_PKG_REASON_EXPLICIT \fP\fP
Explicitly requested by the user\&.
.TP
\fB\fIALPM_PKG_REASON_DEPEND \fP\fP
Installed as a dependency for another package\&.
.SS "enum \fBalpm_pkgvalidation_t\fP"
.PP
Method used to validate a package\&.
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fIALPM_PKG_VALIDATION_UNKNOWN \fP\fP
The package's validation type is unknown\&.
.TP
\fB\fIALPM_PKG_VALIDATION_NONE \fP\fP
The package does not have any validation\&.
.TP
\fB\fIALPM_PKG_VALIDATION_MD5SUM \fP\fP
The package is validated with md5\&.
.TP
\fB\fIALPM_PKG_VALIDATION_SHA256SUM \fP\fP
The package is validated with sha256\&.
.TP
\fB\fIALPM_PKG_VALIDATION_SIGNATURE \fP\fP
The package is validated with a PGP signature\&.
.SH "Function Documentation"
.PP
.SS "int alpm_fetch_pkgurl (\fBalpm_handle_t\fP * handle, const \fBalpm_list_t\fP * urls, \fBalpm_list_t\fP ** fetched)"
.PP
Fetch a list of remote packages\&.
.PP
\fBParameters\fP
.RS 4
\fIhandle\fP the context handle
.br
\fIurls\fP list of package URLs to download
.br
\fIfetched\fP list of filepaths to the fetched packages, each item corresponds to one in \fRurls\fP list\&. This is an output parameter, the caller should provide a pointer to an empty list (*fetched === NULL) and the callee fills the list with data\&.
.RE
.PP
\fBReturns\fP
.RS 4
0 on success or -1 on failure
.RE
.PP
.SS "int alpm_pkg_changelog_close (const \fBalpm_pkg_t\fP * pkg, void * fp)"
.PP
Close a package changelog for reading\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP the package to close the changelog of (either file or db)
.br
\fIfp\fP the 'file stream' to the package changelog to close
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, -1 on error
.RE
.PP
.SS "void * alpm_pkg_changelog_open (\fBalpm_pkg_t\fP * pkg)"
.PP
Open a package changelog for reading\&. Similar to fopen in functionality, except that the returned 'file stream' could really be from an archive as well as from the database\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP the package to read the changelog of (either file or db)
.RE
.PP
\fBReturns\fP
.RS 4
a 'file stream' to the package changelog
.RE
.PP
.SS "size_t alpm_pkg_changelog_read (void * ptr, size_t size, const \fBalpm_pkg_t\fP * pkg, void * fp)"
.PP
Read data from an open changelog 'file stream'\&. Similar to fread in functionality, this function takes a buffer and amount of data to read\&. If an error occurs pm_errno will be set\&.
.PP
\fBParameters\fP
.RS 4
\fIptr\fP a buffer to fill with raw changelog data
.br
\fIsize\fP the size of the buffer
.br
\fIpkg\fP the package that the changelog is being read from
.br
\fIfp\fP a 'file stream' to the package changelog
.RE
.PP
\fBReturns\fP
.RS 4
the number of characters read, or 0 if there is no more data or an error occurred\&.
.RE
.PP
.SS "int alpm_pkg_checkmd5sum (\fBalpm_pkg_t\fP * pkg)"
.PP
Check the integrity (with md5) of a package from the sync cache\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP package pointer
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, -1 on error (pm_errno is set accordingly)
.RE
.PP
.SS "\fBalpm_list_t\fP * alpm_pkg_compute_optionalfor (\fBalpm_pkg_t\fP * pkg)"
.PP
Computes the list of packages optionally requiring a given package\&. The return value of this function is a newly allocated list of package names (char*), it should be freed by the caller\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a package
.RE
.PP
\fBReturns\fP
.RS 4
the list of packages optionally requiring pkg
.RE
.PP
.SS "\fBalpm_list_t\fP * alpm_pkg_compute_requiredby (\fBalpm_pkg_t\fP * pkg)"
.PP
Computes the list of packages requiring a given package\&. The return value of this function is a newly allocated list of package names (char*), it should be freed by the caller\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a package
.RE
.PP
\fBReturns\fP
.RS 4
the list of packages requiring pkg
.RE
.PP
.SS "off_t alpm_pkg_download_size (\fBalpm_pkg_t\fP * newpkg)"
.PP
Returns the size of the files that will be downloaded to install a package\&.
.PP
\fBParameters\fP
.RS 4
\fInewpkg\fP the new package to upgrade to
.RE
.PP
\fBReturns\fP
.RS 4
the size of the download
.RE
.PP
.SS "\fBalpm_pkg_t\fP * alpm_pkg_find (\fBalpm_list_t\fP * haystack, const char * needle)"
.PP
Find a package in a list by name\&.
.PP
\fBParameters\fP
.RS 4
\fIhaystack\fP a list of alpm_pkg_t
.br
\fIneedle\fP the package name
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to the package if found or NULL
.RE
.PP
.SS "int alpm_pkg_free (\fBalpm_pkg_t\fP * pkg)"
.PP
Free a package\&. Only packages loaded with \fBalpm_pkg_load\fP can be freed\&. Packages from databases will be freed by libalpm when they are unregistered\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP package pointer to free
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, -1 on error (pm_errno is set accordingly)
.RE
.PP
.SS "const char * alpm_pkg_get_arch (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the architecture for which the package was built\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string
.RE
.PP
.SS "\fBalpm_list_t\fP * alpm_pkg_get_backup (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the list of files backed up when installing pkg\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to a list of \fBalpm_backup_t\fP objects
.RE
.PP
.SS "const char * alpm_pkg_get_base (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the package base name\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string
.RE
.PP
.SS "const char * alpm_pkg_get_base64_sig (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the base64 encoded package signature\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string
.RE
.PP
.SS "\fBalpm_time_t\fP alpm_pkg_get_builddate (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the build timestamp of the package\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
the timestamp of the build time
.RE
.PP
.SS "\fBalpm_list_t\fP * alpm_pkg_get_checkdepends (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns a list of package check dependencies\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&.
.RE
.PP
.SS "\fBalpm_list_t\fP * alpm_pkg_get_conflicts (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the list of packages conflicting with pkg\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&.
.RE
.PP
.SS "\fBalpm_db_t\fP * alpm_pkg_get_db (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the database containing pkg\&. Returns a pointer to the alpm_db_t structure the package is originating from, or NULL if the package was loaded from a file\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to the DB containing pkg, or NULL\&.
.RE
.PP
.SS "\fBalpm_list_t\fP * alpm_pkg_get_depends (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the list of package dependencies as \fBalpm_depend_t\fP\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&.
.RE
.PP
.SS "const char * alpm_pkg_get_desc (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the package description\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string
.RE
.PP
.SS "const char * alpm_pkg_get_filename (\fBalpm_pkg_t\fP * pkg)"
.PP
Gets the name of the file from which the package was loaded\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string
.RE
.PP
.SS "\fBalpm_filelist_t\fP * alpm_pkg_get_files (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the list of files installed by pkg\&. The filenames are relative to the install root, and do not include leading slashes\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to a filelist object containing a count and an array of package file objects
.RE
.PP
.SS "\fBalpm_list_t\fP * alpm_pkg_get_groups (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the list of package groups\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to an internal list of strings\&.
.RE
.PP
.SS "\fBalpm_time_t\fP alpm_pkg_get_installdate (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the install timestamp of the package\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
the timestamp of the install time
.RE
.PP
.SS "off_t alpm_pkg_get_isize (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the installed size of the package\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
the total size of files installed by the package\&.
.RE
.PP
.SS "\fBalpm_list_t\fP * alpm_pkg_get_licenses (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the list of package licenses\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a pointer to an internal list of strings\&.
.RE
.PP
.SS "\fBalpm_list_t\fP * alpm_pkg_get_makedepends (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns a list of package make dependencies\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&.
.RE
.PP
.SS "const char * alpm_pkg_get_md5sum (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the package's MD5 checksum as a string\&. The returned string is a sequence of 32 lowercase hexadecimal digits\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string
.RE
.PP
.SS "const char * alpm_pkg_get_name (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the package name\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string
.RE
.PP
.SS "\fBalpm_list_t\fP * alpm_pkg_get_optdepends (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the list of package optional dependencies\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&.
.RE
.PP
.SS "\fBalpm_pkgfrom_t\fP alpm_pkg_get_origin (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the origin of the package\&.
.PP
\fBReturns\fP
.RS 4
an alpm_pkgfrom_t constant, -1 on error
.RE
.PP
.SS "const char * alpm_pkg_get_packager (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the packager's name\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string
.RE
.PP
.SS "\fBalpm_list_t\fP * alpm_pkg_get_provides (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the list of packages provided by pkg\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&.
.RE
.PP
.SS "\fBalpm_pkgreason_t\fP alpm_pkg_get_reason (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the package installation reason\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
an enum member giving the install reason\&.
.RE
.PP
.SS "\fBalpm_list_t\fP * alpm_pkg_get_replaces (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the list of packages to be replaced by pkg\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal list of \fBalpm_depend_t\fP structures\&.
.RE
.PP
.SS "const char * alpm_pkg_get_sha256sum (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the package's SHA256 checksum as a string\&. The returned string is a sequence of 64 lowercase hexadecimal digits\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string
.RE
.PP
.SS "int alpm_pkg_get_sig (\fBalpm_pkg_t\fP * pkg, unsigned char ** sig, size_t * sig_len)"
.PP
Extracts package signature either from embedded package signature or if it is absent then reads data from detached signature file\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package\&.
.br
\fIsig\fP output parameter for signature data\&. Callee function allocates a buffer needed for the signature data\&. Caller is responsible for freeing this buffer\&.
.br
\fIsig_len\fP output parameter for the signature data length\&.
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, negative number on error\&.
.RE
.PP
.SS "off_t alpm_pkg_get_size (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the size of the package\&. This is only available for sync database packages and package files, not those loaded from the local database\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
the size of the package in bytes\&.
.RE
.PP
.SS "const char * alpm_pkg_get_url (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the package URL\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string
.RE
.PP
.SS "int alpm_pkg_get_validation (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the method used to validate a package during install\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
an enum member giving the validation method
.RE
.PP
.SS "const char * alpm_pkg_get_version (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns the package version as a string\&. This includes all available epoch, version, and pkgrel components\&. Use \fBalpm_pkg_vercmp()\fP to compare version strings if necessary\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP a pointer to package
.RE
.PP
\fBReturns\fP
.RS 4
a reference to an internal string
.RE
.PP
.SS "int alpm_pkg_has_scriptlet (\fBalpm_pkg_t\fP * pkg)"
.PP
Returns whether the package has an install scriptlet\&.
.PP
\fBReturns\fP
.RS 4
0 if FALSE, TRUE otherwise
.RE
.PP
.SS "int alpm_pkg_load (\fBalpm_handle_t\fP * handle, const char * filename, int full, int level, \fBalpm_pkg_t\fP ** pkg)"
.PP
Create a package from a file\&. If full is false, the archive is read only until all necessary metadata is found\&. If it is true, the entire archive is read, which serves as a verification of integrity and the filelist can be created\&. The allocated structure should be freed using \fBalpm_pkg_free()\fP\&.
.PP
\fBParameters\fP
.RS 4
\fIhandle\fP the context handle
.br
\fIfilename\fP location of the package tarball
.br
\fIfull\fP whether to stop the load after metadata is read or continue through the full archive
.br
\fIlevel\fP what level of package signature checking to perform on the package; note that this must be a '\&.sig' file type verification
.br
\fIpkg\fP address of the package pointer
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, -1 on error (pm_errno is set accordingly)
.RE
.PP
.SS "int alpm_pkg_mtree_close (const \fBalpm_pkg_t\fP * pkg, struct archive * archive)"
.PP
Close a package mtree file\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP the local package to close the mtree of
.br
\fIarchive\fP the archive to close
.RE
.PP
.SS "int alpm_pkg_mtree_next (const \fBalpm_pkg_t\fP * pkg, struct archive * archive, struct archive_entry ** entry)"
.PP
Read next entry from a package mtree file\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP the package that the mtree file is being read from
.br
\fIarchive\fP the archive structure reading from the mtree file
.br
\fIentry\fP an archive_entry to store the entry header information
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, 1 if end of archive is reached, -1 otherwise\&.
.RE
.PP
.SS "struct archive * alpm_pkg_mtree_open (\fBalpm_pkg_t\fP * pkg)"
.PP
Open a package mtree file for reading\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP the local package to read the mtree of
.RE
.PP
\fBReturns\fP
.RS 4
an archive structure for the package mtree file
.RE
.PP
.SS "int alpm_pkg_set_reason (\fBalpm_pkg_t\fP * pkg, \fBalpm_pkgreason_t\fP reason)"
.PP
Set install reason for a package in the local database\&. The provided package object must be from the local database or this method will fail\&. The write to the local database is performed immediately\&.
.PP
\fBParameters\fP
.RS 4
\fIpkg\fP the package to update
.br
\fIreason\fP the new install reason
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, -1 on error (pm_errno is set accordingly)
.RE
.PP
.SS "int alpm_pkg_should_ignore (\fBalpm_handle_t\fP * handle, \fBalpm_pkg_t\fP * pkg)"
.PP
Test if a package should be ignored\&. Checks if the package is ignored via IgnorePkg, or if the package is in a group ignored via IgnoreGroup\&.
.PP
\fBParameters\fP
.RS 4
\fIhandle\fP the context handle
.br
\fIpkg\fP the package to test
.RE
.PP
\fBReturns\fP
.RS 4
1 if the package should be ignored, 0 otherwise
.RE
.PP
.SS "int alpm_pkg_vercmp (const char * a, const char * b)"
.PP
Compare two version strings and determine which one is 'newer'\&. Returns a value comparable to the way strcmp works\&. Returns 1 if a is newer than b, 0 if a and b are the same version, or -1 if b is newer than a\&.
.PP
Different epoch values for version strings will override any further comparison\&. If no epoch is provided, 0 is assumed\&.
.PP
Keep in mind that the pkgrel is only compared if it is available on both versions handed to this function\&. For example, comparing 1\&.5-1 and 1\&.5 will yield 0; comparing 1\&.5-1 and 1\&.5-2 will yield -1 as expected\&. This is mainly for supporting versioned dependencies that do not include the pkgrel\&.
.SH "Author"
.PP
Generated automatically by Doxygen for libalpm from the source code\&.
|