[Kimchi-devel] [PATCH V3 1/3] add a method to tell the kimchi is in package directory

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Mon Apr 14 15:38:53 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

It means the kimchi run in package install path when the
__inpackage__  is "yes".

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
---
 Makefile.am             | 3 ++-
 src/kimchi/Makefile.am  | 7 +++++++
 src/kimchi/config.py.in | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 6831b5d..c6935ad 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -102,6 +102,7 @@ all-local:
 install-deb: install
 	cp -R $(top_srcdir)/contrib/DEBIAN $(DESTDIR)/
 	$(MKDIR_P) $(DESTDIR)/etc/init
+	$(MKDIR_P) $(DESTDIR)/InPackage
 	$(MKDIR_P) $(DESTDIR)/usr/lib/firewalld/services
 	cp -R $(top_srcdir)/contrib/kimchid-upstart.conf.debian \
 		$(DESTDIR)/etc/init/kimchid.conf
@@ -123,7 +124,7 @@ kimchi.spec: contrib/kimchi.spec.fedora contrib/kimchi.spec.suse
 	fi
 
 rpm: dist kimchi.spec
-	$(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS
+	$(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS rpm/BUILD/InPackage
 	cp $(top_srcdir)/kimchi.spec rpm/SPECS/kimchi.spec
 	cp $(DIST_ARCHIVES) rpm/SOURCES
 	rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/kimchi.spec
diff --git a/src/kimchi/Makefile.am b/src/kimchi/Makefile.am
index 957d2c9..e48a6d1 100644
--- a/src/kimchi/Makefile.am
+++ b/src/kimchi/Makefile.am
@@ -43,9 +43,16 @@ do_substitution = \
 	-e 's,[@]pkgdatadir[@],$(pkgdatadir),g'         \
 	-e 's,[@]kimchidir[@],$(kimchidir),g'
 
+inpackage_substitution = sed -i -e 's,[@]inpackage[@],yes,g'
 
 config.py: config.py.in Makefile
 	$(do_substitution) < $(srcdir)/config.py.in > config.py
+	if test -d $$PWD/../../../InPackage; then               \
+		$(inpackage_substitution) config.py;            \
+	fi
+	if test -d $$PWD/../../../../BUILD/InPackage; then      \
+		$(inpackage_substitution) config.py;            \
+	fi
 
 BUILT_SOURCES = config.py
 CLEANFILES = config.py
diff --git a/src/kimchi/config.py.in b/src/kimchi/config.py.in
index 04218c2..3e84215 100644
--- a/src/kimchi/config.py.in
+++ b/src/kimchi/config.py.in
@@ -29,6 +29,7 @@ from ConfigParser import SafeConfigParser
 
 from kimchi.xmlutils import xpath_get_text
 
+__inpackage__ = "@inpackage@"
 
 DEFAULT_LOG_LEVEL = "debug"
 
-- 
1.8.5.3




More information about the Kimchi-devel mailing list