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 should use rpmbuild, not rpm #55331

Closed
purpleidea mannequin opened this issue Feb 4, 2011 · 25 comments
Closed

bdist_rpm should use rpmbuild, not rpm #55331

purpleidea mannequin opened this issue Feb 4, 2011 · 25 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life easy stdlib Python modules in the Lib dir

Comments

@purpleidea
Copy link
Mannequin

purpleidea mannequin commented Feb 4, 2011

BPO 11122
Nosy @ericvsmith, @tarekziade, @ned-deily, @merwok, @petere, @stratakis, @csabella, @bhyde, @miss-islington
PRs
  • bpo-11122: always use rpmbuild in bdist_rpm #10594
  • [3.8] bpo-11122: fix hardcoded path checking for rpmbuild in bdist_rpm.py (GH-10594) #13922
  • Files
  • fix-rpm-use-2.7.diff
  • 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 = 'https://github.com/merwok'
    closed_at = <Date 2019-06-08.21:06:22.873>
    created_at = <Date 2011-02-04.21:19:22.059>
    labels = ['easy', '3.8', '3.7', 'library']
    title = 'bdist_rpm should use rpmbuild, not rpm'
    updated_at = <Date 2019-06-08.21:25:24.644>
    user = 'https://bugs.python.org/purpleidea'

    bugs.python.org fields:

    activity = <Date 2019-06-08.21:25:24.644>
    actor = 'miss-islington'
    assignee = 'eric.araujo'
    closed = True
    closed_date = <Date 2019-06-08.21:06:22.873>
    closer = 'cheryl.sabella'
    components = ['Distutils']
    creation = <Date 2011-02-04.21:19:22.059>
    creator = 'purpleidea'
    dependencies = []
    files = ['34407']
    hgrepos = []
    issue_num = 11122
    keywords = ['patch', 'easy']
    message_count = 25.0
    messages = ['127942', '127943', '127944', '127945', '127948', '127958', '127959', '128005', '128052', '128053', '153098', '155120', '175042', '177241', '193105', '213484', '213588', '315180', '315188', '315197', '315198', '315200', '330061', '345063', '345067']
    nosy_count = 13.0
    nosy_names = ['eric.smith', 'tarek', 'ned.deily', 'eric.araujo', 'purpleidea', 'petere', 'westley.martinez', 'James.Bennet', 'cstratak', 'cheryl.sabella', 'bhyde', 'miss-islington', 'stanp']
    pr_nums = ['10594', '13922']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue11122'
    versions = ['Python 3.7', 'Python 3.8']

    @purpleidea
    Copy link
    Mannequin Author

    purpleidea mannequin commented Feb 4, 2011

    Hi distutils,

    When I run:

    ./setup.py bdist --formats=rpm

    on my source directory, I get the error:

    rpm -ba --define _topdir /home/james/code/scantran/build/bdist.linux-x86_64/rpm --clean build/bdist.linux-x86_64/rpm/SPECS/scantran.spec
    -ba: unknown option
    error: command 'rpm' failed with exit status 1

    It seems the problem can be fixed by installing the rpm-build package (on fedora 14 anyways) and so perhaps something should be done so that this is more obvious...

    HTH,
    James

    @purpleidea purpleidea mannequin assigned tarekziade Feb 4, 2011
    @purpleidea purpleidea mannequin added the stdlib Python modules in the Lib dir label Feb 4, 2011
    @merwok
    Copy link
    Member

    merwok commented Feb 4, 2011

    Does this mean that there is one rpm command that does not have all options, and that rpm-build overwrites that command with another one that does the right thing?

    @purpleidea
    Copy link
    Mannequin Author

    purpleidea mannequin commented Feb 4, 2011

    In the source for distutils it seems to attempt to use 'rpmbuild' if it exists, but otherwise falls back on regular 'rpm', however in my rpm:

    $ rpm --version
    RPM version 4.8.1

    this fails as there is no -ba option.

    James

    @merwok
    Copy link
    Member

    merwok commented Feb 4, 2011

    What is your OS name and version? Is that rpm version considered obsolete or not?

    @ericvsmith
    Copy link
    Member

    "rpm -ba" is very old. I think it's been at least since 2002 that "-ba" was supported by rpm.

    I believe bdist_rpm is calling "rpmbuild -ba", and if that doesn't exist, then "rpm -ba" is a transition strategy until all systems supported "rpmbuild". This transition period should be over. Unfortunately today it's far more likely that "rpm -ba" will not be what you want to call, but "rpm" will almost always be found, giving this error.

    Most systems (certain RedHat based) ship rpmbuild as a separate command. RedHat installs it via the rpm-build package.

    I'd suggest just switching bdist_rpm to always use rpmbuild. Then at least the error would be that rpmbuild isn't found.

    @merwok
    Copy link
    Member

    merwok commented Feb 5, 2011

    This is a gray area between bugfix and bahavior change forbidden by the feature freeze. Would it be okay for you to add a note in the docs and close this report?

    @merwok
    Copy link
    Member

    merwok commented Feb 5, 2011

    Would it be okay for you to add a note in the docs and close this report?

    I meant to ask whether you would agree with that outcome, not that you should do the work (you’re welcome to provide a patch if you want to, but that’s not required).

    @purpleidea
    Copy link
    Mannequin Author

    purpleidea mannequin commented Feb 5, 2011

    I'll write a docs and script patch for this next week...

    I'm happy to do the work,

    Thanks for the comments.

    James

    @merwok
    Copy link
    Member

    merwok commented Feb 6, 2011

    Thanks for volunteering. I will review and apply when the py3k branch is unfrozen.

    I'll write a docs and script patch for this next week...
    Note that I proposed to patch the docs only.

    @merwok merwok assigned merwok and unassigned tarekziade Feb 6, 2011
    @merwok
    Copy link
    Member

    merwok commented Feb 6, 2011

    BTW, it may be useful to point people to http://pypi.python.org/pypi/pypi2rpm, which contains an updated command, bdist_rpm2.

    @merwok
    Copy link
    Member

    merwok commented Feb 11, 2012

    Given that we’ve made changes to distutils for Debian multiarch or Mac OS X compiler breakage, I now think that switching distutils to only use rpmbuild would be reasonable.

    @merwok
    Copy link
    Member

    merwok commented Mar 7, 2012

    More info on rpm vs. rpmbuild: http://bugs.python.org/issue1533164#msg82592

    @merwok merwok added the easy label Mar 7, 2012
    @merwok merwok changed the title bdist_rpm fails bdist_rpm should use rpmbuild, not rpm Mar 7, 2012
    @petere
    Copy link
    Mannequin

    petere mannequin commented Nov 7, 2012

    I ran into a similar instance of this problem today and would like to add my support for just getting rid of the "rpm" calls and just call "rpmbuild" in all cases. The last release where "rpm" was used for building was more than 10 years ago.

    @ericvsmith
    Copy link
    Member

    I agree on just switching to rpmbuild, at least for 3.4.

    @JamesBennet
    Copy link
    Mannequin

    JamesBennet mannequin commented Jul 15, 2013

    I have observed this bug under CentOS 5.9 using the version of python-setuptools from the official CentOS repository. -ba is not a valid option for that version of RPM. I am able to get further by installing the rpm-build package.

    @merwok
    Copy link
    Member

    merwok commented Mar 13, 2014

    Can someone test the attached patch for 2.7? I don’t know if the second use (rpm -q --qf etc) should be converted too.

    @petere
    Copy link
    Mannequin

    petere mannequin commented Mar 14, 2014

    No, the second use should not be converted.

    @stanp
    Copy link
    Mannequin

    stanp mannequin commented Apr 10, 2018

    can this patch be sped up?
    i am running into this issue with the latest python version
    the patch was submitted 7 years ago

    i don't see any workaround.

    @stanp stanp mannequin added 3.7 (EOL) end of life 3.8 (EOL) end of life labels Apr 10, 2018
    @stratakis
    Copy link
    Mannequin

    stratakis mannequin commented Apr 11, 2018

    I could make a PR out of the patch but I wonder if anyone is actually using this functionality. Wearing my Fedora's python maintainer hat, we have a lot of tooling around rpm that handles those things, so I don't think there is a valid usecase for Fedora at least. Is it useful somehow for other rpm based distros or is the resulting rpm's functional enough for some testing at least?

    @stanp
    Copy link
    Mannequin

    stanp mannequin commented Apr 11, 2018

    i am using this on redhat enterprise and mac. both running python 3.5
    both running latest rpm. if you can make a pr it would great.

    @stratakis
    Copy link
    Mannequin

    stratakis mannequin commented Apr 11, 2018

    The bug exists indeed but I would like to know what is the actual use case here.

    @stanp
    Copy link
    Mannequin

    stanp mannequin commented Apr 11, 2018

    the use case is being able to publish python package as rpm using setup.py on mac.

    @ned-deily
    Copy link
    Member

    Note that bpo-32281 also describes the problem of trying to use build_rpm on non-rpm systems, again specifically macOS. Before stumbling on this issue,I had suggested over there to use change bdist_rpm to not use hardwired paths for rpmbuild but, if the better solution is to just unconditionally use rpmbuild, let's do that instead.

    @csabella
    Copy link
    Contributor

    csabella commented Jun 8, 2019

    New changeset 45a1494 by Cheryl Sabella (Marcin Niemira) in branch 'master':
    bpo-11122: fix hardcoded path checking for rpmbuild in bdist_rpm.py (GH-10594)
    45a1494

    @csabella csabella closed this as completed Jun 8, 2019
    @miss-islington
    Copy link
    Contributor

    New changeset 3f7629d by Miss Islington (bot) in branch '3.8':
    bpo-11122: fix hardcoded path checking for rpmbuild in bdist_rpm.py (GH-10594)
    3f7629d

    @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.7 (EOL) end of life 3.8 (EOL) end of life easy stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants