Rpm spec macros and variables

A nice place to read about the macros in rpm specs is https://fedoraproject.org/wiki/Packaging:RPMMacros. You can also run a command similar to rpm -E ‘%{dist}’ to see a variable’s definition.

To use your own variable in a spec, you can use a %define.

%define myvar 3.1415926

To get even fancier, you can do shell commands in a definition.

%define version_num "%( echo %version | tr -d '\.' )"

This takes %{version} which could be 4.51 and sets a variable to “451” for which I had a use.

Advertisements

Logical or in package dependencies

Logical OR in rpm dependencies

Requires: (wine >= 1.3 or /usr/bin/wine)

Logical OR in dpkg dependencies

Depends: wine (>= 1.3) | wine-staging | winehq-staging | winehq

References

Weblinks

  1. https://www.debian.org/doc/debian-policy/#document-ch-relationships
  2. rpm since 4.13.0http://rpm.org/user_doc/more_dependencies.html
  3. http://rpm.org/user_doc/boolean_dependencies.html

VeraCrypt rpm for Fedora

In these post-TrueCrypt days, I migrated to VeraCrypt. For a very long time now, I have been maintaining an encrypted file container on a flash drive on my keychain. Additionally, I keep various binaries to help open it, like on Windows or GNU/Linux, should I ever need emergency access to my files when not on one of my regular machines. I’m not NSA-proof, but I do intend to keep my private files out of the view of the general public or any random person who might find a lost flash drive.

So about VeraCrypt, A user can download the latest binary packages, even for GNU/Linux, from the offical downloads page. And the source code is on gitlab at https://gitlab.com/veracrypt/VeraCrypt.

But nobody I could find on the Internet has a Fedora rpm package for it. Well, I present to you now my Veracrypt rpm project. It took me a while to figure out the different releases of VeraCrypt don’t compile on Fedora 27 for various bug-related reasons. But the freshest commit version does, so this rpm is generated from the beta upstream point in time where I saved a copy of the repo.

The normal way to compile any of my rpms is to use the usr/share/${package}/build/pack script. It will download sources, prepare the file list in the spec, and perform the rpmbuild.

Dnf ignore weak dependencies

tl;dr

dnf --setopt=install_weak_deps=False --best install newpackage

dnf do not install weak dependencies

In the new paradigm for rpm package management (rpmpm?), we use dnf. I am fine with using the latest and greatest, but sometimes yum looks nicer in hindsight than dnf.

One of the more recent features added to rpms is weak dependencies. Debian has had weak dependencies for a longer time, so it’s nice to see rpm adding such a feature.

I recently went through a spell where I wanted to install my own package but exclude the recommended options.

After a lot of research and man dnf dnf.conf, I derived the command I needed.

dnf --setopt=install_weak_deps=False --best install newpackage

History

I tried an ugly hack, which technically worked.

dnf --disablerepo=* install ./bgscripts*

But all it does is disable all repos. I was using a local file, so it could get to the rpm I required, but any hard dependencies would be not found. I then tried another option, which technically worked.

dnf install ./bgscripts* -x freerdp

But I had to run a dnf command to see what packages would be installed, and then manually named the packages in the exclude list.

References

Weblinks

  1. https://fedoraproject.org/wiki/PackagingDrafts/WeakDependencies
  2. https://www.debian.org/doc/debian-policy/ch-relationships.html

Man pages

dnf

dnf.conf