1rpkg(1)                          rpm-packager                          rpkg(1)
2
3
4

NAME

6       rpkg - RPM packaging utility
7

SYNOPSIS

9       rpkg [ global_options ] command [ command_options ] [ command_arguments
10       ]
11       rpkg help
12       rpkg command --help
13

DESCRIPTION

15       rpkg is a script to manage spec enriched Git repositories - meaning any
16       repositories  which  contain  an  rpm spec file. It is designed to work
17       with expanded application sources as well as with standard DistGit tar‐
18       balls  and patches. Note that you should trust the .spec files you work
19       with because many operations (like `rpkg srpm` or `rpkg lint`)  involve
20       parsing  the  spec  file, which brings along evaluation of any shell or
21       lua scriplets present in it.
22
23   Global Options
24         --config CONFIG, -C CONFIG
25                               Specify a config file to use.
26         --module-name MODULE_NAME
27                               Override the module name. Otherwise it is  dis‐
28       covered
29                               from: Git push URL or Git URL.
30         --user USER           Override the discovered user name.
31         --path  PATH            Define  the directory to work in (defaults to
32       cwd).
33         --verbose, -v         Run with verbose debug output.
34         --debug, -d           Run with debug output.
35         -q                    Run quietly only displaying errors.
36

COMMAND OVERVIEW

38       rpkg build [-h] [--config CONFIG] [-w] [--outdir OUTDIR] [--spec  SPEC]
39       [project]
40              Alias for copr-build
41
42       rpkg  ci  [-h] [-m MESSAGE] [--with-changelog] [-t] [-F FILE] [-p] [-s]
43       [files ...]
44              Alias for commit
45
46       rpkg clean [-h] [--dry-run] [-x]
47              Remove untracked files
48
49       rpkg clog [-h] [--raw] [--outdir OUTDIR] [--spec SPEC]
50              Make a clog file containing top changelog entry
51
52       rpkg clone [-h] [--branches] [--branch BRANCH]  [--anonymous]  [--depth
53       DEPTH] repo [clone_target] ...
54              Clone and checkout a repository
55
56       rpkg  co  [-h]  [--branches]  [--branch  BRANCH] [--anonymous] [--depth
57       DEPTH] repo [clone_target] ...
58              Alias for clone
59
60       rpkg commit [-h] [-m MESSAGE] [--with-changelog] [-t]  [-F  FILE]  [-p]
61       [-s] [files ...]
62              Commit changes
63
64       rpkg  compile [-h] [--target TARGET] [--with OPTION] [--without OPTION]
65       [--short-circuit] [--nocheck] [--outdir OUTDIR] [--spec SPEC]
66              Local test rpmbuild compile
67
68       rpkg copr-build [-h] [--config CONFIG] [-w] [--outdir  OUTDIR]  [--spec
69       SPEC] [project]
70              Build package in Copr Build System
71
72       rpkg diff [-h] [--cached] [files ...]
73              Show changes between commits, commit and working tree, etc
74
75       rpkg gimmespec [-h]
76              Print the spec file name
77
78       rpkg help [-h]
79              Show usage
80
81       rpkg import [-h] [--skip-diffs] [--offline] srpm
82              Import srpm content into a module
83
84       rpkg  install [-h] [--target TARGET] [--with OPTION] [--without OPTION]
85       [--short-circuit] [--nocheck] [--outdir OUTDIR] [--spec SPEC]
86              Local test rpmbuild install
87
88       rpkg is-packed [-h] [--outdir OUTDIR] [--spec SPEC]
89              Deprecated. Tell user whether content is packed
90
91       rpkg lint [-h] [--info] [--rpmlintconf RPMLINTCONF] [--outdir OUTDIR]
92              Run rpmlint against local spec and build output if present.
93
94       rpkg local [-h] [--target TARGET] [--with  OPTION]  [--without  OPTION]
95       [--outdir OUTDIR] [--spec SPEC]
96              Local test rpmbuild binary
97
98       rpkg make-source [-h] [--outdir OUTDIR] [--spec SPEC]
99              Deprecated. Create Source0 from the content of the current work‐
100              ing directory after downloading any external sources.  The  con‐
101              tent must be of unpacked type.
102
103       rpkg new [-h]
104              Diff against last tag
105
106       rpkg new-sources [-h] files [files ...]
107              Upload source files
108
109       rpkg  prep  [-h]  [--target  TARGET] [--with OPTION] [--without OPTION]
110       [--outdir OUTDIR] [--spec SPEC]
111              Local test rpmbuild prep
112
113       rpkg pull [-h] [--rebase] [--no-rebase]
114              Pull changes from the remote repository and update  the  working
115              copy.
116
117       rpkg push [-h] [--force]
118              Push changes and annotated tags to remote repository.
119
120       rpkg sources [-h] [--outdir OUTDIR]
121              Download source files
122
123       rpkg spec [-h] [--sources] [--outdir OUTDIR] [--spec SPEC]
124              Generate spec file from a spec template
125
126       rpkg  srpm  [-h]  [--target  TARGET] [--with OPTION] [--without OPTION]
127       [--outdir OUTDIR] [--spec SPEC]
128              Create a source rpm
129
130       rpkg switch-branch [-h] [-l] [--fetch] [branch]
131              Work with branches
132
133       rpkg tag [-h] [-l] [-d] [-s] [--outdir OUTDIR] [--spec SPEC] [tag]
134              Management of git tags
135
136       rpkg unused-patches [-h] [--outdir OUTDIR] [--spec SPEC]
137              Print list of patches not referenced by name in the specfile
138
139       rpkg upload [-h] files [files ...]
140              Upload source files
141
142       rpkg verify-files [-h] [--outdir OUTDIR]
143              Locally verify %%files section
144
145       rpkg verrel [-h] [--outdir OUTDIR] [--spec SPEC]
146              Print the name-version-release
147

COMMAND REFERENCE

