How do I build an RPM that depends on other local RPM's?

Hello,

I am trying to make a Copr repo for magic-wormhole. This has required making other packages for required dependencies, which I have succeeded in creating. The issue I am running into locally testing my magic wormhole spec file since it depends on packages in the Copr repo.

I see that there is a problem linking to the iterable-io, but I would rather not constantly upload new version of the SRPM to test iterations.

I have been using fedpkg --release 40 mockbuild to test the other packages that magic-wormhole would rely on, but I cannot seem to find documentation on how to add my Copr repo to my mock build.

1 Like

For Rawhide builds, put this into ~/.config/mock/fedora-wormhole-x86_64.cfg (changing names to suit yourself, of course):

include('/etc/mock/fedora-rawhide-x86_64.cfg')

config_opts['root'] = 'fedora-wormhole-x86_64'

config_opts[f'{config_opts.package_manager}.conf'] += """

[wormhole]
name=Copr repo for Magic Wormhole owned by aquacash5
baseurl=https://copr-be.cloud.fedoraproject.org/results/aquacash5/python-magic-wormhole/fedora-rawhide-$basearch/
type=rpm-md
skip_if_unavailable=False
gpgcheck=1
gpgkey=https://copr-be.cloud.fedoraproject.org/results/aquacash5/python-magic-wormhole/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
cost=10
"""

Then you should be able to do builds with mock -r fedora-wormhole-x86_64 --rebuild {name of srpm}.

2 Likes

Added copr, rpm

I use mock --enablerepo option for local mock builds.
In my case I point to ons of my copr repos.
But you should also point to a local repo use a file: pattern.

Here is python code fragment that my build tool uses.

      run( ('mock',
            '--root=%s' % (self.MOCK_TARGET_FILENAME,),
            '--enablerepo=copr:copr.fedorainfracloud.org:barryascott:%s' % (self.copr_repo,),
            '--rebuild',
                 self.SRPM_FILENAME) )

1 Like

Thank you @jjames and @barryascott, these responses were very helpful.

In the end, I ended up finding mock --chain. I created a justfile to package source rpm’s and build them all in order.

default:
    @just --list


prep PROJECT:
    mkdir -p .rpm
    cd python-{{PROJECT}} && \
    spectool -g python-{{PROJECT}}.spec && \
    rpmbuild -bs python-{{PROJECT}}.spec \
        --define "_sourcedir {{justfile_directory()}}/python-{{PROJECT}}" \
        --define "_srcrpmdir {{justfile_directory()}}/.rpm"


prep-all: (prep "iterable-io") (prep "spake2") (prep "txtorcon") (prep "zipstream-ng") (prep "magic-wormhole")


build:
    mkdir -p {{justfile_directory()}}/.results
    mock --localrepo {{justfile_directory()}}/.results --chain \
        .rpm/python-iterable-io*.src.rpm \
        .rpm/python-spake2*.src.rpm \
        .rpm/python-txtorcon*.src.rpm \
        .rpm/python-zipstream-ng*.src.rpm \
        .rpm/python-magic-wormhole*.src.rpm


clean:
    rm -rf .results/
    rm -rf .rpm/
    rm -rf **/*.tar.*

I actually could not get this to work. It kept telling me that it could not find the repository.

Edit: Word choice

What is the command that you run?