[PATCH] [Wok] Issue #155: 'make clean' does not revert its changes from 'make rpm'

From: Bianca Carvalho <bianca@linux.vnet.ibm.com> Edited Makefile.am to check if there is any file to be stashed or commited before run 'make rpm' to avoid losing any changes. Also included 'git reset --hard' command to revert changes made by 'make rpm' command. Signed-off-by: Bianca Carvalho <bianca@linux.vnet.ibm.com> --- Makefile.am | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index ac07e97..10d9718 100644 --- a/Makefile.am +++ b/Makefile.am @@ -115,17 +115,30 @@ wok.spec: contrib/wok.spec.fedora contrib/wok.spec.suse /bin/false ; \ fi -rpm: dist wok.spec +check_files: + @if [ -d '.git' ]; then \ + if [ `git status --porcelain --untracked-files=no | wc -l` -gt 0 ]; then \ + echo "***** Aborting 'make rpm' command *****"; \ + echo "There are some changes not commited in your working \ +directory. To avoid losing them, please commit or stage before run 'make rpm' command."; \ + exit 1; \ + fi \ + fi + +rpm: check_files dist wok.spec $(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS cp $(top_srcdir)/wok.spec rpm/SPECS/wok.spec cp $(DIST_ARCHIVES) rpm/SOURCES rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/wok.spec + @if [ -d '.git' ]; then \ + git reset --hard; \ + fi -fedora-rpm: contrib/wok.spec.fedora +fedora-rpm: check_files contrib/wok.spec.fedora ln -sf contrib/wok.spec.fedora wok.spec $(MAKE) rpm -suse-rpm: contrib/wok.spec.suse +suse-rpm: check_files contrib/wok.spec.suse ln -sf contrib/wok.spec.suse wok.spec $(MAKE) rpm -- 2.7.4

Reviewed-By: Ramon Medeiros <ramonn@br.ibm.com> On 08/12/2016 05:37 PM, bianca@linux.vnet.ibm.com wrote:
From: Bianca Carvalho <bianca@linux.vnet.ibm.com>
Edited Makefile.am to check if there is any file to be stashed or commited before run 'make rpm' to avoid losing any changes. Also included 'git reset --hard' command to revert changes made by 'make rpm' command.
Signed-off-by: Bianca Carvalho <bianca@linux.vnet.ibm.com> --- Makefile.am | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am index ac07e97..10d9718 100644 --- a/Makefile.am +++ b/Makefile.am @@ -115,17 +115,30 @@ wok.spec: contrib/wok.spec.fedora contrib/wok.spec.suse /bin/false ; \ fi
-rpm: dist wok.spec +check_files: + @if [ -d '.git' ]; then \ + if [ `git status --porcelain --untracked-files=no | wc -l` -gt 0 ]; then \ + echo "***** Aborting 'make rpm' command *****"; \ + echo "There are some changes not commited in your working \ +directory. To avoid losing them, please commit or stage before run 'make rpm' command."; \ + exit 1; \ + fi \ + fi + +rpm: check_files dist wok.spec $(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS cp $(top_srcdir)/wok.spec rpm/SPECS/wok.spec cp $(DIST_ARCHIVES) rpm/SOURCES rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/wok.spec + @if [ -d '.git' ]; then \ + git reset --hard; \ + fi
-fedora-rpm: contrib/wok.spec.fedora +fedora-rpm: check_files contrib/wok.spec.fedora ln -sf contrib/wok.spec.fedora wok.spec $(MAKE) rpm
-suse-rpm: contrib/wok.spec.suse +suse-rpm: check_files contrib/wok.spec.suse ln -sf contrib/wok.spec.suse wok.spec $(MAKE) rpm
-- Ramon Nunes Medeiros Kimchi Developer Linux Technology Center Brazil IBM Systems & Technology Group Phone : +55 19 2132 7878 ramonn@br.ibm.com

Applied to master. Thanks! On 08/12/2016 05:37 PM, bianca@linux.vnet.ibm.com wrote:
From: Bianca Carvalho <bianca@linux.vnet.ibm.com>
Edited Makefile.am to check if there is any file to be stashed or commited before run 'make rpm' to avoid losing any changes. Also included 'git reset --hard' command to revert changes made by 'make rpm' command.
Signed-off-by: Bianca Carvalho <bianca@linux.vnet.ibm.com> --- Makefile.am | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am index ac07e97..10d9718 100644 --- a/Makefile.am +++ b/Makefile.am @@ -115,17 +115,30 @@ wok.spec: contrib/wok.spec.fedora contrib/wok.spec.suse /bin/false ; \ fi
-rpm: dist wok.spec +check_files: + @if [ -d '.git' ]; then \ + if [ `git status --porcelain --untracked-files=no | wc -l` -gt 0 ]; then \ + echo "***** Aborting 'make rpm' command *****"; \ + echo "There are some changes not commited in your working \ +directory. To avoid losing them, please commit or stage before run 'make rpm' command."; \ + exit 1; \ + fi \ + fi + +rpm: check_files dist wok.spec $(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS cp $(top_srcdir)/wok.spec rpm/SPECS/wok.spec cp $(DIST_ARCHIVES) rpm/SOURCES rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/wok.spec + @if [ -d '.git' ]; then \ + git reset --hard; \ + fi
-fedora-rpm: contrib/wok.spec.fedora +fedora-rpm: check_files contrib/wok.spec.fedora ln -sf contrib/wok.spec.fedora wok.spec $(MAKE) rpm
-suse-rpm: contrib/wok.spec.suse +suse-rpm: check_files contrib/wok.spec.suse ln -sf contrib/wok.spec.suse wok.spec $(MAKE) rpm
participants (3)
-
bianca@linux.vnet.ibm.com
-
Daniel Henrique Barboza
-
Ramon Medeiros