package fleetingly import ( "encoding/xml" "time" "pkg.jfrech.com/fleetingly/internal/utils" ) // In-memory representation of a fleetingly package. // Integrity is provided by pkg.jfrech.com/go/utils/integrity's marshalling. type Package struct { XMLName xml.Name `xml:"fleetingly-package"` // Package name; often in a directory-esque fashion to lightly categorise, // i.e. "util/ascii". Name string `xml:"name"` // Package versions are defined to be the point in time of packaging; they // utterly disregard any project-defined versions of the packaged software. Version time.Time `xml:"version"` // Human-readable plaintext describing the package. Description string `xml:"description"` // People who packaged this package. Packagers []Person `xml:"packager"` // An attributed and timestamped list of comments about the package. Comments []Comment `xml:"comment"` // // Name pointer into Files. If non-empty, this file ought to be executable // and will be run on install. When run, the executable may only act on its // current working directory. // TODO Future plans: enforce a jail or chroot. Make string `xml:"make,omitempty"` // Outward-facing filesystem symbolic links pointing to package-intrinsic // files (target may only exist after Make ran). Hooks []Hook `xml:"hook"` // // A package is made up of components, each with their separate licences // and authors. Components []Component `xml:"component"` } // type Person struct { Name string `xml:"name"` // URIs Homepages []string `xml:"homepage"` // Raw e-mail address, without chevrons or display names. EMailAddresses []string `xml:"e-mail"` } type Comment struct { Timestamp time.Time `xml:"timestamp"` // The comment's author. Author Person `xml:"author"` Text string `xml:"text"` } // type Hook struct { // Package-local file to be exported, i.e. "/dotfiles/vimrc" Exported string `xml:"exported"` // The outwards-facing symbolic link's reference, i.e. "home". // Must be one of "", "home" or "bin". HookRelativeTo string `xml:"hook-relative-to,attr,omitempty"` // Hook's filename, i.e. ".vimrc". Hook string `xml:"hook"` } // type File struct { // An absolute path, with the associated component as the root. Name string `xml:"name,attr"` Executable bool `xml:"executable,attr,omitempty"` Data utils.Base64MarshalledBytes `xml:"data-base64"` // [jfrech, 2022-10-23] TODO: `xml:",innerxml"` } // A component is a self-contained, licenced and attributed collection of (virtual) files. type Component struct { // Under this name, the component will be represented in the package's top // level. Each component's name must be unique. Name string `xml:"name,attr"` // An (approximate) timestamp for this component's last (upstream) edit. Timestamp time.Time `xml:"timestamp,attr"` // URIs to e.g. this component's project's homepage. Homepages []string `xml:"homepage,omitempty"` // Authors of the component. Authors []Person `xml:"author"` // Name pointers into associated Files which define the package's licences. Licences []string `xml:"licence"` // Associated binary blobs. Files []File `xml:"file"` }