Bug 1283017 - [rfe] support braces in variable substitution
[rfe] support braces in variable substitution
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: packaging-team-maint
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-17 22:48 EST by Dave Johansen
Modified: 2016-01-04 14:52 EST (History)
5 users (show)

See Also:
Fixed In Version: dnf-1.1.5-1.fc23 dnf-1.1.5-1.fc22
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-22 16:59:38 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dave Johansen 2015-11-17 22:48:13 EST
Description of problem:
dnf does not allow braces in variable substitution and makes it impossible to use with certain URLs in COPR ( see https://lists.fedoraproject.org/pipermail/devel/2015-October/215924.html ).

Version-Release number of selected component (if applicable):
Version used by COPR (not sure what it is).

How reproducible:
Always

Steps to Reproduce:
1. Use a variable with braces in a URL on COPR
2. Notice that variable is not expanded

Actual results:
Variable is not expanded with braces

Expected results:
Variable should be expanded with braces

Additional info:
Here's a Python script with several attempts at updating the regular expression ( see https://github.com/rpm-software-management/dnf/blob/bcbf36cbf140eb8a2a1e496e294b0c5102294446/dnf/conf/parser.py ) to support braces. My regex skills are pretty weak, so none of them are a the fully solution that I would hope for.

import re

_KEYCRE = re.compile(r"\${?(\w+)}?")
#_KEYCRE = re.compile(r"\$(\w+)|\${(\w+)}")
#_KEYCRE = re.compile(r'\$([{}]?)releasever\1')

def do_test(r, s):
    print s
    m = r.search(s)
    if m:
        print "Found", m.group(1), m.group()
    else:
        print "Negative"

do_test(_KEYCRE, 'this is a test of $releasever with spaces no braces')
do_test(_KEYCRE, 'this is a test of ${releasever} {with} spaces and braces')
do_test(_KEYCRE, 'this is a test of ${releasever}without spaces and braces')
do_test(_KEYCRE, 'this is a test of ${releasever with only left brace')
do_test(_KEYCRE, 'this is a test of $releasever} with only right brace')
Comment 1 Honza Silhan 2015-11-18 09:26:30 EST
we can support that. (If you wanna speed things up you can send a pull request [1] with tests inside dnf/tests)

[1] https://github.com/rpm-software-management/dnf
Comment 2 Dave Johansen 2015-11-18 22:12:51 EST
I created a pull request with the change and some added tests:
https://github.com/rpm-software-management/dnf/pull/387
Comment 3 Fedora Update System 2015-12-18 12:47:04 EST
dnf-plugins-core-0.1.15-1.fc23 dnf-1.1.5-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-c72cd24fa0
Comment 4 Fedora Update System 2015-12-18 12:48:46 EST
dnf-plugins-core-0.1.15-1.fc22 dnf-1.1.5-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-1bb112ccc6
Comment 5 Fedora Update System 2015-12-19 14:59:38 EST
dnf-1.1.5-1.fc23, dnf-plugins-core-0.1.15-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update dnf dnf-plugins-core'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-c72cd24fa0
Comment 6 Fedora Update System 2015-12-22 10:35:20 EST
dnf-1.1.5-1.fc22, dnf-plugins-core-0.1.15-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-1bb112ccc6
Comment 7 Fedora Update System 2015-12-22 16:58:53 EST
dnf-1.1.5-1.fc23, dnf-plugins-core-0.1.15-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
Comment 8 Fedora Update System 2016-01-04 14:52:11 EST
dnf-1.1.5-1.fc22, dnf-plugins-core-0.1.15-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.