Bug 816126

Summary: Review Request: python-django-dpaste - Dpaste is a code paste-bin application using Django
Product: [Fedora] Fedora Reporter: Matthias Runge <mrunge>
Component: Package ReviewAssignee: Michael S. <misc>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: david.brown, misc, notting, package-review
Target Milestone: ---Flags: misc: 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-04 06:44:43 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-25 10:16:14 UTC
Spec URL: http://www.matthias-runge.de/fedora/python-django-dpaste.spec
SRPM URL: http://www.matthias-runge.de/fedora/python-django-dpaste-0.2.4-5.fc17.src.rpm
Description: 
Originally inspired by dpaste.com this application adds the ability to:

See the differences between snippets
A history of snippets as a tree
See your latest 25 snippets (admin setting)
A huge bunch of syntax highlighters (lexers)
User defined settings to change the font-family as well as font-sizes
Nicer colors
Multilangual interface

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

[mrunge@mrungexp SPECS]$ rpmlint ./python-django-dpaste.spec ../RPMS/noarch/python-django-dpaste-0.2.4-5.fc16.noarch.rpm ../SRPMS/python-django-dpaste-0.2.4-5.fc16.src.rpm 
2 packages and 1 specfiles checked; 0 errors, 0 warnings.


koji scratchbuild is here: http://koji.fedoraproject.org/koji/taskinfo?taskID=4021530

Comment 1 David Brown 2012-04-30 15:08:54 UTC
You have a patch for rhel <= 5 but no %clean for rhel 5 you should add that and put a similar %if macro around it.

http://fedoraproject.org/wiki/Packaging:Guidelines#.25clean

Also, it looks like you are using the installed files feature of python.

This page has a note about why doing that doesn't work out well.

http://fedoraproject.org/wiki/Packaging:Python#Byte_compiling

Explicitly stating the files and directories installed is more helpful to specfile readers to know what's actually getting installed by what rpm.

Comment 2 Matthias Runge 2012-05-01 20:11:22 UTC
Thank you David,

yes, you're right, that patch is not necessary; targeting for fedora 18+, currently no EPEL branches.

I'm not using the installed files feature of python.
Those complicated files list the files of the package. I have it this complicated to avoid listing the language files twice. Django is currently putting locale files under 
%{python_sitelib}/dpaste/locale/??/...

If you've got a better idea, how to match those files, I'm eager to hear!


Updated
SPEC: http://www.matthias-runge.de/fedora/python-django-dpaste.spec
SRPM: http://www.matthias-runge.de/fedora/python-django-dpaste-0.2.4-6.fc17.src.rpm


[mrunge@sofja SPECS]$ rpmlint ./python-django-dpaste.spec ../SRPMS/python-django-dpaste-0.2.4-6.fc17.src.rpm ../RPMS/noarch/python-django-dpaste-0.2.4-6.fc17.noarch.rpm 
2 packages and 1 specfiles checked; 0 errors, 0 warnings.


[mrunge@sofja SPECS]$ diff -u python-django-dpaste.spec.1 python-django-dpaste.spec
--- python-django-dpaste.spec.1	2012-04-24 21:17:09.000000000 +0200
+++ python-django-dpaste.spec	2012-05-01 22:05:45.058334501 +0200
@@ -4,12 +4,11 @@
 Summary:	Dpaste is a code paste-bin application using Django
 Name:		python-django-dpaste
 Version:	0.2.4
-Release:	5%{?dist}
+Release:	6%{?dist}
 License:	BSD with advertising
 Group:		Development/Libraries
 URL:		https://github.com/bartTC/django-paste/
 SOURCE:		http://pypi.python.org/packages/source/d/%{pkgname}/%{pkgname}-%{version}.tar.gz
-Patch1:		setuptools.patch
 BuildArch:	noarch
 BuildRequires:	python2-devel 
 BuildRequires:	python-setuptools
@@ -39,9 +38,6 @@
 find $buildroot -type f \( -name .DS_Store -o -name ._\* \) -print0 |xargs -0 rm -f
 rm -rf dpaste/templates/dpaste/.tmp* 
 
-%if 0%{?rhel} && 0%{?rhel} <= 5
-%patch1 -p1 
-%endif
 
 
 %build
@@ -66,6 +62,9 @@
 %{python_sitelib}/dpaste/management
 
 %changelog
+* Tue May 01 2012 Matthias Runge <mrunge> - 0.2.4-6
+- dropped unnecessary patch for epel5
+
 * Tue Apr 24 2012 Matthias Runge <mrunge> - 0.2.4-5
 - package renamed to python-django-dpaste
 - minor spec cleanup

Comment 3 David Brown 2012-05-01 20:47:50 UTC
Yeah I'd put something like.

%{python_sitelib}/dpaste/locale

using the dpaste.lang file directories like %{python_sitelib}/dpaste/locale/{de|en}/LC_MESSAGES aren't managed by the rpm.

Comment 4 Matthias Runge 2012-05-02 09:45:26 UTC
David, I'm not sure, (In reply to comment #3)
> Yeah I'd put something like.
> 
> %{python_sitelib}/dpaste/locale
> 
> using the dpaste.lang file directories like
> %{python_sitelib}/dpaste/locale/{de|en}/LC_MESSAGES aren't managed by the rpm.
I'm not sure, if we're talking about the same thing, or if I really understand you.

Language files are explicitly declared. That some ugly find-scriptlet does that for me (in this case).  If I include %{python_sitelib}/dpaste in files-section, especially those language files will get included twice.

David, are you interested in a more formal review? I could do a review for your package in exchange?

Comment 5 David Brown 2012-05-02 13:59:22 UTC
The lang files get included if you use both the line above and the -f argument to files.

So the crux of the issue is that the directories de, en, de/LC_MESSAGES and en/LC_MESSAGES aren't getting tracked by the rpm when you use the -f argument to files. My recommendation would be to remove the -f argument to %files and just use the line above in the files section.

To show how this can be an issue try installing your rpm then uninstalling it. See if the directories mentioned above in the dpaste/locale directory get removed. On my system they didn't get removed. This can cause issues later down the road when the upstream maintainers choose to change how they are doing things. Then during an upgrade from this version to the next version directories are there that shouldn't be and could cause the upgrade to fail.

In my opinion its better to track everything in the rpm including all the directories the package might touch. The only time its not okay if the directory is owned by another package. So if the Requires for this package track the locale directories already then this fix isn't needed.

Comment 6 David Brown 2012-05-02 14:01:52 UTC
Oh, forgot to mention...

Yes I wouldn't mind a more formal review of my packages. The more eyes on the problems the better ;)

Comment 7 Matthias Runge 2012-05-02 14:16:56 UTC
OK, partly agreed, but for other reasons.

[mrunge@noname SPECS]$ diff -u python-django-dpaste.spec.1 python-django-dpaste.spec
--- python-django-dpaste.spec.1	2012-05-01 22:09:59.000000000 +0200
+++ python-django-dpaste.spec	2012-05-02 16:10:43.112278927 +0200
@@ -4,7 +4,7 @@
 Summary:	Dpaste is a code paste-bin application using Django
 Name:		python-django-dpaste
 Version:	0.2.4
-Release:	6%{?dist}
+Release:	7%{?dist}
 License:	BSD with advertising
 Group:		Development/Libraries
 URL:		https://github.com/bartTC/django-paste/
@@ -60,8 +60,12 @@
 %{python_sitelib}/dpaste/templates
 %{python_sitelib}/dpaste/templatetags
 %{python_sitelib}/dpaste/management
+%dir %{python_sitelib}/dpaste/locale/??/LC_MESSAGES
 
 %changelog
+* Wed May 02 2012 Matthias Runge <mrunge> - 0.2.4-7
+- added locale-dir to files-list
+
 * Tue May 01 2012 Matthias Runge <mrunge> - 0.2.4-6
 - dropped unnecessary patch for epel5

Updated 
SPEC: http://www.matthias-runge.de/fedora/python-django-dpaste.spec
SRPM: http://www.matthias-runge.de/fedora/python-django-dpaste-0.2.4-7.fc17.src.rpm

If you want me to take a look onto your packages, you'll need to list them for me ;-)

[mrunge@noname SPECS]$ rpm -qlvp ../RPMS/noarch/python-django-dpaste-0.2.4-7.fc17.noarch.rpm | grep locale
(first line is the important one):

drwxr-xr-x    2 root    root                        0 May  2 16:10 /usr/lib/python2.7/site-packages/dpaste/locale/de/LC_MESSAGES
-rw-r--r--    1 root    root                     3419 May  7  2009 /usr/lib/python2.7/site-packages/dpaste/locale/de/LC_MESSAGES/django.mo
-rw-r--r--    1 root    root                     5759 May  7  2009 /usr/lib/python2.7/site-packages/dpaste/locale/de/LC_MESSAGES/django.po
drwxr-xr-x    2 root    root                        0 May  2 16:10 /usr/lib/python2.7/site-packages/dpaste/locale/en/LC_MESSAGES
-rw-r--r--    1 root    root                     1175 May  7  2009 /usr/lib/python2.7/site-packages/dpaste/locale/en/LC_MESSAGES/django.mo
-rw-r--r--    1 root    root                     4827 May  7  2009 /usr/lib/python2.7/site-packages/dpaste/locale/en/LC_MESSAGES/django.po

Comment 8 David Brown 2012-05-02 14:30:23 UTC
Bah but you forgot the en and de directories!

Add this please.

%dir %{python_sitelib}/dpaste/locale/??

Comment 9 Matthias Runge 2012-05-02 19:27:42 UTC
-Release:	7%{?dist}
+Release:	8%{?dist}
 License:	BSD with advertising
 Group:		Development/Libraries
 URL:		https://github.com/bartTC/django-paste/
@@ -61,10 +61,12 @@
 %{python_sitelib}/dpaste/templatetags
 %{python_sitelib}/dpaste/management
 %dir %{python_sitelib}/dpaste/locale/??/LC_MESSAGES
+%dir %{python_sitelib}/dpaste/locale/??
+%dir %{python_sitelib}/dpaste/locale
 
 %changelog
-* Wed May 02 2012 Matthias Runge <mrunge> - 0.2.4-7
-- added locale-dir to files-list
+* Wed May 02 2012 Matthias Runge <mrunge> - 0.2.4-8
+- added locale, and subdirs to files-list

[mrunge@sofja SPECS]$ rpmlint ./python-django-dpaste.spec ../SRPMS/python-django-dpaste-0.2.4-8.fc17.src.rpm ../RPMS/noarch/python-django-dpaste-0.2.4-8.fc17.noarch.rpm 
2 packages and 1 specfiles checked; 0 errors, 0 warnings.

SPEC: http://www.matthias-runge.de/fedora/python-django-dpaste.spec
SRPM: http://www.matthias-runge.de/fedora/python-django-dpaste-0.2.4-8.fc17.src.rpm

Comment 10 Michael S. 2012-05-20 22:21:39 UTC
Fedora-review complain on 

[!]: MUST Package consistently uses macros (instead of hard-coded directory
     names).
     Note: Using both %{buildroot} and $RPM_BUILD_ROOT

Comment 11 Michael S. 2012-05-20 22:26:30 UTC
Also, it seems that pygment is required at run-time, not at buildtime.

Comment 12 Michael S. 2012-05-20 22:37:23 UTC
So, besides theses 2 issues the rest is fine.


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.
     Note: Licenses found: "*No copyright* UNKNOWN" For detailed output of
     licensecheck see file:
     /home/misc/checkout/git/FedoraReview/src/816126/licensecheck.txt
[!]: MUST Package consistently uses macros (instead of hard-coded directory
     names).
     Note: Using both %{buildroot} and $RPM_BUILD_ROOT
[x]: MUST Package is named according to the Package Naming Guidelines.
[x]: MUST Package does not generate any conflict.
[x]: MUST Package obeys FHS, except libexecdir and /usr/target.
[x]: MUST If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[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-dpaste-0.2.4-8.fc17.src.rpm

1 packages and 0 specfiles checked; 0 errors, 0 warnings.


rpmlint python-django-dpaste-0.2.4-8.fc17.noarch.rpm

1 packages and 0 specfiles checked; 0 errors, 0 warnings.


[x]: MUST Sources used to build the package match the upstream source, as
     provided in the spec URL.
/home/misc/checkout/git/FedoraReview/src/816126/django-dpaste-0.2.4.tar.gz :
  MD5SUM this package     : d485d3c2303e576d2e24ee45390bbc44
  MD5SUM upstream package : d485d3c2303e576d2e24ee45390bbc44

[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.
[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.
[x]: 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.
[x]: SHOULD Packages should try to preserve timestamps of original installed
     files.
[x]: SHOULD Spec use %global instead of %define.


==== Python ====
[x]: MUST Module list python2-devel or python3-devel as BuildRequires
[x]: MUST Python egg is built from source
[x]: MUST Python egg do not download anything during build

Issues:
[!]: MUST Package consistently uses macros (instead of hard-coded directory
     names).
     Note: Using both %{buildroot} and $RPM_BUILD_ROOT
See: http://fedoraproject.org/wiki/Packaging/Guidelines#macros


Generated by fedora-review 0.2.0git
External plugins:


So once the 2 issues are fixed, i will validate the review.

Comment 13 Matthias Runge 2012-05-21 07:22:55 UTC
Michael, thank you for your review. You're right, pygments is required during runtime, not at build time. Also I corrected the usage of buildroot/RPM_BUILD_ROOT




updated
SPEC:
SRPM: http://www.matthias-runge.de/fedora/python-django-dpaste-0.2.4-9.fc17.src.rpm

[mrunge@mrungexp SPECS]$ rpmlint /home/mrunge/rpmbuild/SRPMS/python-django-dpaste-0.2.4-9.fc17.src.rpm /home/mrunge/rpmbuild/RPMS/noarch/python-django-dpaste-0.2.4-9.fc17.noarch.rpm ./python-django-dpaste.spec 
2 packages and 1 specfiles checked; 0 errors, 0 warnings.


@@ -4,7 +4,7 @@
 Summary:	Dpaste is a code paste-bin application using Django
 Name:		python-django-dpaste
 Version:	0.2.4
-Release:	8%{?dist}
+Release:	9%{?dist}
 License:	BSD with advertising
 Group:		Development/Libraries
 URL:		https://github.com/bartTC/django-paste/
@@ -13,7 +13,7 @@
 BuildRequires:	python2-devel 
 BuildRequires:	python-setuptools
 Requires:		python-django-mptt 
-BuildRequires:	python-pygments
+Requires:		python-pygments
 
 Provides:		%{pkgname} = %{version}-%{release}
 Obsoletes:		%{pkgname} < %{obs_ver}
@@ -46,7 +46,7 @@
 %install
 %{__python} setup.py install -O1 --skip-build --root="%{buildroot}" --prefix="%{_prefix}"
 #Language files; not under /usr/share, need to be handled manually
-(cd $RPM_BUILD_ROOT && find . -name 'django*.[mp]o') |
+(cd %{buildroot} && find . -name 'django*.[mp]o') |
     %{__sed} -e 's|^.||' | %{__sed} -e \
 	's:\(.*/locale/\)\([^/_]\+\)\(.*\.[mp]o$\):%lang(\2) \1\2\3:' \
 	>> django.lang
@@ -65,6 +65,10 @@
 %dir %{python_sitelib}/dpaste/locale
 
 %changelog
+* Mon May 21 2012 Matthias Runge <mrunge> - 0.2.4-9
+- use buildroot instead of RPM_BUILD_ROOT
+- corrected requires/buildrequires python-pygments
+
 * Wed May 02 2012 Matthias Runge <mrunge> - 0.2.4-8
 - added locale, and subdirs to files-list

Comment 15 Michael S. 2012-05-21 10:20:44 UTC
You also forgot to update the spec on the webserver :)

Comment 16 Matthias Runge 2012-05-21 10:23:39 UTC
Actually, I did upload version 9 to my webserver (just checked that). An older version may reside in your browser cache?

Comment 17 Michael S. 2012-05-21 12:30:35 UTC
Indeed :/

So the package is good to go.

Comment 18 Matthias Runge 2012-05-21 14:38:57 UTC
Thank you for the review!

Michael, could you please assign yourself to the ticket?


New Package SCM Request
=======================
Package Name: python-django-dpaste
Short Description: Dpaste is a code paste-bin application using Django
Owners: mrunge
Branches: devel

Comment 19 Gwyn Ciesla 2012-05-21 17:57:23 UTC
Git done (by process-git-requests).

Comment 20 Matthias Runge 2012-06-04 06:44:43 UTC
Imported into devel, old package deprecated and blocked. 

Thanks.