[meego-commits] 5375: Changes to Trunk/spectacle
Jian-feng Ding
jian-feng.ding at intel.com
Wed Jul 7 04:39:40 UTC 2010
Hi,
I have made the following changes to spectacle in project Trunk. Please review and accept ASAP.
Thank You,
Jian-feng Ding
[This message was auto-generated]
---
Request #5375:
submit: devel:tools:building/spectacle(r52) -> Trunk/spectacle
Message:
Release 0.18 with new features and bug fixings
State: new 2010-07-06T16:35:21 jfding
Comment: None
changes files:
--------------
--- spectacle.changes
+++ spectacle.changes
@@ -0,0 +1,26 @@
+* Wed Jul 07 2010 Jian-feng Ding <jian-feng.ding at intel.com> 0.18
+- Release 0.18, with the following changes:
+ specify:
+ - Support new builder: 'qmake'
+ - Added all sub-package specific keywords, including:
+ - License
+ - Version, Release, Epoch
+ - NoAutoreq, NoAutoprov
+ - BuildArch
+ - URL
+ - Added the following new keywords:
+ - BuildConflicts
+ - Prefix
+ - More precise duplicate checking for customized spec part:
+ - duplicate '/sbin/ldconfig' in %post/postun
+ - duplicate scripts for special files handling:
+ Info, Desktop, Icon, Schema, etc
+ - duplicate "%defattr" line in %files
+ - Checking for valid configure/builder values
+ - Checking for valid keywords for sub-packages
+ - Warning for PkgBR/PkgConfigBR in sub-packages
+ - Added Icon/Scheme auto-handling for sub-packages
+ spec2spectacle:
+ - Fixed bugs in parsing of Perl packages' spec
+ - More old spec directives support: Prereq, BuildConflicts
+
old:
----
spectacle-0.17.tar.gz
new:
----
spectacle-0.18.tar.gz
spec files:
-----------
--- spectacle.spec
+++ spectacle.spec
@@ -1,6 +1,6 @@
#
# Do not Edit! Generated by:
-# spectacle version 0.17
+# spectacle version 0.18
#
# >> macros
# << macros
@@ -8,7 +8,7 @@
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Name: spectacle
Summary: RPM Spec file generator and management tool
-Version: 0.17
+Version: 0.18
Release: 1
Group: Development/Tools
License: GPLv2+
dsc files:
----------
--- spectacle.dsc
+++ spectacle.dsc
@@ -1,6 +1,6 @@
Format: 1.0
Source: spectacle
-Version: 0.17
+Version: 0.18
Binary: spectacle
Maintainer: Jian-feng Ding <jian-feng.ding at intel.com>
Architecture: all
other changes:
--------------
++++++ debian.changelog
--- debian.changelog
+++ debian.changelog
@@ -1,3 +1,32 @@
+spectacle (0.18) unstable; urgency=high
+
+ * Release 0.18, with the following changes:
+ specify:
+ - Support new builder: 'qmake'
+ - Added all sub-package specific keywords, including:
+ - License
+ - Version, Release, Epoch
+ - NoAutoreq, NoAutoprov
+ - BuildArch
+ - URL
+ - Added the following new keywords:
+ - BuildConflicts
+ - Prefix
+ - More precise duplicate checking for customized spec part:
+ - duplicate '/sbin/ldconfig' in %post/postun
+ - duplicate scripts for special files handling:
+ Info, Desktop, Icon, Schema, etc
+ - duplicate "%defattr" line in %files
+ - Checking for valid configure/builder values
+ - Checking for valid keywords for sub-packages
+ - Warning for PkgBR/PkgConfigBR in sub-packages
+ - Added Icon/Scheme auto-handling for sub-packages
+ spec2spectacle:
+ - Fixed bugs in parsing of Perl packages' spec
+ - More old spec directives support: Prereq, BuildConflicts
+
+ -- Jian-feng Ding <jian-feng.ding at intel.com> Wed, 07 Jul 2010 11:25:15 +0800
+
spectacle (0.17) unstable; urgency=high
* Release 0.17, with the following changes:
++++++ spectacle-0.17.tar.gz -> spectacle-0.18.tar.gz
--- README
+++ README
@@ -90,7 +90,7 @@
* Summary: **string**
-* Version: **string**, version string (not version NUMBER)
+* Version: **string**, version string
* Release: **string**
@@ -106,6 +106,8 @@
* ExclusiveArch: **string**, *optional*
+* Prefix: **string**, *optional*
+
* LocaleName: **string**, *optional*
* LocaleOptions: **string**, *optional*
@@ -120,8 +122,6 @@
* SetupOptions: **string**, *optional*, the options string for %setup
-* ExtraInstall: **string**, *optional*
-
* Patches: **list** of **string**, all patches need to be in 'p1' level
* Requires: **list** of **string**
@@ -144,12 +144,14 @@
* Obsoletes: **list** of **string**
+* BuildConflicts: **list** of **string**
+
* Configure: **string**, *optional*, valid values: **autogen**, **configure**,
**reconfigure**, **none**<br>
**If not specified, the default value ``configure`` will be used**
* Builder: **string**, *optional*, valid values: **make**, **single-make**,
- **python**, **perl**, **none**<br>
+ **python**, **perl**, **qmake**, **none**<br>
**If not specified, the deault value ``make`` will be used. If do not want a
automatic builder, please use ``none``.**
@@ -167,7 +169,7 @@
* SupportOtherDistros: **boolean**, whether need to check for other distros (besides MeeGo)
-* UseAsNeeded: **boolean**, whether export LD_AS_NEEDED=1 env when building
+* UseAsNeeded: **boolean**, whether export LD\_AS\_NEEDED=1 environ variable before building
* NoAutoReq: **boolean**, whether add 'AutoReq: 0' to spec
@@ -175,7 +177,7 @@
* NoSetup: **boolean**, whether to skip using ``%setup`` in ``%prep``
-* NoAutoLocale: **boolean**, whether to use ``%find_lang`` to search locale data when found 'inittool' in PkgBR
+* NoAutoLocale: **boolean**, whether to use ``%find_lang`` to search locale data when found 'intltool' in PkgBR
* NoDesktop: **boolean**, whether to install the desktop files in package
@@ -194,8 +196,8 @@
* Summary
* Description, *optional*
* Group, *optional*
+ * License, *optional*
* Requires, *optional*
- * FilesInput, *optional*
* etc.
**CAUTION**: The following cases of value string have special meaning in YAML syntax:
@@ -203,6 +205,7 @@
* string with leading **``%``** charactor
* string with leading **``*``** charactor
* string contains **``:``** charactor and one or more spaces/tabs after **``:``**
+* string end with **``:``** charactor
**Then these string values need to be quoted by ``'``(single-quote) or ``"``
(double-quote), and the choice of quote char should not conflict with the value
@@ -294,14 +297,14 @@
With placeholder:
- # >> files [sub-package]
- # << files [sub-package]
+ # >> files [[-p] sub-package]
+ # << files [[-p] sub-package]
**NOTE**: "sub-packge" stands for the name of sub-package, and it is optional.
If no sub-package name specified, it means the files of **main** package.
**NOTE**: If the file list is simple enough, you can use YAML *Files* keyword
instead to record it.
-* Scriptlets for %check section
+* Scripts for %check section
With placeholder:
@@ -350,7 +353,8 @@
Spectacle uses cheetah templates to generate the spec file, based the metadata
from YAML file. But the end users need not tackle it.
-## Tips * If to upgrade the pkg to a newer version, you can just edit the
+## Tips
+* If to upgrade the pkg to a newer version, you can just edit the
version string in spectacle YAML file, and when you run ``specify``, it
will download the needed files for you automatically.
--- VERSION
+++ VERSION
@@ -1 +1 @@
-0.17
+0.18
--- spectacle/dumper.py
+++ spectacle/dumper.py
@@ -75,7 +75,8 @@
if val.startswith('%') or \
val.startswith('*') or \
": " in val or \
- ":\t" in val:
+ ":\t" in val or \
+ val.endswith(':'):
if '"' in val:
quote_char = '\''
--- spectacle/spec/spec.tmpl
+++ spectacle/spec/spec.tmpl
@@ -46,6 +46,9 @@
#if $metadata.has_key("BuildArch")
BuildArch: ${metadata.BuildArch}
#end if
+#if $metadata.has_key("Prefix")
+Prefix: ${metadata.Prefix}
+#end if
#if $metadata.has_key("URL")
URL: ${metadata.URL}
#end if
@@ -78,13 +81,13 @@
## end of checking
#if $arch
%ifarch $arch
-#end if
Patch${idx}: $patch
-#if $arch
%endif
+#else
+Patch${idx}: $patch
#end if
#set $idx = $idx + 1
-#end for
+#end for ## each patch
#end if
#if 'NoAutoReq' in $metadata
AutoReq: 0
@@ -108,12 +111,12 @@
## end of checking
#if $arch
%ifarch $arch
-#end if
Requires: $req
-#if $arch
%endif
+#else
+Requires: $req
#end if
-#end for
+#end for ## each req
#end if
#if $metadata.has_key("RequiresPre")
#for $req in $metadata.RequiresPre
@@ -161,7 +164,7 @@
#if $arch
%endif
#end if
-#end for
+#end for ## each br
#end if
#set $br_locale = ""
#if $metadata.has_key("PkgBR")
@@ -182,11 +185,17 @@
#end if
#if $arch
%ifarch $arch
-#end if
BuildRequires: $br
-#if $arch
%endif
+#else
+BuildRequires: $br
+#end if
+#end for ## each br
#end if
+## BuildConflicts
+#if $metadata.has_key("BuildConflicts")
+#for $bcfl in $metadata.BuildConflicts
+BuildConflicts: $bcfl
#end for
#end if
#if $metadata.has_key("RunFdupes")
@@ -246,14 +255,38 @@
%package $sp.Name
#end if
Summary: $sp.Summary
+#if $sp.has_key("License")
+License: $sp.License
+#end if
#if $sp.has_key("Group")
Group: $sp.Group
#else
Group: ${metadata.Group}
#end if
-#if 'NoAutoReq' in $metadata
+#if $sp.has_key("Version")
+Version: $sp.Version
+#end if
+#if $sp.has_key("Release")
+Release: $sp.Release
+#end if
+#if $sp.has_key("Epoch")
+Epoch: $sp.Epoch
+#end if
+#if $sp.has_key("URL")
+URL: $sp.URL
+#end if
+#if $sp.has_key("BuildArch")
+BuildArch: $sp.BuildArch
+#end if
+#if $sp.has_key("Prefix")
+Prefix: $sp.Prefix
+#end if
+#if 'NoAutoReq' in $sp
AutoReq: 0
#end if
+#if 'NoAutoProv' in $sp
+AutoProv: 0
+#end if
#if $sp.has_key("AutoDepend") and not $metadata.has_key("NoFiles")
Requires: %{name} = $auto_depend
#end if
@@ -272,12 +305,12 @@
## end of checking
#if $arch
%ifarch $arch
-#end if
Requires: $req
-#if $arch
%endif
+#else
+Requires: $req
#end if
-#end for
+#end for ## each req
#end if
#if $sp.has_key("RequiresPre")
#for $req in $sp.RequiresPre
@@ -317,6 +350,63 @@
Obsoletes: $obs
#end for
#end if
+## BR
+#if $sp.has_key("PkgBR")
+#for $br in $sp.PkgBR
+## checking arch namespace prefix
+#if $br.startswith('arm:')
+#set $arch = '%{arm}'
+#set $br = $br[4:]
+#else if $br.startswith('ix86:')
+#set $arch = '%{ix86}'
+#set $br = $br[5:]
+#else
+#set $arch = ""
+#end if
+## end of checking
+#if $arch
+%ifarch $arch
+BuildRequires: $br
+%endif
+#else
+BuildRequires: $br
+#end if
+#end for ## each br
+#end if
+## PkgConfigBR
+#if $sp.has_key("PkgConfigBR")
+#for $br in $sp.PkgConfigBR
+## checking arch namespace prefix
+#if $br.startswith('arm:')
+#set $arch = '%{arm}'
+#set $br = $br[4:]
+#else if $br.startswith('ix86:')
+#set $arch = '%{ix86}'
+#set $br = $br[5:]
+#else
+#set $arch = ""
+#end if
+## end of checking
+#if $arch
+%ifarch $arch
+#end if
+#set $br_comps = $br.split()
+#if $len($br_comps) > 1
+BuildRequires: pkgconfig($br_comps[0])$br[$len($br_comps[0]):]
+#else
+BuildRequires: pkgconfig($br_comps[0])
+#end if
+#if $arch
+%endif
+#end if
+#end for ## each br
+#end if
+## BuildConflicts
+#if $sp.has_key("BuildConflicts")
+#for $bcfl in $sp.BuildConflicts
+BuildConflicts: $bcfl
+#end for
+#end if
#if $sp.has_key("AsWholeName")
%description -n $sp.Name
@@ -504,16 +594,21 @@
find %{buildroot} -type f -name '*.bs' -empty -exec rm -f {} ';'
%{_fixperms} %{buildroot}/*
#else if $Builder == 'make' or $Builder == 'single-make' or $Builder == 'qmake'
+#if $Builder == 'qmake'
+#set $extra_install_param="INSTALL_ROOT=%{buildroot}"
+#else
+#set $extra_install_param=""
+#end if
#if 'SupportOtherDistros' in $metadata
%if 0%{?moblin_version}
-%make_install
+%make_install $extra_install_param
%else
%makeinstall
%endif
#else
-%make_install
+%make_install $extra_install_param
#end if
-#end if ## of Builder==python
+#end if ## of Builder==???
#if $metadata.has_key("ExtraInstall")
$metadata.ExtraInstall
#end if
@@ -609,7 +704,7 @@
#end if
############################ Post
-#set $has_extra_post = $extra.content.has_key("post") and $extra.content.post.has_key("main")
+#set $has_extra_post = $extra.content.has_key("post") and $extra.content.post.has_key("main") and $extra.content.post.main
#if $extra.Lib or $extra.Info or $extra.Schema or $extra.Icon or $extra.DesktopDB or $has_extra_post
#set $only_Lib = not ($extra.Info or $extra.Schema or $extra.Icon or $extra.DesktopDB or $has_extra_post)
#if $only_Lib
@@ -654,7 +749,7 @@
#end if ## need post
############################ PostUn
-#set $has_extra_postun = $extra.content.has_key("postun") and $extra.content.postun.has_key("main")
+#set $has_extra_postun = $extra.content.has_key("postun") and $extra.content.postun.has_key("main") and $extra.content.postun.main
#if $extra.Lib or $extra.Info or $extra.Icon or $extra.DesktopDB or $has_extra_postun
#set $only_Lib = not ($extra.Info or $extra.Icon or $extra.DesktopDB or $has_extra_postun)
#if $only_Lib
@@ -691,6 +786,7 @@
#end if
#end if ## need postun
+########################################
## Pre/Preun/Post/Postun for SubPackages
#if $metadata.has_key("SubPackages")
#for $sp in $metadata.SubPackages
@@ -699,30 +795,60 @@
#else
#set $pkg_name = $sp.Name
#end if
+#set $sub_extra = $extra.subpkgs[$sp.Name]
#######################
## Pre for SubPackages
-#if $extra.content.has_key("pre") and $extra.content.pre.has_key($sp.Name)
+#set $has_extra_pre = $extra.content.has_key("pre") and $extra.content.pre.has_key($sp.Name)
+#if $sub_extra.Schema or $has_extra_pre
%pre $pkg_name
+## -Schema
+#if $sub_extra.Schema
+if [ "$1" -gt 1 ]; then
+#for $schema in $sub_extra.Schemas
+ export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
+ gconftool-2 --makefile-uninstall-rule \
+ $schema \
+ > /dev/null || :
+#end for
+fi
+#end if
+## -Extra pre
+#if $has_extra_pre
# >> pre $sp.Name
$str_newline.join($extra.content.pre[$sp.Name])
# << pre $sp.Name
#end if
+#end if
#######################
## Preun for SubPackages
-#if $extra.content.has_key("preun") and $extra.content.preun.has_key($sp.Name)
+#set $has_extra_preun = $extra.content.has_key("preun") and $extra.content.preun.has_key($sp.Name)
+#if $sub_extra.Schema or $has_extra_preun
%preun $pkg_name
+## -Schema
+#if $sub_extra.Schema
+if [ "$1" -eq 0 ]; then
+#for $schema in $sub_extra.Schemas
+ export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
+ gconftool-2 --makefile-uninstall-rule \
+ $schema \
+ > /dev/null || :
+#end for
+fi
+#end if
+## -Extra preun
+#if $has_extra_preun
# >> preun $sp.Name
$str_newline.join($extra.content.preun[$sp.Name])
# << preun $sp.Name
#end if
+#end if
#######################
## Post for SubPackages
-#set $has_extra_post = $extra.content.has_key("post") and $extra.content.post.has_key($sp.Name)
-#set $sub_extra = $extra.subpkgs[$sp.Name]
-#if $sub_extra.Lib or $sub_extra.Info or $sub_extra.Schema or $sub_extra.DesktopDB or $has_extra_post
-#set $only_Lib = not ($sub_extra.Info or $sub_extra.Schema or $sub_extra.DesktopDB or $has_extra_post)
+#set $has_extra_post = $extra.content.has_key("post") and $extra.content.post.has_key($sp.Name) and $extra.content.post[$sp.Name]
+#if $sub_extra.Lib or $sub_extra.Info or $sub_extra.Icon or $sub_extra.Schema or $sub_extra.DesktopDB or $has_extra_post
+#set $only_Lib = not ($sub_extra.Info or $sub_extra.Icon or $sub_extra.Schema or $sub_extra.DesktopDB or $has_extra_post)
#if $only_Lib
%post $pkg_name -p /sbin/ldconfig
#else
@@ -746,6 +872,12 @@
%install_info --info-dir=%_infodir $inf
#end for
#end if ## Info
+## -Icon
+#if $sub_extra.Icon
+/bin/touch --no-create %{_datadir}/icons/hicolor || :
+%{_bindir}/gtk-update-icon-cache \
+ --quiet %{_datadir}/icons/hicolor 2> /dev/null|| :
+#end if
## -DesktopDB
#if $sub_extra.DesktopDB
update-desktop-database %{_datadir}/applications &> /dev/null || :
@@ -760,9 +892,9 @@
#######################
## PostUn for SubPackages
-#set $has_extra_postun = $extra.content.has_key("postun") and $extra.content.postun.has_key($sp.Name)
-#if $sub_extra.Lib or $sub_extra.Info or $sub_extra.DesktopDB or $has_extra_postun
-#set $only_Lib = not ($sub_extra.Info or $sub_extra.DesktopDB or $has_extra_postun)
+#set $has_extra_postun = $extra.content.has_key("postun") and $extra.content.postun.has_key($sp.Name) and $extra.content.postun[$sp.Name]
+#if $sub_extra.Lib or $sub_extra.Info or $sub_extra.Icon or $sub_extra.DesktopDB or $has_extra_postun
+#set $only_Lib = not ($sub_extra.Info or $sub_extra.Icon or $sub_extra.DesktopDB or $has_extra_postun)
#if $only_Lib
%postun $pkg_name -p /sbin/ldconfig
#else
@@ -778,6 +910,12 @@
#end for
fi
#end if ## Info
+## -Icon
+#if $sub_extra.Icon
+/bin/touch --no-create %{_datadir}/icons/hicolor || :
+%{_bindir}/gtk-update-icon-cache \
+ --quiet %{_datadir}/icons/hicolor 2> /dev/null|| :
+#end if
## -DesktopDB
#if $sub_extra.DesktopDB
update-desktop-database %{_datadir}/applications &> /dev/null || :
--- spectacle/specify.py
+++ spectacle/specify.py
@@ -79,6 +79,7 @@
'PkgConfigBR',
'Provides',
'Conflicts',
+ 'BuildConflicts',
'Obsoletes',
'AutoSubPackages',
'Files',
@@ -107,16 +108,37 @@
'LocaleOptions',
'FilesInput',
'PostScripts',
- 'ExtraInstall',
'RunFdupes',
+ 'Prefix',
)
SUBONLY_KEYS = ('AsWholeName',
'AutoDepend',
)
-# TODO
-MAINONLY_KEYS = ()
+SUBWARN_KEYS = ('PkgBR',
+ 'PkgConfigBR',
+ 'BuildConflicts',
+ )
+SUBAVAIL_KEYS = ('Name',
+ 'Summary',
+ 'Description',
+ 'Group',
+ 'License',
+ 'Files',
+ 'Prefix',
+ 'Requires',
+ 'RequiresPre',
+ 'RequiresPreUn',
+ 'RequiresPost',
+ 'RequiresPostUn',
+ 'Provides',
+ 'Conflicts',
+ 'Obsoletes',
+ 'NoAutoReq',
+ 'NoAutoProv',
+ 'Version', 'Release', 'Epoch', 'URL', 'BuildArch' # very rare
+ )
DROP_KEYS = ('PostScripts',
'Documents',
@@ -134,6 +156,8 @@
)
ARCHS = ('ix86', 'arm')
+CONFIGURES = ('configure', 'reconfigure', 'autogen', 'none')
+BUILDERS = ('make', 'single-make', 'python', 'perl', 'qmake', 'none')
class GitAccess():
def __init__(self, path):
@@ -218,6 +242,111 @@
def dump(self):
print yaml.dump(yaml.load(self.stream))
+ def _check_dup_files(self, files):
+ # try to remove duplicate '%defattr' in files list
+ dup1 = '%defattr(-,root,root,-)'
+ dup2 = '%defattr(-,root,root)'
+ found_dup = dup1 if dup1 in files else dup2 if dup2 in files else None
+ if found_dup:
+ logger.warning('found duplicate "%s" in file list, removed!' % found_dup)
+ files.remove(found_dup)
+
+ def _check_dup_ldconfig(self, pkgname = None):
+ if not pkgname:
+ pkgname = 'main'
+ if not self.extra['Lib']:
+ return
+ else:
+ if not self.extra['subpkgs'][pkgname]['Lib']:
+ return
+
+ dup1 = '/sbin/ldconfig'
+ dup2 = 'ldconfig'
+
+ for sec in ('post', 'postun'):
+ try:
+ extra = self.extra['content'][sec][pkgname]
+ except KeyError:
+ continue
+ found_dup = dup1 if dup1 in extra else dup2 if dup2 in extra else None
+ if found_dup:
+ extra.remove(found_dup)
+ logger.warning('Found duplicate "%s" calling in "%%%s" of %s package, removed!' % (found_dup, sec, pkgname))
+
+ def _check_dup_scriptlets(self, pkgname = None):
+ if not pkgname:
+ pkgname = 'main'
+ extra = self.extra
+ else:
+ extra = self.extra['subpkgs'][pkgname]
+
+ if extra['Desktop']:
+ re_idstr = re.compile('^desktop-file-install\s+')
+ try:
+ lines = extra['content']['install']['pre'] + \
+ extra['content']['install']['post']
+ except KeyError:
+ pass
+ else:
+ for line in lines:
+ if re_idstr.match(line):
+ logger.warning('Found possible duplicate "desktop-file-install" script in post install')
+ break
+
+ if extra['DesktopDB']:
+ re_idstr = re.compile('^update-desktop-database\s+')
+ for sec in ('post', 'postun'):
+ try:
+ lines = self.extra['content'][sec][pkgname]
+ except KeyError:
+ continue
+
+ for line in lines:
+ if re_idstr.match(line):
+ logger.warning('Found possible duplicate "update-desktop-database" script in %%%s of %s package'%(sec, pkgname))
+ break
+
+ if extra['Info']:
+ re_idstr = re.compile('^%install_info')
+ for sec in ('post', 'postun'):
+ try:
+ lines = self.extra['content'][sec][pkgname]
+ except KeyError:
+ continue
+
+ for line in lines:
+ if re_idstr.match(line):
+ logger.warning('Found possible duplicate "%%install_info..." script in %%%s of %s package'%(sec, pkgname))
+ break
+
+ if extra['Icon']:
+ re_idstr = re.compile('^/bin/touch\s+.*%{_datadir}/icons/hicolor.*')
+ re_idstr2 = re.compile('gtk-update-icon-cache\s+')
+ for sec in ('post', 'postun'):
+ try:
+ lines = self.extra['content'][sec][pkgname]
+ except KeyError:
+ continue
+
+ for line in lines:
+ if re_idstr.match(line):
+ logger.warning('Found possible duplicate script to touch icons in %%%s of %s package'%(sec, pkgname))
+ elif re_idstr2.search(line):
+ logger.warning('Found possible duplicate "gtk-update-icon-cache" script in %%%s of %s package'%(sec, pkgname))
+
+ if extra['Schema']:
+ re_idstr = re.compile('gconftool-2\s+')
+ for sec in ('post', 'pre', 'preun'):
+ try:
+ lines = self.extra['content'][sec][pkgname]
+ except KeyError:
+ continue
+
+ for line in lines:
+ if re_idstr.search(line):
+ logger.warning('Found possible duplicate "gconftool-2" script in %%%s of %s package'%(sec, pkgname))
+ break
+
def sanity_check(self):
def _check_empty_keys(metadata):
@@ -246,15 +375,16 @@
def _check_invalid_keys(metadata, subpkg = None):
""" return list of invalid keys """
- all_keys = list(LIST_KEYS + STR_KEYS + BOOL_KEYS + ('Date', 'MyVersion'))
- all_keys += RENAMED_KEYS.keys()
if not subpkg:
+ # main package
+ all_keys = list(LIST_KEYS + STR_KEYS + BOOL_KEYS + ('Date', 'MyVersion'))
+ all_keys += RENAMED_KEYS.keys()
all_keys.append('SubPackages')
for key in SUBONLY_KEYS:
all_keys.remove(key)
else:
- for key in MAINONLY_KEYS:
- all_keys.remove(key)
+ # sub package
+ all_keys = list(SUBAVAIL_KEYS + SUBWARN_KEYS)
keys = []
for key in metadata:
@@ -263,6 +393,11 @@
return keys
+ def _check_subwarn_keys(metadata, subpkg):
+ for key in SUBWARN_KEYS:
+ if key in metadata:
+ logger.warning('"%s" found in sub-pkg: %s, please consider to move it to main package' %(key, subpkg))
+
def _check_key_group(metadata):
if metadata.has_key("Group"):
warn = True
@@ -332,13 +467,6 @@
return False
return True
- def _check_key_files(metadata):
- # try to remove duplicate '%defattr' in files list
- dup = '%defattr(-,root,root,-)'
- if dup in metadata['Files']:
- logger.warning('found duplicate "%s" in file list, removed!' % dup)
- metadata['Files'].remove(dup)
-
def _check_dropped_keys(metadata):
for key in DROP_KEYS:
if key in metadata:
@@ -371,10 +499,21 @@
'RequiresPostUn',
'Provides',
'Conflicts',
+ 'BuildConflicts',
'Obsoletes'):
if req in metadata and metadata[req]:
logger.warning('"NoFiles" exists, key %s has no effect any more' % req)
+ def _check_key_configure(metadata):
+ cfg = metadata['Configure']
+ if cfg not in CONFIGURES:
+ logger.warning('"%s" is not a valid choice of Configure(%s)' % (cfg, '/'.join(CONFIGURES)))
+
+ def _check_key_builder(metadata):
+ builder = metadata['Builder']
+ if builder not in BUILDERS:
+ logger.warning('"%s" is not a valid choice of Builder(%s)' % (builder, '/'.join(BUILDERS)))
+
# checking for empty keys
keys = _check_empty_keys(self.metadata)
if keys:
@@ -405,6 +544,11 @@
if keys:
logger.warning('Unexpected keys for sub-pkg %s found: %s' % (sp['Name'], ', '.join(keys)))
+ # checking for questionable sub-package keys
+ if "SubPackages" in self.metadata:
+ for sp in self.metadata["SubPackages"]:
+ keys = _check_subwarn_keys(sp, sp['Name'])
+
# checking for deprecated keys
_check_dropped_keys(self.metadata)
@@ -517,7 +661,17 @@
# checking duplicate 'Files' items
if 'Files' in self.metadata:
- _check_key_files(self.metadata)
+ self._check_dup_files(self.metadata['Files'])
+ if "SubPackages" in self.metadata:
+ for sp in self.metadata["SubPackages"]:
+ if 'Files' in sp:
+ self._check_dup_files(sp['Files'])
+
+ # checking for validation of 'Configure and Builder'
+ if 'Configure' in self.metadata:
+ _check_key_configure(self.metadata)
+ if 'Builder' in self.metadata:
+ _check_key_builder(self.metadata)
def __get_scm_latest_release(self):
@@ -688,7 +842,7 @@
'Lib': {'RequiresPost': ['/sbin/ldconfig'],
'RequiresPostUn': ['/sbin/ldconfig'],
},
- 'Icon': {'RequiresPost': ['/bin/touch'],
+ 'Icon': {'RequiresPost': ['/bin/touch', 'gtk2'],
},
'Desktop': {'PkgBR': ['desktop-file-utils'],
},
@@ -1059,11 +1213,8 @@
logger.warning('both "Files" YAML keyword and inline %file content in spec present')
# try to remove duplicate '%defattr' in files list
- dup = '%defattr(-,root,root,-)'
for key in content['files']:
- if dup in content['files'][key]:
- logger.warning('found duplicate "%s" in file list, removed!' % dup)
- content['files'][key].remove(dup)
+ self._check_dup_files(content['files'][key])
return content
@@ -1146,6 +1297,22 @@
for sp in self.metadata["SubPackages"]:
self._gen_auto_requires(sp, self.extra['subpkgs'][sp['Name']], sp['Name'])
+ # check duplicate 'ldconfig' in %post/%postun
+ # actually, all auto generated scripts in %post like sections should be checked
+ # for duplicate issue, but it's not nice to do that according current design.
+ # But for 'ldconfig', there're too many issues with it, the following code
+ # is just a workaround to fix them.
+ self._check_dup_ldconfig()
+ if "SubPackages" in self.metadata:
+ for sp in self.metadata["SubPackages"]:
+ self._check_dup_ldconfig(sp['Name'])
+
+ # check duplicate other auto-scriptlets in %post/%postun
+ self._check_dup_scriptlets()
+ if "SubPackages" in self.metadata:
+ for sp in self.metadata["SubPackages"]:
+ self._check_dup_scriptlets(sp['Name'])
+
spec_content = str(
spec.spec(searchList=[{
'metadata': self.metadata,
--- tests/specify_cases/test-builder_default
+++ tests/specify_cases/test-builder_default
+(directory)
--- tests/specify_cases/test-builder_default/input.p
+++ tests/specify_cases/test-builder_default/input.p
(renamed from tests/specify_cases/test-key_builder_default/input.p)
--- tests/specify_cases/test-builder_default/output.p
+++ tests/specify_cases/test-builder_default/output.p
+--- output.orig.spec 2010-06-21 16:39:53.000000000 +0800
++++ output.spec 2010-06-21 16:39:53.000000000 +0800
+@@ -43,6 +43,7 @@ This package contains development files
+ # << build pre
+
+
++make %{?jobs:-j%jobs}
+
+ # >> build post
+ # << build post
+@@ -50,6 +51,7 @@ This package contains development files
+ rm -rf %{buildroot}
+ # >> install pre
+ # << install pre
++%make_install
+
+ # >> install post
+ # << install post
--- tests/specify_cases/test-builder_qmake/output.p
+++ tests/specify_cases/test-builder_qmake/output.p
@@ -1,6 +1,6 @@
---- output.orig.spec 2010-03-17 21:15:03.000000000 +0800
-+++ output.spec 2010-03-17 21:15:03.000000000 +0800
-@@ -41,7 +41,8 @@ This package contains development files
+--- output.orig.spec 2010-06-21 16:39:41.000000000 +0800
++++ output.spec 2010-06-21 16:39:41.000000000 +0800
+@@ -42,7 +42,8 @@ This package contains development files
# >> build pre
# << build pre
@@ -10,11 +10,11 @@
# >> build post
# << build post
-@@ -49,6 +50,7 @@ This package contains development files
+@@ -50,6 +51,7 @@ This package contains development files
rm -rf %{buildroot}
# >> install pre
# << install pre
-+%make_install
++%make_install INSTALL_ROOT=%{buildroot}
# >> install post
# << install post
--- tests/specify_cases/test-builder_single_make/output.p
+++ tests/specify_cases/test-builder_single_make/output.p
@@ -1,6 +1,6 @@
---- output.orig.spec 2010-03-17 21:15:03.000000000 +0800
-+++ output.spec 2010-03-17 21:15:03.000000000 +0800
-@@ -41,7 +41,8 @@ This package contains development files
+--- output.orig.spec 2010-06-21 16:42:01.000000000 +0800
++++ output.spec 2010-06-21 16:42:01.000000000 +0800
+@@ -42,7 +42,8 @@ This package contains development files
# >> build pre
# << build pre
@@ -10,11 +10,11 @@
# >> build post
# << build post
-@@ -49,6 +50,7 @@ This package contains development files
+@@ -50,6 +51,7 @@ This package contains development files
rm -rf %{buildroot}
# >> install pre
# << install pre
-+%make_install
++%make_install
# >> install post
# << install post
--- tests/specify_cases/test-builder_without_configure/output.p
+++ tests/specify_cases/test-builder_without_configure/output.p
@@ -1,6 +1,6 @@
---- output.orig.spec 2010-03-17 21:15:15.000000000 +0800
-+++ output.spec 2010-03-17 21:15:15.000000000 +0800
-@@ -42,6 +42,7 @@ This package contains development files
+--- output.orig.spec 2010-06-21 16:40:59.000000000 +0800
++++ output.spec 2010-06-21 16:40:59.000000000 +0800
+@@ -43,6 +43,7 @@ This package contains development files
# << build pre
@@ -8,11 +8,11 @@
# >> build post
# << build post
-@@ -49,6 +50,7 @@ This package contains development files
+@@ -50,6 +51,7 @@ This package contains development files
rm -rf %{buildroot}
# >> install pre
# << install pre
-+%make_install
++%make_install
# >> install post
# << install post
--- tests/specify_cases/test-checking_invalid_cfgr_builder
+++ tests/specify_cases/test-checking_invalid_cfgr_builder
+(directory)
--- tests/specify_cases/test-checking_invalid_cfgr_builder/input.p
+++ tests/specify_cases/test-checking_invalid_cfgr_builder/input.p
+--- ../base/testpkg.yaml 2010-03-15 12:26:52.000000000 +0800
++++ testpkg.yaml 2010-07-07 09:41:50.525421578 +0800
+@@ -12,8 +12,8 @@ Description: |
+ the base of all testings. In this YAML file, only basic keywords
+ specified, plus with one sub package "devel".
+
+-Configure: none
+-Builder: none
++Configure: abc
++Builder: xyz
+
+ SubPackages:
+ - Name: devel
--- tests/specify_cases/test-checking_invalid_cfgr_builder/output.2p
+++ tests/specify_cases/test-checking_invalid_cfgr_builder/output.2p
+--- output.2.o 2010-07-07 09:41:40.916096869 +0800
++++ output.2 2010-07-07 09:41:50.749043384 +0800
+@@ -1,2 +1,4 @@
+ [33mWarning:[0m There is no "Makefile" for this package, please update it using packaging-tools
++[33mWarning:[0m "abc" is not a valid choice of Configure(configure/reconfigure/autogen/none)
++[33mWarning:[0m "xyz" is not a valid choice of Builder(make/single-make/python/perl/qmake/none)
+ [32mInfo:[0m Creating new spec file: output.spec
--- tests/specify_cases/test-checking_invalid_cfgr_builder/output.p
+++ tests/specify_cases/test-checking_invalid_cfgr_builder/output.p
+--- output.orig.spec 2010-07-07 09:41:40.916096869 +0800
++++ output.spec 2010-07-07 09:41:50.749043384 +0800
+@@ -43,6 +43,7 @@ This package contains development files
+ # << build pre
+
+
++xyz
+
+ # >> build post
+ # << build post
--- tests/specify_cases/test-duplicate_cfg_opts/output.2p
+++ tests/specify_cases/test-duplicate_cfg_opts/output.2p
@@ -1,5 +1,5 @@
---- output.2.o 2010-03-17 21:15:05.000000000 +0800
-+++ output.2 2010-03-17 21:15:05.000000000 +0800
+--- output.2.o 2010-06-21 16:41:52.000000000 +0800
++++ output.2 2010-06-21 16:41:52.000000000 +0800
@@ -1,2 +1,3 @@
[33mWarning:[0m There is no "Makefile" for this package, please update it using packaging-tools
+[33mWarning:[0m found duplicate configure options: "--disable-static", please remove it
--- tests/specify_cases/test-duplicate_cfg_opts/output.p
+++ tests/specify_cases/test-duplicate_cfg_opts/output.p
@@ -1,6 +1,6 @@
---- output.orig.spec 2010-03-17 21:15:05.000000000 +0800
-+++ output.spec 2010-03-17 21:15:05.000000000 +0800
-@@ -41,7 +41,10 @@ This package contains development files
+--- output.orig.spec 2010-06-21 16:41:52.000000000 +0800
++++ output.spec 2010-06-21 16:41:52.000000000 +0800
+@@ -42,7 +42,10 @@ This package contains development files
# >> build pre
# << build pre
@@ -11,11 +11,11 @@
# >> build post
# << build post
-@@ -49,6 +52,7 @@ This package contains development files
+@@ -50,6 +53,7 @@ This package contains development files
rm -rf %{buildroot}
# >> install pre
# << install pre
-+%make_install
++%make_install
# >> install post
# << install post
--- tests/specify_cases/test-filesparsing_staticlib/output.p
+++ tests/specify_cases/test-filesparsing_staticlib/output.p
@@ -1,5 +1,5 @@
---- output.orig.spec 2010-03-17 21:15:08.000000000 +0800
-+++ output.spec 2010-03-17 21:15:08.000000000 +0800
+--- output.orig.spec 2010-06-21 16:41:15.000000000 +0800
++++ output.spec 2010-06-21 16:41:15.000000000 +0800
@@ -4,6 +4,7 @@
#
# >> macros
@@ -8,7 +8,7 @@
Name: testpkg
Summary: Sample package for spectacle testings
-@@ -41,7 +42,8 @@ This package contains development files
+@@ -42,7 +43,8 @@ This package contains development files
# >> build pre
# << build pre
@@ -18,15 +18,15 @@
# >> build post
# << build post
-@@ -49,6 +51,7 @@ This package contains development files
+@@ -50,6 +52,7 @@ This package contains development files
rm -rf %{buildroot}
# >> install pre
# << install pre
-+%make_install
++%make_install
# >> install post
# << install post
-@@ -61,6 +64,7 @@ rm -rf %{buildroot}
+@@ -64,6 +67,7 @@ rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
--- tests/specify_cases/test-key_buildconflicts
+++ tests/specify_cases/test-key_buildconflicts
+(directory)
--- tests/specify_cases/test-key_buildconflicts/input.p
+++ tests/specify_cases/test-key_buildconflicts/input.p
+--- ../base/testpkg.yaml 2010-03-15 12:26:52.000000000 +0800
++++ testpkg.yaml 2010-06-21 16:34:38.000000000 +0800
+@@ -12,6 +12,10 @@ Description: |
+ the base of all testings. In this YAML file, only basic keywords
+ specified, plus with one sub package "devel".
+
++BuildConflicts:
++ - package-conflict1
++ - package-conflict2
++
+ Configure: none
+ Builder: none
+
--- tests/specify_cases/test-key_buildconflicts/output.p
+++ tests/specify_cases/test-key_buildconflicts/output.p
+--- output.orig.spec 2010-06-21 16:34:07.000000000 +0800
++++ output.spec 2010-06-21 16:34:38.000000000 +0800
+@@ -14,6 +14,8 @@ License: BSD
+ URL: http://www.testpkg.org/
+ Source0: http://www.testpkg.org/testpkg-%{version}.tar.gz
+ Source100: testpkg.yaml
++BuildConflicts: package-conflict1
++BuildConflicts: package-conflict2
+
+
+ %description
--- tests/specify_cases/test-key_builder_default
+++ tests/specify_cases/test-key_builder_default
-(directory)
--- tests/specify_cases/test-key_builder_default/input.p
+++ tests/specify_cases/test-key_builder_default/input.p
(renamed to tests/specify_cases/test-builder_default/input.p)
--- tests/specify_cases/test-key_builder_default/output.p
+++ tests/specify_cases/test-key_builder_default/output.p
---- output.orig.spec 2010-03-17 21:15:04.000000000 +0800
-+++ output.spec 2010-03-17 21:15:04.000000000 +0800
-@@ -42,6 +42,7 @@ This package contains development files
- # << build pre
-
-
-+make %{?jobs:-j%jobs}
-
- # >> build post
- # << build post
-@@ -49,6 +50,7 @@ This package contains development files
- rm -rf %{buildroot}
- # >> install pre
- # << install pre
-+%make_install
-
- # >> install post
- # << install post
--- tests/specify_cases/test-key_noautoreq_noautoprov/output.p
+++ tests/specify_cases/test-key_noautoreq_noautoprov/output.p
@@ -1,5 +1,5 @@
---- output.orig.spec 2010-03-17 21:15:15.000000000 +0800
-+++ output.spec 2010-03-17 21:15:15.000000000 +0800
+--- output.orig.spec 2010-07-06 18:53:41.052001337 +0800
++++ output.spec 2010-07-06 18:53:41.206652613 +0800
@@ -14,6 +14,8 @@ License: BSD
URL: http://www.testpkg.org/
Source0: http://www.testpkg.org/testpkg-%{version}.tar.gz
@@ -7,13 +7,5 @@
+AutoReq: 0
+AutoProv: 0
- %description
- Sample package for spectacle testings, which will be used as
-@@ -25,6 +27,7 @@ specified, plus with one sub package "de
- %package devel
- Summary: Development files for %{name}
- Group: Development/Libraries
-+AutoReq: 0
- Requires: %{name} = %{version}-%{release}
- %description devel
+ %description
--- tests/specify_cases/test-key_prefix
+++ tests/specify_cases/test-key_prefix
+(directory)
--- tests/specify_cases/test-key_prefix/input.p
+++ tests/specify_cases/test-key_prefix/input.p
+--- ../base/testpkg.yaml 2010-03-15 12:26:52.000000000 +0800
++++ testpkg.yaml 2010-07-07 09:40:21.655437506 +0800
+@@ -14,6 +14,7 @@ Description: |
+
+ Configure: none
+ Builder: none
++Prefix: /opt
+
+ SubPackages:
+ - Name: devel
--- tests/specify_cases/test-key_prefix/output.p
+++ tests/specify_cases/test-key_prefix/output.p
+--- output.orig.spec 2010-07-07 09:40:12.216880219 +0800
++++ output.spec 2010-07-07 09:40:22.080459763 +0800
+@@ -11,6 +11,7 @@ Version: 1.0
+ Release: 1
+ Group: System/Base
+ License: BSD
++Prefix: /opt
+ URL: http://www.testpkg.org/
+ Source0: http://www.testpkg.org/testpkg-%{version}.tar.gz
+ Source100: testpkg.yaml
--- tests/specify_cases/test-namespace_configoptions/output.p
+++ tests/specify_cases/test-namespace_configoptions/output.p
@@ -1,6 +1,6 @@
---- output.orig.spec 2010-03-30 17:16:00.000000000 +0800
-+++ output.spec 2010-03-30 17:16:50.000000000 +0800
-@@ -41,7 +41,16 @@ This package contains development files
+--- output.orig.spec 2010-06-21 16:41:36.000000000 +0800
++++ output.spec 2010-06-21 16:41:36.000000000 +0800
+@@ -42,7 +42,16 @@ This package contains development files
# >> build pre
# << build pre
@@ -17,11 +17,11 @@
# >> build post
# << build post
-@@ -49,6 +58,7 @@ This package contains development files
+@@ -50,6 +59,7 @@ This package contains development files
rm -rf %{buildroot}
# >> install pre
# << install pre
-+%make_install
++%make_install
# >> install post
# << install post
--- tools/spec2spectacle
+++ tools/spec2spectacle
@@ -71,17 +71,19 @@
'Group',
'BuildArch',
'ExclusiveArch',
+ 'Prefix',
'License' )
REQUIRES = ('BuildRequires',
- 'PreRequires',
'Requires',
'Requires(post)',
'Requires(postun)',
'Requires(pre)',
+ 'PreRequires', 'PreReq', 'Prereq', # alias in old spec
'Requires(preun)',
'Provides',
'Obsoletes',
'Conflicts',
+ 'BuildConflicts',
)
SKIPS = ( 'BuildRoot',)
@@ -108,6 +110,9 @@
'Requires(post)': 'RequiresPost',
'Requires(postun)': 'RequiresPostUn',
'Requires(pre)': 'RequiresPre',
+ 'PreRequires': 'RequiresPre',
+ 'PreReq': 'RequiresPre',
+ 'Prereq': 'RequiresPre',
'Requires(preun)': 'RequiresPreUn',
'Url': 'URL',
}
@@ -384,6 +389,15 @@
def _do_changelog(self, items, pkg, h, v):
logger.warning('Please move changelog in %changelog to *.changes file.')
+ def _remove_attrs(self, files):
+ # try to remove duplicate '%defattr' in files list
+ dup = '%defattr(-,root,root,-)'
+ dup2 = '%defattr(-,root,root)'
+ if dup in files:
+ files.remove(dup)
+ if dup2 in files:
+ files.remove(dup2)
+
def _do_files(self, items, pkg, h, v):
files = map(str.strip, v.strip().splitlines())
@@ -391,6 +405,8 @@
if files[0].startswith('-'):
files.pop(0)
+ self._remove_attrs(files)
+
if self.include_files:
items['Files'] = files
else:
@@ -556,7 +572,9 @@
nbr = [] # new 'PkgConfigBR' list
nv = []
for vi in v:
- if ',' in vi:
+ if 'perl' in vi:
+ nv.append(vi)
+ elif ',' in vi:
reqs = []
for entry in re.findall('\S+\s+[<>=]+\s+[^,\s]+|[^,\s]+', vi):
reqs.append(entry)
++++++ spectacle.yaml
--- spectacle.yaml
+++ spectacle.yaml
@@ -1,6 +1,6 @@
Name: spectacle
Summary: RPM Spec file generator and management tool
-Version: 0.17
+Version: 0.18
Release: 1
SCM: git at git.moblin.org:spectacle
Group: Development/Tools
More information about the MeeGo-commits
mailing list