149   rpkg build
150         usage: rpkg build  [-h]  [--config  CONFIG]  [-w]  [--outdir  OUTDIR]
151       [--spec SPEC]
152                           [project]
153
154         Build  package  in  Copr  Build  System.  You  need  to have copr-cli
155       installed and
156         also set up Copr api key. For more information about the api key, see
157       API KEY
158         section in copr-cli(1) man page.
159
160         positional arguments:
161           project           Name  of  the project in format OWNER/PROJECT. If
162       not
163                            specified, project will be set to module name.
164
165         optional arguments:
166           -h, --help       show this help message and exit
167           --config CONFIG  Path to an alternative Copr configuration file
168           -w, --wait       Wait for build to finish.
169           --outdir OUTDIR  Where to put any generated rpm content.  Directory
170       must
171                            exist.
172           --spec  SPEC       An  input  spec template. If not given, the spec
173       template is
174                            auto-located  in  path  as  a  file  ending   with
175       ".spec.rpkg" or
176                            ".spec" suffix in this order.
177
178
179   rpkg ci
180         usage:  rpkg  ci  [-h] [-m MESSAGE] [--with-changelog] [-t] [-F FILE]
181       [-p] [-s]
182                        [files ...]
183
184         Alias for commit.
185
186         positional arguments:
187           files                 Optional list of specific files to commit
188
189         optional arguments:
190           -h, --help            show this help message and exit
191           -m MESSAGE, --message MESSAGE
192                                 Use the given <msg>  as  the  commit  message
193       summary
194           --with-changelog       Get  the  last changelog from SPEC as commit
195       message
196                                 content. This option must  be  used  with  -m
197       together.
198           -t, --tag             Create a tag for this commit
199           -F FILE, --file FILE  Take the commit message from the given file
200           -p, --push            Commit and push as one action
201           -s, --signoff         Include a signed-off-by
202
203
204   rpkg clean
205         usage: rpkg clean [-h] [--dry-run] [-x]
206
207         This  command  can  be  used  to  clean up your working directory. By
208       default it
209         will follow .gitignore rules.
210
211         optional arguments:
212           -h, --help     show this help message and exit
213           --dry-run, -n  Perform a dry-run
214           -x             Do not follow .gitignore rules
215
216
217   rpkg clog
218         usage: rpkg clog [-h] [--raw] [--outdir OUTDIR] [--spec SPEC]
219
220         This will create a file named "clog" that  contains  the  latest  rpm
221       changelog
222         entry. The leading "- " text will be stripped.
223
224         optional arguments:
225           -h, --help       show this help message and exit
226           --raw             Generate  a more "raw" clog without twiddling the
227       contents
228           --outdir OUTDIR  Where to put any generated rpm content.  Directory
229       must
230                            exist.
231           --spec  SPEC       An  input  spec template. If not given, the spec
232       template is
233                            auto-located  in  path  as  a  file  ending   with
234       ".spec.rpkg" or
235                            ".spec" suffix in this order.
236
237
238   rpkg clone
239         usage: rpkg clone [-h] [--branches] [--branch BRANCH] [--anonymous]
240                           [--depth DEPTH]
241                           repo [clone_target] ...
242
243         This  command  will  clone  the  named repository from the configured
244       repository
245         base URL. By default it will also checkout the master branch for your
246       working
247         copy.
248
249         positional arguments:
250           repo                  Name of the repository to clone
251           clone_target          Directory in which to clone the repository
252           extra_args             Custom arguments that are passed to the 'git
253       clone'.
254                                 Use '--' to separate them  from  other  argu‐
255       ments.
256
257         optional arguments:
258           -h, --help            show this help message and exit
259           --branches,  -B         Do  an  old style checkout with subdirs for
260       branches
261           --branch BRANCH, -b BRANCH
262                                 Check out a specific branch
263           --anonymous, -a       Check out a module anonymously
264           --depth DEPTH         Create a shallow clone with a  history  trun‐
265       cated to the
266                                 specified number of commits
267
268
269   rpkg co
270         usage: rpkg co [-h] [--branches] [--branch BRANCH] [--anonymous]
271                        [--depth DEPTH]
272                        repo [clone_target] ...
273
274         Alias for clone.
275
276         positional arguments:
277           repo                  Name of the repository to clone
278           clone_target          Directory in which to clone the repository
279           extra_args             Custom arguments that are passed to the 'git
280       clone'.
281                                 Use '--' to separate them  from  other  argu‐
282       ments.
283
284         optional arguments:
285           -h, --help            show this help message and exit
286           --branches,  -B         Do  an  old style checkout with subdirs for
287       branches
288           --branch BRANCH, -b BRANCH
289                                 Check out a specific branch
290           --anonymous, -a       Check out a module anonymously
291           --depth DEPTH         Create a shallow clone with a  history  trun‐
292       cated to the
293                                 specified number of commits
294
295
296   rpkg commit
297         usage:  rpkg  commit  [-h]  [-m  MESSAGE] [--with-changelog] [-t] [-F
298       FILE] [-p]
299                            [-s]
300                            [files ...]
301
302         This invokes a git commit. All tracked files  with  changes  will  be
303       committed
304         unless a specific file list is provided. $EDITOR will be used to gen‐
305       erate a
306         changelog message unless one is given to the command. A tag  or  push
307       can be
308         done at the same time.
309
310         positional arguments:
311           files                 Optional list of specific files to commit
312
313         optional arguments:
314           -h, --help            show this help message and exit
315           -m MESSAGE, --message MESSAGE
316                                 Use  the  given  <msg>  as the commit message
317       summary
318           --with-changelog      Get the last changelog from  SPEC  as  commit
319       message
320                                 content.  This  option  must  be used with -m
321       together.
322           -t, --tag             Create a tag for this commit
323           -F FILE, --file FILE  Take the commit message from the given file
324           -p, --push            Commit and push as one action
325           -s, --signoff         Include a signed-off-by
326
327
328   rpkg compile
329         usage: rpkg compile [-h] [--target TARGET] [--with OPTION] [--without
330       OPTION]
331                             [--short-circuit] [--nocheck] [--outdir OUTDIR]
332                             [--spec SPEC]
333
334         This  command  calls  rpmbuild  to compile the source. By default the
335       prep and
336         configure stages will be  done  as  well,  unless  the  short-circuit
337       option is
338         used.
339
340         optional arguments:
341           -h, --help        show this help message and exit
342           --target TARGET   Prep for a specific arch or arch-vendor-os.
343           --with  OPTION     Enable %bcond spec OPTION. Can be specified mul‐
344       tiple
345                             times.
346           --without OPTION  Disable %bcond spec OPTION. Can be specified mul‐
347       tiple
348                             times.
349           --short-circuit   short-circuit compile
350           --nocheck         nocheck compile
351           --outdir OUTDIR   Where to put any generated rpm content. Directory
352       must
353                             exist.
354           --spec SPEC       An input spec template. If not  given,  the  spec
355       template is
356                             auto-located  in  path  as  a  file  ending  with
357       ".spec.rpkg" or
358                             ".spec" suffix in this order.
359
360
361   rpkg copr-build
362         usage: rpkg copr-build [-h] [--config CONFIG] [-w] [--outdir OUTDIR]
363                                [--spec SPEC]
364                                [project]
365
366         Build package in  Copr  Build  System.  You  need  to  have  copr-cli
367       installed and
368         also set up Copr api key. For more information about the api key, see
369       API KEY
370         section in copr-cli(1) man page.
371
372         positional arguments:
373           project          Name of the project in  format  OWNER/PROJECT.  If
374       not
375                            specified, project will be set to module name.
376
377         optional arguments:
378           -h, --help       show this help message and exit
379           --config CONFIG  Path to an alternative Copr configuration file
380           -w, --wait       Wait for build to finish.
381           --outdir  OUTDIR  Where to put any generated rpm content. Directory
382       must
383                            exist.
384           --spec SPEC      An input spec template. If  not  given,  the  spec
385       template is
386                            auto-located   in  path  as  a  file  ending  with
387       ".spec.rpkg" or
388                            ".spec" suffix in this order.
389
390
391   rpkg diff
392         usage: rpkg diff [-h] [--cached] [files ...]
393
394         Use git diff to show changes that have been made to tracked files. By
395       default
396         cached changes (changes that have been git added) will not be shown.
397
398         positional arguments:
399           files       Optionally diff specific files
400
401         optional arguments:
402           -h, --help  show this help message and exit
403           --cached    View staged changes
404
405
406   rpkg gimmespec
407         usage: rpkg gimmespec [-h]
408
409         Print the spec file name.
410
411         optional arguments:
412           -h, --help  show this help message and exit
413
414
415   rpkg help
416         usage: rpkg help [-h]
417
418         Show usage.
419
420         optional arguments:
421           -h, --help  show this help message and exit
422
423
424   rpkg import
425         usage: rpkg import [-h] [--skip-diffs] [--offline] srpm
426
427         This  will  extract  sources, patches, and the spec file from an srpm
428       and update
429         the current module accordingly. It will import to the current  branch
430       by
431         default.
432
433         positional arguments:
434           srpm          Source rpm to import
435
436         optional arguments:
437           -h, --help    show this help message and exit
438           --skip-diffs  Don't show diffs when import srpms
439           --offline     Do not upload files into lookaside cache
440
441
442   rpkg install
443         usage: rpkg install [-h] [--target TARGET] [--with OPTION] [--without
444       OPTION]
445                             [--short-circuit] [--nocheck] [--outdir OUTDIR]
446                             [--spec SPEC]
447
448         This will call rpmbuild to run the install section. All leading  sec‐
449       tions will
450         be processed as well, unless the short-circuit option is used.
451
452         optional arguments:
453           -h, --help        show this help message and exit
454           --target TARGET   Prep for a specific arch or arch-vendor-os.
455           --with  OPTION     Enable %bcond spec OPTION. Can be specified mul‐
456       tiple
457                             times.
458           --without OPTION  Disable %bcond spec OPTION. Can be specified mul‐
459       tiple
460                             times.
461           --short-circuit   short-circuit install
462           --nocheck         nocheck install
463           --outdir OUTDIR   Where to put any generated rpm content. Directory
464       must
465                             exist.
466           --spec SPEC       An input spec template. If not  given,  the  spec
467       template is
468                             auto-located  in  path  as  a  file  ending  with
469       ".spec.rpkg" or
470                             ".spec" suffix in this order.
471
472
473   rpkg is-packed
474         usage: rpkg is-packed [-h] [--outdir OUTDIR] [--spec SPEC]
475
476         Deprecated. Determine whether the  package  content  in  the  working
477       directory is
478         packed or unpacked and print that information to the screen.
479
480         optional arguments:
481           -h, --help       show this help message and exit
482           --outdir  OUTDIR  Where to put any generated rpm content. Directory
483       must
484                            exist.
485           --spec SPEC      An input spec template. If  not  given,  the  spec
486       template is
487                            auto-located   in  path  as  a  file  ending  with
488       ".spec.rpkg" or
489                            ".spec" suffix in this order.
490
491
492   rpkg lint
493         usage: rpkg lint [-h] [--info] [--rpmlintconf RPMLINTCONF]  [--outdir
494       OUTDIR]
495
496         Rpmlint  can  be  configured  using the --rpmlintconf/-r option or by
497       setting a
498         .rpmlint file in the working directory.
499
500         optional arguments:
501           -h, --help            show this help message and exit
502           --info, -i            Display explanations for reported messages
503           --rpmlintconf RPMLINTCONF, -r RPMLINTCONF
504                                 Use a specific configuration file for rpmlint
505           --outdir OUTDIR       Directory with rpm items to be linted or just
506       a single
507                                 rpm item like a .spec file. If not specified,
508       a
509                                 directory  from  base  output  path  will  be
510       selected.
511
512
513   rpkg local
514         usage:  rpkg  local [-h] [--target TARGET] [--with OPTION] [--without
515       OPTION]
516                           [--outdir OUTDIR] [--spec SPEC]
517
518         Locally test run of rpmbuild producing binary RPMs. The rpmbuild out‐
519       put will
520         be logged into a file named .build-%{version}-%{release}.log
521
522         optional arguments:
523           -h, --help        show this help message and exit
524           --target TARGET   Prep for a specific arch or arch-vendor-os.
525           --with  OPTION     Enable %bcond spec OPTION. Can be specified mul‐
526       tiple
527                             times.
528           --without OPTION  Disable %bcond spec OPTION. Can be specified mul‐
529       tiple
530                             times.
531           --outdir OUTDIR   Where to put any generated rpm content. Directory
532       must
533                             exist.
534           --spec SPEC       An input spec template. If not  given,  the  spec
535       template is
536                             auto-located  in  path  as  a  file  ending  with
537       ".spec.rpkg" or
538                             ".spec" suffix in this order.
539
540
541   rpkg make-source
542         usage: rpkg make-source [-h] [--outdir OUTDIR] [--spec SPEC]
543
544         Deprecated. Puts content of the  current  working  directory  into  a
545       gzip-
546         compressed  archive  named according to Source0 filename as specified
547       in the
548         .spec file. The content must be of unpacked type, otherwise no action
549       is
550         taken.  Unpacked  content  is such that it contains a .spec file that
551       references
552         no present source or patch (typically it contains only Source0  being
553       generated
554         automatically)  and  there  is  at  least one file not in the list of
555       ignored
556         content (README,  README.md,  sources,  LICENSE,  tito.props,  hidden
557       files, .spec
558         file).  Note  that  by  invoking  this  command with --outdir ./, the
559       directory
560         content becomes "packed".
561
562         optional arguments:
563           -h, --help       show this help message and exit
564           --outdir OUTDIR  Where to put any generated rpm content.  Directory
565       must
566                            exist.
567           --spec  SPEC       An  input  spec template. If not given, the spec
568       template is
569                            auto-located  in  path  as  a  file  ending   with
570       ".spec.rpkg" or
571                            ".spec" suffix in this order.
572
573
574   rpkg new
575         usage: rpkg new [-h]
576
577         This will use git to show a diff of all the changes (even uncommitted
578       changes)
579         since the last git tag was applied.
580
581         optional arguments:
582           -h, --help  show this help message and exit
583
584
585   rpkg new-sources
586         usage: rpkg new-sources [-h] files [files ...]
587
588         This will upload new source file(s) to lookaside cache, and all  file
589       names
590         listed  in  sources  file  will  be replaced. .gitignore will be also
591       updated with
592         new uploaded file(s). Please remember to commit them.
593
594         positional arguments:
595           files
596
597         optional arguments:
598           -h, --help  show this help message and exit
599
600
601   rpkg prep
602         usage: rpkg prep [-h] [--target TARGET]  [--with  OPTION]  [--without
603       OPTION]
604                          [--outdir OUTDIR] [--spec SPEC]
605
606         Use  rpmbuild to "prep" the sources (unpack the source archive(s) and
607       apply any
608         patches.)
609
610         optional arguments:
611           -h, --help        show this help message and exit
612           --target TARGET   Prep for a specific arch or arch-vendor-os.
613           --with OPTION     Enable %bcond spec OPTION. Can be specified  mul‐
614       tiple
615                             times.
616           --without OPTION  Disable %bcond spec OPTION. Can be specified mul‐
617       tiple
618                             times.
619           --outdir OUTDIR   Where to put any generated rpm content. Directory
620       must
621                             exist.
622           --spec  SPEC        An  input spec template. If not given, the spec
623       template is
624                             auto-located  in  path  as  a  file  ending  with
625       ".spec.rpkg" or
626                             ".spec" suffix in this order.
627
628
629   rpkg pull
630         usage: rpkg pull [-h] [--rebase] [--no-rebase]
631
632         This  command  uses git to fetch remote changes and apply them to the
633       current
634         working copy. A rebase option is available which can be used to avoid
635       merges.
636
637         optional arguments:
638           -h, --help   show this help message and exit
639           --rebase      Rebase  the  locally  committed changes on top of the
640       remote
641                        changes after fetching. This can avoid a merge commit,
642       but does
643                        rewrite local history.
644           --no-rebase   Do  not  rebase, overriding .git settings to the con‐
645       trary
646
647         See git pull --help for more details
648
649
650   rpkg push
651         usage: rpkg push [-h] [--force]
652
653         Push changes and annotated tags to remote repository.
654
655         optional arguments:
656           -h, --help   show this help message and exit
657           --force, -f  Force push
658
659
660   rpkg sources
661         usage: rpkg sources [-h] [--outdir OUTDIR]
662
663         Download source files
664
665         optional arguments:
666           -h, --help       show this help message and exit
667           --outdir OUTDIR  Directory to download files into (defaults to pwd)
668
669
670   rpkg spec
671         usage: rpkg spec [-h] [--sources] [--outdir OUTDIR] [--spec SPEC]
672
673         Preprocess a given spec template and put the resulting spec file into
674       outdir.
675         The  spec  template  is simply copied into the outdir if spec prepro‐
676       cessing is
677         turned off or if the input spec template does not  contain  any  pre‐
678       processor
679         macros.
680
681         optional arguments:
682           -h, --help       show this help message and exit
683           --sources         Enable  source  generation by the input spec tem‐
684       plate. By
685                            default disabled.
686           --outdir OUTDIR  Where to put any generated rpm content.  Directory
687       must
688                            exist.
689           --spec  SPEC       An  input  spec template. If not given, the spec
690       template is
691                            auto-located  in  path  as  a  file  ending   with
692       ".spec.rpkg" or
693                            ".spec" suffix in this order.
694
695
696   rpkg srpm
697         usage:  rpkg  srpm  [-h] [--target TARGET] [--with OPTION] [--without
698       OPTION]
699                          [--outdir OUTDIR] [--spec SPEC]
700
701         Create a source rpm
702
703         optional arguments:
704           -h, --help        show this help message and exit
705           --target TARGET   Prep for a specific arch or arch-vendor-os.
706           --with OPTION     Enable %bcond spec OPTION. Can be specified  mul‐
707       tiple
708                             times.
709           --without OPTION  Disable %bcond spec OPTION. Can be specified mul‐
710       tiple
711                             times.
712           --outdir OUTDIR   Where to put any generated rpm content. Directory
713       must
714                             exist.
715           --spec  SPEC        An  input spec template. If not given, the spec
716       template is
717                             auto-located  in  path  as  a  file  ending  with
718       ".spec.rpkg" or
719                             ".spec" suffix in this order.
720
721
722   rpkg switch-branch
723         usage: rpkg switch-branch [-h] [-l] [--fetch] [branch]
724
725         This  command  can  switch  to a local git branch. If provided with a
726       remote
727         branch name that does not have a local match it will create  one.  It
728       can also
729         be used to list the existing local and remote branches.
730
731         positional arguments:
732           branch      Branch name to switch to
733
734         optional arguments:
735           -h, --help  show this help message and exit
736           -l, --list  List both remote-tracking branches and local branches
737           --fetch     Fetch new data from remote before switch
738
739
740   rpkg tag
741         usage:  rpkg  tag [-h] [-l] [-d] [-s] [--outdir OUTDIR] [--spec SPEC]
742       [tag]
743
744         This command uses git to create, list, or delete tags.
745
746         positional arguments:
747           tag              Name of the tag
748
749         optional arguments:
750           -h, --help       show this help message and exit
751           -l, --list       List all tags with a given pattern, or all if  not
752       pattern
753                            is given
754           -d, --delete     Delete a tag
755           -s, --skip-edit  Skips changelog editing when creating a tag.
756           --outdir  OUTDIR  Where to put any generated rpm content. Directory
757       must
758                            exist.
759           --spec SPEC      An input spec template. If  not  given,  the  spec
760       template is
761                            auto-located   in  path  as  a  file  ending  with
762       ".spec.rpkg" or
763                            ".spec" suffix in this order.
764
765
766   rpkg unused-patches
767         usage: rpkg unused-patches [-h] [--outdir OUTDIR] [--spec SPEC]
768
769         Print list of patches not referenced by name in the specfile.
770
771         optional arguments:
772           -h, --help       show this help message and exit
773           --outdir OUTDIR  Where to put any generated rpm content.  Directory
774       must
775                            exist.
776           --spec  SPEC       An  input  spec template. If not given, the spec
777       template is
778                            auto-located  in  path  as  a  file  ending   with
779       ".spec.rpkg" or
780                            ".spec" suffix in this order.
781
782
783   rpkg upload
784         usage: rpkg upload [-h] files [files ...]
785
786         This  command  will  upload  new  source  file(s) to lookaside cache.
787       Source file
788         names are appended to sources  file,  and  .gitignore  will  be  also
789       updated with
790         new uploaded file(s). Please remember to commit them.
791
792         positional arguments:
793           files
794
795         optional arguments:
796           -h, --help  show this help message and exit
797
798
799   rpkg verify-files
800         usage: rpkg verify-files [-h] [--outdir OUTDIR]
801
802         Locally run 'rpmbuild -bl' to verify the spec file's %files sections.
803       This
804         requires a successful run of 'rpkg install' in advance.
805
806         optional arguments:
807           -h, --help       show this help message and exit
808           --outdir OUTDIR  Output directory with build results.
809
810
811   rpkg verrel
812         usage: rpkg verrel [-h] [--outdir OUTDIR] [--spec SPEC]
813
814         Print the name-version-release.
815
816         optional arguments:
817           -h, --help       show this help message and exit
818           --outdir OUTDIR  Where to put any generated rpm content.  Directory
819       must
820                            exist.
821           --spec  SPEC       An  input  spec template. If not given, the spec
822       template is
823                            auto-located  in  path  as  a  file  ending   with
824       ".spec.rpkg" or
825                            ".spec" suffix in this order.
826
827

