Create dummy RPM package & avoid installing garbage dependencies
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2018
    Location
    bash shell
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb Create dummy RPM package & avoid installing garbage dependencies

    I would like to have a lightweight and clean Fedora, without some of the additional garbage packages that are forcefully installed as dependencies. The best way to do this, that is future proof and allows all future RPM updates to work without a problem, is to install dummy (fake) RPM packages in place of the real ones. Essentially, these dummy packages are empty and do absolutely nothing, other than to fulfill all dependency requirements by dnf.

    Below are the steps I used to create these dummy packages with a Fedora live image:

    # boot the live CD (cinnamon spin, because gnome3 is garbage), login and open a terminal

    # create rpmbuild macros
    echo '%_topdir /home/liveuser/rpmbuild' > ~/.rpmmacros

    # create rpmbuild structure
    mkdir ~/rpmbuild
    cd ~/rpmbuild
    mkdir BUILD BUILDROOT RPMS SOURCES SPECS SRPMS

    # install rpmbuild and deps
    dnf -y install rpm-build rpmdevtools

    # download SRPM
    cd ~/rpmbuild/SRPMS
    dnf --enablerepo=*-source download geoclue2 --source

    # install SRPM
    cd ~/rpmbuild/SRPMS
    rpm -i *.rpm

    # delete SRPM + SOURCES
    rm -rf ~/rpmbuild/SRPMS/*.rpm
    rm -rf ~/rpmbuild/SOURCES/*

    # modify SPEC

    at this point we are left with the original SPEC file: ~/rpmbuild/SPECS/geoclue2.spec, the idea is to download any package and modify the original SPEC file, but as an alternative you may create empty SPEC files and use those directly. I prefer to look at the original SPEC file in case there is something I can re-use.

    below is what I use for geoclue2:

    Code:
    Name:           geoclue2
    Version:        9.9.9
    Epoch:          9
    Release:        2%{?dist}
    Summary:        Geolocation service
    
    License:        GPLv2+
    URL:            http://www.freedesktop.org/wiki/Software/GeoClue/
    Source0:        https://gitlab.freedesktop.org/geoclue/geoclue/-/archive/%{version}/geoclue-%{version}.tar.bz2
    
    Obsoletes:      geoclue2 < 9.9.9
    Obsoletes:      geoclue2-server < 2.1.8
    Obsoletes:      geoclue < 0.12.99-10
    Obsoletes:      geoclue-devel < 0.12.99-10
    Obsoletes:      geoclue-gsmloc < 0.12.99-10
    Obsoletes:      geoclue-gui < 0.12.99-10
    Obsoletes:      geoclue-gypsy < 0.12.99-10
    
    %description
    Dummy rpm
    
    %files
    
    %changelog
    * Thu Jan 31 2019 Dummy God <dummy@god.org> - 9.9.9
    - Rebuilt dummy rpm

    # build RPM based on SPEC file
    cd ~/rpmbuild/
    rpmbuild -bb --nodebuginfo ./SPECS/geoclue2.spec


    You should now have your own custom made dummy RPM file under ~/rpmbuild/RPMS/x86_64/ which you can install as root with:

    rpm --nogpgcheck -i geoclue2-9.9.9-2.fc30.x86_64.rpm

    The trick here, is to use a high "Epoch", which will always override any real package and at the same time dnf will be happy about any dependencies. It is also possible to create a simple script that generates SPEC files based on a package name, so you can just do "./generate-dummy.sh geoclue2", or even do this via an ansible playbook.
    Last edited by fedup4ever; 3rd August 2019 at 09:56 AM.

  2. #2
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    7,662
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Create dummy RPM package & avoid installing garbage dependencies

    You don't need to do this by hand:

    Code:
    # create rpmbuild structure
    mkdir ~/rpmbuild
    cd ~/rpmbuild
    mkdir BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
    You installed rpmdev-tools, so go ahead and run "rpmdev-setuptree", that's its job. It makes your ~/rpmbuild and puts all six of those dirs in there.

    Also, I've never actually done this but I think there might be a MUCH simpler way to do this. You're making a fake "one to one" dependency resolution by making a fake rpm of the same name of every real package that you want to satisfy the dependency for. So suppose you have 30 of these, that means you'd make 30 dummy rpms of these same names with no files.

    I think this URL suggests this could be done with just one rpm AND even better you'd not be faking the same names as the real rpms which I think is confusing

    REF: http://ftp.rpm.org/max-rpm/s1-rpm-de...endencies.html

    They mention something in there called a "virtual package"

    For the example below I'm just assuming you want to dummy away dependencies "dep1" to "dep6"
    (this is just six). Just replace that with whatever your deps are.
    It seems to me you could just make one rpm, lets call it "dummy-deps" and make its spec:

    Code:
    Name:           dummy-deps
    Version:        9.9.9
    Epoch:          9
    Release:        2%{?dist}
    Summary:        A bunch of dummy deps for dep1,dep2,dep3,dep4,dep5,dep6
    
    Obsoletes:      (put in obsoletes as you like for dep1)
    Obsoletes:       (one for dep2,.....)
    Obsoletes:        .....etc .....
    Provides:       dep1, dep2, dep3, dep4, dep5, dep6
    
    %description
    Dummy rpm for deps: dep1, dep2, dep3, dep4, dep5, dep6
    
    %files
    
    %changelog
    * Thu Jan 31 2019 Dummy God <dummy@god.org> - 9.9.9
    - Rebuilt dummy rpm for dep1, dep2, dep3, dep4, dep5, dep6
    The magic here is that "Provides:" string, most rpms just have a Provides: length one, namely themselves. Or more accurately the spec didn't have a Provides: but the package itself becomes the Provides by default (ie package "foo" Provides "foo")
    The dummy-deps rpm is telling rpm "I'm dummy-deps and I provide what you need for geoclue2, foobar-libs, whatever-prog, texlive-whatever,....." and so on for all 30 of your dummies.

    So you'd just have one rpm to install and it would have a sensible name and you could see what it's meant for with "rpm -qi dummy-deps"
    Last edited by marko; 11th August 2019 at 11:16 PM.

Similar Threads

  1. Replies: 1
    Last Post: 8th September 2016, 09:42 PM
  2. [SOLVED]
    rpm package - installing error: Failed dependencies:
    By TheBigRed in forum Programming & Packaging
    Replies: 4
    Last Post: 24th December 2015, 10:49 PM
  3. how to avoid broken dependencies with Rpmfusion free/non ?
    By kiwitoad in forum F16 Development
    Replies: 1
    Last Post: 6th November 2011, 02:37 AM
  4. [SOLVED]
    Is there any way to avoid this while installing software via yum?
    By blackplague1347 in forum Using Fedora
    Replies: 2
    Last Post: 28th May 2011, 05:36 PM
  5. how to avoid grub not installing right ?
    By neighborlee in forum Using Fedora
    Replies: 1
    Last Post: 19th July 2006, 06:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •