Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bdist_rpm fails if no rpm command and rpmbuild is not in /usr/bin or /bin #76462

Closed
bhyde mannequin opened this issue Dec 11, 2017 · 4 comments
Closed

bdist_rpm fails if no rpm command and rpmbuild is not in /usr/bin or /bin #76462

bhyde mannequin opened this issue Dec 11, 2017 · 4 comments
Labels
3.8 only security fixes easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@bhyde
Copy link
Mannequin

bhyde mannequin commented Dec 11, 2017

BPO 32281
Nosy @ned-deily, @merwok, @dstufft, @bhyde
PRs
  • bpo-32281: Fix hardcoded bdist_rpm in Lib/distutils/command/bdist_rpm.py #10589
  • Superseder
  • bpo-11122: bdist_rpm should use rpmbuild, not rpm
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-11-18.19:25:44.140>
    created_at = <Date 2017-12-11.23:26:49.741>
    labels = ['easy', '3.8', 'type-feature', 'library']
    title = 'bdist_rpm fails if no rpm command and rpmbuild is not in /usr/bin or /bin'
    updated_at = <Date 2018-11-18.19:25:44.139>
    user = 'https://github.com/bhyde'

    bugs.python.org fields:

    activity = <Date 2018-11-18.19:25:44.139>
    actor = 'ned.deily'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-11-18.19:25:44.140>
    closer = 'ned.deily'
    components = ['Distutils']
    creation = <Date 2017-12-11.23:26:49.741>
    creator = 'bhyde'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32281
    keywords = ['patch', 'easy']
    message_count = 4.0
    messages = ['308080', '329434', '329551', '330060']
    nosy_count = 4.0
    nosy_names = ['ned.deily', 'eric.araujo', 'dstufft', 'bhyde']
    pr_nums = ['10589']
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '11122'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue32281'
    versions = ['Python 3.8']

    @bhyde
    Copy link
    Mannequin Author

    bhyde mannequin commented Dec 11, 2017

    With the fix below is becomes possible to build rpms on the Mac.

    The developer will need to install rpm tooling. That's easy via "brew install rpm".

    That, for example, installs /usr/local/bin/rpmbuild.

    Sadly bdist_rpm.py only supports rpmbuild in two places, see:

    if os.path.exists('/usr/bin/rpmbuild') or \

    Which due to the Mac's fastidious security setup we are very strongly discouraged from working around.

    So, yeah, let's add a third, like so maybe:

        if ((os.path.exists('/usr/bin/rpmbuild')
             or os.path.exists('/bin/rpmbuild')
             or os.path.exists('/usr/local/bin/rpmbuild'))):
            rpm_cmd = ['rpmbuild']
    

    And now I can use build_rpm on my mac, oh joy.

    @bhyde bhyde mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Dec 11, 2017
    @bhyde
    Copy link
    Mannequin Author

    bhyde mannequin commented Nov 7, 2018

    ping

    @ned-deily
    Copy link
    Member

    Rather than searching a few hard-coded paths, I would think this would be a good case for using distutils.spawn find_executable like test_bdist_rpm.py does :) If someone (@bhyde) were willing to create a PR with that change, this issue will have a much better chance of being resolved.

    @ned-deily ned-deily added easy 3.8 only security fixes labels Nov 9, 2018
    @ned-deily ned-deily changed the title bdist_rpm v.s. the Macintosh bdist_rpm fails if no rpm command and rpmbuild is not in /usr/bin or /bin Nov 9, 2018
    @ned-deily
    Copy link
    Member

    Thanks, @n0npax, for producing a PR implementing what I suggested. It looks good. However, while testing it, I ran across earlier open bpo-11122 in which the same issue of building rpms on macOS is brought up. (Sorry I didn't see this earlier!) The solution proposed there is to just unconditionally use rpmbuild as the use of rpm was for now obsolete versions. I don't really have any experience with rpmbuild or stake in making the change. But, rather than applying PR 10589, it looks like following through on bpo-11122 would be the better approach. Therefore, I'm going to close this issue (and PR) as a duplicate and suggest we move the discussion and perhaps generate a new PR there.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant