Stub out fetching secret key entity
This commit is contained in:
parent
85e33bbe90
commit
17cfd72173
@ -149,7 +149,7 @@ func main() {
|
|||||||
fatalf("usage: pm package create <directory>\n")
|
fatalf("usage: pm package create <directory>\n")
|
||||||
}
|
}
|
||||||
dir := args[0]
|
dir := args[0]
|
||||||
if err := pkg.Create(dir, signID); err != nil {
|
if err := pkg.Create(root, signID, dir); err != nil {
|
||||||
fatalf("creating package: %v\n", err)
|
fatalf("creating package: %v\n", err)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -340,3 +340,8 @@ func findKey(el openpgp.EntityList, id string) (*openpgp.Entity, error) {
|
|||||||
}
|
}
|
||||||
return e, fmt.Errorf("key %q not found", id)
|
return e, fmt.Errorf("key %q not found", id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FindSecretEntity searches for id in the secret keyring.
|
||||||
|
func FindSecretEntity(root, id string) (*openpgp.Entity, error) {
|
||||||
|
return nil, errors.New("NYI")
|
||||||
|
}
|
||||||
|
10
pkg/pkg.go
10
pkg/pkg.go
@ -2,17 +2,25 @@ package pkg
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
"mcquay.me/fs"
|
"mcquay.me/fs"
|
||||||
|
"mcquay.me/pm/keyring"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create traverses the contents of dir and emits a valid pkg, signed by id
|
// Create traverses the contents of dir and emits a valid pkg, signed by id
|
||||||
func Create(dir, id string) error {
|
func Create(root, id, dir string) error {
|
||||||
if !fs.Exists(dir) {
|
if !fs.Exists(dir) {
|
||||||
return fmt.Errorf("%q: doesn't exist", dir)
|
return fmt.Errorf("%q: doesn't exist", dir)
|
||||||
}
|
}
|
||||||
if !fs.IsDir(dir) {
|
if !fs.IsDir(dir) {
|
||||||
return fmt.Errorf("%q: is not a directory", dir)
|
return fmt.Errorf("%q: is not a directory", dir)
|
||||||
}
|
}
|
||||||
|
e, err := keyring.FindSecretEntity(dir, id)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "find secret key")
|
||||||
|
}
|
||||||
|
log.Printf("found key: %v", e.PrimaryKey.KeyIdShortString())
|
||||||
return fmt.Errorf("creating package from %q for %q: NYI", dir, id)
|
return fmt.Errorf("creating package from %q for %q: NYI", dir, id)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user