[PATCH v3] [Kimchi] Issue #585: '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 clean -df & git reset --hard' command to remove untracked files from the working tree and 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 9bebb65..9917dcc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -135,17 +135,30 @@ kimchi.spec: contrib/kimchi.spec.fedora contrib/kimchi.spec.suse /bin/false ; \ fi -rpm: dist kimchi.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 kimchi.spec $(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS cp $(top_srcdir)/kimchi.spec rpm/SPECS/kimchi.spec cp $(DIST_ARCHIVES) rpm/SOURCES rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/kimchi.spec + @if [ -d '.git' ]; then \ + git reset --hard; \ + fi -fedora-rpm: contrib/kimchi.spec.fedora +fedora-rpm: check_files contrib/kimchi.spec.fedora ln -sf contrib/kimchi.spec.fedora kimchi.spec $(MAKE) rpm -suse-rpm: contrib/kimchi.spec.suse +suse-rpm: check_files contrib/kimchi.spec.suse ln -sf contrib/kimchi.spec.suse kimchi.spec $(MAKE) rpm -- 2.7.4

Reviewed-by: Daniel Barboza <danielhb@linux.vnet.ibm.com> Tested-by: Daniel Barboza <danielhb@linux.vnet.ibm.com> On 08/12/2016 04:55 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 clean -df & git reset --hard' command to remove untracked files from the working tree and 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 9bebb65..9917dcc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -135,17 +135,30 @@ kimchi.spec: contrib/kimchi.spec.fedora contrib/kimchi.spec.suse /bin/false ; \ fi
-rpm: dist kimchi.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 kimchi.spec $(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS cp $(top_srcdir)/kimchi.spec rpm/SPECS/kimchi.spec cp $(DIST_ARCHIVES) rpm/SOURCES rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/kimchi.spec + @if [ -d '.git' ]; then \ + git reset --hard; \ + fi
-fedora-rpm: contrib/kimchi.spec.fedora +fedora-rpm: check_files contrib/kimchi.spec.fedora ln -sf contrib/kimchi.spec.fedora kimchi.spec $(MAKE) rpm
-suse-rpm: contrib/kimchi.spec.suse +suse-rpm: check_files contrib/kimchi.spec.suse ln -sf contrib/kimchi.spec.suse kimchi.spec $(MAKE) rpm

Reviewed-By: Ramon Medeiros <ramonn@br.ibm.com> On 08/12/2016 04:55 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 clean -df & git reset --hard' command to remove untracked files from the working tree and 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 9bebb65..9917dcc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -135,17 +135,30 @@ kimchi.spec: contrib/kimchi.spec.fedora contrib/kimchi.spec.suse /bin/false ; \ fi
-rpm: dist kimchi.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 kimchi.spec $(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS cp $(top_srcdir)/kimchi.spec rpm/SPECS/kimchi.spec cp $(DIST_ARCHIVES) rpm/SOURCES rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/kimchi.spec + @if [ -d '.git' ]; then \ + git reset --hard; \ + fi
-fedora-rpm: contrib/kimchi.spec.fedora +fedora-rpm: check_files contrib/kimchi.spec.fedora ln -sf contrib/kimchi.spec.fedora kimchi.spec $(MAKE) rpm
-suse-rpm: contrib/kimchi.spec.suse +suse-rpm: check_files contrib/kimchi.spec.suse ln -sf contrib/kimchi.spec.suse kimchi.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 04:55 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 clean -df & git reset --hard' command to remove untracked files from the working tree and 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 9bebb65..9917dcc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -135,17 +135,30 @@ kimchi.spec: contrib/kimchi.spec.fedora contrib/kimchi.spec.suse /bin/false ; \ fi
-rpm: dist kimchi.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 kimchi.spec $(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS cp $(top_srcdir)/kimchi.spec rpm/SPECS/kimchi.spec cp $(DIST_ARCHIVES) rpm/SOURCES rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/kimchi.spec + @if [ -d '.git' ]; then \ + git reset --hard; \ + fi
-fedora-rpm: contrib/kimchi.spec.fedora +fedora-rpm: check_files contrib/kimchi.spec.fedora ln -sf contrib/kimchi.spec.fedora kimchi.spec $(MAKE) rpm
-suse-rpm: contrib/kimchi.spec.suse +suse-rpm: check_files contrib/kimchi.spec.suse ln -sf contrib/kimchi.spec.suse kimchi.spec $(MAKE) rpm

Hi Bianca, I have on doubt about this solution. Firstly, why while make-rpm were changing files? Shouldn't it only generate a package based on current code? Why don't we have the same issue for deb package? Seems we are fixing a problem without identifying the root cause. Could you investigate that and share your thoughts on it? Regards, Aline Manera On 08/12/2016 04:55 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 clean -df & git reset --hard' command to remove untracked files from the working tree and 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 9bebb65..9917dcc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -135,17 +135,30 @@ kimchi.spec: contrib/kimchi.spec.fedora contrib/kimchi.spec.suse /bin/false ; \ fi
-rpm: dist kimchi.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 kimchi.spec $(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS cp $(top_srcdir)/kimchi.spec rpm/SPECS/kimchi.spec cp $(DIST_ARCHIVES) rpm/SOURCES rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/kimchi.spec + @if [ -d '.git' ]; then \ + git reset --hard; \ + fi
-fedora-rpm: contrib/kimchi.spec.fedora +fedora-rpm: check_files contrib/kimchi.spec.fedora ln -sf contrib/kimchi.spec.fedora kimchi.spec $(MAKE) rpm
-suse-rpm: contrib/kimchi.spec.suse +suse-rpm: check_files contrib/kimchi.spec.suse ln -sf contrib/kimchi.spec.suse kimchi.spec $(MAKE) rpm

On 08/30/2016 11:39 AM, Aline Manera wrote:
Hi Bianca,
I have on doubt about this solution.
Firstly, why while make-rpm were changing files? Shouldn't it only generate a package based on current code?
I believe it's because make rpm is updating the .po files and the ChangeLog
Why don't we have the same issue for deb package?
Probably because the deb package doesn't try to update anything, it simply packs the current source code state.
Seems we are fixing a problem without identifying the root cause.
Could you investigate that and share your thoughts on it?
Regards, Aline Manera
On 08/12/2016 04:55 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 clean -df & git reset --hard' command to remove untracked files from the working tree and 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 9bebb65..9917dcc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -135,17 +135,30 @@ kimchi.spec: contrib/kimchi.spec.fedora contrib/kimchi.spec.suse /bin/false ; \ fi
-rpm: dist kimchi.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 kimchi.spec $(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS cp $(top_srcdir)/kimchi.spec rpm/SPECS/kimchi.spec cp $(DIST_ARCHIVES) rpm/SOURCES rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/kimchi.spec + @if [ -d '.git' ]; then \ + git reset --hard; \ + fi
-fedora-rpm: contrib/kimchi.spec.fedora +fedora-rpm: check_files contrib/kimchi.spec.fedora ln -sf contrib/kimchi.spec.fedora kimchi.spec $(MAKE) rpm
-suse-rpm: contrib/kimchi.spec.suse +suse-rpm: check_files contrib/kimchi.spec.suse ln -sf contrib/kimchi.spec.suse kimchi.spec $(MAKE) rpm
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

On 08/30/2016 11:43 AM, Daniel Henrique Barboza wrote:
On 08/30/2016 11:39 AM, Aline Manera wrote:
Hi Bianca,
I have on doubt about this solution.
Firstly, why while make-rpm were changing files? Shouldn't it only generate a package based on current code?
I believe it's because make rpm is updating the .po files and the ChangeLog
Should it be done automatically while generating the package?
Why don't we have the same issue for deb package?
Probably because the deb package doesn't try to update anything, it simply packs the current source code state.
Seems we are fixing a problem without identifying the root cause.
Could you investigate that and share your thoughts on it?
Regards, Aline Manera
On 08/12/2016 04:55 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 clean -df & git reset --hard' command to remove untracked files from the working tree and 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 9bebb65..9917dcc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -135,17 +135,30 @@ kimchi.spec: contrib/kimchi.spec.fedora contrib/kimchi.spec.suse /bin/false ; \ fi
-rpm: dist kimchi.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 kimchi.spec $(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS cp $(top_srcdir)/kimchi.spec rpm/SPECS/kimchi.spec cp $(DIST_ARCHIVES) rpm/SOURCES rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/kimchi.spec + @if [ -d '.git' ]; then \ + git reset --hard; \ + fi
-fedora-rpm: contrib/kimchi.spec.fedora +fedora-rpm: check_files contrib/kimchi.spec.fedora ln -sf contrib/kimchi.spec.fedora kimchi.spec $(MAKE) rpm
-suse-rpm: contrib/kimchi.spec.suse +suse-rpm: check_files contrib/kimchi.spec.suse ln -sf contrib/kimchi.spec.suse kimchi.spec $(MAKE) rpm
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
participants (4)
-
Aline Manera
-
bianca@linux.vnet.ibm.com
-
Daniel Henrique Barboza
-
Ramon Medeiros