diff --git a/Makefile b/Makefile index 03c708b59d1f..091a1cc4392e 100644 --- a/Makefile +++ b/Makefile @@ -792,8 +792,8 @@ win-gvproxy: test/version/version cp tmp-gv/bin/gvproxy.exe bin/windows/ rm -rf tmp-gv -.PHONY: package -package: ## Build rpm packages +.PHONY: rpm +rpm: ## Build rpm packages $(MAKE) -C rpm ### @@ -803,9 +803,9 @@ package: ## Build rpm packages # Remember that rpms install exec to /usr/bin/podman while a `make install` # installs them to /usr/local/bin/podman which is likely before. Always use # a full path to test installed podman or you risk to call another executable. -.PHONY: package-install -package-install: package ## Install rpm packages - sudo $(call err_if_empty,PKG_MANAGER) -y install ${HOME}/rpmbuild/RPMS/*/*.rpm +.PHONY: rpm-install +rpm-install: package ## Install rpm packages + $(call err_if_empty,PKG_MANAGER) -y install rpm/RPMS/*/*.rpm /usr/bin/podman version /usr/bin/podman info # will catch a broken conmon diff --git a/rpm/Makefile b/rpm/Makefile index 62fa0c075f76..58320a3acede 100644 --- a/rpm/Makefile +++ b/rpm/Makefile @@ -8,3 +8,4 @@ rpm: --define '_srcrpmdir %{_sourcedir}/SRPMS' \ --define '_builddir %{_sourcedir}/BUILD' \ podman.spec + @echo ___Undo any changes to Version, Source0 and %autosetup in rpm/podman.spec before committing.___ diff --git a/rpm/update-spec-version.sh b/rpm/update-spec-version.sh index ec7173b1d6c9..16b174c0f82c 100644 --- a/rpm/update-spec-version.sh +++ b/rpm/update-spec-version.sh @@ -4,12 +4,16 @@ # default. Useful for local manual rpm builds where the Version needs to be set # correctly. -set -e +set -eox pipefail -# Script is run from git root directory -SPEC_FILE=rpm/podman.spec +SPEC_FILE=podman.spec +GIT_DESCRIBE=$(git describe) +VERSION=$(echo $GIT_DESCRIBE | sed -e 's/^v//' -e 's/-/~/g') -LATEST_TAG=$(git tag --sort=creatordate | tail -1) -LATEST_VERSION=$(echo $LATEST_TAG | sed -e 's/^v//') +# Generate Source0 archive from HEAD +git-archive-all podman-$GIT_DESCRIBE.tar.gz -sed -i "s/^Version:.*/Version: $LATEST_VERSION/" $SPEC_FILE +# Update spec file to use local changes +sed -i "s/^Version:.*/Version: $VERSION/" $SPEC_FILE +sed -i "s/^Source0:.*/Source0: podman-$GIT_DESCRIBE.tar.gz/" $SPEC_FILE +sed -i "s/^%autosetup.*/%autosetup -Sgit -n %{name}-$GIT_DESCRIBE/" $SPEC_FILE