Skip to content
Browse files

refactor daemon ftw

  • Loading branch information...
1 parent 653ee13 commit d7578feafd983b6e5b7dd1c196b9102aa787995a @falconindy committed Sep 8, 2010
Showing with 12 additions and 12 deletions.
  1. +12 −12 gobble.go
View
24 gobble.go
@@ -16,7 +16,7 @@ const (
PKGCACHE = "/var/cache/pacman/pkg"
)
-type archpkg struct {
+type archPkg struct {
Name string
Version string
Arch string
@@ -36,25 +36,25 @@ var (
/* global listing of package groups */
var pkgList = map[string]*list.List{}
-func addPkgSorted(l *list.List, eAdd *archpkg) {
- p := l.Front()
- ele := (p.Value).(*archpkg)
+func addPkgSorted(lst *list.List, pkg *archPkg) {
+ p := lst.Front()
+ ele := (p.Value).(*archPkg)
for {
- if vercmp(eAdd.Version, ele.Version) == -1 {
- l.InsertBefore(eAdd, p)
+ if vercmp(pkg.Version, ele.Version) == -1 {
+ lst.InsertBefore(pkg, p)
return
}
if next := p.Next(); next == nil {
- l.PushBack(eAdd)
+ lst.PushBack(pkg)
return
} else {
p = p.Next()
}
}
}
-func parsePkg(file string) *archpkg {
+func parsePkg(file string) *archPkg {
parts := strings.Split(file, "-", -1)
n := len(parts)
if n < 3 {
@@ -69,7 +69,7 @@ func parsePkg(file string) *archpkg {
pkgver := strings.Join(parts[n-3:n-1], "-")
ext := strings.Split(parts[n-1], ".", 2)
- return &archpkg{pkgname, pkgver, ext[0], ext[1]}
+ return &archPkg{pkgname, pkgver, ext[0], ext[1]}
}
func copyFile(src io.Reader, dst *bufio.Writer) os.Error {
@@ -97,7 +97,7 @@ func copyFile(src io.Reader, dst *bufio.Writer) os.Error {
return nil
}
-func movePkg(pkg *archpkg) os.Error {
+func movePkg(pkg *archPkg) os.Error {
filename := fmt.Sprintf("%s-%s-%s.%s", pkg.Name, pkg.Version, pkg.Arch, pkg.Ext)
srcPath := fmt.Sprintf("%s/%s", *cachePath, filename)
@@ -132,7 +132,7 @@ func movePkg(pkg *archpkg) os.Error {
return os.Errno(errno)
}
-func addPkgToMap(pkg *archpkg) {
+func addPkgToMap(pkg *archPkg) {
pkgKey := fmt.Sprintf("%s$%s", pkg.Name, pkg.Arch)
if _, ok := pkgList[pkgKey]; !ok {
pkgList[pkgKey] = list.New()
@@ -151,7 +151,7 @@ func prune() (int, int) {
continue
}
for i := 0; i < groupSz-*keep; i++ {
- p := (group.Front().Value).(*archpkg)
+ p := (group.Front().Value).(*archPkg)
filename := fmt.Sprintf("%s-%s-%s.%s", p.Name, p.Version, p.Arch, p.Ext)
fullpath := fmt.Sprintf("%s/%s", *cachePath, filename)

0 comments on commit d7578fe

Please sign in to comment.
Something went wrong with that request. Please try again.