Skip to content

Commit

Permalink
rpm-deb version changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulguptajss authored and cgrinds committed May 20, 2021
1 parent 8549e47 commit b7d71c9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
6 changes: 3 additions & 3 deletions cmd/harvest/harvest.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright NetApp Inc, 2021 All rights reserved
NetApp Harvest 2.0: the swiss-army-knife for datacenter monitoring
NetApp Harvest : the swiss-army-knife for datacenter monitoring
Authors:
Georg Mey & Vachagan Gratian
Expand Down Expand Up @@ -71,8 +71,8 @@ var (

var rootCmd = &cobra.Command{
Use: "harvest <command> <subcommand> [flags]",
Short: "NetApp Harvest 2.0 - application for monitoring storage systems",
Long: `NetApp Harvest 2.0 - application for monitoring storage systems
Short: "NetApp Harvest - application for monitoring storage systems",
Long: `NetApp Harvest - application for monitoring storage systems
`,
Args: cobra.ArbitraryArgs,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/harvest/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var (
)

func String() string {
return fmt.Sprintf("harvest version %s %s (commit %s) (build date %s) %s/%s\n",
return fmt.Sprintf("harvest version %s-%s (commit %s) (build date %s) %s/%s\n",
VERSION,
Release,
Commit,
Expand Down
7 changes: 2 additions & 5 deletions deb/build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mkdir -p "$BUILD/opt/harvest/bin/"
cp -r "$SRC/grafana" "$SRC/conf" "$BUILD/opt/harvest/"
cp "$SRC/harvest.example.yml" "$BUILD/opt/harvest/"
cp -r "$SRC/pkg/" "$SRC/cmd/" "$SRC/docs/" "$BUILD/opt/harvest/"
cp -r "$SRC/rpm/" "$SRC/deb/" "$SRC/service/" "$BUILD/opt/harvest/"
cp -r "$SRC/rpm/" "$SRC/deb/" "$SRC/service/" "$SRC/.git" "$BUILD/opt/harvest/"
cp "$SRC/Makefile" "$SRC/README.md" "$SRC/LICENSE" "$SRC/go.mod" "$SRC/go.sum" "$BUILD/opt/harvest/"
if [ -d "$SRC/vendor" ]; then
cp -r "$SRC/vendor" "$BUILD/opt/harvest/"
Expand All @@ -40,9 +40,6 @@ cat "$SRC/deb/control" >> "$BUILD/DEBIAN/control"

echo " --> update version & build info in [cmd/harvest/version/version.go]"
cd "$BUILD/opt/harvest/cmd/harvest/version"
sed -i -E "s/(\s*BUILD\s*=\s*\")\w*(\")/\1deb $HARVEST_ARCH\2/" version.go
sed -i -E "s/(\s*VERSION\s*=\s*\")\w*(\")/\1$HARVEST_VERSION\2/" version.go
sed -i -E "s/(\s*RELEASE\s*=\s*\")\w*(\")/\1$HARVEST_RELEASE\2/" version.go

# build binaries, since arch of build machine might not be the same as the target machine
# export a variable that Makefile will pass to the go compiler
Expand All @@ -54,7 +51,7 @@ if [ "$HARVEST_ARCH" = "armhf" ]; then
export GOARM="7"
fi
echo " --> build harvest with envs [GOOS=$GOOS, GOARCH=$GOARCH, GOARM=$GOARM]"
make all
make all VERSION=$HARVEST_VERSION RELEASE=$HARVEST_RELEASE
if [ ! $? -eq 0 ]; then
error " build failed"
exit 1
Expand Down
7 changes: 2 additions & 5 deletions rpm/build-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fi
echo "copying source files"
rm -rf "$BUILD"
mkdir -p "$BUILD/harvest/bin"
cp -r "$SRC/.git" "$BUILD/harvest"
cp -r "$SRC/pkg/" "$BUILD/harvest/"
cp -r "$SRC/cmd/" "$BUILD/harvest/"
cp -r "$SRC/grafana/" "$BUILD/harvest/"
Expand All @@ -33,15 +34,11 @@ cp "$SRC/Makefile" "$BUILD/harvest/"
cp "$SRC/README.md" "$BUILD/harvest/"
cp "$SRC/LICENSE" "$BUILD/harvest/"

# update build and package version
sed -i -E "s/(\s*BUILD\s*=\s*\")\w*(\")/\1rpm $HARVEST_ARCH\2/" $BUILD/harvest/cmd/harvest/version/version.go
sed -i -E "s/(\s*VERSION\s*=\s*\")\w*(\")/\1$HARVEST_VERSION\2/" $BUILD/harvest/cmd/harvest/version/version.go
sed -i -E "s/(\s*RELEASE\s*=\s*\")\w*(\")/\1$HARVEST_RELEASE\2/" $BUILD/harvest/cmd/harvest/version/version.go

# build binaries
echo "building binaries"
cd "$BUILD/harvest"
make all
make all VERSION=$HARVEST_VERSION RELEASE=$HARVEST_RELEASE
if [ ! $? -eq 0 ]; then
echo "build failed, aborting"
exit 1
Expand Down

0 comments on commit b7d71c9

Please sign in to comment.