How To Install rpkg-macros on CentOS 8

rpkg-macros is Set of preproc macros for rpkg utility

Introduction

In this tutorial we learn how to install rpkg-macros on CentOS 8.

What is rpkg-macros

Set of preproc macros to be used by rpkg utility. They are designed to dynamically generate certain parts of rpm spec files. You can use those macros also without rpkg by $ cat <file_with_the_macros> | preproc -s /usr/lib/rpkg.macros.d/all.bash -e INPUT_PATH=<file_with_the_macros> INPUT_PATH env variable is passed to preproc to inform macros about the input file location. The variable is used to derive INPUT_DIR_PATH variable which rpkg macros use. If neither INPUT_PATH nor INPUT_DIR_PATH are specified, INPUT_PATH will stay empty and INPUT_DIR_PATH will default to ‘.’ (the current working directory). Another option to experiment with the macros is to source /usr/lib/rpkg.macros.d/all.bash into your bash environment Then you can directly invoke the macros on your command-line as bash functions. See content in /usr/lib/rpkg.macros.d to discover available macros. Please, see man rpkg-macros for more information.

We can use yum or dnf to install rpkg-macros on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install rpkg-macros.

Install rpkg-macros on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install rpkg-macros using dnf by running the following command:

sudo dnf -y install rpkg-macros

Install rpkg-macros on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install rpkg-macros using yum by running the following command:

sudo yum -y install rpkg-macros

How To Uninstall rpkg-macros on CentOS 8

To uninstall only the rpkg-macros package we can use the following command:

sudo dnf remove rpkg-macros

rpkg-macros Package Contents on CentOS 8

/usr/bin/pack_sources
/usr/lib/rpkg.macros.d
/usr/lib/rpkg.macros.d/all.bash
/usr/lib/rpkg.macros.d/git.bash
/usr/lib/rpkg.macros.d/helpers
/usr/lib/rpkg.macros.d/helpers/git
/usr/lib/rpkg.macros.d/helpers/git_branch
/usr/lib/rpkg.macros.d/helpers/git_head
/usr/lib/rpkg.macros.d/helpers/git_head_short
/usr/lib/rpkg.macros.d/helpers/git_merged_tag_refs
/usr/lib/rpkg.macros.d/helpers/git_remote
/usr/lib/rpkg.macros.d/helpers/git_remote_url
/usr/lib/rpkg.macros.d/helpers/git_root
/usr/lib/rpkg.macros.d/helpers/git_status
/usr/lib/rpkg.macros.d/helpers/git_submodule_refs
/usr/lib/rpkg.macros.d/library
/usr/lib/rpkg.macros.d/library/log.bash
/usr/lib/rpkg.macros.d/library/output.bash
/usr/lib/rpkg.macros.d/library/query.bash
/usr/lib/rpkg.macros.d/library/utils.bash
/usr/share/licenses/rpkg-macros
/usr/share/licenses/rpkg-macros/LICENSE
/usr/share/man/man1/rpkg-macros.1.gz

References

Summary

In this tutorial we learn how to install rpkg-macros on CentOS 8 using yum and dnf.