Bug 39239 - remove dependency to texlive in univention-directory-reports (use python-reportlab? for creating PDF's instead)
remove dependency to texlive in univention-directory-reports (use python-repo...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Reports
UCS 4.0
Other Linux
: P5 normal (vote)
: UCS 4.2-1-errata
Assigned To: Florian Best
Johannes Keiser
:
: 24359 24986 (view as bug list)
Depends on:
Blocks: 45475
  Show dependency treegraph
 
Reported: 2015-08-20 11:54 CEST by Felix Botner
Modified: 2017-10-02 09:16 CEST (History)
5 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
best: Patch_Available+


Attachments
patch (76.09 KB, patch)
2017-06-16 17:46 CEST, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Botner univentionstaff 2015-08-20 11:54:14 CEST
We should get rid of the all the texlive packages.

Why:

 * installing/updating takes a long time
 * save ~190 MB of disk space
 * texlive packages caused many update/installing problems in the past,
   problems we wouldn't have had without the texlive packages
 * Keep in mind, univention-apps also benefit from smaller images and faster 
   setup.

Alternatives:

 * python-reportlab

   from reportlab.pdfgen import canvas
   c = canvas.Canvas("hello.pdf")
   c.drawString(100,750,"Welcome to Reportlab!")
   c.save()

   http://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/

 * ???
Comment 1 Florian Best univentionstaff 2015-08-20 12:15:30 CEST
yes, that would be cool.
Comment 2 Felix Botner univentionstaff 2015-08-20 12:30:52 CEST
Alternatives:

 * python-trml2pdf

   Tiny RML2PDF is a tool to easily create PDF document without programming. It
   can be used as a Python library or as a standalone binary. It converts a RML,
   an XML dialect that lets you define the precise appearance of a printed
   document, to a PDF. You can use your existing tools to generate an input file
   that exactly describes the layout of a printed document, and RML2PDF converts
   it into PDF. RML is a much more powerful and flexible alternative to XSL:FO.
Comment 3 Alexander Kläser univentionstaff 2015-10-21 11:54:02 CEST
Maybe GrailTeX would be an option?

"GrailTeX is a small TeX distribution based on LaTeX and designed to build web-based applications."

https://github.com/nagybence/grailtex
Comment 4 Florian Best univentionstaff 2017-06-16 17:46:04 CEST
Created attachment 8928 [details]
patch

I implemented a solution based on the suggested RML:

Further reference documents are:
http://www.reportlab.com/docs/rml-for-idiots.pdf
http://www.reportlab.com/docs/rml2pdf-userguide.pdf
http://www.reportlab.com/software/rml-reference/
http://www.reportlab.com/snippets/
http://www.reportlab.com/documentation/rml-samples/

The attached patch is backwards compatible to LaTex but moves all the dependencies to a new package univention-directory-reports-latex which is not installed by default.

FYI: Latex is much more simple and flexible than RML!
Comment 5 Florian Best univentionstaff 2017-06-16 18:07:02 CEST
*** Bug 24986 has been marked as a duplicate of this bug. ***
Comment 6 Florian Best univentionstaff 2017-06-16 18:07:21 CEST
*** Bug 24359 has been marked as a duplicate of this bug. ***
Comment 7 Florian Best univentionstaff 2017-06-20 19:24:25 CEST
The patch has been applied.

univention-management-console-module-udm (7.0.10-5):
r80356 | Bug #39239: improove report creation

univention-management-console-module-udm.yaml:
r80367 | YAML Bug #1567, Bug #39239

univention-directory-reports (9.0.1-1):
r80355 | Bug #39239: remove dependency to latex

univention-directory-reports.yaml:
r80368 | YAML Bug #39239
Comment 8 Florian Best univentionstaff 2017-06-21 14:40:58 CEST
Cherry picked package python-trml2pdf[62302] version 1.2-3 from 4.0-0-0[75]/None[0] to 4.2[78]/errata4.2-1[492]

Added the package to the triggers list:
r80387 | Bug #39239: add python-trml2pdf to maintained / copy trigger list to errata
r80386 | Bug #39239: add python-trml2pdf to maintained

Successful build
Package: python-trml2pdf
Version: 1.2-3A~4.2.0.201706211305
Branch: ucs_4.2-0
Scope: errata4.2-1

I tried to create the new package list with the steps from:
https://hutten.knut.univention.de/mediawiki/index.php/Debian_Installer#debian-cd_-_Maintained_packages_list
https://hutten.knut.univention.de/mediawiki/index.php/Errata-Updates#Ein_neues_Paket_als_Erratum_nach_maintained_.C3.BCbernehmen

First I got this:
CRITICAL:root:Failed to read "/home/fbest/src/triggers/ucs_4.2-0-errata4.2-1.txt": [Errno 2] No such file or directory: '/home/fbest/src/triggers/ucs_4.2-0-errata4.2-1.txt'
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/repong/repo_apt.py", line 457, in read_packages
    filename, self.options.arch, self.source_packages))
  File "/usr/lib/pymodules/python2.6/univention/repong/repo_util.py", line 93, in read_trigger_file
    with open(filename, 'r', encoding=ENCODING) as src_pkg:
  File "/usr/lib/python2.6/codecs.py", line 881, in open
    file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 2] No such file or directory: '/home/fbest/src/triggers/ucs_4.2-0-errata4.2-1.txt'


Now I get this:

Traceback (most recent call last):
  File "/usr/lib/python2.6/runpy.py", line 122, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.6/runpy.py", line 34, in _run_code
    exec code in run_globals
  File "/usr/lib/pymodules/python2.6/univention/repong/repo_apt.py", line 648, in <module>
    main()
  File "/usr/lib/pymodules/python2.6/univention/repong/repo_apt.py", line 71, in main
    with dep.apt as dep.cache:
  File "/usr/lib/pymodules/python2.6/univention/repong/repo_apt.py", line 218, in __enter__
    return super(AptCommonSource, self).__enter__()
  File "/usr/lib/pymodules/python2.6/univention/repong/repo_apt.py", line 179, in __enter__
    cache.update()
  File "/usr/lib/python2.6/dist-packages/apt/deprecation.py", line 98, in deprecated_function
    return func(*args, **kwds)
  File "/usr/lib/python2.6/dist-packages/apt/cache.py", line 364, in update
    raise FetchFailedException(e)
apt.cache.FetchFailedException: W:Failed to fetch file:/var/univention/buildsystem2/apt/ucs_4.2-0-errata4.2-1/dists/ucs420/main/binary-amd64/Packages.gz  Datei nicht gefunden
, W:Failed to fetch file:/var/univention/buildsystem2/apt/ucs_4.2-0-errata4.2-1/dists/ucs420/main/debian-installer/binary-amd64/Packages.gz  Datei nicht gefunden
, E:Some index files failed to download, they have been ignored, or old ones used instead.
Comment 9 Florian Best univentionstaff 2017-06-21 14:52:07 CEST
The package list generation has succeeded now, thanks Philipp.
Comment 10 Johannes Keiser univentionstaff 2017-06-26 12:50:45 CEST
The content of the old and new reports is identical.

I noticed a few translation errors:

- The title in the CreateReportDialog is not translated. (e.g. "Report for user")
- The text "This may take a while" in the CreateReportDialog when creating the report is not translated.

- The selection "PDF Document" is not translated.

- The date in the german pdf document is not translated (if you create the report via command line it is translated)


Computer report:
- The report for a computer object does not have a header like the user or group report (e.g. for users: "User report: <last name>, <first name>)

User report:
- The 'disabled' attribute ('Account deactivation') and 'locked' attribute 
('Locked login methods') in the Account settings are not translated

- 'Employee type' is translated 'Mitarbeiterkategorie' in the UMC but in the Report it is 'Mitarbeitertyp'

- The 'inherited' ('Ererbt') attribute is not translated in the german report but only when creating the report via command line

Group report look OK
Comment 11 Florian Best univentionstaff 2017-06-26 14:06:34 CEST
(In reply to Johannes Keiser from comment #10)
> The content of the old and new reports is identical.
> 
> I noticed a few translation errors:
> 
> - The title in the CreateReportDialog is not translated. (e.g. "Report for
> user")
fixed, Translation error from Bug #42220.

> - The text "This may take a while" in the CreateReportDialog when creating
> the report is not translated.
fixed, Translation error from Bug #42220.

> - The selection "PDF Document" is not translated.
The UCR variables have no translation, therefor I translate it in the module.

> - The date in the german pdf document is not translated (if you create the
> report via command line it is translated)
fixed. This is because LC_TIME was not set in the module process. I hope this doesn't cause any regressions in UMC-UDM.

> Computer report:
> - The report for a computer object does not have a header like the user or
> group report (e.g. for users: "User report: <last name>, <first name>)
Yes, the previous reports only had a caption "Computer report". I don't know how to add such thing in RML on each page.

> User report:
> - The 'disabled' attribute ('Account deactivation') and 'locked' attribute 
> ('Locked login methods') in the Account settings are not translated
Yes, the values are 'none', 'windows', 'kerberos', 'kerberos_posix', 'windows_posix', ... and not translated with the syntax class. It's not a regression so I ignore this for now as it's not so easy to fix.

> - 'Employee type' is translated 'Mitarbeiterkategorie' in the UMC but in the
> Report it is 'Mitarbeitertyp'
fixed

> - The 'inherited' ('Ererbt') attribute is not translated in the german
> report but only when creating the report via command line
TODO

univention-management-console-module-udm (7.0.10-10):
r80490 | Bug #39239: fix some translations

univention-directory-reports (9.0.1-2):
r80491 | Bug #39239: fix some translations
Comment 12 Florian Best univentionstaff 2017-06-26 14:33:18 CEST
(In reply to Florian Best from comment #11)
> > - The 'inherited' ('Ererbt') attribute is not translated in the german
> > report but only when creating the report via command line
> TODO
fixed!

univention-directory-reports (9.0.1-3):
r80492 | Bug #39239: fix locale of _ instances
Comment 13 Johannes Keiser univentionstaff 2017-06-26 18:00:12 CEST
OK looks good now
YAML: OK
-> verified