Skip to content

Commit 54af19f

Browse files
committed
dir2apk: Tweaks
1 parent c672e3e commit 54af19f

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

Scripts/alpine/dir2apk.go

+15-10
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,25 @@ func doMain() error {
9696

9797
docpkginfo := NewPKGInfo()
9898
docpkginfo["arch"] = "noarch"
99-
docpkginfo["builddate"] = strconv.FormatInt(builddate.UnixMilli(), 10)
100-
docpkginfo["pkgver"] = *version
101-
docpkginfo["commit"] = *commit
102-
docpkginfo["pkgdesc"] = docpkginfo["pkgdesc"] + " (documentation)"
103-
docpkginfo["install_if"] = fmt.Sprintf("docs %s=%s", docpkginfo["pkgname"], docpkginfo["pkgver"])
104-
docpkginfo["pkgname"] = docpkginfo["pkgname"] + "-doc"
99+
docpkginfo["builddate"] = pkginfo["builddate"]
100+
docpkginfo["pkgver"] = pkginfo["pkgver"]
101+
docpkginfo["commit"] = pkginfo["commit"]
102+
docpkginfo["pkgdesc"] = pkginfo["pkgdesc"] + " (documentation)"
103+
docpkginfo["install_if"] = fmt.Sprintf("docs %s=%s", pkginfo["pkgname"], pkginfo["pkgver"])
104+
docpkginfo["pkgname"] = pkginfo["pkgname"] + "-doc"
105+
105106
if err := CreatePackage(docpkginfo, rootdir, isDocPath, *outdir, *keyfile, builddate); err != nil {
106107
return err
107108
}
108109
return nil
109110
}
110111

112+
func isDocPath(path string) bool {
113+
return strings.Contains(path, "/man/") || strings.Contains("/licenses/", path)
114+
}
115+
116+
////////////////////////////////////////////////////////////////////////////////
117+
111118
func CreatePackage(pkginfo PKGInfo, rootdir string, pathfilter func(string) bool, outdir string, keyfile string, buildtime time.Time) error {
112119
datapath, size, err := CreateDataTarball(rootdir, pathfilter, buildtime)
113120
if err != nil {
@@ -151,6 +158,8 @@ func CreatePackage(pkginfo PKGInfo, rootdir string, pathfilter func(string) bool
151158
return nil
152159
}
153160

161+
////////////////////////////////////////////////////////////////////////////////
162+
154163
func CreateDataTarball(rootdir string, pathfilter func(string) bool, buildtime time.Time) (string, int64, error) {
155164
datafile, err := os.CreateTemp("", "apk-data")
156165
if err != nil {
@@ -284,10 +293,6 @@ func CreateTarSegment(filename string, contents []byte, buildtime time.Time) ([]
284293
return gzbuf.Bytes(), nil
285294
}
286295

287-
func isDocPath(path string) bool {
288-
return strings.Contains(path, "/man/") || strings.Contains("/licenses/", path)
289-
}
290-
291296
////////////////////////////////////////////////////////////////////////////////
292297

293298
func sha1sum(path string) (string, error) {

0 commit comments

Comments
 (0)