CONFIGURATION

829       rpkg  reads  configuration  options  from  the  following files in this
830       order:
831
832           /etc/rpkg.conf,      ~/.config/rpkg.conf,      <gitroot>/rpkg.conf,
833       ./rpkg.conf
834
835       Configuration found in ./rpkg.conf has the highest priority. Configura‐
836       tion in /etc/rpkg.conf has the lowest priority.  <gitroot>  placeholder
837       above  means  the top level of the Git repository we are working in. If
838       we are in a plain directory and all our  parent  directories  are  also
839       plain, reading of <gitroot>/rpkg.conf is simply skipped.
840
841
842   DEFAULT COMMENTED CONFIGURATION
843           [rpkg]
844           # whether to enable spec preprocessing,
845           # that is parsing and evaluation of {{{ ... }}} expressions
846           preprocess_spec = True
847
848           # generate tarball from sources named
849           # according to Source0 definition in
850           # a spec file. Used by `rpkg srpm`.
851           # Deprecated by spec templates.
852           auto_pack = False
853
854           # base directory where results should be stored
855           base_output_path = /tmp/rpkg
856
857           # sets permanent value for --module-name option
858           # for each executed rpkg command
859           # module_name = @group/project
860
861           [git]
862           #  download URL for DistGit lookaside cache, used by `rpkg sources`
863       command
864           # %(ns1)s, %(pkg)s are parts of a module name (e.g. rpms/rpkg-util)
865           # %(filename)s, %(hashtype)s,  %(hash)s,  %(filename)s  fields  are
866       read from 'sources' file if present
867           lookaside                  =                 https://src.fedorapro
868       ject.org/repo/pkgs/%(ns1)s/%(pkg)s/%(file‐
869       name)s/%(hashtype)s/%(hash)s/%(filename)s
870
871           # upload URL for DistGit lookaside cache, used by `rpkg upload`
872           lookaside_cgi = https://src.fedoraproject.org/repo/pkgs/upload.cgi
873
874           # default Git repository URL, used by `rpkg clone <module>`
875           gitbaseurl = ssh://%(user)s@pkgs.fedoraproject.org/%(module)s
876
877           #  default  anonymous  Git  repository  URL, used by `rpkg clone -a
878       <module>`
879           anongiturl = https://src.fedoraproject.org/%(module)s
880
881

EXAMPLES

883       Run %prep phase of an rpm build:
884
885           $ rpkg prep
886           git_pack: packing directory /home/clime/rpkg-util
887           git_pack:        Wrote:        /tmp/rpkg/rpkg-util-1-j8x35rb3/rpkg-
888       util-2.2.git.18.5b6a884.tar.gz
889           Wrote: /tmp/rpkg/rpkg-util-1-j8x35rb3/rpkg-util.spec
890           Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.vE42SH
891           + umask 022
892           + cd /tmp/rpkg/rpkg-util-1-j8x35rb3
893           + cd /tmp/rpkg/rpkg-util-1-j8x35rb3
894           + rm -rf rpkg-util-2.2.git.18.5b6a884
895           +     /usr/bin/gzip     -dc    /tmp/rpkg/rpkg-util-1-j8x35rb3/rpkg-
896       util-2.2.git.18.5b6a884.tar.gz
897           + /usr/bin/tar -xof -
898           + STATUS=0
899           + '[' 0 -ne 0 ']'
900           + cd rpkg-util-2.2.git.18.5b6a884
901           + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
902           + exit 0
903
904       For the following command, you need to have a project in COPR  created.
905       See quick tutorial at
906
907       https://docs.pagure.org/copr.copr/user_documentation.html#quick-start
908
909       on how to do it.
910
911           $ rpkg build
912           git_pack: packing directory /home/clime/rpkg-util
913           git_pack:        Wrote:        /tmp/rpkg/rpkg-util-2-ab6awb8y/rpkg-
914       util-2.2.git.18.0cb6974.tar.gz
915           Wrote: /tmp/rpkg/rpkg-util-2-ab6awb8y/rpkg-util.spec
916           Wrote:                         /tmp/rpkg/rpkg-util-2-ab6awb8y/rpkg-
917       util-2.2.git.18.0cb6974-1.fc28.src.rpm
918           Uploading        package       /tmp/rpkg/rpkg-util-2-ab6awb8y/rpkg-
919       util-2.2.git.18.0cb6974-1.fc28.src.rpm
920           100% |################################| 122kB 359kB/s eta 0:00:00
921           Build was added to rpkg-util:
922             https://copr.fedorainfracloud.org/coprs/build/782327/
923           Created builds: 782327
924
925       Here you can see a simple operation of generation spec file from a tem‐
926       plate:
927
928           $ rpkg spec
929           Wrote: /tmp/rpkg/rpkg-util-3-1u34plfx/rpkg-util.spec
930
931

SPEC TEMPLATES

933       Apart from being useful as a means to handle unpacked as well as packed
934       content, they also make it possible to generate certain parts  of  your
935       spec  file  automatically from a Git repository where your spec file is
936       located. You need to have "spec_preprocess" configuration option set to
937       True in rpkg config to use this functionality.
938
939
940   BASIC EXAMPLE
941           Name:       {{{ git_name }}}
942           Version:    {{{ git_version }}}
943           Release:    1%{?dist}
944           Summary:    This is a test package.
945
946           License:    GPLv2+
947           URL:        https://someurl.org
948           VCS:        {{{ git_vcs }}}
949
950           Source:     {{{ git_pack }}}
951
952           %description
953           This is a test package.
954
955           %prep
956           {{{ git_setup_macro }}}
957
958           %changelog
959           {{{ git_changelog }}}
960
961       Having  a  spec  template  like this in your project (instead of just a
962       plain spec file) allows you to build source and rpm packages  automati‐
963       cally following git history of your project.
964
965
966   MACRO REFERENCE
967       BASE GIT MACROS
968
969              Without  any  parameters,  these macros work on repository level
970              and use globally available repository information.
971
972              NOTE: If your local repository is not  properly  initialized  or
973              if,  for example, the .git metadata directory in your local tree
974              has been renamed or removed, operation of the  base  macros  can
975              get  out  of  the intended scope. It is therefore recommended to
976              use more specific git_dir_* macros  where  possible,  which  are
977              always  bound  to  the  directory  where  the input spec file is
978              located. This is mainly relevant for  git_pack  and  git_archive
979              macros (see below).
980
981              Output  of  every  git macro call is cached and other macros are
982              made to take those cached values into account by  default.   You
983              can  see  that  a  macro  uses a cached value as a default input
984              parameter value by looking at its function header definition and
985              searching for the `cached` keyword.
986
987              E.g.
988
989                  git_version [name="$(cached git_name)"] [lead=0] [follow=]
990
991              Default  value  for  name in this definition is derived from the
992              cached output of the previously  invoked  `git_name`  macro.  If
993              `git_name`  macro  has  not been invoked or if its output was an
994              empty string, the default value for the `name=` parameter  above
995              will be also an empty string.
996
997              Note that $(cached_git_name_version) in the function header def‐
998              initions below is  an  alias  for  "$(cached  git_name)-$(cached
999              git_version)".
1000
1001              git_name [name=] [prepend=] [append=]
1002
1003              Without  any  parameters,  lookup  remote  URL for the currently
1004              active branch and output its basename with .git suffix stripped.
1005              If  the  remote URL could not be determined, use "origin" remote
1006              URL instead.
1007
1008                  Optional arguments:
1009                      name     the base name to be output
1010                      prepend  string to be prepended to the base name
1011                      append   string to be appended to the base name
1012
1013              git_version [name="$(cached git_name)"] [lead=0] [follow=]
1014
1015              Output version of a subpackage given by ${name}. The version  is
1016              a string constructed of the following parts:
1017
1018                  "${lead}.${follow}${commit_count_appendix}${wtree_appendix}"
1019
1020              ${lead}  is  a mandatory argument of the macro. By default it is
1021              set to zero.
1022
1023              ${follow} (if not specified) is obtained from the follow part of
1024              the latest tag made for the subpackage given by ${name}.
1025
1026              ${commit_count_appendix} is generated only if the current commit
1027              is not tagged for the given subpackage and it is composed of the
1028              following parts
1029
1030                  .git.<commit_count>.<latest_commit_short_hash>
1031
1032              Commit  count  is a number of commits from the latest tag on the
1033              given subpackage.
1034
1035              ${wtree_appendix} is generated only if the currently checked out
1036              working tree is dirty. It is composed of the following parts:
1037
1038                  .wtree.<encoded_latest_file_status_change>
1039
1040                  Optional arguments:
1041                      name     name of a subpackage
1042                      lead     major version substring
1043                      follow    minor version substring, dynamically generated
1044              if not specified
1045
1046                  Environment variables:
1047                      VERSION_BUMP: if set to a non-empty value, the following
1048              procedure is applied
1049                      to get the version string:
1050
1051                      If  $follow  is  specified  by  user  explicitly, return
1052              $lead.$follow.
1053
1054                      Otherwise, extract $follow from the latest  tag  as  the
1055              last version component (after the last dot)
1056                      and  return $lead.$follow+1. If $follow is not a number,
1057              throw an error (manual setting of follow
1058                      is needed).
1059
1060                      rpkg sets the VERSION_BUMP variable into the preprocess‐
1061              ing environment during
1062                      execution  of  `rpkg  tag`  subcommand. Otherwise, it is
1063              unset.
1064
1065              git_vcs [subtree=]
1066
1067              Output pseudo repository URL pointing the currently checked  out
1068              tree.
1069
1070              Example           output:          git+ssh://git@pagure.io/test-
1071              project.git#dadef2a8b9554e94797a7336261192e02d5d9351:
1072
1073                  Optional arguments:
1074                      subtree     path to a subtree to generate the URL for
1075
1076              git_pack     [path="$(git      rev-parse      --show-toplevel)"]
1077              [dir_name="$(cached_git_name_version)"]
1078              [source_name="$(cached_git_name_version).tar.gz"]
1079
1080              Pack the whole working tree content  (including  untracked  con‐
1081              tent)  into  a  gzipped  source tarball and output $source_name,
1082              which is a filename of the created tarball.  Uses GNU tar to  do
1083              the job. Files ignored by git as well as .git metadata directory
1084              will be excluded from the resulting tarball.
1085
1086                  Optional arguments:
1087                      path         path  to  a  specific  subdirectory  to  be
1088              packed
1089                      dir_name      top-level  directory  name  in the created
1090              tarball
1091                      source_name  filename of the created source tarball
1092
1093                  Enviroment variables:
1094                      OUTDIR:  if  empty,  git_pack  will  not  generate   any
1095              sources, only the source filename will be output
1096
1097                      rpkg sets OUTDIR, only if the tarball is actually needed
1098              to be generated. It does not set it
1099                      when `rpkg spec` is called (without any additional argu‐
1100              ments).
1101
1102              git_archive     [path="$(git     rev-parse    --show-toplevel)"]
1103              [dir_name="$(cached_git_name_version)"]
1104              [source_name="$(cached_git_name_version).tar.gz"]
1105
1106              Pack  the  latest commit tree content into a gzipped source tar‐
1107              ball and output $source_name, which is a filename of the created
1108              tarball.  Uses `git archive` to do the job. Note that this macro
1109              will refuse to generate a tarball if your working tree is dirty.
1110
1111                  Optional arguments:
1112                      path         path  to  a  specific  subdirectory  to  be
1113              packed
1114                      dir_name      top-level  directory  name  in the created
1115              tarball
1116                      source_name  filename of the created source tarball
1117
1118                  Enviroment variables:
1119                      OUTDIR: if empty,  git_archive  will  not  generate  any
1120              sources, only the source filename will be output
1121
1122                      rpkg sets OUTDIR, only if the tarball is actually needed
1123              to be generated. It does not set it
1124                      when `rpkg spec` is called (without any additional argu‐
1125              ments).
1126
1127              git_setup_macro [dir_name="$(cached_git_name_version)"]
1128
1129              Output  %setup  rpm macro for the given top-level source-tarball
1130              directory.
1131
1132                  Optional arguments:
1133                      dir_name     name of  the  top-level  directory  in  the
1134              source-tarball
1135
1136              git_changelog     [name="$(cached    git_name)"]    [since_tag=]
1137              [until_tag=] [header_locale=POSIX] [header_date_format="%a %b %d
1138              %Y"] [body_wrap=80]
1139
1140              Output rpm spec changelog as generated from tag messages for the
1141              subpackage given by ${name}.
1142
1143                  Optional arguments:
1144                      name                name of the subpackage  to  generate
1145              the changelog for
1146                      since_tag            start  the  changelog  records with
1147              this tag
1148                      until_tag           end the changelog records with  this
1149              tag
1150                      header_locale        locale  to  be  used when changelog
1151              record date is being generated
1152                      header_date_format   date  format  to  be  used  in  the
1153              changelog record headers
1154                      body_wrap            maximum  allowed  line  length  for
1155              changelog body
1156
1157              When `rpkg tag` is called, it allows you to specify a  tag  mes‐
1158              sage.  This  is  the  message  that  will be used as a changelog
1159              record body.
1160
1161
1162
1163       GIT_DIR MACROS
1164
1165              These macros operate on a directory level. In particular,  on  a
1166              directory  where  the  input spec file template is located. They
1167              are basically aliases to the GIT BASE  MACROS  with  some  input
1168              values  set  specifically for the directory-level operation. The
1169              input spec template location is given by INPUT_PATH  environment
1170              variable set by rpkg. You can influence it from the command line
1171              by explicitly specifying  --spec  <template_path>  argument  for
1172              rpkg subcommands that support it.
1173
1174              Below  you  can  see  to what the GIT DIR macros expand. In some
1175              cases, the macro is a direct alias to the  underlying  git  base
1176              macro.
1177
1178              git_dir_name
1179
1180                  git_name  append="-$(git  -C "$(dirname "$INPUT_PATH")" rev-
1181              parse --show-prefix | path_to_name_suffix)"
1182
1183                  Outputs repository origin URL  basename  appended  with  the
1184              path (after slash to dash substitution) from the repository
1185                  root to the spec file's directory.
1186
1187              git_dir_version
1188
1189                  git_version
1190
1191              git_dir_vcs
1192
1193                  git_vcs  subtree="$(git  -C  "$(dirname "$INPUT_PATH")" rev-
1194              parse --show-prefix)"
1195
1196                  Outputs VCS pseudo URL pointing to the spec file's subdirec‐
1197              tory.
1198
1199              git_dir_pack
1200
1201                  git_pack path="$(dirname "$INPUT_PATH")"
1202
1203                  Packs spec file's subdirectory by using GNU tar.
1204
1205              git_dir_archive
1206
1207                  git_archive path="$(dirname "$INPUT_PATH")"
1208
1209                  Packs spec file's subdirectory by using `git archive`.
1210
1211              git_dir_setup_macro
1212
1213                  git_setup_macro
1214
1215              git_dir_changelog
1216
1217                  git_changelog
1218
1219
1220
1221       GIT_CWD MACROS
1222
1223              These  macros  operate on a directory level. In particular, on a
1224              rpkg's working directory. Again, they are  aliases  to  the  GIT
1225              BASE  MACROS  with  some  input  values set specifically for the
1226              directory-level operation.
1227
1228              You can influence the rpkg's working dir from the  command  line
1229              by explicitly specifying its --path argument.
1230
1231              Below  you  can  see  to what the GIT_CWD macros expand. In some
1232              cases, the macro is a direct alias for the underlying  git  base
1233              macro.
1234
1235              git_cwd_name
1236
1237                  git_name  append="-$(git -C "$(pwd)" rev-parse --show-prefix
1238              | path_to_name_suffix)"
1239
1240                  Outputs repository origin URL  basename  appended  with  the
1241              rpkg's  working  directory  path  (after slash to dash substitu‐
1242              tion).
1243
1244              git_cwd_version
1245
1246                  git_version
1247
1248              git_cwd_vcs
1249
1250                  git_vcs subtree="$(git -C "$(pwd)" rev-parse --show-prefix)"
1251
1252                  Outputs VCS pseudo URL pointing to the rpkg's working direc‐
1253              tory.
1254
1255              git_cwd_pack
1256
1257                  git_pack path="$(pwd)"
1258
1259                  Packs rpkg's working directory by using GNU tar.
1260
1261              git_cwd_archive
1262
1263                  git_archive path="$(pwd)"
1264
1265                  Packs rpkg's working directory by using `git archive`.
1266
1267              git_cwd_setup_macro
1268
1269                  git_setup_macro
1270
1271              git_cwd_changelog
1272
1273                  git_changelog
1274
1275

USER-DEFINED MACROS

1277       You  can  define  your own rpkg macros that are basically just standard
1278       bash functions read from rpkg.macros file placed in an  rpkg's  working
1279       directory.  Standard  output  of your custom macro will be captured and
1280       the {{{ <macro_name> }}} invocation in  an  input  spec  file  will  be
1281       replaced with it.
1282
1283       Example of a custom macro placed in rpkg.macros file:
1284
1285           function git_commits_no {
1286               total_commits="$(git rev-list --all --count)"
1287               echo -n "$total_commits"
1288           }
1289
1290

AUTO-PACKING (DEPRECATED)

1292       Auto-packing  works  only  if  auto_pack configuration option is set to
1293       True and only if the content you are working with is  not  packed  (see
1294       `rpkg is-packed`).
1295
1296       When  invoking  `rpkg  srpm` on an unpacked content, rpkg will download
1297       external sources (if any) and then it will generate a tarball from  the
1298       whole content of the working directory named according to Source0 defi‐
1299       nition present in the associated .spec  file.   This  tarball  and  the
1300       .spec file are then passed to rpmbuild to generate the resulting srpm.
1301
1302

PACKED VS UNPACKED

1304       NOTE: This article relates to deprecated auto_pack feature.
1305
1306       While  it is quite intuitive what is packed content (.spec + tarballs +
1307       patches) and what is unpacked content  (.spec  +  original  application
1308       source  files), it might be useful to know how exactly rpkg differenti‐
1309       ates between these two.  You can go through the following  examples  to
1310       get overview how this tool exactly works.
1311
1312
1313   PACKED CONTENT:
1314           $ cd source0-present-example
1315           $ grep -E '(Source|Patch)' testpkg.spec
1316           Source0: foo.tar.gz
1317           $ ls .
1318           foo.tar.gz testpkg.spec
1319           $ rpkg make-source
1320           Could not execute make_source: Not an unpacked content.
1321           $ rpkg srpm
1322           Failed to get module name from Git url or pushurl.
1323           Wrote: source0-present-example/testpkg-1-1.fc25.src.rpm
1324
1325           The error about module name is caused by running `rpkg`
1326           on a plain directory content and not a Git repo. In this
1327           case, module name is read out from the spec file. The
1328           error about not being able to make source is expected for
1329           packed content (tarballs to be put into srpm are expected
1330           to be present already).
1331
1332           $ cd only-ignored-files-example
1333           $ grep -E '(Source|Patch)' testpkg.spec
1334           Source0: https://example.org/foo.tar.gz
1335           $ ls .
1336           README.md testpkg.spec
1337           $ rpkg make-source
1338           Could not execute make_source: Not an unpacked content.
1339           $ echo '%_disable_source_fetch 0' >> ~/.rpmmacros
1340           $ rpkg srpm
1341           Failed to get module name from Git url or pushurl
1342           warning:   Downloading   https://example.org/foo.tar.gz   to  only-
1343       ignored-files-example/foo.tar.gz
1344           Wrote: only-ignored-files-example/testpkg-1-1.fc25.src.rpm
1345
1346           In this example, sources are downloaded from network when
1347           srpm is being built. The %_disable_source_fetch rpm macro
1348           must be set to 0 and the tarball url must be valid for this
1349           to work. The content is recognized as packed because there
1350           are only ignored files in the directory (.spec and readmes).
1351
1352
1353   UNPACKED CONTENT:
1354           $ cd cpp-source-file-present-example
1355           $ git init .
1356           $ git remote add origin https://github.com/testpkg.git
1357           $ grep -E '(Source|Patch)' testpkg.spec
1358           Source0: foo.tar.gz
1359           $ ls .
1360           main.cpp testpkg.spec
1361           $ rpkg make-source
1362           Wrote: cpp-source-file-present-example/foo.tar.gz
1363           $ rpkg srpm
1364           Wrote: cpp-source-file-present-example/testpkg-1-1.fc25.src.rpm
1365
1366           foo.tar.gz (the only Source referenced from the .spec file) is
1367           not present and there is unignored main.cpp file that makes the
1368           content recognized as unpacked. When `rpkg make-source` is invoked,
1369           foo.tar.gz is created and will contain the main.cpp file (as
1370           well as the .spec metadata file but that is just because the
1371           whole content directory is packed). Note that the error about
1372           failing to get module name from Git url disappeared because
1373           we have run `git init .` and `git remote add ...`.
1374
1375

SEE ALSO

1377       https://pagure.io/rpkg-util/
1378
1379
1380
1381                                  2021-02-20                           rpkg(1)
Impressum