Bug#983160: dput-ng: --override doesn't override profile parameters

2021-09-14 Thread Paride Legovini

On Sat, 20 Feb 2021  wrote:

Package: dput-ng
Version: 1.32

It seems the `--override` option in dput-ng doesn't really override
parameters in profiles.


Hi, this is just to confirm this issue. I had a look at the dput-ng 
commit history and I'm failing to see how this was supposed to work even 
when --override was first implemented [1].


[1] 
https://salsa.debian.org/debian/dput-ng/-/commit/a283c444ec73780962c3a1e783d5b957999b1f96




Bug#983160: dput-ng: --override doesn't override profile parameters

2021-02-19 Thread Louis-Philippe Véronneau
Package: dput-ng
Version: 1.32

Dear maintainers,

It seems the `--override` option in dput-ng doesn't really override
parameters in profiles.

I've added the `check-debs` hook to my test profile and added the
following default values:

"check-debs": {
"enforce": "source",
"skip": false
},

To debug this issue, I also made `dput/uploader.py` print the values of
`args.override` and `profile` right before `run_pre_hooks(changes,
profile)` is ran:

foo@bar:/usr/lib/python3/dist-packages/dput# diff -C 3 uploader.py
new_uploader.py
*** uploader.py 2021-02-20 02:09:11.222489435 -0500
--- new_uploader.py 2021-02-20 02:09:05.314403878 -0500
***
*** 310,315 
--- 310,317 

  if changes.get_changes_file().endswith(".changes"):
  if 'hooks' in profile:
+ print("Printing overrides:\n", args.override) ## NEW
+ print("Printing profile:\n", profile)  ## NEW
  run_pre_hooks(changes, profile)
  else:
  logger.trace(profile)

Here's the result:

foo@bar:$ dput --override "check-debs.enforce=debs" --override
"check-debs.skip=true" test foo_1.0.0-1_amd64.changes

Uploading foo using ftp to test (host: test.org; directory:
/pub/UploadQueue/)
Printing overrides:
 {'check-debs': {'enforce': [['debs']], 'skip': [['true']]}}
Printing profile:
 {'name': 'test', 'allow_dcut': True, 'allow_unsigned_uploads': False,
'allowed_distributions': '(?!UNRELEASED)', 'default_host_main': 'test',
'full_upload_log': False, 'hash': 'md5', 'interface': 'cli', 'login':
'anonymous', 'meta': 'debian', 'method': 'ftp', 'passive_ftp': True,
'post_upload_command': '', 'pre_upload_command': '', 'run_lintian':
False, 'scp_compress': False, 'allowed-distribution':
{'codename-groups': ['general', 'backport', 'rm-managed']}, 'codenames':
'debian', 'hooks': ['allowed-distribution', 'protected-distribution',
'check-debs', 'checksum', 'suite-mismatch', 'gpg'], 'run_dinstall':
False, 'check_version': False, 'fqdn': 'test.org', 'incoming':
'/pub/UploadQueue/', 'check-debs': {'enforce': 'source', 'skip': False},
'valid_commands': ['break-the-archive', 'cancel', 'dm', 'reschedule',
'rm', 'upload']}
running allowed-distribution: check whether a local profile permits
uploads to the target distribution
running protected-distribution: warn before uploading to distributions
where a special policy applies
running check-debs: makes sure the upload contains a binary package
There are .debs in this upload, and enforcing they don't exist.

As you can see, the proper overrides are passed to `args.override`, but
they don't seem to be merged with the `profile` variable, which is the
one passed to the `run_pre_hooks(changes, profile)` command.

This makes it impossible to actually override any profile variables :(

I've put this in on my TODO list, but I'm not sure I'll have time to
send a patch anytime soon.

If someone else wants to have a go at this bug, please be my guest :)

-- 
  ⢀⣴⠾⠻⢶⣦⠀
  ⣾⠁⢠⠒⠀⣿⡁  Louis-Philippe Véronneau
  ⢿⡄⠘⠷⠚⠋   po...@debian.org / veronneau.org
  ⠈⠳⣄