[Kimchi-devel] [PATCH 04/17] Ginger Base : base plugin build-aix and contrib

Chandra Shehkhar Reddy Potula chandra at linux.vnet.ibm.com
Fri Sep 11 10:02:12 UTC 2015



On 09/10/2015 07:20 PM, Aline Manera wrote:
>
>
> On 01/09/2015 14:55, chandra at linux.vnet.ibm.com wrote:
>> From: chandrureddy <chandra at linux.vnet.ibm.com>
>>
>> ---
>>   plugins/gingerbase/build-aux/config.rpath          | 672 
>> +++++++++++++++++++++
>>   plugins/gingerbase/build-aux/genChangelog          |  25 +
>>   plugins/gingerbase/build-aux/pkg-version           |  59 ++
>>   plugins/gingerbase/contrib/DEBIAN/Makefile.am      |  17 +
>>   plugins/gingerbase/contrib/DEBIAN/control.in       |  14 +
>>   plugins/gingerbase/contrib/Makefile.am             |  34 ++
>>   plugins/gingerbase/contrib/check_i18n.py           |  82 +++
>>   .../gingerbase/contrib/gingerbase.spec.fedora.in   |  68 +++
>>   plugins/gingerbase/contrib/gingerbase.spec.suse.in |  62 ++
>>   plugins/gingerbase/contrib/make-deb.sh.in          |  15 +
>>   10 files changed, 1048 insertions(+)
>>   create mode 100644 plugins/gingerbase/build-aux/config.rpath
>>   create mode 100755 plugins/gingerbase/build-aux/genChangelog
>>   create mode 100755 plugins/gingerbase/build-aux/pkg-version
>>   create mode 100644 plugins/gingerbase/contrib/DEBIAN/Makefile.am
>>   create mode 100644 plugins/gingerbase/contrib/DEBIAN/control.in
>>   create mode 100644 plugins/gingerbase/contrib/Makefile.am
>>   create mode 100755 plugins/gingerbase/contrib/check_i18n.py
>>   create mode 100644 
>> plugins/gingerbase/contrib/gingerbase.spec.fedora.in
>>   create mode 100644 plugins/gingerbase/contrib/gingerbase.spec.suse.in
>>   create mode 100644 plugins/gingerbase/contrib/make-deb.sh.in
>>
>
>
>> diff --git a/plugins/gingerbase/contrib/DEBIAN/control.in 
>> b/plugins/gingerbase/contrib/DEBIAN/control.in
>> new file mode 100644
>> index 0000000..0f1e187
>> --- /dev/null
>> +++ b/plugins/gingerbase/contrib/DEBIAN/control.in
>> @@ -0,0 +1,14 @@
>> +Package: @PACKAGE_NAME@
>> +Version: @PACKAGE_VERSION@
>> +Section: base
>> +Priority: optional
>> +Architecture: all
>> +Depends: wok,
>> +         python-psutil (>= 0.6.0),
>> +         sosreport,
>> +Build-Depends: libxslt,
>> +               python-lxml
>> +Maintainer: Aline Manera <alinefm at br.ibm.com>
>
> As gingerbase will be part of Ginger community, you need to assign 
> Daniel as the maintainer.
Agreed
>
>> +Description: Ginger Base is an open source base host management 
>> plugin for Wok
>> +(Webserver Originated from Kimchi), that provides an intuitive web 
>> panel with
>> +common tools for configuring and managing the Linux systems.
>> diff --git a/plugins/gingerbase/contrib/Makefile.am 
>> b/plugins/gingerbase/contrib/Makefile.am
>> new file mode 100644
>> index 0000000..7ca0752
>> --- /dev/null
>> +++ b/plugins/gingerbase/contrib/Makefile.am
>> @@ -0,0 +1,34 @@
>> +# Copyright IBM Corp, 2013
>> +#
>
> Update the copyright date
Sure
>
>> +# This library is free software; you can redistribute it and/or
>> +# modify it under the terms of the GNU Lesser General Public
>> +# License as published by the Free Software Foundation; either
>> +# version 2.1 of the License, or (at your option) any later version.
>> +#
>> +# This library is distributed in the hope that it will be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> +# Lesser General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU Lesser General Public
>> +# License along with this library; if not, write to the Free Software
>> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
>> 02110-1301  USA
>> +
>> +SUBDIRS = DEBIAN
>> +
>> +EXTRA_DIST = \
>> +    check_i18n.py \
>> +    gingerbase.spec.fedora.in \
>> +    make-deb.sh.in \
>> +    $(NULL)
>> +
>
> What about SUSE spec file?
> Missed for some reason. Will add it.
>> +make-deb.sh: make-deb.sh.in $(top_builddir)/config.status
>> +    $(AM_V_GEN)sed                        \
>> +        -e 's|[@]PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g'    \
>> +        -e 's|[@]PACKAGE_RELEASE[@]|$(PACKAGE_RELEASE)|g'    \
>> +        < $< > $@-t &&                    \
>> +        chmod a+x $@-t &&                    \
>> +        mv $@-t $@
>> +BUILT_SOURCES = make-deb.sh
>> +
>> +CLEANFILES = gingerbase.spec.fedora gingerbase.spec.suse 
>> gingerbase.spec make-deb.sh
>> diff --git a/plugins/gingerbase/contrib/check_i18n.py 
>> b/plugins/gingerbase/contrib/check_i18n.py
>> new file mode 100755
>> index 0000000..6a2603c
>> --- /dev/null
>> +++ b/plugins/gingerbase/contrib/check_i18n.py
>> @@ -0,0 +1,82 @@
>> +#!/usr/bin/env python2
>> +#
>> +# Project Kimchi
>> +#
>> +# Copyright IBM, Corp. 2014-2015
>> +#
>
> Update the copyright
> Sure
>> +# This library is free software; you can redistribute it and/or
>> +# modify it under the terms of the GNU Lesser General Public
>> +# License as published by the Free Software Foundation; either
>> +# version 2.1 of the License, or (at your option) any later version.
>> +#
>> +# This library is distributed in the hope that it will be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> +# Lesser General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU Lesser General Public
>> +# License along with this library; if not, write to the Free Software
>> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
>> 02110-1301 USA
>> +
>> +import imp
>> +import os
>> +import re
>> +import sys
>> +
>> +
>
> How is this file different from the one in Kimchi plugin?
> No difference. Is this could be available part of WOK base frame work 
> itself then we could reuse it.
>> +# Match all conversion specifier with mapping key
>> +PATTERN = re.compile(r'''%\([^)]+\)  # Mapping key
>> +                         [#0\-+]?  # Conversion flags (optional)
>> +                         (\d+|\*)?  # Minimum field width (optional)
>> +                         (\.(\d+|\*))?  # Precision (optional)
>> +                         [lLh]?  # Length modifier (optional)
>> +                         [cdeEfFgGioursxX%]  # Conversion type''',
>> +                     re.VERBOSE)
>> +BAD_PATTERN = re.compile(r"%\([^)]*?\)")
>> +
>> +
>> +def load_i18n_module(i18nfile):
>> +    path = os.path.dirname(i18nfile)
>> +    mname = i18nfile.replace("/", "_").rstrip(".py")
>> +    mobj = imp.find_module("i18n", [path])
>> +    return imp.load_module(mname, *mobj)
>> +
>> +
>> +def check_string_formatting(messages):
>> +    for k, v in messages.iteritems():
>> +        if BAD_PATTERN.findall(PATTERN.sub(" ", v)):
>> +            print "bad i18n string formatting:"
>> +            print "  %s: %s" % (k, v)
>> +            exit(1)
>> +
>> +
>> +def check_obsolete_messages(path, messages):
>> +    def find_message_key(path, k):
>> +        for root, dirs, files in os.walk(path):
>> +            for f in files:
>> +                fname = os.path.join(root, f)
>> +                if (not fname.endswith("i18n.py") and 
>> fname.endswith(".py") or
>> +                   fname.endswith(".json")):
>> +                    with open(fname) as f:
>> +                        string = "".join(f.readlines())
>> +                        if k in string:
>> +                            return True
>> +        return False
>> +
>> +    for k in messages.iterkeys():
>> +        if not find_message_key(path, k):
>> +            print "  %s is obsolete, it is no longer in use" % k
>> +            exit(1)
>> +
>> +
>> +def main():
>> +    print "Checking for invalid i18n string..."
>> +    for f in sys.argv[1:]:
>> +        messages = load_i18n_module(f).messages
>> +        check_string_formatting(messages)
>> +        check_obsolete_messages(os.path.dirname(f), messages)
>> +    print "Checking for invalid i18n string successfully"
>> +
>> +
>> +if __name__ == '__main__':
>> +    main()
>> diff --git a/plugins/gingerbase/contrib/gingerbase.spec.fedora.in 
>> b/plugins/gingerbase/contrib/gingerbase.spec.fedora.in
>> new file mode 100644
>> index 0000000..44f03fd
>> --- /dev/null
>> +++ b/plugins/gingerbase/contrib/gingerbase.spec.fedora.in
>> @@ -0,0 +1,68 @@
>> +Name:        Ginger Base
>> +Version:    @PACKAGE_VERSION@
>> +Release:    @PACKAGE_RELEASE@%{?dist}
>> +Summary:    Kimchi server application
>
> Wok plugin for base host management
Sure.
>> +BuildRoot: %{_topdir}/BUILD/%{name}-%{version}-%{release}
>> +BuildArch:    noarch
>> +Group:        System Environment/Base
>> +License:    LGPL/ASL2
>> +Source0:    %{name}-%{version}.tar.gz
>> +Requires:    wok
>> +Requires:    python-psutil >= 0.6.0
>> +Requires:    sos
>> +BuildRequires:    libxslt
>> +BuildRequires:    python-lxml
>> +
>> +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
>> +%global with_systemd 1
>> +%endif
>> +
>> +%if 0%{?rhel} == 6
>> +Requires:    python-ordereddict
>> +BuildRequires:    python-unittest2
>> +%endif
>> +
>> +%description
>> +Ginger Base is an open source base host management plugin for Wok
>> +(Webserver Originated from Kimchi), that provides an intuitive web 
>> panel with
>> +common tools for configuring and managing the Linux systems.
>> +
>> +%prep
>> +
>> +
>> +%build
>> +%configure
>> +make
>> +
>> +
>> +%install
>> +rm -rf %{buildroot}
>> +make DESTDIR=%{buildroot} install
>> +
>> +
>> +%clean
>> +rm -rf $RPM_BUILD_ROOT
>> +
>> +%files
>> +%attr(-,root,root)
>> +%{python_sitelib}/wok/plugins/gingerbase/*.py*
>> +%{python_sitelib}/wok/plugins/gingerbase/control/*.py*
>> +%{python_sitelib}/wok/plugins/gingerbase/model/*.py*
>> +%{python_sitelib}/wok/plugins/gingerbase/API.json
>> +%{python_sitelib}/wok/plugins/gingerbase/
>> +%{_datadir}/wok/plugins/gingerbase/doc/API.md
>> +%{_datadir}/wok/plugins/gingerbase/doc/README.md
>> +%{_datadir}/wok/plugins/gingerbase/doc/README-federation.md
>> +%{_prefix}/share/locale/*/LC_MESSAGES/gingerbase.mo
>> +%{_datadir}/wok/plugins/gingerbase/ui/config/*.xml
>> +%{_datadir}/wok/plugins/gingerbase/ui/
>> +%{_datadir}/wok/plugins/gingerbase
>> +%{_sysconfdir}/wok/plugins.d/gingerbase.conf
>> +%{_sysconfdir}/wok/
>> +%{_sharedstatedir}/wok/debugreports/
>> +%{_sharedstatedir}/wok/
>> +
>
>
>> +
>> +%changelog
>> +* Thu Aug 25 2015 Aline Manera <alinefm at br.ibm.com> 0.0-1
>> +- First build
>
> As you are creating the spec file you should add you as the first 
> entry on changelog
Sure
>
>> diff --git a/plugins/gingerbase/contrib/gingerbase.spec.suse.in 
>> b/plugins/gingerbase/contrib/gingerbase.spec.suse.in
>> new file mode 100644
>> index 0000000..5ecd8b4
>> --- /dev/null
>> +++ b/plugins/gingerbase/contrib/gingerbase.spec.suse.in
>> @@ -0,0 +1,62 @@
>> +Name:        Ginger Base
>> +Version:    @PACKAGE_VERSION@
>> +Release:    @PACKAGE_RELEASE@%{?dist}
>> +Summary:    Kimchi server application
>
> Same I comment above.
Got it
>
>> +BuildRoot: %{_topdir}/BUILD/%{name}-%{version}-%{release}
>> +BuildArch:    noarch
>> +Group:        System Environment/Base
>> +License:    LGPL/ASL2
>> +Source0:    %{name}-%{version}.tar.gz
>> +Requires:    wok
>> +Requires:    python-psutil >= 0.6.0
>> +BuildRequires:    libxslt-tools
>> +BuildRequires:    python-lxml
>> +
>> +%if 0%{?suse_version} == 1100
>> +Requires:       python-ordereddict
>> +%endif
>> +
>> +%if 0%{?suse_version} > 1140
>> +%global with_systemd 1
>> +%endif
>> +
>> +%description
>> +Ginger Base is an open source base host management plugin for Wok
>> +(Webserver Originated from Kimchi), that provides an intuitive web 
>> panel with
>> +common tools for configuring and managing the Linux systems.
>> +
>> +%prep
>> +%setup
>> +
>> +%install
>> +rm -rf %{buildroot}
>> +make DESTDIR=%{buildroot} install
>> +
>> +
>> +%clean
>> +rm -rf $RPM_BUILD_ROOT
>> +
>> +%files
>> +%attr(-,root,root)
>> +%{python_sitelib}/wok/plugins/gingerbase/*.py*
>> +%{python_sitelib}/wok/plugins/gingerbase/control/*.py*
>> +%{python_sitelib}/wok/plugins/gingerbase/model/*.py*
>> +%{python_sitelib}/wok/plugins/gingerbase/API.json
>> +%{python_sitelib}/wok/plugins/gingerbase/
>> +%{_datadir}/wok/plugins/gingerbase/doc/API.md
>> +%{_datadir}/wok/plugins/gingerbase/doc/README.md
>> +%{_datadir}/wok/plugins/gingerbase/doc/README-federation.md
>> +%{_prefix}/share/locale/*/LC_MESSAGES/gingerbase.mo
>> +%{_datadir}/wok/plugins/gingerbase/ui/config/*.xml
>> +%{_datadir}/wok/plugins/gingerbase/ui/
>> +%{_datadir}/wok/plugins/gingerbase
>> +%{_sysconfdir}/wok/plugins.d/gingerbase.conf
>> +%{_sysconfdir}/wok/
>> +%{_var}/lib/wok/debugreports/
>> +%{_var}/lib/wok/
>> +
>> +
>> +
>
>> +%changelog
>> +* Thu Aug 25 2015 Aline Manera <alinefm at br.ibm.com> 0.0-1
>> +- First build
>
> Same I commented for the fedora spec file
>
Agree
>> diff --git a/plugins/gingerbase/contrib/make-deb.sh.in 
>> b/plugins/gingerbase/contrib/make-deb.sh.in
>> new file mode 100644
>> index 0000000..a4c92bf
>> --- /dev/null
>> +++ b/plugins/gingerbase/contrib/make-deb.sh.in
>> @@ -0,0 +1,15 @@
>
> How is this file different from the one in Kimchi plugin?
> Maybe we could keep them on wok and reuse in the plugins.
>
Except plug in name everything is same. Package dependencies will change
>> +#!/bin/bash
>> +
>> +VERSION="@PACKAGE_VERSION@"
>> +RELEASE="@PACKAGE_RELEASE@"
>> +
>> +if [ ! -f configure ]; then
>> +    echo "Please run this script from the top of the package tree"
>> +    exit 1
>> +fi
>> +
>> +TMPDIR=`mktemp -d`
>> +
>> +make DESTDIR=$TMPDIR install-deb
>> +dpkg-deb -b $TMPDIR gingerbase-${VERSION}-${RELEASE}.noarch.deb
>> +rm -rf $TMPDIR
>




More information about the Kimchi-devel mailing list