Skip to content

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

Closed

Description

@bhyde
mannequin
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']

    Activity

    1. bhyde commented on Dec 11, 2017

      bhydemannequin
      MannequinAuthor

      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.

    2. added
      stdlib
      type-feature
      on Dec 11, 2017
    3. bhyde commented on Nov 7, 2018

      bhydemannequin
      MannequinAuthor

      ping

    4. ned-deily commented on Nov 9, 2018

      @ned-deily
      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.

    5. 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[/+] on Nov 9, 2018
    6. ned-deily commented on Nov 18, 2018

      @ned-deily
      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.

    7. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.8 (EOL)easystdlibtype-feature

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions