Bug 49240 - enable use of ucslint on files (not packages)
enable use of ucslint on files (not packages)
Status: NEW
Product: UCS
Classification: Unclassified
Component: ucslint
UCS 5.0
Other Linux
: P5 normal with 1 vote (vote)
: ---
Assigned To: UCS maintainers
UCS maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-04-06 09:12 CEST by Daniel Tröder
Modified: 2020-08-06 10:41 CEST (History)
4 users (show)

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: 2: Improvement: Would be a product improvement
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?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2019-04-06 09:12:35 CEST
With more and more join scripts being created / migrated to "inst" files as appcenter configuration files for Docker based apps, we are loosing the possibility to check them for errors, that were previously caught by ucslint.

Option a (minimal)

Add a command line option that allows join script checks to be run a given file.

Option b (full appcenter support)

Add a command line option that scans in a give directory for known appcenter configuration files and checks them.
The files in the directory can have their per-app-name "inst", "configure" etc or their corresponding names in the appcenter cache directories (/var/cache/univention-appcenter/*/*/):
"$app_$component.$filename" → r'\w+_[0-9]{14}.(?P<filename>[a-zA-Z]+) with match.filename being "inst", "configure" etc.
The first one will help during development, the latter will help the appcenter team /jenkins to automatically scan all appcenter configuration files of all apps.
Comment 1 Florian Best univentionstaff 2020-06-25 10:19:54 CEST
I am voting for this (but i don't have free votes :-D) because I would like to have ucslint integrated into vim.
Comment 2 Philipp Hahn univentionstaff 2020-06-25 10:22:19 CEST
This also would allow to use ucs-lint from pre-commit as currently discussed for U@S.
Comment 3 Philipp Hahn univentionstaff 2020-08-06 10:41:42 CEST
The reverse is now possible and you can run ucslint on multiple packages:

[4.4-5] d9c6841a93 Bug #49240 ucslint: Allow ucslint on multiple packages
[4.4-5] de8635cf9f Bug #49240 ucslint: Improve sorting

This allows generating a statistic for full UCS:

$ find -maxdepth 3 -name doc -prune -o -name debian -printf '%h\0' |
  xargs -0 ./packaging/ucslint/ucslint -x 20 -i 0007-5,0007-6 |
  ./packaging/ucslint/ucslint-sort-output.py -g -s |
  tee ucslint.txt
$ join -a1 -j1 -t'        ' \
  <(sed -rne 's/^([UWEIS]:[0-9]+-[BEFNW]?[0-9]+)\s+([0-9]+)$/\1\t\2/p' \
    ucslint.txt | LC_ALL=C sort) \
  <(sed -rne "/def getMsgIds/,/^\s*\}/s/\s*[\"']([0-9]+-[0-9A-Z]+)[\"']: \(uub.RESULT_(\S)\S+, [\"'](.*)[\"']\).*/\2:\1\t\3/p" \
    packaging/ucslint/univention/ucslint/00??-*.py | LC_ALL=C sort) |
  sort -k2nr
S:0009-13       356     variable names should not use internal Python keywords
W:0008-4        261     po-file contains empty msg string
W:0009-10       138     invalid Python string literal escape sequence
W:0013-4        126     unquoted local variable
W:0009-1        113     failed to open file
I:0018-5        95      Maintainer script contains old upgrade code
I:0004-56       86      No UCR variables used
W:0008-7        86      found well-known LDAP object but no custom_*name()
S:0017-9        72      Useless use of `grep`; use /PATTERN/s instead
W:0018-4        56      Use debian/*.pyinstall to install Python modules
S:0017-6        44      Use `ldapsearch -LLLo ldif-wrap=no`
S:0017-8        37      Useless use of `cat`; redirect STDIN instead
S:0004-24       34      debian/*.univention-config-registry exists but no corresponding debian/*.univention-config-registry-variables file
S:0017-5        31      Use `sed -n "s/^prefix: //p"`
S:0014-11       28      depends on "Priority:required/important" package
W:0004-18       20      UCR header is maybe missing in UCR multifile (please check all subfiles)
W:0016-2        17      Deprecated use of "univention-admin"
W:0006-5        14      script contains "set -e"
W:0004-16       13      UCR template file contains no UCR header (please use "@%@UCSWARNING=# @%@")
W:0014-10       13      depends on "Essential:yes" package
W:0004-10       12      UCR .info-file contains entry of "Type: subfile" without corresponding entry of "Type: multifile"
S:0017-7        10      Use `array+=(val)`
S:0009-11       8       Use uldap.searchDN() instead of uldap.search(attr=["dn"])
W:0001-7        8       join script seems not to be called in any postinst file
W:0001-6        7       join script seems not to be installed via debian/rules
W:0009-5        7       dict.has_key is deprecated in python3 - please use "if key in dict:"
W:0014-8        6       unexpected UCR file
S:0017-10       5       Useless use of `echo $(...)` for single argument
W:0018-3        5       Invalid action in Debian maintainer script
W:0001-21       4       unjoin script does not call "joinscript_init"
S:0009-7        3       fragile comparison with None
W:0001-8        3       join scripts should be called with "|| true" do avoid failing postinst scripts if "set -e" is used
W:0004-14       3       UCR template file is found in directory conffiles/ but is not registered in any debian/*.univention-config-registry file 
W:0017-3        3       LDAP simple bind is an internal detail of "univention-ldapsearch"
S:0009-8        2       use ucr.is_true() or .is_false()
W:0004-15       2       UCR template file is registered in UCR .info-file but cannot be found in conffiles/
W:0011-3        2       wrong section - should be "Univention"
W:0016-3        2       Use of deprecated "univention-baseconfig"
W:0001-17       1       unjoin script seems not to be called in any postrm file
W:0001-18       1       unjoin script seems not to be copied in any prerm file
W:0004-1        1       The given path in UCR header seems to be incorrect
W:0004-42       1       UCR .info-file contains entry with unexpected key
W:0006-1        1       postinst script does not contain string "#DEBHELPER#"
W:0010-1        1       failed to open file
W:0011-14       1       no matching package in debian/control
W:0011-4        1       wrong priority - should be "optional"
W:0013-1        1       failed to open file
W:0014-6        1       init-autostart.lib is sourced by a script, but the package lacks an explicit dependency on univention-base-files.


Running it on a single file is often not possible because ucslint checks for inter-file issues, like
- debian/changelog not matching debian/control
- UCR variables used in conffiles/ not being declared in debian/*.ucr-variables