I think we're missing the ball here. Now all the untracked files were
removed,
including the generated rpm. Which is kind of funny considering that I
executed 'make rpm'.
This is the output of the command:
(...)
Wrote:
/home/danielhb/kimchi/wok_all_plugins/src/wok/plugins/kimchi/rpm/SRPMS/kimchi-2.2.0-57.git19f55b8.fc23.src.rpm
Wrote:
/home/danielhb/kimchi/wok_all_plugins/src/wok/plugins/kimchi/rpm/RPMS/noarch/kimchi-2.2.0-57.git19f55b8.fc23.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.I4uKwl
+ umask 022
+ cd /home/danielhb/kimchi/wok_all_plugins/src/wok/plugins/kimchi/rpm/BUILD
+ cd kimchi-2.2.0
+ rm -rf
/home/danielhb/kimchi/wok_all_plugins/src/wok/plugins/kimchi/rpm/BUILDROOT/kimchi-2.2.0-57.git19f55b8.fc23.x86_64
+ exit 0
Removing 0000-cover-letter.patch
Removing 0001-model.py-use-the-new-get_all_model_instances-utils-f.patch
Removing [Kimchi-devel] [PATCH v2] [Kimchi] Issue #585: 'make clean'
does not revert its changes from 'make rpm'.eml
Removing kimchi.spec
HEAD is now at 19f55b8 Issue #585: 'make clean' does not revert its
changes from 'make rpm'
Removing rpm/
Removing test_vv.vv
Removing ui/images/theme-default/
[danielhb@arthas kimchi]$ git status
On branch issue585_v2
nothing to commit, working directory clean
[danielhb@arthas kimchi]$
As you can see the RPM was created at
rpm/RPMS/noarch/kimchi-2.2.0-57.git19f55b8.fc23.noarch.rpm
And afterwards:
"Removing rpm/"
So the script removed the rpm dir with the generated RPM (along with a
bunch of my
files .... BAD BIANCA).
You need to remove the "git clean" call from the logic. This is the
description of this
command in its man page:
git-clean - Remove untracked files from the working tree
This is clearly not desirable here. We only need "git reset --hard" in
our case.
Daniel
On 08/12/2016 02:48 PM, bianca(a)linux.vnet.ibm.com wrote:
From: Bianca Carvalho <bianca(a)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(a)linux.vnet.ibm.com>
---
Makefile.am | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 9bebb65..d4a96b3 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 clean -df & 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