forked from remyoudompheng/go-alpm
-
Notifications
You must be signed in to change notification settings - Fork 14
/
sync.go
40 lines (31 loc) · 792 Bytes
/
sync.go
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
// db.go - Functions for database handling.
//
// Copyright (c) 2013 The go-alpm Authors
//
// MIT Licensed. See LICENSE for details.
package alpm
/*
#include <alpm.h>
*/
import "C"
import "unsafe"
// SyncNewVersion checks if there is a new version of the
// package in a given DBlist.
func (pkg *Package) SyncNewVersion(l IDBList) IPackage {
ptr := C.alpm_sync_get_new_version(pkg.pmpkg, (*C.alpm_list_t)(unsafe.Pointer(l.(*DBList).list)))
if ptr == nil {
return nil
}
return &Package{ptr, l.(*DBList).handle}
}
func (h *Handle) SyncSysupgrade(enableDowngrade bool) error {
intEnableDowngrade := C.int(0)
if enableDowngrade {
intEnableDowngrade = C.int(1)
}
ret := C.alpm_sync_sysupgrade(h.ptr, intEnableDowngrade)
if ret != 0 {
return h.LastError()
}
return nil
}