forked from remyoudompheng/go-alpm
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Usage, transactions and Implement alpm_db_search (#17)
* Support Usage option * Implement alpm_db_search * Add basic support for transactions * Test Usage
- Loading branch information
1 parent
1114f77
commit 047b539
Showing
9 changed files
with
185 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// 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" | ||
|
||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// 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" | ||
) | ||
|
||
func (h *Handle) TransInit(flags TransFlag) error { | ||
ret := C.alpm_trans_init(h.ptr, C.int(flags)) | ||
if ret != 0 { | ||
return h.LastError() | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (h *Handle) TransRelease() error { | ||
ret := C.alpm_trans_release(h.ptr) | ||
if ret != 0 { | ||
return h.LastError() | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (h *Handle) TransGetAdd() PackageList { | ||
pkgs := C.alpm_trans_get_add(h.ptr) | ||
return PackageList{(*list)(unsafe.Pointer(pkgs)), *h} | ||
} | ||
|
||
func (h *Handle) TransGetRemove() PackageList { | ||
pkgs := C.alpm_trans_get_remove(h.ptr) | ||
return PackageList{(*list)(unsafe.Pointer(pkgs)), *h} | ||
} | ||
|
||
func (h *Handle) TransGetFalgs() (TransFlag, error) { | ||
flags := C.alpm_trans_get_flags(h.ptr) | ||
|
||
if flags == -1 { | ||
return -1, h.LastError() | ||
} | ||
|
||
return TransFlag(flags), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters