Example #1
0
func DecodeDesc(r *paclist.Reader) (*Desc, error) {
	m, err := paclist.Decode(r)
	if err != nil {
		return nil, err
	}

	desc := new(Desc)

	if err := decode(m, map[string]interface{}{
		"FILENAME":  &desc.Filename,
		"NAME":      &desc.Name,
		"VERSION":   &desc.Version,
		"DESC":      &desc.Desc,
		"CSIZE":     &desc.Csize,
		"ISIZE":     &desc.Isize,
		"MD5SUM":    &desc.MD5sum,
		"SHA256SUM": &desc.SHA256sum,
		"PGPSIG":    &desc.PGPsig,
		"URL":       &desc.URL,
		"LICENSE":   &desc.License,
		"ARCH":      &desc.Arch,
		"BUILDDATE": &desc.BuildDate,
		"PACKAGER":  &desc.Packager,
		"REPLACES":  &desc.Replaces,
	}); err != nil {
		return nil, err
	}

	return desc, nil
}
Example #2
0
func DecodeDeps(r *paclist.Reader) (*Deps, error) {
	m, err := paclist.Decode(r)
	if err != nil {
		return nil, err
	}

	deps := new(Deps)

	if err := decode(m, map[string]interface{}{
		"DEPENDS":    &deps.Depends,
		"PROVIDES":   &deps.Provides,
		"OPTDEPENDS": &deps.OptDepends,
	}); err != nil {
		return nil, err
	}

	return deps, nil
}
Example #3
0
func main() {
	fmt.Println(paclist.Decode(paclist.NewReader(os.Stdin)))
}