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

Sheldon shaohef at linux.vnet.ibm.com
Mon Apr 14 23:24:36 UTC 2014


On 04/15/2014 03:57 AM, Aline Manera wrote:
>
> I applied the whole patch set and made some tests and I think this 
> specific patch is not needed.
>
> In fact, based on the following 2 patches we don't need to differ if 
> the package is installed or not.
That's great.
It take me a long time to think out different methods to differ if the 
package is installed or not.
None satisfies me. And this is the better than the former two patches.

Will just leave the following 2 patches next version.

>
> With kimchi package installed or not the config.py will have:
>
> __version__ = "1.2.0"
> __release__ = "46.git7c3bb7b"
>
> So we can use those information to display on UI
>
> On 04/14/2014 12:38 PM, shaohef at linux.vnet.ibm.com wrote:
>> 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"
>>
>
>
>


-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list