Merge pull request #1165 from aurutils/sync-filter-verify
[aurutils.git] / man1 / aur.1
blob17bb10aa99b4abedc80e4223b3a0626bc6da7143
1 .TH AUR 1 2023-02-03 AURUTILS
2 .SH NAME
3 aur \- helper tool for the arch user repository
5 .SH DESCRIPTION
6 .BR aur (1)
7 is the command wrapper for
8 .BR aurutils ,
9 a collection of scripts to automate usage of the Arch User
10 Repository. Different tasks such as update checks, package searching,
11 and computing dependencies are split to separate commands.
12 .PP
13 The chosen approach for managing packages is local pacman
14 repositories, instead of foreign (installed by
15 .BR "pacman \-U" )
16 packages.
17 .PP
18 A brief overview of local repositories is given in the
19 .B "CREATING A LOCAL REPOSITORY"
20 section.
22 .SH AUR COMMANDS
23 The below gives a short overview; see the respective documentation for
24 details.
25 .PP
26 .BR aur (1)
27 searches for commands in
28 .BR /usr/lib/aurutils/
29 by default, followed by
30 .B $PATH
31 as set in the environment. A different path may be set at run-time
32 through the
33 .B AUR_EXEC_PATH
34 environment variable, for example
35 .IR /usr/local/lib/aurutils:/usr/lib/aurutils .
38 .BR aur\-build (1)
39 .RS 4
40 Build packages to a local repository.
41 .RE
44 .BR aur\-chroot (1)
45 .RS 4
46 Build pacman packages with systemd-nspawn.
47 .RE
50 .BR aur\-depends (1)
51 .RS 4
52 Retrieve dependencies using aurweb.
53 .RE
56 .BR aur\-fetch (1)
57 .RS 4
58 Fetch packages from a location.
59 .RE
62 .BR aur\-format (1)
63 .RS 4
64 Format AurJson output to text strings.
65 .RE
68 .BR aur\-graph (1)
69 .RS 4
70 Print package/dependency directed graph.
71 .RE
74 .BR aur\-pkglist (1)
75 .RS 4
76 Print the AUR package list.
77 .RE
80 .BR aur\-query (1)
81 .RS 4
82 Send GET requests to the aurweb RPC interface.
83 .RE
86 .BR aur\-repo (1)
87 .RS 4
88 Manage local repositories.
89 .RE
92 .BR aur\-repo\-filter (1)
93 .RS 4
94 Filter packages in the Arch Linux repositories.
95 .RE
98 .BR aur\-search (1)
99 .RS 4
100 Search for AUR packages.
104 .BR aur\-srcver (1)
105 .RS 4
106 List version of VCS packages.
110 .BR aur\-sync (1)
111 .RS 4
112 Download and build AUR packages automatically.
116 .BR aur\-vercmp (1)
117 .RS 4
118 Check packages for AUR updates.
122 .BR aur\-view (1)
123 .RS 4
124 Inspect
125 .BR git (1)
126 repositories.
129 .SH CREATING A LOCAL REPOSITORY
130 A local repository may be configured directly in
131 .BR /etc/pacman.conf ,
132 or in a separate file specified with the
133 .B Include
134 directive. This section documents an example configuration; for
135 details, consult the
136 .BR pacman.conf (5)
137 man page.
140 .B Note:
141 Avoid naming the repository
142 .IR local ,
143 as this name is reserved by
144 .BR pacman (8).
147 .B Tip:
148 Consider separate repositories for different purposes, such as
149 version control packages.
151 .SS Pacman configuration
152 For the purposes of this example, we assume the local repository
153 .I custom
154 is located in
155 .IR /home/custompkgs .
157 Append a section for the local repository to
158 .IR /etc/pacman.conf
161     [custom]
162     SigLevel = Optional TrustAll
163     Server = file:///home/custompkgs
166 Create the repository root and database:
169     $ sudo install \-d /home/custompkgs \-o $USER
170     $ repo\-add /home/custompkgs/custom.db.tar.gz
173 If built packages are available, add them to the database:
176     $ cd /home/custompkgs
177     $ repo\-add \-n custom.db.tar.gz *.pkg.tar*
180 Synchronize pacman:
183     $ sudo pacman \-Syu
186 .SS CacheDir (optional)
187 When packages from a local repository are installed through
188 .BR "pacman \-S" ,
189 they are copied to a cache directory (usually
190 .IR /var/cache/pacman/pkg )
192 .BR pacman .
193 Besides using additional space, this may result in checksum mismatches
194 when rebuilding packages without increasing
195 .BR pkgrel .
196 (See GitHub issue #85)
198 To avoid this, set the repository path as a
199 .B pacman
200 .IR CacheDir ,
201 together with the
202 .B "CleanMethod = KeepCurrent"
203 setting to avoid unexpected deletion of built packages with
204 .BR "pacman \-Sc" .
206 This can be done by editing
207 .IR /etc/pacman.conf
208 as follows:
211     [options]
212     CacheDir = /var/cache/pacman/pkg /home/custompkgs
213     CleanMethod = KeepCurrent
216 In addition,
217 .B SigLevel
218 should be set to
219 .B Never
221 .BR Required ,
222 if package signing is disabled or enabled, respectively. This avoids
223 .B pacman
224 copying over packages to the main
225 .BR CacheDir ,
226 if signature files are missing and
227 .B SigLevel = Optional
228 is set. (FS#71109)
230 Note that
231 .BR "pacman \-Scc"
232 will remove packages regardless of the
233 .B CleanMethod
234 setting.
236 .SH EXAMPLES
237 In this section, we assume that
238 .BR bash (1)
239 is the interactive shell.
241 .SS Arch User Repository
242 Run actions on the dependency tree of an AUR package:
245     $ aur depends \-r foo \-n | tsort | while read \-r pkg; do ... done
248 Retrieve AUR pkgbases and their dependencies recursively:
251     $ aur depends \-r foo | tsort | aur fetch \-
254 Retrieve all AUR packages from a given maintainer:
257     $ aur search \-m mcaur \-\-json | aur format \-f \(aq%b\\n\(aq | aur fetch \-
260 Build
261 .I plasma\-desktop\-git
262 and its dependencies with
263 .BR systemd\-nspawn (1):
266     $ aur sync \-c plasma\-desktop\-git
269 Update all AUR packages in a single local repository:
272     $ aur sync \-u
275 Check foreign packages for AUR updates:
278     $ pacman \-Qm | aur vercmp
281 Check the
282 .I custom
283 repository for AUR updates:
286     $ aur repo \-d custom \-\-list | aur vercmp
290 .B pacman.conf
291 only contains one local repository, the above may be shortened to:
294     $ aur repo \-\-upgrades
297 .SS Arch User Repository - advanced usage
298 Print packages from the
299 .I custom
300 repository that are unavailable in the AUR:
303     $ grep \-Fxvf <(aur pkglist) <(pacman \-Slq custom)
306 As above, but for orphaned packages:
309     $ pacman \-Slq custom | aur query \-t info \- | \e
310           jq \-r \(aq.results[] | select(.Maintainer == null)\(aq
313 Update packages in the
314 .I custom
315 repository which are installed on the host:
318     $ grep \-Fxf <(pacman \-Qq) <(pacman \-Slq custom) > installed.txt
319     $ xargs \-a installed.txt aur sync \-d custom
322 Search for AUR packages with both
323 .I wm
325 .I git
326 in the name:
329     $ aur pkglist \-P \(aq(?=.*wm)(?=.*git)\(aq | aur search \-i \-
332 Select an AUR package with name matching
333 .IR pony ,
334 and build the result:
337     $ select a in $(aur pkglist \-F pony); do aur sync "$a"; break; done
340 .SS Official repositories
341 Print Perl modules that are both in the AUR and official repositories:
344     $ aur pkglist \-P \(aq^perl\-.+\(aq > perl.txt
345     $ grep \-Fxf <(aur repo\-filter < perl.txt) perl.txt
348 Print packages both in AUR and
349 .I [community]
350 and compare their versions:
353     $ aur repo \-d community \-\-all
356 .SS Using PKGBUILDs
357 Build packages in the
358 .I pkgbuilds
359 github repository (generating required
360 .B .SRCINFO
361 files):
364     $ git clone https://www.github.com/Earnestly/pkgbuilds
365     $ cd pkgbuilds
366     $ find \-name PKGBUILD \-execdir sh \-c \(aqmakepkg \-\-printsrcinfo > .SRCINFO\(aq \e;
367     $ aur graph */.SRCINFO | tsort | tac > queue # Remove unwanted targets
368     $ aur build \-a queue
371 Build a package for a different architecture, here \fIi686\fR:
374     $ setarch i686 aur sync \-c \-\-repo=custom_i686 tclkit
378 .SS Custom commands
379 The following scripts are examples of custom commands added anywhere
380 in $PATH, for example
381 .IR /usr/local/bin .
383 .BR aur\-gc
386     #!/bin/bash
387     # Remove unused build files in aur\-sync cache
388     XDG_CACHE_HOME=${XDG_CACHE_HOME:\-$HOME/.cache}
389     AURDEST=${AURDEST:\-$XDG_CACHE_HOME/aurutils/sync}
391     # Assumes build files were retrieved through git(1)
392     find "$AURDEST" \-name .git \-execdir git clean \-xdf \e;
394     # Print directories which do not contain a PKGBUILD file
395     for d in "$AURDEST"/*; do
396         if [[ \-d $d ]] && [[ ! \-f $d/PKGBUILD ]]; then
397             printf \(aq%s\en\(aq "$d"
398         fi
399     done
403 .BR aur\-remove
406     #!/bin/sh \-\-
407     # aur\-remove \- remove listed packages from all local repositories
409     if [ "$#" \-eq 0 ]; then
410         printf \(aqusage: aur remove package [package ...]\en\(aq >&2
411         exit 1
412     fi
414     aur repo \-\-list\-path | while read \-r repo_path; do
415         repo\-remove "$repo_path" "$@"
416         paccache \-c "${repo_path%/*}" \-rvk0 "$@"
417     done
420 .SS Using third-party helpers
421 Repository packages can be "made foreign" by temporarily removing the
422 repository from the pacman configuration. This can be used with programs
423 that support the
424 .B PACMAN
425 environment variable and check foreign packages for AUR updates.
427 For example, create the
428 .I mypacman
429 script in
430 .IR /usr/local/bin/mypacman :
433     #!/bin/sh
434     pacman \-\-config=/usr/share/devtools/pacman\-extra.conf "$@"
437 and point the
438 .B PACMAN
439 variable towards it:
442     $ export PACMAN=/usr/local/bin/mypacman
445 .SH ENVIRONMENT
446 Environment variables for
447 .B aur
448 programs are prefixed with
449 .BR AUR .
450 Where applicable, standard variables such as
451 .B XDG_CONFIG_HOME
452 are respected. Variables supported by specific programs are listed
453 in their respective man pages (see
454 .BR "AUR COMMANDS" ).
456 Variables can be set in the user environment or in
457 .IR $XDG_CONFIG_HOME/aurutils/env ,
458 using a key/value format separated by newlines. For example:
462 AURDEST=/home/custompkgs
463 AUR_PACMAN_AUTH=sudo --askpass
464 AUR_PAGER=ranger
465 AUR_REPO=custom
470 .B AUR_DEBUG
471 Setting this variable enables debug mode (typically
472 .B xtrace
474 .BR bash (1)
475 scripts) in
476 .B aur
477 programs.
480 .B AUR_EXEC_PATH
481 The path in which
482 .B aur
483 searches for commands, prepended to
484 .BR $PATH .
485 Defaults to
486 .BR /usr/lib/aurutils .
489 .B NO_COLOR
490 Output colorization can be disabled by setting this environment
491 variable.
493 .SH EXIT STATUS
494 Programs follow a subset of
495 .BR errno (3),
496 or preserve command status where
497 applicable.
499 .SH AUTHORS
500 .MT https://github.com/AladW
501 Alad Wenter
504 .\" vim: set textwidth=72