summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.text24
-rw-r--r--doIncomingOld.go68
2 files changed, 3 insertions, 89 deletions
diff --git a/config.text b/config.text
index 0941913..2bdd782 100644
--- a/config.text
+++ b/config.text
@@ -1,7 +1,3 @@
-#
-# This is our WIT mirrors config file
-# ~/.config/mirrors/config.text
-#
uuid: "3135d0f9-82a9-40b6-8aa1-b683ebe7bedd"
version: "v0.0.2 go.wit.com/lib/config"
configs: {
@@ -9,21 +5,7 @@ configs: {
value: "protobufs are neat"
}
configs: {
- key: "mirrors.pb"
- value: "/home/mirrors/wit/mirrors.wit.com.pb"
+ key: "Verbose"
+ value: "true"
}
-configs: {
- key: "BaseDir"
- value: "/home/mirrors/wit"
-}
-configs: {
- key: "distPath"
- value: "/home/mirrors/wit/dists/sid"
-}
-# YOUR GPG KEY
-# Find it with: gpg --list-secret-keys --keyid-format=long
-configs: {
- key: "gpgKeyID"
- value: "5D7C9BE47836D2FA48F83C2B4A854AEAF7E0E16D"
-}
-filename: "/root/.config/mirrors/config.text"
+filename: "/home/jcarr/.config/mirrors/config.text"
diff --git a/doIncomingOld.go b/doIncomingOld.go
deleted file mode 100644
index 35873f0..0000000
--- a/doIncomingOld.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package main
-
-import (
- "crypto/md5"
- "errors"
- "os"
- "path/filepath"
- "strings"
-
- "go.wit.com/lib/config"
- "go.wit.com/lib/gui/shell"
- "go.wit.com/log"
-)
-
-func moveOutOfIncomingOld(fullname string) error {
- if strings.HasPrefix(fullname, "pool/main/incoming") {
- log.Info("file is in incoming", fullname)
- } else {
- log.Info("file isn't in incoming", fullname)
- return nil
- }
-
- _, filename := filepath.Split(fullname)
- parts := strings.Split(filename, "_")
- if len(parts) != 3 {
- // todo: add more filename checking here (check for ".deb")
- return errors.New(log.Sprintf("bad filenae %s", filename))
- }
- packageName := parts[0]
- letteredDir := log.Sprintf("%1.1s", filename)
- newfilename := filepath.Join("pool/main", letteredDir, packageName, filename)
- if newfilename == fullname {
- // the filename is correct
- return errors.New(log.Sprintf("should be impossible %s", filename))
- }
- destDir := filepath.Dir(newfilename)
- if err := os.MkdirAll(destDir, 0755); err != nil {
- log.Printf("%s move incoming oldname %s newname: %s\n", packageName, fullname, newfilename)
- log.Fatal("Failed to create destination directory: %v", err)
- }
- if config.Exists(newfilename) {
- olddata, _ := os.ReadFile(fullname)
- newdata, _ := os.ReadFile(newfilename)
- oldmd5 := md5.Sum(olddata)
- newmd5 := md5.Sum(newdata)
- if oldmd5 == newmd5 {
- log.Info("OLD FILE", fullname)
- log.Info("NEW FILE", newfilename)
- log.Printf("files are the same %x %x\n", md5.Sum(olddata), md5.Sum(newdata))
- } else {
- shell.RunVerbose([]string{"dpkg", "-I", fullname})
- shell.RunVerbose([]string{"dpkg", "-I", newfilename})
- log.Printf("different checksums: %s %s\n", fullname, newfilename)
- log.Printf("md5sum old %x vs new %x\n", md5.Sum(olddata), md5.Sum(newdata))
- }
- if argv.Force {
- moveFileToBroken(newfilename)
- // os.Rename(path, newfilename)
- // log.Printf("%s moved incoming oldname %s newname: %s\n", packageName, path, newfilename)
- }
- // return "file already exists. use --force to replace", errors.New("duplicate .deb in incoming/")
- me.argv.GoodExit("file already exists. TODO: fix this to use --force to replace")
- }
- // file can be moved
- os.Rename(fullname, newfilename)
- log.Printf("%s moved incoming oldname %s newname: %s\n", packageName, fullname, newfilename)
- return nil
-}