Changeset View
Changeset View
Standalone View
Standalone View
build/instructions.go
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | |||||
// CopyAs is a concrete build instruction for copying source | // CopyAs is a concrete build instruction for copying source | ||||
// files/directories and setting their ownership to the given UID/GID. | // files/directories and setting their ownership to the given UID/GID. | ||||
// | // | ||||
type CopyAs struct { | type CopyAs struct { | ||||
UID uint // owner UID | UID uint // owner UID | ||||
GID uint // owner GID | GID uint // owner GID | ||||
Copy | Copy | ||||
CopyFrom | |||||
} | } | ||||
// Compile returns the variant name unquoted and all quoted CopyAs instruction | // Compile returns the variant name unquoted and all quoted CopyAs instruction | ||||
// fields. | // fields. | ||||
// | // | ||||
func (ca CopyAs) Compile() []string { | func (ca CopyAs) Compile() []string { | ||||
return append([]string{fmt.Sprintf("%d:%d", ca.UID, ca.GID)}, ca.Copy.Compile()...) | var copy Instruction | ||||
if ca.CopyFrom.From != "" { | |||||
copy = ca.CopyFrom | |||||
} else { | |||||
copy = ca.Copy | |||||
} | |||||
return append([]string{fmt.Sprintf("%d:%d", ca.UID, ca.GID)}, copy.Compile()...) | |||||
} | } | ||||
// CopyFrom is a concrete build instruction for copying source | // CopyFrom is a concrete build instruction for copying source | ||||
// files/directories from one variant image to another. | // files/directories from one variant image to another. | ||||
// | // | ||||
type CopyFrom struct { | type CopyFrom struct { | ||||
From string // source variant name | From string // source variant name | ||||
Copy | Copy | ||||
▲ Show 20 Lines • Show All 128 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 3.0 (CC-BY-SA) unless otherwise noted; code licensed under GNU General Public License (GPL) or other open source licenses. By using this site, you agree to the Terms of Use, Privacy Policy, and Code of Conduct. · Wikimedia Foundation · Privacy Policy · Code of Conduct · Terms of Use · Disclaimer · CC-BY-SA · GPL