Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
04a5ad52
Commit
04a5ad52
authored
Oct 06, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generate sha1 for package files, fixes #913
parent
cc145227
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
build.go
+40
-0
No files found.
build.go
View file @
04a5ad52
...
...
@@ -5,6 +5,7 @@ package main
import
(
"bytes"
"crypto/md5"
"crypto/sha1"
"encoding/json"
"flag"
"fmt"
...
...
@@ -85,17 +86,21 @@ func main() {
case
"package"
:
grunt
(
gruntBuildArg
(
"release"
)
...
)
createLinuxPackages
()
sha1FilesInDist
()
case
"pkg-rpm"
:
grunt
(
gruntBuildArg
(
"release"
)
...
)
createRpmPackages
()
sha1FilesInDist
()
case
"pkg-deb"
:
grunt
(
gruntBuildArg
(
"release"
)
...
)
createDebPackages
()
sha1FilesInDist
()
case
"latest"
:
makeLatestDistCopies
()
sha1FilesInDist
()
case
"clean"
:
clean
()
...
...
@@ -501,3 +506,38 @@ func md5File(file string) error {
return
out
.
Close
()
}
func
sha1FilesInDist
()
{
filepath
.
Walk
(
"./dist"
,
func
(
path
string
,
f
os
.
FileInfo
,
err
error
)
error
{
if
strings
.
Contains
(
path
,
".sha1"
)
==
false
{
sha1File
(
path
)
}
return
nil
})
}
func
sha1File
(
file
string
)
error
{
fd
,
err
:=
os
.
Open
(
file
)
if
err
!=
nil
{
return
err
}
defer
fd
.
Close
()
h
:=
sha1
.
New
()
_
,
err
=
io
.
Copy
(
h
,
fd
)
if
err
!=
nil
{
return
err
}
out
,
err
:=
os
.
Create
(
file
+
".sha1"
)
if
err
!=
nil
{
return
err
}
_
,
err
=
fmt
.
Fprintf
(
out
,
"%x
\n
"
,
h
.
Sum
(
nil
))
if
err
!=
nil
{
return
err
}
return
out
.
Close
()
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment