Bug 815511

Summary: Review Request: python-django-lint - Analyzes Django code looking for bugs and signs of poor quality
Product: [Fedora] Fedora Reporter: Matthias Runge <mrunge>
Component: Package ReviewAssignee: Michel Lind <michel>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: david.brown, michel, misc, notting, package-review
Target Milestone: ---Flags: michel: fedora-review+
gwync: fedora-cvs+
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-06 19:30:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 736776    

Description Matthias Runge 2012-04-23 18:29:46 UTC
Spec URL: http://www.matthias-runge.de/fedora/python-django-lint.spec
SRPM URL: http://www.matthias-runge.de/fedora/python-django-lint-0.13-12.fc17.src.rpm
Description: Django Lint is a static analysis tool that checks (or "lints") projects 
and applications that use the Django web development framework.

It reports on common programming errors and bad code smells, including 
checking for null-able CharField field types, the use of brittle or deprecated 
Django features (such as auto_now_add) as well as the absence of recommended 
options in settings.py. It aims to encourage the development of high-quality 
re-usable Django applications.

Django Lint is currently implemented as a wrapper around PyLint.


please note, this is a review request required for package rename.


koji scratchbuild http://koji.fedoraproject.org/koji/taskinfo?taskID=4015900

Comment 1 Michael S. 2012-04-27 21:04:59 UTC
Hi,

- %clean and rm -Rf $RPM_BUILD_ROOT are not needed for newer Fedora, so this would be cleaner to remove them

I am starting the formal review.

Comment 2 Michael S. 2012-04-27 21:06:53 UTC
Rpmlint complain about :

python-django-lint.noarch: E: non-executable-script /usr/lib/python2.7/site-packages/DjangoLint/script.py 0644L /usr/bin/env

Not ure on the best way to correct that.

Comment 3 David Brown 2012-04-30 14:57:24 UTC
The rm -rf %buildroot in clean is only needed for EPEL. So wrap the %clean in something like this http://fedoraproject.org/wiki/Packaging:Python#Macros.

A sed in the %install section would fix the env bit pretty easy.

sed -i 's|^#!/usr/bin/env.*|#!/usr/bin/python|' %{python_sitelib}/DjangoLint/script.py

Pulling the URL from debian isn't as nice... I thought github.com provides tarball pulling from specified tags. I'd ask the upstream to create some tags so you could pull the tarball directly from github.com at that point.

Comment 4 Matthias Runge 2012-05-01 19:54:53 UTC
Thanks to both of you for your comments.

- clean: yepp, agreed, dropping that
- non exec-script: not needed, dropping /usr/bin/env
- rebasing to github-checkout

Updated 
SPEC: http://www.matthias-runge.de/fedora/python-django-lint.spec
SRPM: http://www.matthias-runge.de/fedora/python-django-lint-0.13-13.20120501git194ce26.fc17.src.rpm

[mrunge@sofja SPECS]$ rpmlint ../SRPMS/python-django-lint-0.13-13.20120501git194ce26.fc17.src.rpm ../RPMS/noarch/python-django-lint-0.13-13.20120501git194ce26.fc17.noarch.rpm ./python-django-lint.spec 
python-django-lint.src: W: spelling-error %description -l en_US py -> pt, p, y
python-django-lint.noarch: W: spelling-error %description -l en_US py -> pt, p, y
2 packages and 1 specfiles checked; 0 errors, 2 warnings.





[mrunge@sofja SPECS]$ diff -u python-django-lint.spec.2 python-django-lint.spec
--- python-django-lint.spec.2	2012-04-23 20:27:16.000000000 +0200
+++ python-django-lint.spec	2012-05-01 21:48:14.226774782 +0200
@@ -1,21 +1,18 @@
 %global pkgname django-lint
 %global obs_ver 0.13-11
+%global commit 194ce26
 
 Name:           python-django-lint
 Version:        0.13
-Release:        12%{?dist}
+Release:        13.20120501git%{commit}%{?dist}
 Summary:        Analyzes Django code looking for bugs and signs of poor quality
 
 Group:          Development/Debuggers
 License:        GPLv3+
 URL:            https://github.com/lamby/django-lint
-# upstream author is debian maintainer, took release from debian page
-Source0:        http://ftp.de.debian.org/debian/pool/main/p/%{name}/%{name}_%{version}.orig.tar.gz
+Source0:        https://github.com/lamby/django-lint/tarball/%{commit}/lamby-django-lint-%{commit}.tar.gz
 BuildArch:      noarch
 
-# fix from upstream for iterable-issue
-# https://github.com/lamby/django-lint/pull/6
-Patch0:         django-lint-type-error-iterable.patch
 
 BuildRequires:  python2-devel
 Requires:       python-django
@@ -38,24 +35,21 @@
 
 
 %prep
-%setup -q -n %{pkgname}
-%patch0 -p2
+%setup -q -n lamby-%{pkgname}-%{commit}
+# remove unneeded /usr/bin/env-call
+sed -i 's|^#!/usr/bin/env.*||' DjangoLint/script.py
 
 %build
 %{__python} setup.py build
 
 
 %install
-rm -rf %{buildroot}
 %{__python} setup.py install -O1 --skip-build --root %{buildroot}
 
 %{__mkdir} -pm 755 %{buildroot}%{_mandir}/man1
 %{__install} -pm 644 django-lint.1 %{buildroot}%{_mandir}/man1/
 
 
-%clean
-rm -rf %{buildroot}
-
 
 %files
 %doc  README.rst COPYING
@@ -66,6 +60,10 @@
 
 
 %changelog
+* Mon Apr 30 2012 Matthias Runge <mrunge> - 0.13-13.20120501git194ce26
+- minor spec cleanup
+- rebase to latest github snapshot
+
 * Mon Apr 23 2012 Matthias Runge <mrunge> - 0.13-12
 - package rename to python-django-lint

Comment 5 David Brown 2012-05-01 20:14:10 UTC
Personally I like the #!/usr/bin/python in the beginning of every python file.

However, I don't see any requirement in the fedora packaging guidelines. Also, the script.py doesn't have any mention of the standard

if __name__ == "__main__":
  do something

So I can't make a reasonable argument to have the #!/usr/bin/python as the shebang for this particular package.

Otherwise looks good to me.

Comment 6 Matthias Runge 2012-05-01 20:27:25 UTC
If you include #!/usr/bin/python in the beginning of every python file, it makes  rpmlint whine about it (if you don't also set executable flags).

Comment 7 David Brown 2012-05-01 20:36:07 UTC
Ah, so that makes me sad... but I'd fall on the safe side of what rpmlint doesn't complain about is good enough for me.

Comment 8 Michel Lind 2012-06-04 14:44:34 UTC
OK, full review below. you'd need to bump the Obsolete: field as in the python-django-authority I reviewed earlier today.

*Note* - I said the wrong thing about being able to use <= %{obs_ver}. This won't work as the package you want to obsolete will have a disttag (or in the case of python-django-lint, some really long VCS tag *plus* disttag. So for both it's better to just use < %{obs_ver} with obs_ver being one higher than the last released version, per the guidelines. Mea culpa!



Package Review
==============

Key:
- = N/A
x = Pass
! = Fail
? = Not evaluated



==== Generic ====
[x]: MUST Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[x]: MUST Package successfully compiles and builds into binary rpms on at
     least one supported primary architecture.
[-]: MUST %build honors applicable compiler flags or justifies otherwise.
[x]: MUST All build dependencies are listed in BuildRequires, except for any
     that are listed in the exceptions section of Packaging Guidelines.
[x]: MUST Buildroot is not present
     Note: Unless packager wants to package for EPEL5 this is fine
[x]: MUST Package contains no bundled libraries.
[x]: MUST Changelog in prescribed format.
[x]: MUST Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
     Note: Clean would be needed if support for EPEL is required
[x]: MUST Sources contain only permissible code or content.
[x]: MUST Each %files section contains %defattr if rpm < 4.4
     Note: Note: defattr macros not found. They would be needed for EPEL5
[x]: MUST Macros in Summary, %description expandable at SRPM build time.
[x]: MUST Package requires other packages for directories it uses.
[x]: MUST Package uses nothing in %doc for runtime.
[x]: MUST Package is not known to require ExcludeArch.
[x]: MUST Permissions on files are set properly.
[x]: MUST Package does not contain duplicates in %files.
[x]: MUST Spec file lacks Packager, Vendor, PreReq tags.
[x]: MUST Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
     Note: rm -rf would be needed if support for EPEL5 is required
[-]: MUST Large documentation files are in a -doc subpackage, if required.
[x]: MUST If (and only if) the source package includes the text of the
     license(s) in its own file, then that file, containing the text of the
     license(s) for the package is included in %doc.
[x]: MUST License field in the package spec file matches the actual license.
[x]: MUST Package consistently uses macros (instead of hard-coded directory
     names).
[x]: MUST Package is named according to the Package Naming Guidelines.
[!]: MUST Package does not generate any conflict.
[x]: MUST Package obeys FHS, except libexecdir and /usr/target.
[x]: MUST Package must own all directories that it creates.
[x]: MUST Package does not own files or directories owned by other packages.
[x]: MUST Package installs properly.
[x]: MUST Requires correct, justified where necessary.
[x]: MUST Rpmlint output is silent.

rpmlint python-django-lint-0.13-13.20120501git194ce26.fc17.src.rpm

python-django-lint.src: W: spelling-error %description -l en_US py -> pt, p, y
1 packages and 0 specfiles checked; 0 errors, 1 warnings.


rpmlint python-django-lint-0.13-13.20120501git194ce26.fc17.noarch.rpm

python-django-lint.noarch: W: spelling-error %description -l en_US py -> pt, p, y
1 packages and 0 specfiles checked; 0 errors, 1 warnings.


[x]: MUST Sources used to build the package match the upstream source, as
     provided in the spec URL.
/home/michel/sources/fedora/reviews/815511/lamby-django-lint-194ce26.tar.gz :
  MD5SUM this package     : f83f3d02087342bd40bff63906721212
  MD5SUM upstream package : f83f3d02087342bd40bff63906721212

[x]: MUST Spec file is legible and written in American English.
[x]: MUST Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[-]: MUST Package contains a SysV-style init script if in need of one.
[x]: MUST File names are valid UTF-8.
[-]: MUST Useful -debuginfo package or justification otherwise.
[x]: SHOULD Reviewer should test that the package builds in mock.
[-]: SHOULD If the source package does not include license text(s) as a
     separate file from upstream, the packager SHOULD query upstream to
     include it.
[x]: SHOULD Dist tag is present.
[x]: SHOULD No file requires outside of /etc, /bin, /sbin, /usr/bin,
     /usr/sbin.
[x]: SHOULD Final provides and requires are sane (rpm -q --provides and rpm -q
     --requires).
[x]: SHOULD Package functions as described.
[x]: SHOULD Latest version is packaged.
[x]: SHOULD Package does not include license text files separate from
     upstream.
[x]: SHOULD SourceX is a working URL.
[-]: SHOULD Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[x]: SHOULD Package should compile and build into binary rpms on all supported
     architectures.
[-]: SHOULD %check is present and all tests pass.
     Upstream didn't seem to include any test case (tried setup.py check and
     test)
[x]: SHOULD Packages should try to preserve timestamps of original installed
     files.
[x]: SHOULD Spec use %global instead of %define.

Issues:
[!]: MUST Package does not generate any conflict.
     It should obsolete packages up to the one next than the release it's
     obsoleting (I made the wrong suggestion with the other django package
     earlier, sorry -- I forgot about all the disttag; x < x.fc17 < x+1


Generated by fedora-review 0.1.3
External plugins:

Comment 9 Matthias Runge 2012-06-05 06:33:25 UTC
Thank you for the review. I'll take another look into obsoletes to make sure, they're correct before committing package.


New Package SCM Request
=======================
Package Name: python-django-lint
Short Description: Analyzes Django code looking for bugs and signs of poor quality
Owners: mrunge
Branches: devel

Comment 10 Gwyn Ciesla 2012-06-05 12:27:49 UTC
Git done (by process-git-requests).

Comment 11 Matthias Runge 2012-06-06 19:30:26 UTC
python-django-lint built, django-lint deprecated and blocked.