rpkg(1)
π rpkg(1) π
okay so bestie, welcome to the rpm-packager manual β this is THE page for rpkg, and honestly? it's a lot. buckle up, we're doing this together π«Ά
β¨ NAME β¨
rpkg β RPM packaging utility π
πΈ SYNOPSIS πΈ
rpkg [ global_options ] command [ command_options ] [ command_arguments ]
rpkg help
rpkg command --help
π DESCRIPTION π
So like, rpkg is a script that manages spec enriched Git repositories β meaning any repo that has an rpm spec file in it. That's the whole vibe. π«
It's built to work with expanded application sources and with standard DistGit tarballs and patches. Both. It's versatile like that, periodt.
β οΈ ok listen, this part matters: you should trust the.specfiles you work with. Because a bunch of operations (likerpkg srpmorrpkg lint) involve parsing the spec file, and parsing the spec file brings along evaluation of any shell or lua scriplets present in it. no cap, fr fr. only point it at specs you actually trust. π
π Global Options π
(this section is empty on the page β nothing here yet, bestie, we move)
π₯ COMMAND OVERVIEW π₯
here's the whole menu, like a little β¨command tasting flightβ¨:
rpkg add [-h] [--all] [paths ...]β Add changes to indexrpkg build [-h] [--outdir OUTDIR] [--spec SPEC] [--config CONFIG] [--wait] [project]β Alias for copr-buildrpkg ci [-h] [--message MESSAGE | --file FILE] [--all] [--amend] [--with-changelog] [--tag] [--push] [--signoff] [file ...]β Alias for commitrpkg clean [-h] [--dry-run] [-x] [--force] [-d]β Remove untracked filesrpkg clog [-h] [--raw]β Output top changelog entry to stdoutrpkg clone [-h] [--branches] [--branch BRANCH] [--anonymous] repo_path [directory]β Clone and checkout a repositoryrpkg commit [-h] [--message MESSAGE | --file FILE] [--all] [--amend] [--with-changelog] [--tag] [--push] [--signoff] [file ...]β Commit changesrpkg compile [-h] [--target TARGET] [--with OPTION] [--without OPTION] [--outdir OUTDIR] [--spec SPEC] [--short-circuit SHORT_CIRCUIT] [--nocheck]β Local test rpmbuild compilerpkg config [-h]β Do nothing, only output used configrpkg copr-build [-h] [--outdir OUTDIR] [--spec SPEC] [--config CONFIG] [--wait] [project]β Build package in Copr build systemrpkg diff [-h] [--cached] [file ...]β Show changes between the last commit and working tree, etc.rpkg gimmespec [-h]β Print auto-located input spec file namerpkg import [-h] [--repo-path REPO_PATH] [--skip-diffs] [--offline] srpmβ Import srpm contentrpkg install [-h] [--target TARGET] [--with OPTION] [--without OPTION] [--outdir OUTDIR] [--spec SPEC] [--short-circuit SHORT_CIRCUIT] [--nocheck]β Local test rpmbuild installrpkg lint [-h] [--info] [--rpmlint-config RPMLINT_CONFIG] [target_path]β Run rpmlint against rendered spec and build products if present. Needs rpmlint to be installed.rpkg local [-h] [--target TARGET] [--with OPTION] [--without OPTION] [--outdir OUTDIR] [--spec SPEC] [--nocheck]β Local test rpmbuild binaryrpkg log [-h] [--graph] [--all] [--show-signature] [revision ...] [path ...]β Display git log historyrpkg merge [-h] [--no-commit] [--squash] [--message MESSAGE] [--file FILE] [--signoff] [--abort] [--continue] [commit ...]β Incorporates changes from the named commits into the current branchrpkg new [-h] [--outdir OUTDIR] [--spec SPEC]β Diff against last package tagrpkg nvr [-h] [--outdir OUTDIR] [--spec SPEC]β Print package name-version-releaserpkg prep [-h] [--target TARGET] [--with OPTION] [--without OPTION] [--outdir OUTDIR] [--spec SPEC]β Prep test rpmbuild binaryrpkg pull [-h] [--rebase] [--no-rebase]β Pull changes from the remote repository and update the working copyrpkg push [-h] [--follow-tags] [--force]β Push changes and annotated tags to remote repositoryrpkg reset [-h] [--soft | --mixed | --hard] [commit|path]β Reset branch tip, index, or the working treerpkg sources [-h] [--repo-path REPO_PATH] [--outdir OUTDIR]β Download source files from lookaside cacherpkg spec [-h] [--outdir OUTDIR] [--spec SPEC] [--sources] [--print]β Generate spec file from a spec templaterpkg srpm [-h] [--target TARGET] [--with OPTION] [--without OPTION] [--outdir OUTDIR] [--spec SPEC]β Create a source rpmrpkg status [-h] [pathspec ...]β Display git status of the current working tree and indexrpkg switch [-h] [--create] [--detach] [--list-branches] [--fetch] [target]β Work with branchesrpkg tag [-h] [--list] [--delete] [--skip-edit] [--name NAME] [--version VERSION] [--release RELEASE] [tag]β Manage git tagsrpkg unused-patches [-h]β Print list of patches in CWD not referenced by name in the specfilerpkg upload [-h] [--repo-path REPO_PATH] [--offline] file [file ...]β Upload source filesrpkg verify-files [-h] [target_dir]β Locally verify %%files section
π COMMAND REFERENCE π
π rpkg add
usage: rpkg add [-h] [--all] [paths ...]
This command updates the index with changes found in the working tree. cute, simple, iconic. β¨
positional arguments
pathsβ Specific paths to add changes for.
options
-h,--helpβ show this help message and exit--all,-Aβ Update index with all changes found in the working tree.
π rpkg build
usage: rpkg build [-h] [--outdir OUTDIR] [--spec SPEC] [--config CONFIG]
[--wait]
[project]
Build package in Copr build system. To do this you need to have copr-cli installed and also have your Copr API key set up. For more info about the API key, see the API KEY section in the copr-cli(1) man page. π
π¨ NOTE, and this is a big one: this method of building the package does not supportwith,without, andrpmdefinesrpkg configuration options. These options are used to build an srpm, and that srpm is then sent to Copr β but the rpm build in Copr happens without these options already, which is important for the resulting build. If you want these options applied, you should instead setup auto-rebuilding in Copr that reacts to new pushes into your repository. iykyk π
positional arguments
projectβ Name of the project in formatOWNER/PROJECT. You can omit it if you have specified thecopr_projectconfiguration option.
options
-h,--helpβ show this help message and exit--outdir OUTDIRβ Where to put any generated rpm content. Directory must exist.--spec SPECβ An input spec template. If not given, the spec template is auto-located in<path>as a file ending either with.spec.rpkgor.specsuffix (in this order). The directory of the template then also becomes search location for the associated sources andrpkg.conffile. By default, these files are being looked up in<path>. Essentially, this argument changes the subpackage we work with and which is determined by the--pathargument initially (with CWD as the default value for it).--config CONFIGβ Path to an alternative Copr configuration file--wait,-wβ Wait for build to finish.
π rpkg ci
usage: rpkg ci [-h] [--message MESSAGE | --file FILE] [--all] [--amend]
[--with-changelog] [--tag] [--push] [--signoff]
[file ...]
Alias for commit. same energy, shorter name. π«
positional arguments
fileβ Optional list of specific files to commit
options
-h,--helpβ show this help message and exit--message,-m MESSAGEβ Use the given<msg>as the commit message summary--file,-F FILEβ Take the commit message from the given file--all,-aβ Tell the command to automatically stage files that have been modified or deleted.--amendβ Replace the tip of the current branch by creating a new commit.--with-changelogβ Get the last changelog from SPEC as commit message content. This option must be used with-mtogether.--tag,-tβ Create a tag for this commit--push,-pβ Commit and push as one action--signoff,-sβ Include a signed-off-by
π rpkg clean
usage: rpkg clean [-h] [--dry-run] [-x] [--force] [-d]
This command can be used to clean up your work tree from untracked files and, additionally if the -x option is passed, files described by .gitignore. π§Ήβ¨
options
-h,--helpβ show this help message and exit--dry-run,-nβ Don't actually remove anything, just show what would be done.-xβ Don't exclude files described by.gitignorerules from deletion.--force,-fβ This option is required to perform deletion of any files or directories if git configuration variableclean.requireForceis set totrue. It is passed by default if rpkg configuration variablegit.clean_forceis set totrue.-dβ Remove whole directories in addition to files. This option is passed by default if rpkg configuration variablegit.clean_dirsis set totrue.
π rpkg clog
usage: rpkg clog [-h] [--raw]
This will output the latest rpm changelog entry to stdout. The leading "- " text will be stripped. π
options
-h,--helpβ show this help message and exit--rawβ Generate a more "raw" clog without twiddling the contents
π rpkg clone
usage: rpkg clone [-h] [--branches] [--branch BRANCH] [--anonymous]
repo_path [directory]
This command will clone the named repository from the configured repository base URL. By default it will also checkout the master branch for your working copy. π±
positional arguments
repo_pathβ Name of the repository to clone or full clone url. If just a basename is specified, preconfigured git clone urls and default namespace is used to construct the final clone url.directoryβ Directory in which to clone the repository
options
-h,--helpβ show this help message and exit--branches,-Bβ Checkout a subdirectory for each branch--branch,-b BRANCHβ Check out a specific branch. This has no effect if--branches/-Bis specified.--anonymous,-aβ Check out a repository anonymously
πΈ rpkg commit πΈ
rpkg commit [-h] [--message MESSAGE | --file FILE] [--all] [--amend]
[--with-changelog] [--tag] [--push] [--signoff]
[file ...]
okay bestie this one literally just calls git commit for you π
every tracked file that's got changes gets committed β unless you hand it a specific file list, in which case only those get the treatment. $EDITOR pops open so you can write your changelog message, unless you already gave the command one. And yes you can tag and/or push in the same breath, no extra steps. Oh and if you've set the git.gpg_keyid rpkg configuration option, then the commit and the tag get created signed with that GPG key you configured. iconic behavior honestly.
positional arguments:
fileβ optional list of specific files to commit, if you're feeling picky
options:
-h,--helpβ shows this help message and dips--message,-mMESSAGE β use the given<msg>as the commit message summary--file,-FFILE β steal the commit message from the file you point at--all,-aβ tells the command to automatically stage files that have been modified or deleted--amendβ replaces the tip of the current branch by creating a new commit--with-changelogβ grabs the last changelog from the SPEC and uses it as the commit message content. β οΈ this one must be used together with-m--tag,-tβ create a tag for this commit--push,-pβ commit and push as one single action, multitasking queen--signoff,-sβ include a signed-off-by
β¨ rpkg compile β¨
rpkg compile [-h] [--target TARGET] [--with OPTION] [--without OPTION]
[--outdir OUTDIR] [--spec SPEC]
[--short-circuit SHORT_CIRCUIT] [--nocheck]
this one rings up rpmbuild to compile the source. by default the prep and configure stages happen too, unless you hit it with the short-circuit option π«Ά
options:
-h,--helpβ shows this help message and exits--targetTARGET β prep for a specific arch or arch-vendor-os--withOPTION β enable%bcondspec OPTION. can be specified multiple times, stack 'em--withoutOPTION β disable%bcondspec OPTION. also stackable, multiple times--outdirOUTDIR β where to put any generated rpm content. the directory must exist--specSPEC β an input spec template. if you don't give one, the spec template is auto-located in<path>as a file ending either with.spec.rpkgor.specsuffix (in this order). the directory of the template then also becomes the search location for the associated sources andrpkg.conffile. by default, these files are being looked up in<path>. essentially, this argument changes the subpackage we work with, and which one that is gets determined by the--pathargument initially (with CWD as the default value for it)--short-circuitSHORT_CIRCUIT β short-circuit compile--nocheckβ nocheck compile
π rpkg config π
rpkg config [-h]
do nothing. literally nothing. only output the config that's being used. it's giving "I'm just here to vibe" π
options:
-h,--helpβ shows this help message and exits
π rpkg copr-build π
rpkg copr-build [-h] [--outdir OUTDIR] [--spec SPEC] [--config CONFIG]
[--wait]
[project]
build the package in the Copr build system, bestie.
you need to have copr-cli installed and also have your Copr API key set up. for more info about the API key, go look at the API KEY section in the copr-cli(1) man page.
NOTE: this method of building the package does not support the with, without, and rpmdefines rpkg configuration options. those options are used to build an srpm which is then sent to Copr β but the rpm build in Copr happens without these options already, which is important for the resulting build. so if you want these options applied, you should rather set up auto-rebuilding in Copr that will react to new pushes into your repository. no cap.
positional arguments:
projectβ name of the project in the formatOWNER/PROJECT. you can omit it if you've specified thecopr_projectconfiguration option
options:
-h,--helpβ shows this help message and exits--outdirOUTDIR β where to put any generated rpm content. the directory must exist--specSPEC β an input spec template. if you don't give one, the spec template is auto-located in<path>as a file ending either with.spec.rpkgor.specsuffix (in this order). the directory of the template then also becomes search location for the associated sources andrpkg.conffile. by default, these files are being looked up in<path>. essentially, this argument changes the subpackage we work with, and which one that is gets determined by the--pathargument initially (with CWD as the default value for it)--configCONFIG β path to an alternative Copr configuration file--wait,-wβ wait for the build to finish (patience era π)
π¦ rpkg diff π¦
rpkg diff [-h] [--cached] [file ...]
uses git diff to show the changes that have been made to tracked files. by default, cached changes β the ones you've already git added β will not show up.
positional arguments:
fileβ optionally diff specific files
options:
-h,--helpβ shows this help message and exits--cachedβ view staged changes
β rpkg gimmespec β
rpkg gimmespec [-h]
prints the auto-located input spec file name. that's it. that's the whole personality π
options:
-h,--helpβ shows this help message and exits
π rpkg import π
rpkg import [-h] [--repo-path REPO_PATH] [--skip-diffs] [--offline]
srpm
this extracts sources, patches, and the spec file from an srpm and overwrites the current package content accordingly. it imports to the current branch by default. newly discovered sources get uploaded and .gitignore and the sources file get updated accordingly. very "new year new me" of it.
positional arguments:
srpmβ source rpm to import. it can also be an URL, in which case the target srpm will be downloaded first
options:
-h,--helpβ shows this help message and exits--repo-pathREPO_PATH β path to the git repository for which to upload sources. if not specified, it will be automatically derived from the remote URL configured for the current branch--skip-diffsβ don't show diffs when importing--offlineβ do not actually upload the files, but do all the rest
π§ rpkg install π§
rpkg install [-h] [--target TARGET] [--with OPTION] [--without OPTION]
[--outdir OUTDIR] [--spec SPEC]
[--short-circuit SHORT_CIRCUIT] [--nocheck]
this calls rpmbuild to run the install section. all the leading sections get processed as well, unless you use the short-circuit option β¨
options:
-h,--helpβ shows this help message and exits--targetTARGET β prep for a specific arch or arch-vendor-os--withOPTION β enable%bcondspec OPTION. can be specified multiple times--withoutOPTION β disable%bcondspec OPTION. can be specified multiple times--outdirOUTDIR β where to put any generated rpm content. the directory must exist--specSPEC β an input spec template. if you don't give one, the spec template is auto-located in<path>as a file ending either with.spec.rpkgor.specsuffix (in this order). the directory of the template then also becomes search location for the associated sources andrpkg.conffile. by default, these files are being looked up in<path>. essentially, this argument changes the subpackage we work with, and which one that is gets determined by the--pathargument initially (with CWD as the default value for it)--short-circuitSHORT_CIRCUIT β short-circuit install--nocheckβ nocheck install
π rpkg lint π
rpkg lint [-h] [--info] [--rpmlint-config RPMLINT_CONFIG] [target_path]
Rpmlint can be configured using the --rpmlint-config/-r option, or by setting the rpkg.rpmlint_config variable. pick your fighter π
positional arguments:
target_pathβ directory with rpm items to be linted, or just a single rpm item like a.specfile. if not specified, the latest package directory from the base output path will be selected
options:
-h,--helpβ shows this help message and exits--info,-iβ display explanations for reported messages--rpmlint-config,-rRPMLINT_CONFIG β use a specific configuration file for rpmlint
π₯ rpkg local π₯
rpkg local [-h] [--target TARGET] [--with OPTION] [--without OPTION]
[--outdir OUTDIR] [--spec SPEC] [--nocheck]
locally test run of rpmbuild producing binary RPMs. main character energy, but make it local π«Ά
options:
-h,--helpβ shows this help message and exits--targetTARGET β prep for a specific arch or arch-vendor-os--withOPTION β enable%bcondspec OPTION. can be specified multiple times--withoutOPTION β disable%bcondspec OPTION. can be specified multiple times--outdirOUTDIR β where to put any generated rpm content. the directory must exist--specSPEC β an input spec template. if you don't give one, the spec template is auto-located in<path>as a file ending either with.spec.rpkgor.specsuffix (in this order). the directory of the template then also becomes search location for the associated sources andrpkg.conffile. by default, these files are being looked up in<path>. essentially, this argument changes the subpackage we work with, and which one that is gets determined by the--pathargument initially (with CWD as the default value for it)--nocheckβ nocheck build-h,--helpβ shows this help message and dips, no notes π--target TARGETβ preps for a specific arch or arch-vendor-os.--with OPTIONβ enables the%bcondspec OPTION. You can stack this one, specify it multiple times, go off bestie πΈ--without OPTIONβ disables the%bcondspec OPTION. Also stackable, also multiple times β¨--outdir OUTDIRβ where to put any generated rpm content. The directory has to already exist, it will not make it for you π--spec SPECβ an input spec template. If you don't hand it one, the spec template gets auto-located in<path>as a file ending either with.spec.rpkgor.specsuffix (in this order). The directory of the template then also becomes the search location for the associated sources andrpkg.conffile. By default, these files are being looked up in<path>. Basically: this argument changes the subpackage we work with, and which one that is gets determined by the--pathargument initially (with CWD as the default value for it). Very demure, very mindfull π--nocheckβ nocheck local build π«Ά
π rpkg log
usage: rpkg log [-h] [--graph] [--all] [--show-signature]
[revision ...] [path ...]
Displays the git log history, bestie. It can be configured by the git.log_graph and git.log_all rpkg configuration options π
positional arguments
revisionβ specific revisions or revision range to be shown.pathβ limits commits to those that touch the specific path(s). You might need to use a--to explicitly separate paths from revisions. And in that case, you also need to insert another--to first separate options from all the positional arguments. Yes, two of them. Not me explaining this twice π
options
-h,--helpβ show this help message and exit.--graphβ draws a text-based graphical representation of the commit history. By default enabled by the rpkg configuration optiongit.log_graphβ¨--allβ pretends as if all the refs inrefs/, along withHEAD, are listed on the command line as a revision. By default enabled by the rpkg configuration optiongit.log_all.--show-signatureβ show gpg signatures and check their validity π
π¦ rpkg merge
usage: rpkg merge [-h] [--no-commit] [--squash] [--message MESSAGE]
[--file FILE] [--signoff] [--abort] [--continue]
[commit ...]
Incorporates changes from the named commits (since the time their histories diverged from the current branch) into the current branch. Classic merge behaviour, no cap π«Ά
positional arguments
commitβ commits, usually other branch heads, to merge into our branch. If no commit is given, merge the remote-tracking branches that the current branch is configured to use as its upstream.
options
-h,--helpβ show this help message and exit.--no-commitβ performs the merge but does not auto-commit.--squashβ produces the working tree and index state as if a real merge happened but does not auto-commit. The next commit will have only a single parent and contain all the merged changes. Squash it, slay it π--message,-m MESSAGEβ use the given<msg>as the commit message summary.--file,-F FILEβ take the commit message from the given file.--signoffβ add aSigned-off-byline by the committer βοΈ--abortβ abort the current conflict resolution process, and try to reconstruct the pre-merge state. The escape hatch, we love her π--continueβ when all your merge conflicts have been resolved, you can conclude the merge by running this command.
π rpkg new
usage: rpkg new [-h] [--outdir OUTDIR] [--spec SPEC]
This will use git to show a diff of all the changes (even uncommitted changes) since the last package tag was created. The receipts, literally πΈ
options
-h,--helpβ show this help message and exit.--outdir OUTDIRβ where to put any generated rpm content. The directory must exist.--spec SPECβ an input spec template. If not given, the spec template is auto-located in<path>as a file ending either with.spec.rpkgor.specsuffix (in this order). The directory of the template then also becomes search location for the associated sources andrpkg.conffile. By default, these files are being looked up in<path>. Essentially, this argument changes the subpackage we work with and which is determined by the--pathargument initially (with CWD as the default value for it) π
β rpkg nvr
usage: rpkg nvr [-h] [--outdir OUTDIR] [--spec SPEC]
Print package name-version-release. That's it, that's the whole vibe π·οΈ
options
-h,--helpβ show this help message and exit.--outdir OUTDIRβ where to put any generated rpm content. Directory must exist.--spec SPECβ an input spec template. If not given, the spec template is auto-located in<path>as a file ending either with.spec.rpkgor.specsuffix (in this order). The directory of the template then also becomes search location for the associated sources andrpkg.conffile. By default, these files are being looked up in<path>. Essentially, this argument changes the subpackage we work with and which is determined by the--pathargument initially (with CWD as the default value for it) β¨
πΈ rpkg prep
usage: rpkg prep [-h] [--target TARGET] [--with OPTION] [--without OPTION]
[--outdir OUTDIR] [--spec SPEC]
Use rpmbuild to "prep" the sources β that means unpack the source archive(s) and apply any patches π§°
options
-h,--helpβ show this help message and exit.--target TARGETβ prep for a specific arch or arch-vendor-os.--with OPTIONβ enable%bcondspec OPTION. Can be specified multiple times.--without OPTIONβ disable%bcondspec OPTION. Can be specified multiple times.--outdir OUTDIRβ where to put any generated rpm content. Directory must exist.--spec SPECβ an input spec template. If not given, the spec template is auto-located in<path>as a file ending either with.spec.rpkgor.specsuffix (in this order). The directory of the template then also becomes search location for the associated sources andrpkg.conffile. By default, these files are being looked up in<path>. Essentially, this argument changes the subpackage we work with and which is determined by the--pathargument initially (with CWD as the default value for it) π
π§ rpkg pull
usage: rpkg pull [-h] [--rebase] [--no-rebase]
This command uses git to fetch remote changes and apply them to the current working copy. A rebase option is available which can be used to avoid merges π
options
-h,--helpβ show this help message and exit.--rebaseβ rebase the locally committed changes on top of the remote changes after fetching. This can avoid a merge commit, but does rewrite local history π--no-rebaseβ do not rebase, overriding.gitsettings to the contrary.
π₯ rpkg push
usage: rpkg push [-h] [--follow-tags] [--force]
Push changes and annotated tags to remote repository. Send it π€
options
-h,--helpβ show this help message and exit.--follow-tagsβ push all the refs that would be pushed without this option and also push annotated tags reachable from the refs that are pushed by default. This option is passed by default if thegit.push_follow_tagsconfiguration variable is set totrueβ¨--force,-fβ force push. Careful bestie, this one rewrites what's out there.
π rpkg reset
usage: rpkg reset [-h] [--soft | --mixed | --hard] [commit|path]
Reset HEAD to the specified commit and update index and/or working tree. Alternatively, if path is passed instead of commit, reset the respective index entry to its state at HEAD π
positional arguments
commit|pathβ commit or path. Ifpathis passed, the respective index entry is updated to itsHEADstate, otherwise the action depends on the specified option switch (--mixedis implicit).
options
-h,--helpβ show this help message and exit.--softβ does not touch the index file or the working tree. Only resets the head to the specified commit.--mixedβ resets the index but not the working tree. This is the default action.--hardβ resets the index and working tree. Any changes to tracked files in the working tree since the specified commit are discarded. Gone. Poof. π
π rpkg sources
usage: rpkg sources [-h] [--repo-path REPO_PATH] [--outdir OUTDIR]
Download source files from lookaside cache. Grab the goods ποΈ
options
-h,--helpβ show this help message and exit.--repo-path REPO_PATHβ path to git repository for which to download sources. If not specified, it will be automatically derived from remote URL configured for the current branch.--outdir OUTDIRβ directory to put downloaded files into (defaults tocwd).
π rpkg spec
usage: rpkg spec [-h] [--outdir OUTDIR] [--spec SPEC] [--sources] [--print]
Preprocess a given spec template and put the resulting spec file into outdir.
The spec template is simply copied into the outdir if spec preprocessing is turned off, or if the input spec template does not contain any preprocessor macros. Like, it's just a copy-paste at that point. No glow-up needed. π
β¨ options β¨
-h,--helpβ show this help message and exit. Your classic escape hatch. π«Ά--outdir OUTDIRβ Where to put any generated rpm content. The directory must exist. It will not be created for you, bestie, it is not that kind of girl.--spec SPECβ An input spec template. If not given, the spec template is auto-located in<path>as a file ending either with.spec.rpkgor.specsuffix β and yes, in that order. The directory of the template then also becomes the search location for the associated sources andrpkg.conffile. By default, these files are being looked up in<path>. Essentially, this argument changes the subpackage we work with, which is determined by the--pathargument initially (with CWD as the default value for it). So it's giving "actually, we're working over here now". πββοΈ--sourcesβ Enable source generation by the input spec template. By default disabled. You gotta opt in, no cap.--print,-pβ Print the rendered spec file to stdout. Iconic for peeking at what you cooked. π
π rpkg srpm π
usage: rpkg srpm [-h] [--target TARGET] [--with OPTION] [--without OPTION]
[--outdir OUTDIR] [--spec SPEC]
Create a source rpm. That's it, that's the whole vibe. β¨
β¨ options β¨
-h,--helpβ show this help message and exit.--target TARGETβ Prep for a specific arch or arch-vendor-os.--with OPTIONβ Enable%bcondspecOPTION. Can be specified multiple times. Stack 'em up, queen. π--without OPTIONβ Disable%bcondspecOPTION. Can be specified multiple times.--outdir OUTDIRβ Where to put any generated rpm content. Directory must exist. Same energy as before, it's not gonna build the folder for you.--spec SPECβ An input spec template. If not given, the spec template is auto-located in<path>as a file ending either with.spec.rpkgor.specsuffix (in this order). The directory of the template then also becomes the search location for the associated sources andrpkg.conffile. By default, these files are being looked up in<path>. Essentially, this argument changes the subpackage we work with, and which is determined by the--pathargument initially (with CWD as the default value for it).
π¦ rpkg status π¦
usage: rpkg status [-h] [pathspec ...]
Display git status of the current working tree and index. The mirror moment, but for your repo. πͺ
β¨ positional arguments β¨
pathspecβ Limit status information to the specific subpaths. Narrow it down, focus your lens. π
β¨ options β¨
-h,--helpβ show this help message and exit.
π rpkg switch π
usage: rpkg switch [-h] [--create] [--detach] [--list-branches] [--fetch]
[target]
Switch to a given git branch. If the --detach option is given, also tag, or a commit can be used as a target for switching. Additionally, this command can be used to list the existing local and remote branches, or to fetch new refs from remote. Multitasking queen fr fr. π
β¨ positional arguments β¨
targetβ Target branch name or, alternatively, commit or tag to switch to. If provided with a remote branch name that does not have a local match, it creates one and sets it to track the corresponding remote branch. So it just β¨makesβ¨ the local branch for you. So generous.
β¨ options β¨
-h,--helpβ show this help message and exit.--create,-cβ Create a new local branch even if it does not have the corresponding remote, and switch to it. Going off the grid, love that for you. π§--detach,-dβ Detach HEAD at target commit or tag.--list-branches,-lβ List both remote-tracking branches and local branches. Implied whentargetis not specified. So if you pass nothing, you get the list anyway. Sneaky but helpful.--fetchβ Fetch branches and tags from remote before switch.
π rpkg tag π
usage: rpkg tag [-h] [--list] [--delete] [--skip-edit] [--name NAME]
[--version VERSION] [--release RELEASE]
[tag]
This command uses git to create, list, or delete tags. If you have set git.gpg_keyid in rpkg configuraion, the tags will be created signed. Signed tags?? Secure AND cute, we love to see it. πβ¨
β¨ positional arguments β¨
tagβ Name of the tag. Overrides any of the--name,--version,--releaseargs if specified. It said "I'm the main character now." π
β¨ options β¨
-h,--helpβ show this help message and exit.--list,-lβ List all tags with a given pattern, or all if no pattern is given.--delete,-dβ Delete a tag. Gone. Poof. Make sure you mean it. π--skip-edit,-sβ Skip changelog editing when creating a tag.--name,-n NAMEβ Set the package name part of the tag name to a specific value.--version,-v VERSIONβ Set the version part of the tag name to a specific value.--release,-r RELEASEβ Set the release part of the tag name to a specific value.
πΈ rpkg unused-patches πΈ
usage: rpkg unused-patches [-h]
Print list of patches in the current working directory not referenced by name in the specfile. The callout post for your forgotten patches. π
β¨ options β¨
-h,--helpβ show this help message and exit.
β rpkg upload β
usage: rpkg upload [-h] [--repo-path REPO_PATH] [--offline] file [file ...]
This command will upload new source file(s) to the lookaside cache. Source file names are appended to the sources file, and .gitignore will be also updated with the new uploaded file(s). Please remember to commit them. Not me reminding you twice because you will forget. π
β¨ positional arguments β¨
fileβ List of files to upload.
β¨ options β¨
-h,--helpβ show this help message and exit.--repo-path REPO_PATHβ Path to git repository for which to upload sources. If not specified, it will be automatically derived from the remote URL configured for the current branch. Auto-detect mode, slay.--offlineβ Do not actually upload the files, but do all the rest, which involves updating.gitignoreand thesourcesfile. A little dry run moment. π«Ά
π rpkg verify-files π
usage: rpkg verify-files [-h] [target_dir]
Locally run rpmbuild -bl to verify the spec file's %files sections. This requires a successful run of the install commaned in advance. So like, do the install step first or this does nothing for you. π
β¨ positional arguments β¨
target_dirβ Directory with build results to verify. If not specified, the latest package directory from the base output path will be selected. It'll pick the freshest one for you. π
β¨ options β¨
-h,--helpβ show this help message and exit.
π CONFIGURATION π
okay bestie, this is the part where rpkg goes snooping through your config files, and it has a very specific order it reads them in. no skipping, no vibes-based priority, just this list:
/etc/rpkg.conf, ~/.config/rpkg.conf, <git_root>/rpkg.conf, <pkg_path>/rpkg.conf
here's the tea on who wins: config in <pkg_path>/rpkg.conf has the highest priority, and config in /etc/rpkg.conf has the lowest priority. main character vs. background extra, fr.
so what even is <git_root>? it's the top level of the Git repo you're currently hanging out in. and here's the plot twist: if you're in a plain directory (like, there's no .git subdir) and all your parent directories are also plain, then rpkg just skips reading <git_root>/rpkg.conf entirely. ghosted.
and <pkg_path>? that's your CWD by default, but you can override it with the --path argument or the --spec argument β and --spec wins that fight, it has higher priority. π
there are also built-in default values for every single variable, used whenever a variable isn't specified in any config file. they're all listed below with their descriptions, so you literally cannot miss them.
β¨ DEFAULT CONFIGURATION WITH DESCRIPTIONS β¨
this is the whole thing, verbatim, no cap:
[rpkg]
# Whether to enable spec preprocessing,
# that is parsing and evaluation of {{{ ... }}} expressions
# type: bool
preprocess_spec = True
# Base directory where generated files should be put.
# The files will not be put directly there but
# instead into dynamically generated subdirectories
# type: string
base_output_path = /tmp/rpkg
# Path to user preproc macros. You may use ${git_props:root}
# variable to anchor the path to top-level of your git repo.
# type: list of space-separated strings
user_macros =
# rpm bcondition "with" specifier
# type: list of space-separated strings
with =
# rpm bcondition "without" specifier
# type: list of space-separated strings
without =
# Defines rpm variables for spec parsing
# type: list of space-separated quoted string pairs (e.g. 'dist %nil')
rpmdefines =
# Defines rpm variables for spec parsing during
# version/release bumping (see the tag subcommand)
# This list is not being concatenated with rpmdefines.
# type: list of space-separated quoted string pairs
bump_rpmdefines = 'dist %nil'
# Path to rpmlint configuration (see the lint subcommand)
# type: string
rpmlint_config =
# Paths to default preproc macros relative to
# /usr/lib/rpkg.macros.d directory
# type: list of space-separated strings
default_macros = git.bash
[git]
# Default Git repository URL, used by `rpkg clone <repo_path>`
# type: string
clone_url =
# Default Git repository URL, used by `rpkg clone -a <repo_path>`
# type: string
anon_clone_url =
# If you clone a project with rpkg clone and specify only
# its basename (i.e. the last part like "dist-git"), then
# default namespace (e.g. rpms) will be automatically
# prepended to it together with ending slash if specified.
# type: string
default_namespace =
# Whether to automatically push tags with rpkg push
# type: bool
push_follow_tags = True
# Allows removing of files and directories
# for rpkg clean operation
# type: bool
clean_force = True
# Whether rpkg clean should descend into
# untracked directories
# type: bool
clean_dirs = True
# Whether rpkg log should be in graph form
# type: bool
log_graph = True
# Whether rpkg log should display all branches
# type: bool
log_all = True
# Key to sign commits and tags with. Specifying
# it enables signing.
# type: bool
gpg_keyid =
# In which Copr project to build a package by using
# rpkg build command, in form: user/project or @group/project
# type: string
copr_project =
[lookaside]
# Download URL for DistGit lookaside cache, used by rpkg sources.
# There are some dynamic variables that you can use:
# %(repo_path)s is a fully-namespaced repository name (e.g. rpms/rpkg-util)
# %(ns<n>)s, ..., %(ns2)s, %(ns1)s, %(name)s is %(repo_path)s split into individual components.
# E.g. forks/praiskup/rpms/passwd path will provide variables: %(ns3)s == forks, %(ns2)s == praiskup, %(ns1)s == rpms, %(name)s == passwd
# %(filename)s, %(hashtype)s, %(hash)s fields are read from 'sources' file, if present.
# Further, you can use ${git_props:remote_netloc} interpolation
# variable to base the download URL on git clone URL.
# type: string
download_url =
# Upload URL for DistGit lookaside cache, used by rpkg upload.
# You can use ${git_props:remote_netloc} interpolation
# variable to base the download URL on git clone URL.
# type: string
upload_url =
# For client certificate authentication if employed
# by the server
# type: string
client_cert =
# For client certificate authentication if employed
# by the server
# type: string
client_key =
# For client certificate authentication if employed
# by the server
# type: string
ca_cert =
real talk:gpg_keyidsays# type: boolin the comments but it's holding a key id β that's straight from the original, so I'm not touching it. copy the source, not me. π
π DYNAMIC CONFIGURATION SECTIONS π
plot twist #2: there are other config sections that rpkg just kinda spawns during runtime, no config file needed. those are:
[DEFAULT]β containsuser,path, andpkg_pathproperties[git_props]β contains a whole lot of git status specific information
you can print the entire final config (yes, including those dynamically added sections) with the rpkg config command. iconic behavior honestly. π
π¦ INTERPOLATION π¦
when you're setting configuration values, you're allowed to use interpolation to reference another configuration variable β even one from a totally different section. the syntax is:
${<section name>:<param name>}
like for example ${git_props:remote_netloc}. bestie behavior: referencing your friends across the group chat. π
there's also a %(<var>)s interpolation for some fields, like lookaside:download_url. and the variables you can interpolate like that are always field-specific β no cross-pollinating, it's a closed circle.
π₯ EXAMPLES π₯
run the %prep phase of an rpm build
$ rpkg prep
git_dir_pack: packing path /home/clime/rpkg-util
git_dir_pack: Wrote: /tmp/rpkg/rpkg-util-12-ft3gm2mw/rpkg-util-f01b36d7-dirty.tar.gz
Wrote: /tmp/rpkg/rpkg-util-12-ft3gm2mw/rpkg-util.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.iqrI6z
+ umask 022
+ cd /tmp/rpkg/rpkg-util-12-ft3gm2mw
+ cd /tmp/rpkg/rpkg-util-12-ft3gm2mw
+ rm -rf rpkg-util
+ /usr/bin/gzip -dc /tmp/rpkg/rpkg-util-12-ft3gm2mw/rpkg-util-f01b36d7-dirty.tar.gz
+ /usr/bin/tar -xof -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd rpkg-util
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ RPM_EC=0
++ jobs -p
+ exit 0
generate a spec file from a template
$ rpkg spec
Wrote: /tmp/rpkg/rpkg-util-13-53194610/rpkg-util.spec
build an srpm
$ rpkg srpm
git_dir_pack: packing path /home/clime/rpkg-util
git_dir_pack: Wrote: /tmp/rpkg/rpkg-util-14-q3t0g4um/rpkg-util-f01b36d7-dirty.tar.gz
Wrote: /tmp/rpkg/rpkg-util-14-q3t0g4um/rpkg-util.spec
Wrote: /tmp/rpkg/rpkg-util-14-q3t0g4um/rpkg-util-3.prototype.git.229.f01b36d7.dirty.02idw5-1.fc31.src.rpm
π§ SPEC TEMPLATES π§
so spec templates do two things and both are kinda slay. first, they're a way to handle unpacked and packed content. second β and this is the iconic part β they let you auto-generate certain chunks of your spec file straight from the Git repository your spec file lives in. πΈ
β οΈ important: for this to work at all, you need thepreprocess_specconfiguration option set toTruein your rpkg config. no setting, no magic. periodt.
β BASIC EXAMPLE β
Name: {{{ git_dir_name }}}
Version: {{{ git_dir_version }}}
Release: 1%{?dist}
Summary: This is a test package.
License: GPLv2+
URL: https://someurl.org
VCS: {{{ git_dir_vcs }}}
Source: {{{ git_dir_pack }}}
%description
This is a test package.
%prep
{{{ git_dir_setup_macro }}}
%changelog
{{{ git_dir_changelog }}}
having a spec template like this in your project (instead of just a plain boring spec file) is what lets you build source packages and rpm packages automatically, following the git history of your project. it's giving self-updating. it's giving main character spec file. π
π MACRO REFERENCE π
please, see the dedicated rpkg-macros page. that's where all the macro lore lives.
π USER-DEFINED MACROS π
you can absolutely write your own rpkg macros, bestie. they're basically just standard bash functions, read from the file specified by the user_macros config variable. when one gets used, the standard output of your custom macro is captured, and the {{{ <macro_name> }}} invocation inside your input spec file gets replaced with it. πͺ
here's an example of a custom macro, living in a repo-specific rpkg.macros file:
function my_git_commits_no {
total_commits=$(git rev-list --all --count)
echo -n "$total_commits"
}
so if you've got an rpkg.macros file with this content sitting in your project's git top-level directory, then you also need to create an rpkg.conf file in your top-level dir with at least the following content:
[rpkg]
user_macros = ${git_props:root}/rpkg.macros
that's what enables reading of the custom user macros. β¨ and then inside your spec file, you can use a snippet like this:
Release: {{{ my_git_commits_no }}}
which turns your release number into "however many commits exist", generated for you. no manual counting, no suffering. π«Ά
β SEE ALSO β
and... that's it. the page just ends here, bestie β nothing else listed, no further reading, no cross-refs. a lil cliffhanger. π
aaaand that's the whole manual page, start to finish, every flag, every default, every single {{{ }}}. you ate that. π
that little footer down at the bottom is just the boring admin stuff β the source/version stamp and the date it was generated β nothing you need to memorise, just the receipt. go build something iconic with it. πΈβ¨ππ¦π
π¦ where this page comes from
- fedora 43: rpkg 3.3-6.fc43 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms