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

Aline Manera alinefm at linux.vnet.ibm.com
Wed Sep 21 19:12:17 UTC 2016


Hi Bianca,

Wouldn't you remove only the dist targert as dependency to rpm target? 
The same approach you follow for Kimchi.

On 09/21/2016 03:53 PM, bianca at linux.vnet.ibm.com wrote:
> From: Bianca Carvalho <bianca at 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 at 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
>




More information about the Kimchi-devel mailing list