Skip to content

Commit

Permalink
CA-362560: Go build not get the version replaced source
Browse files Browse the repository at this point in the history
Signed-off-by: Xihuan Yang <[email protected]>
  • Loading branch information
Xihuan Yang authored and stormi committed Aug 2, 2022
1 parent ccf2bc6 commit c6f8338
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ GOBUILDDIR = $(BUILDDIR)/gobuild
STAGEDIR = $(BUILDDIR)/stage
OBJECTDIR = $(BUILDDIR)/obj
DISTDIR = $(BUILDDIR)/dist
VENDORDIR = $(REPO)/vendor/$(shell basename $(REPO))

OBJECTS :=
OBJECTS += $(OBJECTDIR)/xe-daemon
Expand Down Expand Up @@ -51,6 +52,7 @@ clean:
$(RM) -rf $(BUILDDIR)

$(DISTDIR)/$(PACKAGE)_$(VERSION)-$(RELEASE)_$(ARCH).tgz: $(OBJECTS)
$(info ***** Create build direcotry *****)
( mkdir -p $(DISTDIR) ; \
install -d $(STAGEDIR)/etc/init.d/ ; \
install -m 755 $(SOURCEDIR)/xe-linux-distribution.init $(STAGEDIR)/etc/init.d/xe-linux-distribution ; \
Expand All @@ -74,19 +76,29 @@ $(DISTDIR)/$(PACKAGE)_$(VERSION)-$(RELEASE)_$(ARCH).tgz: $(OBJECTS)
)

$(OBJECTDIR)/xe-daemon: $(XE_DAEMON_SOURCES:%=$(GOBUILDDIR)/%)
$(info ***** Build xe-daemon ******)
(cd $(VENDORDIR) && ln -sfn ../../build/gobuild/guestmetric guestmetric)
(cd $(VENDORDIR) && ln -sfn ../../build/gobuild/syslog syslog)
(cd $(VENDORDIR) && ln -sfn ../../build/gobuild/system system)
(cd $(VENDORDIR) && ln -sfn ../../build/gobuild/xenstoreclient xenstoreclient)
mkdir -p $(OBJECTDIR)
$(GO_BUILD) $(GO_FLAGS) -o $@ $<

$(OBJECTDIR)/xenstore: $(XENSTORE_SOURCES:%=$(GOBUILDDIR)/%) $(GOROOT)
$(OBJECTDIR)/xenstore: $(XENSTORE_SOURCES:%=$(GOBUILDDIR)/%)
$(info ***** Build xenstore ******)
mkdir -p $(OBJECTDIR)
$(GO_BUILD) $(GO_FLAGS) -o $@ $<
(cd $(VENDORDIR) && ln -sfn ../../guestmetric guestmetric)
(cd $(VENDORDIR) && ln -sfn ../../syslog syslog)
(cd $(VENDORDIR) && ln -sfn ../../system system)
(cd $(VENDORDIR) && ln -sfn ../../xenstoreclient xenstoreclient)

$(GOBUILDDIR)/%: $(REPO)/%
$(info ****** Replace product version for: [$<] *****)
mkdir -p $$(dirname $@)
cat $< | \
sed -e "s/@PRODUCT_MAJOR_VERSION@/$(PRODUCT_MAJOR_VERSION)/g" | \
sed -e "s/@PRODUCT_MINOR_VERSION@/$(PRODUCT_MINOR_VERSION)/g" | \
sed -e "s/@PRODUCT_MICRO_VERSION@/$(PRODUCT_MICRO_VERSION)/g" | \
sed -e "s/@NUMERIC_BUILD_NUMBER@/$(RELEASE)/g" \
> $@

2 changes: 1 addition & 1 deletion vendor/xe-guest-utilities/xenstoreclient

0 comments on commit c6f8338

Please sign in to comment.