Compare commits

..

No commits in common. "master" and "v3.2.2" have entirely different histories.

927 changed files with 65198 additions and 254356 deletions

View file

@ -1,24 +0,0 @@
# EditorConfig configuration for pacman
# https://editorconfig.org
# Top-most EditorConfig file
root = true
# Unix-style newlines without trailing whitespaces, but with a newline
# ending every file, utf-8 charset, set indent to tabs
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = tab
[{NEWS,HACKING}]
indent_style = space
[meson.build]
indent_style = space
indent_size = 2
[*.py]
indent_style = space

1
.gitattributes vendored
View file

@ -1 +0,0 @@
*.py diff=python

29
.gitignore vendored
View file

@ -1,3 +1,30 @@
*~
Makefile
Makefile.in
mkinstalldirs
aclocal.m4
autom4te.cache
config.guess
config.h
config.h.in
config.log
config.status
config.status.lineno
config.rpath
config.sub
configure
configure.lineno
depcomp
install-sh
libtool
ltmain.sh
missing
stamp-h1
*.o
*~
root
tags
cscope.out
cscope.in.out
cscope.po.out
pacman-*.tar.gz

View file

@ -1,132 +0,0 @@
variables:
MAKEFLAGS: "-j10"
VERBOSE: 1
default:
after_script:
- build-aux/print-failed-test-output build/meson-logs/testlog.json
.arch-test:
image: archlinux:base-devel
before_script:
- >
pacman -Syu --needed --noconfirm
git
gpgme libarchive curl
python
fakeroot fakechroot
meson
artifacts:
when: always
paths:
- build/meson-logs/meson-log.txt
arch:
extends: .arch-test
script:
- meson setup build
- ninja -C build
- fakechroot meson test -C build
arch-debug:
extends: .arch-test
script:
- meson setup --buildtype=debug --werror build
- ninja -C build
- fakechroot meson test -C build
arch-docs:
extends: .arch-test
script:
- pacman -Syu --needed --noconfirm asciidoc
- meson setup -Ddoc=enabled build
- ninja -C build
arch-clang:
extends: .arch-test
script:
- pacman -Syu --needed --noconfirm clang
- CC=clang meson setup build
- ninja -C build
- fakechroot meson test -C build
#arch-valgrind:
# extends: .arch-test
# script:
# - pacman -Syu --needed --noconfirm valgrind
# - pacman -U --noconfirm https://geo.mirror.pkgbuild.com/core-debug/os/x86_64/glibc-debug-$(pacman -S --print-format %v glibc)-x86_64.pkg.tar.zst
# - meson setup build
# - ninja -C build
# - PACTEST_VALGRIND=1 fakechroot meson test -C build
arch-nettle:
extends: .arch-test
script:
- meson setup -Dcrypto=nettle --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
arch-no-gpg:
extends: .arch-test
script:
- meson setup -Dgpgme=disabled --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
arch-no-curl:
extends: .arch-test
script:
- meson setup -Dcurl=disabled --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
arch-no-nls:
extends: .arch-test
script:
- meson setup -Di18n=false --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
debian:
image: debian:bookworm
before_script:
- apt update
- >
apt -y install --no-install-recommends
git pkg-config meson gcc libtool
libgpgme-dev libarchive-dev libcurl4-openssl-dev libssl-dev curl
gettext python3 python3-setuptools dash gawk ca-certificates
fakeroot fakechroot
script:
- meson setup --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
fedora:
image: fedora
before_script:
- >
dnf -y install
git findutils patch sed
meson gcc libtool bsdtar
gpgme-devel libarchive-devel libcurl-devel openssl-devel gettext-devel
asciidoc python3 dash gawk
fakeroot fakechroot
perl-Module-Load-Conditional
script:
- meson setup --buildtype=debug build
- ninja -C build
- fakechroot meson test -C build
pages:
extends: .arch-test
script:
- pacman -Syu --needed --noconfirm asciidoc
- meson setup -Ddoc=enabled build
- ninja -C build html
artifacts:
paths:
- build/doc
publish: build/doc
rules:
- if: $CI_COMMIT_BRANCH == "release/6.1.x"

View file

@ -1,35 +0,0 @@
Aaron Griffin <aaron@archlinux.org> <aaronmgriffin@gmail.com>
Allan McRae <allan@archlinux.org> <mcrae_allan@hotmail.com>
Allan McRae <allan@archlinux.org> <mcrae_allan at hotmail.com>
Allan McRae <allan@archlinux.org> <allan.mcrae@qimr.edu.au>
Andres P <aepd87@gmail.com> <stderr@mail.com>
Andrew Gregory <andrew.gregory.8@gmail.com>
Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
Bryan Ischo <bryan@ischo.com> <bji-keyword-pacman.3644cb@www.ischo.com>
Christos Nouskas <nous@archlinux.us> <nouskas@gmail.com>
Daenyth Blank <daenyth+arch@gmail.com> <Daenyth+Arch@gmail.com>
Daenyth Blank <Daenyth+arch@gmail.com> <Daenyth+git@gmail.com>
Dave Reisner <dreisner@archlinux.org> <d@falconindy.com>
甘露(Gan Lu) <rhythm.gan@gmail.com>
Giovanni Scafora <giovanni@archlinux.org> <linuxmania@gmail.com>
Jan Alexander Steffens (heftig) <heftig@archlinux.org> <jan.steffens@gmail.com>
Jaroslaw Swierczynski <swiergot@gmail.com> <swiergot@juvepoland.com>
Jonathan Conder <j@skurvy.no-ip.org> <jonno.conder@gmail.com>
Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar>
Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar> <jotapesan@gmail.com>
Manuel Tortosa <manutortosa@chakra-project.org> <manutortosa@gmail.com>
Marc - A. Dahlhaus <mad@wol.de>
Matthias Gorissen <matthias@archlinux.de> <siquame@web.de>
morganamilo <morganamilo@archlinux.org> <morganamilo@gmail.com>
Laszlo Papp <djszapi@archlinux.us> <djszapi2@gmail.com>
Nagy Gabor <ngaba@bibl.u-szeged.hu> <ngaba@petra.hos.u-szeged.hu>
Nagy Gabor <ngaba@bibl.u-szeged.hu> <ngaba at bibl.u-szeged.hu>
Nezmer <git@nezmer.info> <Nezmer@allurelinux.org>
Roman Kyrylych <roman@archlinux.org> <roman.kyrylych@gmail.com>
Sebastian Nowicki <sebnow@gmail.com> <xilonmu@gmail.com>
Vojtěch Gondžala <vojtech.gondzala@gmail.com> <vogo@seznam.cz>
Vojtěch Gondžala <vojtech.gondzala@gmail.com> Vojtech Gondzala <vojtech.gondzala@gmail.com>
William Giokas <1007380@gmail.com>
Xavier Chantry <shiningxc@gmail.com>
Xavier Chantry <shiningxc@gmail.com> <chantry.xavier@gmail.com>
Xavier Chantry <shiningxc@gmail.com> <xav@chantry.homelinux.org>

View file

@ -1,18 +0,0 @@
[main]
host = https://www.transifex.com
[o:toofishes:p:archlinux-pacman:r:libalpm-pot]
file_filter = lib/libalpm/po/<lang>.po
source_file = lib/libalpm/po/libalpm.pot
source_lang = en
[o:toofishes:p:archlinux-pacman:r:pacman-pot]
file_filter = src/pacman/po/<lang>.po
source_file = src/pacman/po/pacman.pot
source_lang = en
[o:toofishes:p:archlinux-pacman:r:pacman-scripts-pot]
file_filter = scripts/po/<lang>.po
source_file = scripts/po/pacman-scripts.pot
source_lang = en

17
AUTHORS
View file

@ -1 +1,16 @@
Use `git shortlog -s` for a list of contributors.
Judd Vinet <jvinet@zeroflux.org>
Aurelien Foret <aurelien@archlinux.org>
Aaron Griffin <aaron@archlinux.org>
Dan McGee <dan@archlinux.org>
Miklós Vajna <vmiklos@frugalware.org>
Christian Hamar <krics@linuxforum.hu>
Josh Wheeler <deltalima@gmail.com>
David Kimpe <DNAku@frugalware.org>
James Rosten <seinfeld90@gmail.com>
Roman Kyrylych <Roman.Kyrylych@gmail.com>
Andrew Fyfe <andrew@neptune-one.net>
Chantry Xavier <shiningxc@gmail.com>
Nagy Gabor <ngaba@petra.hos.u-szeged.hu>
Nathan Jones <nathanj@insightbb.com>
Allan McRae <mcrae_allan@hotmail.com>

16
ChangeLog.proto Normal file
View file

@ -0,0 +1,16 @@
2007-12-01 Your Name <youremail@domain.com>
* pkgver-pkgrel :
new upstream release.
Reason we changed stuff.
Another reason we changed stuff.
* gcc-4.1.patch :
Removed, no longer needed.
2007-11-01 Your Name <youremail@domain.com>
* 1.0-5 :
added ChangeLog.
the last line should end with just one newline.
you can cat the file to check it displays fine.

120
HACKING
View file

@ -6,13 +6,16 @@ concerns when hacking on pacman. If you are interested in contributing, please
read link:submitting-patches.html[submitting-patches] and
link:translation-help.html[translation-help] as well.
Coding Style
Coding style
------------
1. All code should be indented with tabs. (Ignore the use of only spaces in
this file.) A tab size of two spaces is used when calculating line widths,
which should be a maximum of 80 characters. An EditorConfig file is used
to set this project-wide default.
this file) By default, source files contain the following VIM modeline:
+
[code,C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* vim: set ts=2 sw=2 noet: */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2. When opening new blocks such as 'while', 'if', or 'for', leave the opening
brace on the same line as the beginning of the codeblock. The closing brace
@ -21,8 +24,8 @@ Coding Style
braces, even if it's just a one-line block. This reduces future error when
blocks are expanded beyond one line.
+
[source,C]
-------------------------------------------
[code,C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
for(lp = list; lp; lp = lp->next) {
newlist = _alpm_list_add(newlist, strdup(lp->data));
}
@ -32,19 +35,19 @@ while(it) {
if(fn) {
fn(it->data);
} else {
return 1;
return(1);
}
free(it);
it = ptr;
}
-------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3. When declaring a new function, put the opening and closing braces on their
own line. Also, when declaring a pointer, do not put a space between the
asterisk and the variable name.
+
[source,C]
-------------------------------------------
[code,C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
{
alpm_list_t *ptr, *lp;
@ -55,7 +58,7 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
}
...
}
-------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4. Comments should be ANSI-C89 compliant. That means no `// Comment` style;
use only `/* Comment */` style.
@ -64,13 +67,21 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
NOT
// This is a comment
5. Return statements should *not* be written like function calls.
5. Return statements should be written like a function call.
return 0;
NOT
return(0);
NOT
return 0;
6. When using strcmp() (or any function that returns 0 on success) in a
6. The sizeof() operator should accept a type, not a value. (TODO: in certain
cases, it may be better- should this be a set guideline? Read "The Practice
of Programming")
sizeof(alpm_list_t);
NOT
sizeof(*mylist);
7. When using strcmp() (or any function that returns 0 on success) in a
conditional statement, use != 0 or == 0 and not the negation (!) operator.
It reads much cleaner for humans (using a negative to check for success is
confusing) and the compiler will treat it correctly anyway.
@ -79,61 +90,6 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
NOT
if(!strcmp(a, b))
7. Use spaces around almost all arithmetic, comparison and assignment
operators and after all ',;:' separators.
foobar[2 * size + 1] = function(a, 6);
NOT
foobar[2*size+1]=function(a,6);
for(a = 0; a < n && n > 0; a++, n--) {}
NOT
for(a=0;a<n&&n>0;a++,n--) {}
8. Declare all variables at the start of the block.
[source,C]
-------------------------------------------
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
{
char *newurl, *vdata = NULL;
newurl = url;
if(!newurl) {
return -1;
}
...
if(vdata) {
...
}
return 1;
}
-------------------------------------------
NOT
[source,C]
-------------------------------------------
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
{
char *newurl = url;
if(!newurl) {
return -1;
}
char *vdata = NULL;
if(vdata) {
...
}
return 1;
}
-------------------------------------------
Other Concerns
--------------
@ -145,34 +101,38 @@ Currently our #include usage is in messy shape, but this is no reason to
continue down this messy path. When adding an include to a file, follow this
general pattern, including blank lines:
[source,C]
-------------------------------------------
[code,C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include "config.h"
#include <standardheader.h>
#include <another.h>
#include <...>
-------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Follow this with some more headers, depending on whether the file is in libalpm
or pacman proper. For libalpm:
[source,C]
-------------------------------------------
[code,C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* libalpm */
#include "yourfile.h"
#include "alpm_list.h"
#include "anythingelse.h"
-------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For pacman:
[source,C]
-------------------------------------------
[code,C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <alpm.h>
#include <alpm_list.h>
/* pacman */
#include "yourfile.h"
#include "anythingelse.h"
-------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Never directly include config.h. This will always be added via Makefiles.
/////
vim: set ts=2 sw=2 syntax=asciidoc et:
/////

234
INSTALL Normal file
View file

@ -0,0 +1,234 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

32
Makefile.am Normal file
View file

@ -0,0 +1,32 @@
SUBDIRS = lib/libalpm src/util src/pacman scripts etc po pactest contrib
if WANT_DOC
SUBDIRS += doc
endif
# Make sure we test and build manpages when doing distcheck
DISTCHECK_CONFIGURE_FLAGS = --enable-doc --disable-git-version
# Some files automatically included, so they aren't specified below:
# AUTHORS, COPYING, NEWS, README
EXTRA_DIST = HACKING
# Sample makepkg prototype files
pkgdatadir = ${datadir}/${PACKAGE}
dist_pkgdata_DATA = PKGBUILD.proto proto.install ChangeLog.proto
# run the pactest test suite and vercmp tests
check-local: pactest src/pacman src/util
$(PYTHON) $(top_srcdir)/pactest/pactest.py --debug=1 \
--test $(top_srcdir)/pactest/tests/*.py \
-p $(top_builddir)/src/pacman/pacman
rm -rf $(top_builddir)/root
$(SH) $(top_srcdir)/pactest/vercmptest.sh \
$(top_builddir)/src/util/vercmp
# create the pacman DB and cache directories upon install
install-data-local:
for dir in "$(DESTDIR)$(localstatedir)/lib/pacman" "$(DESTDIR)$(localstatedir)/cache/pacman/pkg"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
# vim:set ts=2 sw=2 noet:

1122
NEWS

File diff suppressed because it is too large Load diff

View file

@ -3,11 +3,10 @@
# NOTE: Please fill out the license field for your package! If it is unknown,
# then please put 'unknown'.
# Maintainer: Your Name <youremail@domain.com>
# Contributor: Your Name <youremail@domain.com>
pkgname=NAME
pkgver=VERSION
pkgrel=1
epoch=
pkgdesc=""
arch=()
url=""
@ -15,7 +14,6 @@ license=('GPL')
groups=()
depends=()
makedepends=()
checkdepends=()
optdepends=()
provides=()
conflicts=()
@ -23,30 +21,16 @@ replaces=()
backup=()
options=()
install=
changelog=
source=("$pkgname-$pkgver.tar.gz"
"$pkgname-$pkgver.patch")
source=($pkgname-$pkgver.tar.gz)
noextract=()
sha256sums=()
validpgpkeys=()
prepare() {
cd "$pkgname-$pkgver"
patch -p1 -i "$srcdir/$pkgname-$pkgver.patch"
}
md5sums=() #generate with 'makepkg -g'
build() {
cd "$pkgname-$pkgver"
./configure --prefix=/usr
make
cd "$srcdir/$pkgname-$pkgver"
./configure --prefix=/usr
make || return 1
make DESTDIR="$pkgdir/" install
}
check() {
cd "$pkgname-$pkgver"
make -k check
}
package() {
cd "$pkgname-$pkgver"
make DESTDIR="$pkgdir/" install
}
# vim:set ts=2 sw=2 et:

548
README
View file

@ -6,7 +6,7 @@ Package Management) library. This document, while not exhaustive, also
indicates some limitations (on purpose, or sometimes due to its poor design) of
the library at the present time.
There is one special file, "alpm.h", which is the public interface that
There is one special file,"alpm.h", which is the public interface that
should be distributed and installed on systems with the library. Only
structures, data and functions declared within this file are made available to
the frontend. Lots of structures are of an opaque type and their fields are
@ -51,18 +51,14 @@ library is initialized.
* logcb: The callback function for "log" operations.
* dlcb: The callback function for download progress of each package.
* fetchcb: Callback for custom download function.
* eventcb: Callback for transaction messages.
* questioncb: Callback for selecting amongst choices.
* progresscb: Callback to handle display of transaction progress.
* gpgdir: Directory where GnuPG files are stored.
* arch: Allowed package architecture.
* checkspace: Check disk space before installing.
* default_siglevel: Default signature verification level.
* local_file_siglevel: Signature verification level for local file upgrades.
* remote_file_siglevel: Signature verification level for remote file upgrades.
* totaldlcb: The callback function for overall download progress.
* root: The root directory for pacman to install to (Default: /)
* dbpath: The toplevel database directory (Default: /var/lib/pacman)
* logfile: The base path to pacman's log file (Default: /var/log/pacman.log)
* usesyslog: Log to syslog instead of `logfile` for file-base logging.
* xfercommand: The command to use for downloading instead of pacman's internal
downloading functionality.
* nopassiveftp: Do not use passive FTP commands for ftp connections.
The following options also have `alpm_option_{add,remove}_*` functions, as the
values are list structures.
@ -74,13 +70,18 @@ alpm_option_{get,set}_noupgrades -> alpm_option_{add,remove}_noupgrade.
* noextracts: Files which will never be extracted at all (no .pacnew file)
* ignorepkgs: Packages to ignore when upgrading.
* ignoregrps: Groups to ignore when upgrading.
* holdpkgs: Important packages which need a confirmation before being removed.
The following options are read-only, having ONLY alpm_option_get_* functions:
* root: The root directory for pacman to install to
* dbpath: The toplevel database directory
* lockfile: The file used for locking the database (Default: <dbpath>/db.lck)
* lockfile: The file used for locking the database
(Default: <dbpath>/db.lck)
* localdb: A pmdb_t structure for the local (installed) database
* syncdbs: A list of pmdb_t structures to which pacman can sync from.
The following options are write-only, having ONLY alpm_option_set_* functions:
* usedelta: Download delta files instead of complete packages if possible.
[Transactions]
@ -156,7 +157,7 @@ specified error code into a more friendly sentence, and alpm_strerrorlast()
does the same for the last error encountered (represented by pm_errno).
[List - alpm_list_t]
[List - alpm_list_t]
The alpm_list_t structure is a doubly-linked list for use with the libalpm
routines. This type is provided publicly so that frontends are free to use it
@ -194,8 +195,8 @@ remove.c and sync.c).
The frontend is using a configuration file, usually "/etc/pacman.conf". Some
of these options are only useful for the frontend only (mainly the ones used to
control the output like verbosepkglist, or the behavior with cleanmethod).
The rest is used to configure the library.
control the output like showsize or totaldownload, or the behavior with
cleanmethod and syncfirst). The rest is used to configure the library.
[UPGRADE/REMOVE/SYNC]
@ -239,520 +240,9 @@ API CHANGES BETWEEN 3.1 AND 3.2
- alpm_checkdbconflicts()
- alpm_sync_newversion()
- alpm_deptest()
- error codes:
- error codes :
PM_ERR_DLT_INVALID, PM_ERR_LIBARCHIVE, PM_ERR_LIBDOWNLOAD and
PM_ERR_EXTERNAL_DOWNLOAD
- flags:
PM_TRANS_FLAG_ALLEXPLICIT, PM_TRANS_FLAG_UNNEEDED and
PM_TRANS_FLAG_RECURSEALL
API CHANGES BETWEEN 3.2 AND 3.3
===============================
[REMOVED]
- pmsyncpkg_t struct (pmpkg_t is used for all types of transaction targets):
- alpm_sync_get_pkg()
- alpm_sync_get_removes() (use alpm_pkg_get_removes() instead)
- HoldPkg handling (it is the front-end's task):
- alpm_option_get_holdpkgs()
- alpm_option_add_holdpkg()
- alpm_option_set_holdpkgs()
- alpm_option_remove_holdpkg()
- PM_TRANS_CONV_REMOVE_HOLDPKG conversation
- Print URIs feature (it is the front-end's task):
- flag: PM_TRANS_FLAG_PRINTURIS
- event: PM_TRANS_EVT_PRINTURI
- alpm_delta_get_from_md5sum() and alpm_delta_get_to_md5sum()
- alpm_sync_sysupgrade()
- error codes:
PM_ERR_TRANS_COMMITING, PM_ERR_TRANS_DOWNLOADING, PM_ERR_PKG_LOAD,
PM_ERR_PKG_CANT_FRESH, PM_ERR_GRP_NOT_FOUND, PM_ERR_USER_ABORT,
PM_ERR_INTERNAL_ERROR, PM_ERR_DB_SYNC, PM_ERR_PKG_HOLD and
PM_ERR_LIBDOWNLOAD
[CHANGED]
- XferCommand support was removed, any fetch callback function can be defined:
- alpm_option_get_xfercommand() and alpm_option_set_xfercommand() were removed
- alpm_option_get_fetchcb() and alpm_option_set_fetchcb() were added
- function renames:
- alpm_db_getpkgcache() -> alpm_db_get_pkgcache()
- alpm_db_getgrpcache() -> alpm_db_get_grpcache()
- alpm_dep_get_string() -> alpm_dep_compute_string()
- alpm_get_md5sum() -> alpm_compute_md5sum()
- alpm_checkdbconflicts() -> alpm_checkconflicts()
- alpm_trans_sysupgrade() has a new enable_downgrade parameter
- alpm_checkdeps() and alpm_checkconflicts() require local package list instead
of local database
- the to-be-upgraded package is passed to the callback function with
PM_TRANS_EVT_UPGRADE_START (as the second parameter)
- the "requiredby" package is never passed to the callback function with
PM_TRANS_CONV_INSTALL_IGNOREPKG (the second parameter is always NULL)
[ADDED]
- alpm_pkg_get_db()
- alpm_pkg_get_removes()
- conversation: PM_TRANS_CONV_REMOVE_PKGS (remove unresolvable targets)
- flag: PM_TRANS_FLAG_NOLOCK (do not lock database)
- error codes:
PM_ERR_SERVER_NONE, PM_ERR_TRANS_NOT_LOCKED, PM_ERR_PKG_IGNORED and
PM_ERR_LIBFETCH
API CHANGES BETWEEN 3.3 AND 3.4
===============================
[REMOVED]
- pmtranstype_t struct (transaction type), alpm_trans_get_type()
- alpm_option_get_nopassiveftp(), alpm_option_set_nopassiveftp()
[CHANGED]
- interface for target loading:
- alpm_trans_addtarget() and alpm_trans_sysupgrade() were removed
- alpm_sync_target() and alpm_sync_dbtarget() can be used to add a sync target
- alpm_sync_sysupgrade() can be used to add outdated packages (for sysupgrade)
- alpm_add_target() can be used to add an add/upgrade target
- alpm_remove_target() can be used to add a remove target
- interface for target listing:
- alpm_trans_get_pkgs() was removed
- alpm_pkg_get_removes() was removed
- alpm_trans_get_add() can be used to list add/upgrade/sync targets
- alpm_trans_get_remove() can be used to list to-be-removed packages
- the type parameter of alpm_trans_init() was removed
- the type of alpm_db_fetch callback function: mtimeold and mtimenew parameters
were replaced by force parameter
- unsigned short -> int changes for Boolean variables
[ADDED]
- alpm_db_set_pkgreason()
- alpm_option_get_arch(), alpm_option_set_arch()
- alpm_option_get_usedelta()
- alpm_pkg_unused_deltas()
- alpm_conflict_get_reason()
- error code: PM_ERR_PKG_INVALID_ARCH
API CHANGES BETWEEN 3.4 AND 3.5
===============================
[REMOVED]
- alpm_db_register_local()
- alpm_pkg_has_force()
- alpm_depcmp()
[CHANGED]
- alpm_trans_cb_progress type had some types changed from int to size_t
- alpm_cb_log format string is now const char *
- the interface to add/remove targets:
- functions take pmpkg_t * rather than char *.
- alpm_sync_target() and alpm_sync_dbtarget() are replaced by alpm_add_pkg()
- alpm_add_target() is replaced by alpm_add_pkg()
- alpm_remove_target() is replaced by alpm_remove_pkg()
- packages can come from:
- alpm_db_get_pkg() for normal targets
- alpm_find_dbs_satisfier() for versioned provisions
- alpm_find_grp_pkgs() for groups
- alpm_deptest() is replaced by the more flexible alpm_find_satisfier()
- size_t used for alpm_list_t sizes
- return type for alpm_list_count()
- parameter type in alpm_list_msort() and alpm_list_nth()
[ADDED]
- alpm_option_get_checkspace(), alpm_option_set_checkspace()
- alpm_find_grp_pkgs()
- alpm_trans_get_flags()
- error codes:
PM_ERR_DISK_SPACE, PM_ERR_WRITE
- flags:
PM_TRANS_FLAG_NODEPVERSION, PM_TRANS_EVT_DISKSPACE_START,
PM_TRANS_EVT_DISKSPACE_DONE, PM_TRANS_CONV_SELECT_PROVIDER,
PM_TRANS_PROGRESS_DISKSPACE_START, PM_TRANS_PROGRESS_INTEGRITY_START
API CHANGES BETWEEN 3.5 AND 4.0
===============================
[REMOVED]
- error codes:
PM_ERR_LIBFETCH, PM_ERR_WRITE
- alpm_option_set_root(), alpm_option_set_dbpath()
- alpm_list_first()
- alpm_grp_get_name(), alpm_grp_get_pkgs()
- alpm_delta_get_from(), alpm_delta_get_to(), alpm_delta_get_filename(),
alpm_delta_get_md5sum(), alpm_delta_get_size()
- alpm_miss_get_target(), alpm_miss_get_dep(), alpm_miss_get_causingpkg()
- alpm_dep_get_mod(), alpm_dep_get_name(), alpm_dep_get_version()
- alpm_conflict_get_package1(), alpm_conflict_get_package2(),
alpm_conflict_get_reason()
- alpm_fileconflict_get_target(), alpm_fileconflict_get_type(),
alpm_fileconflict_get_file(), alpm_fileconflict_get_ctarget()
- alpm_db_get_url()
[CHANGED]
- PM_ prefixes for enum values are now ALPM_
- pm prefixes for structs and enums are now alpm_
- alpm_initialize now has parameters: char *root, char *dbpath,
alpm_errno_t *err and returns an alpm_handle_t struct.
- alpm_release now takes an alpm_handle_t *.
- alpm_db_register_sync() now requires a extra parameter of a alpm_siglevel_t.
- alpm_pkg_load() now requires an extra parameter of an alpm_siglevel_t
- alpm_db_setserver() replaced by alpm_db_set_servers(), alpm_db_add_server(),
alpm_db_remove_server()
- alpm_trans_init() no longer takes callbacks, set those using
alpm_option_set_*cb() functions
- many functions now require a first parameter of an alpm_handle_t *:
- alpm_option_get_*
- alpm_option_set_*
- alpm_option_add_*
- alpm_option_remove_*
- alpm_trans_*
- alpm_add_pkg
- alpm_checkconflicts
- alpm_checkdeps
- alpm_db_register_sync
- alpm_db_set_pkgreason
- alpm_db_unregister_all
- alpm_fetch_pkgurl
- alpm_find_dbs_satisfier
- alpm_logaction
- alpm_pkg_load
- alpm_release
- alpm_remove_pkg
- alpm_sync_sysupgrade
- several structs are no longer opaque:
- alpm_conflict_t
- alpm_delta_t
- alpm_depend_t
- alpm_depmissing_t
- alpm_depmod_t
- alpm_fileconflict_t
- alpm_group_t
- alpm_pkg_reason_t
[ADDED]
- option functions:
- alpm_{get,set}_eventcb()
- alpm_option_{get,set}_convcb()
- alpm_option_{get,set}_progresscb()
- package signing functions:
- alpm_option_get_default_siglevel()
- alpm_option_set_default_siglevel()
- alpm_option_get_gpgdir()
- alpm_option_set_gpgdir()
- alpm_db_get_siglevel()
- alpm_siglist_cleanup()
- alpm_db_check_pgp_signature()
- alpm_pkg_check_pgp_signature()
- alpm_pkg_get_origin()
- alpm_pkg_get_sha256sum()
- alpm_pkg_get_base64_sig()
- list functions:
- alpm_list_to_array()
- alpm_list_previous()
- structs:
- alpm_backup_t
- alpm_file_t
- alpm_filelist_t
- enums:
- alpm_siglevel_t
- alpm_sigstatus_t
- alpm_sigvalidity_t
- alpm_pkgfrom_t
- error codes:
ALPM_ERR_DB_INVALID, ALPM_ERR_DB_INVALID_SIG, ALPM_ERR_GPGME,
ALPM_ERR_PKG_INVALID_CHECKSUM, ALPM_ERR_PKG_INVALID_SIG, ALPM_ERR_SIG_INVALID,
ALPM_ERR_SIG_MISSING
API CHANGES BETWEEN 4.0 AND 4.1
===============================
[REMOVED]
- alpm_list_getdata()
[CHANGED]
- alpm_pkgfrom_t members are now prefixed with ALPM_
- alpm_siglevel_t - added members ALPM_SIG_PACKAGE_SET, ALPM_SIG_PACKAGE_TRUST_SET
- alpm_depend_t - additional desc member
- alpm_filelist_t - additional resolved_path member
- alpm_pgpkey_t - added members length, revoked, pubkey_algo
- alpm_logaction - added caller identifier argument
- function renaming:
- alpm_option_get_localdb -> alpm_get_localdb
- alpm_option_get_syncdbs -> alpm_get_syncdbs
- alpm_db_register_sync -> alpm_register_syncdb
- alpm_db_unregister_all -> alpm_unregister_all_syncdbs
- alpm_db_readgroup -> alpm_db_get_group
- alpm_db_set_pkgreason -> alpm_pkg_set_reason (handle parameter removed)
- alpm_time_t typedef used for all times:
- members of alpm_pgpkey_t
- return types of alpm_pkg_get_builddate and alpm_pkg_get_installdate
- delta options now use required ratio rather than on/off:
- alpm_option_get_usedelta -> alpm_option_get_deltaratio
- alpm_option_set_usedelta -> alpm_option_set_deltaratio
[ADDED]
- tracking of how a package was validated:
- alpm_pkgvalidation_t
- alpm_pkg_get_validation()
- adjustable signature verification levels for upgrade operations:
- alpm_option_get_local_file_siglevel()
- alpm_option_set_local_file_siglevel()
- alpm_option_get_remote_file_siglevel()
- alpm_option_set_remote_file_siglevel()
- sync database usage functions:
- alpm_db_usage_t
- alpm_db_set_usage()
- alpm_db_get_usage()
- wrapper functions for reading mtree files:
- alpm_pkg_mtree_open()
- alpm_pkg_mtree_next()
- alpm_pkg_mtree_close()
- utility functions:
- alpm_pkg_find()
- alpm_pkg_compute_optionalfor()
- alpm_filelist_contains()
- types:
- alpm_time_t
- alpm_errno_t
- flags:
ALPM_EVENT_OPTDEP_REQUIRED, ALPM_EVENT_DATABASE_MISSING,
ALPM_EVENT_KEYRING_START, ALPM_EVENT_KEYRING_DONE, ALPM_EVENT_KEY_DOWNLOAD_START,
ALPM_EVENT_KEY_DOWNLOAD_DONE, ALPM_PROGRESS_KEYRING_START
API CHANGES BETWEEN 4.1 AND 4.2
===============================
[CHANGED]
- alpm_filelist_t - removed member resolved_path
- alpm_filelist_contains - now returns alpm_file_t
- event callback:
- alpm_event_t renamed to alpm_event_type_t
- alpm_event_t union added
- alpm_event_cb now takes only an alpm_event_t parameter
- alpm_event_any_t, alpm_package_operation_t, alpm_event_package_operation_t,
alpm_event_optdep_removal_t, alpm_event_delta_patch_t, alpm_event_scriptlet_info_t,
alpm_event_database_missing_t, alpm_event_pkgdownload_t, alpm_event_pacnew_created_t,
alpm_event_pacsave_created_t, alpm_event_pacorig_created_t added
- ALPM_EVENT_*_START -> ALPM_EVENT_PACKAGE_OPERATION_START
- ALPM_EVENT_*_DONE -> ALPM_EVENT_PACKAGE_OPERATION_DONE
- question callback:
- alpm_question_t renamed to alpm_question_type_t
- alpm_question_t union added
- alpm_cb_question now takes only an alpm_question_t parameter
- alpm_question_any_t, alpm_question_install_ignorepkg_t, alpm_question_replace_t
alpm_question_conflict_t, alpm_question_corrupted_t, alpm_question_remove_pkgs_t,
alpm_question_select_provider_t, alpm_question_import_key_t added
[ADDED]
- memory management:
- alpm_fileconflict_free()
- alpm_depmissing_free()
- alpm_conflict_free()
- alpm_dep_free()
- database usage:
- alpm_db_usage_t
- alpm_db_set_usage()
- alpm_db_get_usage()
- assume installed:
- alpm_option_get_assumeinstalled()
- alpm_option_add_assumeinstalled()
- alpm_option_set_assumeinstalled()
- alpm_option_remove_assumeinstalled()
- using noupgrade/noextract:
- alpm_option_match_noupgrade()
- alpm_option_match_noextract()
- utility functions:
- alpm_dep_from_string()
- alpm_pkg_should_ignore()
- alpm_decode_signature()
- alpm_extract_keyid()
- flags:
ALPM_EVENT_RETRIEVE_DONE, ALPM_EVENT_RETRIEVE_FAILED, ALPM_EVENT_PKGDOWNLOAD_START,
ALPM_EVENT_PKGDOWNLOAD_DONE, ALPM_EVENT_PKGDOWNLOAD_FAILED, ALPM_EVENT_OPTDEP_REMOVAL,
ALPM_EVENT_PACNEW_CREATED, ALPM_EVENT_PACSVAE_CREATED, ALPM_EVENT_PACORIG_CREATED
API CHANGES BETWEEN 4.2 AND 5.0
===============================
[REMOVED]
- alpm_siglevel_t - removed members ALPM_SIG_PACKAGE_SET, ALPM_SIG_PACKAGE_TRUST_SET
- removed .pacorig generation:
- ALPM_EVENT_PACORIG_CREATED
- alpm_event_pacorig_created_t
- alpm_event_t.pacorig_created
[ADDED]
- hook support:
- alpm_option_get_hookdirs()
- alpm_option_set_hookdirs()
- alpm_option_add_hookdir()
- alpm_option_remove_hookdir()
- alpm_event_hook_t, alpm_event_hook_run_t
- alpm_hook_when_t
- ALPM_EVENT_HOOK_START, ALPM_EVENT_HOOK_DONE
- ALPM_EVENT_HOOK_RUN_START, ALPM_EVENT_HOOK_RUN_DONE
- ALPM_ERR_TRANS_HOOK_FAILED
- different database extension support:
- alpm_option_get_dbext()
- alpm_option_set_dbext()
- pkgbase accessor:
- alpm_pkg_get_base()
- transaction events:
- ALPM_EVENT_TRANSACTION_START, ALPM_EVENT_TRANSACTION_DONE
- database unlocking:
- alpm_unlock()
API CHANGES BETWEEN 5.0 AND 5.1
===============================
[CHANGED]
- alpm_errno_t - added member ALPM_ERR_OK
- alpm_siglevel_t - value of ALPM_SIG_USE_DEFAULT changed
- functions using bitfields return/pass an int instead of an enum:
- alpm_option_get_default_siglevel()
- alpm_option_set_default_siglevel()
- alpm_option_get_remote_file_siglevel()
- alpm_option_set_remote_file_siglevel()
- alpm_register_syncdb()
- alpm_db_get_siglevel()
- alpm_db_set_usage()
- alpm_db_get_usage()
- alpm_pkg_load()
- alpm_pkg_get_validation()
- alpm_trans_get_flags()
- alpm_trans_init()
- alpm_option_get_local_file_siglevel()
- alpm_option_set_local_file_siglevel()
[ADDED]
- overwrite support:
- alpm_option_get_overwrite_files()
- alpm_option_set_overwrite_files()
- alpm_option_add_overwrite_file()
- alpm_option_remove_overwrite_file()
- download timeout control:
- alpm_option_set_disable_dl_timeout()
- access make/checkdepends info:
- alpm_pkg_get_checkdepends()
- alpm_pkg_get_makedepends()
- check pacman capabilities:
- alpm_capabilities()
- duplicate and add to list:
- alpm_list_append_strdup()
API CHANGES BETWEEN 5.1 AND 5.2
===============================
[REMOVED]
- package delta support:
- alpm_delta_t
- alpm_event_delta_patch_t
- alpm_event_t union - removed alpm_event_delta_patch_t
- ALPM_EVENT_DELTA_INTEGRITY_START, ALPM_EVENT_DELTA_INTEGRITY_DONE,
ALPM_EVENT_DELTA_PATCHES_START, ALPM_EVENT_DELTA_PATCHES_DONE,
ALPM_EVENT_DELTA_PATCH_START, ALPM_EVENT_DELTA_PATCH_DONE,
ALPM_EVENT_DELTA_PATCH_FAILED
- ALPM_ERR_DLT_INVALID, ALPM_ERR_DLT_PATCHFAILED
- alpm_option_get_deltaratio()
- alpm_option_set_deltaratio()
- alpm_pkg_get_deltas()
- alpm_pkg_unused_deltas()
- alpm_transflag_t - removed member ALPM_TRANS_FLAG_FORCE
[CHANGED]
- alpm_errno_t - added member ALPM_ERR_MISSING_CAPABILITY_SIGNATURES
- alpm_sync_newversion() replaced with alpm_sync_get_new_version() which
does not filter on any ALPM_DB_USAGE_*.
API CHANGES BETWEEN 5.2 AND 6.0
===============================
[REMOVED]
- ALPM_EVENT_PKGDOWNLOAD_START, ALPM_EVENT_PKGDOWNLOAD_DONE, ALPM_EVENT_PKGDOWNLOAD_FAILED
- ALPM_ERR_PKG_REPO_NOT_FOUND
- old TotalDownload implementation:
- alpm_cb_totaldl
- alpm_option_get_totaldlcb()
- alpm_option_set_totaldlcb()
[CHANGED]
- alpm_db_update() now accepts a list of databases rather than a single database.
- alpm_fetch_pkgurl() accepts a list of packages to download.
- alpm_db_search() now has an additional parameter and returns success status
- ALPM_EVENT_RETRIEVE_* -> ALPM_EVENT_DB_RETRIEVE_* and ALPM_EVENT_PKG_RETRIEVE_*
- alpm_cb_download pass event and data
- multi architecture support:
- alpm_option_get_arch() -> alpm_option_get_architectures()
- alpm_option_set_arch() -> alpm_option_set_architectures()
- alpm_db_get_servers() copies parameter data
[ADDED]
- parallel download support:
- alpm_option_set_parallel_downloads()
- alpm_option_get_parallel_downloads()
- file download events:
- alpm_download_event_type_t
- alpm_download_event_init_t
- alpm_download_event_progress_t
- alpm_download_event_completed_t
- download misc:
- ALPM_DOWNLOAD_RETRY
- alpm_download_event_retry_t
- alpm_event_pkg_retrieve_t
- multiarchitecture support:
- alpm_option_add_architecture()
- alpm_option_remove_architecture()
- misc:
- alpm_pkg_get_sig()
- callbacks add front-end provided context
API CHANGES BETWEEN 6.0 AND 6.1
===============================
[REMOVED]
- alpm_trans_t
[CHANGED]
- alpm_conflict_t - full package added as member, removing package name and name
hash members
- alpm_question_import_key_t - holds key uid and fingerprint rather than alpm_pgpkey_t
- alpm_pkgreason_t - added ALPM_PKG_REASON_UNKNOWN
- alpm_transflag_t - added ALPM_TRANS_FLAG_NOHOOKS
[ADDED]
- extensible package data type:
- alpm_pkg_xdata_t
- alpm_pkg_get_xdata()
- accessor functions:
- alpm_db_get_handle()
- alpm_pkg_get_handle()
- cache server support:
- alpm_db_get_cache_servers()
- alpm_db_set_cache_servers()
- alpm_db_add_cache_server()
API CHANGES BETWEEN 6.1 AND 7.0
===============================
[ADDED]
- sandbox functions:
- alpm_option_get_sandboxuser()
- alpm_option_set_sandboxuser()
- alpm_option_set_disable_sandbox()
- alpm_sandbox_setup_child()
API CHANGES BETWEEN 7.0 AND 7.1
===============================
[CHANGED]
- error codes:
PM_ERR_TRANS_COMMITING renamed to PM_ERR_TRANS_COMMITTING

34
RELEASE
View file

@ -1,34 +0,0 @@
The following checklist should be used for making a pacman release.
- Ensure "ninja dist" succeeds
- Call a freeze to development.
- Send translation updates to Transifex at least two weeks before a major
release (see below). At this stage, strings can only be changed for a
major issue.
- Update NEWS and README files
- Pull translation updates from Transifex
- Update version in meson.build as described in file
- Update doc/index.asciidoc
- Create a signed git tag (git tag -s vX.Y.Z -m "commit message")
- Create and sign release tarballs (generate with "ninja dist")
- Create release on gitlab project page
- Upload release tarball and signature to gitlab ("glab release upload ...")
- Create branch release/?.?.x (with ?.? replaced by major version number)
- Update .gitlab-ci.yml to point the website pages run at release branch
Transifex updates are handled using the transifex client. The basic process is:
- Pull updates from transifex ("tx pull -f --minimum-perc 75")
- Update po files ("./build-aux/update-po")
- Fix all translation errors found (e.g. using "mint-check-translations")
- Add any new locales to the relevant LINGUAS file
- Optional: Make any manual changes needed (e.g. fixing spacing in a string)
and update po files again
- Push updated po files to transifex ("tx push -s -t --skip")
Point releases:
- all bugs fixes slated for the release branch must first land on master
(unless no longer relevant)
- following the initial post-release period when the release and master
branches may be kept in sync, commits are backported to the release branch
using "git cherry-pick -x"
- translation updates should be pulled onto the release branch only

57
TODO.aaron Normal file
View file

@ -0,0 +1,57 @@
== This is my custom TODO file ==
* transaction object should contain two package list (install and remove)
instead of a single list of syncpkgs - this should allow us to get rid of that
type. This also requires seperate functionality to return a list of
"replaces" packages to the front end, so the frontend can handle the QUESTION()
stuff in that case
* libalpm -> front end communication needs a work-up. Both progress functions
can be combined into one callback, IFF we adjust it to accept a prefix string
for the progress bars, and format it at the lib side. Question functions
should also do the same - create the string at the library side, and simply
call some sort of int yes_no = ask_question("Do foo with bar?");
* move logging (alpm_logaction) out of the library. log files should be
written by the app, not the library. Adding a PM_LOG_* constant that
frontends can recognize and send to a file is probably a good idea.
* clear up list allocation/deallocation - some lists need to be free'd, some
do not and there is no clear indication WHEN this should happen.
* remove DB entries (directories) on a read error?
* Add a pm_errstr error string, which will allow us to do things like:
pm_errno = PM_ERR_LIBARCHIVE;
pm_errstr = archive_error_string(archive);
or:
pm_errno = PM_ERR_LIBDOWNLOAD;
pm_errstr = downloadLastErrString;
This way we don't break abstraction when returning specific errors in
cases like the above.
* pacman: A LOT of functions are way too long. There should be an upper limit of
100-200 lines. _alpm_add_commit is around 600 lines, and is far too complex.
* pacman: fixup doxygen documentation for public interface
* feature for 3.1: package file hooks *
I've been planning on this one for some time. Here's a simple rundown:
in /etc/pacman.d/hooks:
Hook /usr/include/* : /usr/bin/ctags -R /usr/include/*.h -f /usr/include/systags
This will allow us to make "global hooks" to simplify a lot of repetitive
install files (scrollkeeper, depmod, etc). This also allows us to move
ldconfig out of pacman entirely.
possible: /etc/pacman.hooks/* files for hooks, so packages can add them too
* feature for 3.1: multiple search/match types
option: MatchType regex (current way)
MatchType fnmatch (use fnmatch to match things like 'pacman -S gnome*')
MatchType plain (no matching. expect plain text).
* feature for 3.1: revamp the autotools system. I'd LOVE to use a manual system
like wmii and friends do. It'd be real nice if we could just do away with
autotools altogether.
**** BUGS ****
* Removal of conflicts on -A and -U (INCOMPLETE)

101
TODO.dan Normal file
View file

@ -0,0 +1,101 @@
TODO.dan
========
This is my personal TODO list. No guarantees if it is out of date and things no
longer apply. If you want to help out with any of it, send me an email.
Pacman 3.1:
-----------
Downgrade feature - allow users to see cached packages and downgrade to
(previous or any?) available options.
Installed size and download size in -Si/Qi output should scale with package
size- KB to MB to GB. We should also get consistancy of K/KB, M/MB, etc.
Extreme similarity between some of the sync and add code...we have to be able
to abstract more away from sync actions and add actions to just 'actions'
(example: sync,c, add.c, and deptest.c all contain a switch on PM_DEP_MOD_*).
Merge update, add, and sync code when possible, so we reduce duplication.
Review progress/transaction event subsystem. (from TODO)
Add Doxygen comments to every function in libalpm including private functions.
Ensure functions are doing exactly their purpose and nothing more. Find
functions that perform duplicate behavior and merge them. Combine and refactor
others. Delete unnecessary functions. Stop keeping everything clustered in
little add/sync/remove parts, allow transactions to share code.
Go through options list. Decide if namings are good, all options are still
relevant, etc. Ideas for -Re (#6273), changing meaning of -c (has two meanings,
another FS bug), etc. Remove the -A flag and possibly -D, -T, and -Y (-Y is
killed now in favor of vercmp binary) if they can be done by other actions.
Possible switch of -U --> -I (#5571).
Review display and logging functions. There seems to be an abundance of them.
Make it extensible to use color, review what verbose/debug means. Perhaps
separate logging functionality- Pacman has its normal log, and alpm backend
keeps a very simple log file - listing only adds (including syncs) and removes.
This way a consistency list can be kept of what is currently installed and what
isn't, without all the logging junk from the front end.
Profile the code. Find the functions that are being called a lot, and see what
can be done about it. Find out if all these calls are necessary (e.g. excessive
alpm_list_count calls), and maybe think about changing data structures to speed
operations up (e.g. a 'count' field). NOTE: already found two huge issues with
quick profiling- excessive setlocale calls, and extremely excessive strcmp
calls.
Fix other localized issues- use non-printf when necessary. We may need to use
some wchar_t output on the progress bar as char/byte counts differ here. Sizes
of packages (e.g. 10,400.23 MB) should all be localized with correct
seperators.
Rewrite makepkg to use terminal-safe coloring/bolding. tput utility should
allow us to do this. Make universal message functions for systemwide use,
including all pacman utilites- abs, pacman-optimize, etc.
Bugs/FRs to smash: 6468, 6437, 6430?, 6420, 6404, 6389, 6312?, 6284, 6273?,
6255?, 6208, 5987, 5885, 5571, 4182, 3492, 2810?, 1769, 1588, 1571
Update doxygen comments, they may need some work. Try to document all of the
private internal functions too- it helps a ton for people just getting a
start on pacman hacking.
Other smaller things:
---------------------
unsigned int vs. unsigned- determine a standard and stick with it
FS #4185 - move where message is logged, perhaps?
Update copyrights (2007)
Update pacman website, and add/finish pacman coding style page
Refine makepkg error codes. Each kind of failure could have its own code:
--package already built
--failed integ checks
--failed build
--etc.
Add utility function to either frontend or backend to convert sizes: e.g. bytes
to KB, MB, GB.
Revamp the downloadprog function a bit. Seems kind of messy.
--print-uri option to sync should not require saying yes or no to up to date
Build a replacement for this, or at least standardize its use. We shouldn't
always need to pass handle->root around, it is constant. Something like char*
buildpath(file).
/* build the new entryname relative to handle->root */
snprintf(filename, PATH_MAX, "%s%s", handle->root, entryname);
Random ideas:
-------------
Possibly split utilities/extras from pacman package
Make .indent.pro file for GNU indent (started, but didn't finish)

View file

@ -1,55 +1,44 @@
Thanks to all of those who have helped translate pacman, both in the past and
currently. Our translations are currently maintained in Transifex; please read
doc/translation-help.txt for more details.
Thanks to all of those who have helped translate pacman, both in the past
and currently. Here are some of the current translators (past translators
can be found by looking in the GIT history).
Below is a list of past translators before we switched to Transifex; more can
be found by looking in the Git history.
If your language is listed here and you are interested in helping translate,
contact either the pacman mailing list at pacman-dev@archlinux.org, or one
of the translators listed above.
If your language is not already in the various po/ subdirectories and you wish
it was, set up a team in Transifex for your language and we will be happy to
add your language to the mix.
If your language is not listed here and you wish it was, let the pacman mailing
list know you are interested in making a translation. We will be happy to add
your language to the mix.
Catalan (ca):
Manuel Tortosa <manutortosa@chakra-project.org>
Czech (cs):
Vojtěch Gondžala <vojtech.gondzala@gmail.com>
German (de):
Matthias Gorissen <matthias@archlinux.de>
Greek (el):
Christos Nouskas <nouskas@gmail.com>
Benjamin Andresen <benny@in-ulm.de>
British English (en_GB):
Jeff Bailes <thepizzaking@gmail.com>
Spanish (es):
Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar>
Juan Pablo González Tognarelli <jotapesan@gmail.com>
Fernando Lagos <fernando@zerial.org>
French (fr):
Chantry Xavier <shiningxc@gmail.com>
Hungarian (hu):
Nagy Gabor <ngaba@bibl.u-szeged.hu>
Avramucz Péter <muczyjoe@gmail.com>
Italian (it):
Giovanni Scafora <giovanni@archlinux.org>
Kazakh (kk):
Baurzhan Muftakhidinov <baurthefirst@gmail.com>
Norwegian (nb):
Hans-Kristian Arntzen <maister@archlinux.us>
Giovanni 'voidnull' Scafora <linuxmania@gmail.com>
Polish (pl):
Mateusz Herych <heniekk@gmail.com>
Jaroslaw Swierczynski <swiergot@gmail.com>
Mateusz Jędrasik <m.jedrasik@gmail.com>
Brazilian Portuguese (pt_BR):
Hugo Doria <hugo@archlinux.org>
Armando M. Baratti <ambaratti@archlinux-br.org>
Rodrigo Flores <flores@archlinux-br.org>
Marcelo Cavalcante <kalibslack@gmail.com>
Romanian (ro):
Volodia Macovei <blog@volodia.ro>
Leandro Inacio <leandro@archlinux-br.org>
Russian (ru):
Sergey Tereschenko <serg.partizan@gmail.com>
Vitaly Dolgov <ferhiord@gmail.com>
Oleg Finkelshteyn <olegfink@gmail.com>
Vladimir Bayrakovskiy <4rayven@gmail.com>
Swedish (sv):
Christian Larsson <congacx@gmail.com>
Turkish (tr):
Samed Beyribey <ras0ir@eventualis.org>
Alper KANAT <alperkanat@gmail.com>

4952
acinclude.m4 Normal file

File diff suppressed because it is too large Load diff

34
autoclean.sh Executable file
View file

@ -0,0 +1,34 @@
#!/bin/sh -xu
[ -f Makefile ] && make distclean
rm -rf autom4te.cache
rm -rf {Makefile.in,Makefile}
rm -rf {config.h.in,config.h}
rm -rf config.status
rm -rf configure
rm -rf stamp*
rm -rf aclocal.m4
rm -rf compile
rm -rf libtool
rm -rf lib/libalpm/{Makefile.in,Makefile}
rm -rf src/util/{Makefile.in,Makefile}
rm -rf src/pacman/{Makefile.in,Makefile}
rm -rf scripts/{Makefile.in,Makefile}
rm -rf etc/{Makefile.in,Makefile}
rm -rf etc/pacman.d/{Makefile.in,Makefile}
rm -rf etc/abs/{Makefile.in,Makefile}
rm -rf pactest/{Makefile.in,Makefile}
rm -rf doc/{Makefile.in,Makefile}
rm -rf doc/html/*.html
rm -rf doc/man3/*.3
rm -rf po/{Makefile.in,Makefile}
rm -rf po/POTFILES
rm -rf po/stamp-po
rm -rf po/*.gmo
rm -rf lib/libalpm/po/{Makefile.in,Makefile}
rm -rf lib/libalpm/po/POTFILES
rm -rf lib/libalpm/po/stamp-po
rm -rf lib/libalpm/po/*.gmo

6
autogen.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh -xu
aclocal
autoheader
automake --foreign
autoconf

View file

@ -1,2 +0,0 @@
*
!ltmain-asneeded.patch

View file

@ -1,11 +0,0 @@
#!/usr/bin/python3
import sys
for path in sys.argv[1:]:
print('# -----------------------------------')
print('# ' + path + ':')
print('# -----------------------------------')
with open(path, 'r') as f:
for line in f:
print('# ' + line, end='')

View file

@ -1,29 +0,0 @@
#!@BASH@
input=$1
output=$2
mode=$3
sed \
-e "s|@rootdir[@]|@ROOTDIR@|g" \
-e "s|@localedir[@]|@LOCALEDIR@|g" \
-e "s|@sysconfdir[@]|@sysconfdir@|g" \
-e "s|@localstatedir[@]|@localstatedir@|g" \
-e "s|@libmakepkgdir[@]|@LIBMAKEPKGDIR@|g" \
-e "s|@pkgdatadir[@]|@PKGDATADIR@|g" \
-e "s|@keyringdir[@]|@KEYRINGDIR@|g" \
-e "s|@prefix[@]|@PREFIX@|g" \
-e "1s|#!/bin/bash|#!@BASH@|g" \
-e "s|@PACKAGE_VERSION[@]|@PACKAGE_VERSION@|g" \
-e "s|@PACKAGE_NAME[@]|@PACKAGE_NAME@|g" \
-e "s|@BUILDSCRIPT[@]|@BUILDSCRIPT@|g" \
-e "s|@TEMPLATE_DIR[@]|@TEMPLATE_DIR@|g" \
-e "s|@DEBUGSUFFIX[@]|@DEBUGSUFFIX@|g" \
-e "s|@INODECMD[@]|@INODECMD@|g" \
-e "s|@FILECMD[@]|@FILECMD@|g" \
-e "s|@BSDTAR_NO_READ_SPARSE[@]|@BSDTAR_NO_READ_SPARSE@|g" \
"$input" >"$output"
if [[ $mode ]]; then
chmod "$mode" "$output"
fi

View file

@ -1,10 +0,0 @@
#!/bin/sh
set -eu
# this is needed mostly because $DESTDIR is provided as a variable,
# and we need to create the target directory...
mkdir -vp "$(dirname "${DESTDIR:-}$2")"
rm -f "${DESTDIR:-}$2"
ln -vs "$1" "${DESTDIR:-}$2"

View file

@ -1,17 +0,0 @@
#!/usr/bin/python
import json
import sys
def print_result(result):
print('==================================================================')
print(result['name'])
print(' '.join(result['command']))
print('==================================================================')
print(result['stdout'])
with open(sys.argv[1], 'r') as f:
for line in f:
result = json.loads(line)
if result['result'] == 'FAIL':
print_result(result)

View file

@ -1,6 +0,0 @@
#!/bin/bash
# This script serves as a trampoline for running scripts which depend on
# libmakepkg with the libmakepkg within the build tree.
MAKEPKG_LIBRARY=@BUILDDIR@/libmakepkg exec @BASH@ -$- @REAL_PROGPATH@ "$@"

View file

@ -1,8 +0,0 @@
#! /bin/sh
OLD=$1
NEW=$2
for file in $(git grep -l "Copyright .* Pacman Development" | grep -v "\.po"); do \
sed -i -e "/Copyright (/s/-${OLD}/-${NEW}/" -e "/Copyright (/s/ ${OLD}/ ${OLD}-${NEW}/" "$file"
done

View file

@ -1,39 +0,0 @@
#!/bin/bash
find_build_directory() {
local build_dirs=(*/build.ninja)
if [[ ! -e ${build_dirs[0]} ]]; then
echo "error: No build directory found. Have you run 'meson build' yet?" >&2
return 1
elif (( ${#build_dirs[*]} > 1 )); then
echo "error: Multiple build directories found. Unable to proceed." >&2
return 1
fi
printf '%s\n' "${build_dirs[0]%/*}"
}
filter_targets_by_name() {
if command -v jq &>/dev/null; then
jq --arg re "$1" -r 'map(.name)[] | select(match($re))'
else
json_pp | awk -v filter="$1" -F'[:"]' \
'$2 == "name" && $(NF - 1) ~ filter { print $(NF - 1) }'
fi
}
# Make things simple and require that we're in the build root rather than
# trying to chase down the location of this script and the relative build dir.
if [[ ! -d .git ]]; then
echo "This script must be run from the root of the repository" >&2
exit 1
fi
build_dir=$(find_build_directory) || exit 1
mapfile -t targets < \
<(meson introspect "$build_dir" --targets | filter_targets_by_name "-update-po$")
ninja -C "$build_dir" "${targets[@]}"

1526
config.guess vendored Executable file

File diff suppressed because it is too large Load diff

614
config.rpath Executable file
View file

@ -0,0 +1,614 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2006 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.
# Known limitations:
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
# than 256 bytes, otherwise the compiler driver will dump core. The only
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
shrext=.so
host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Code taken from libtool.m4's _LT_CC_BASENAME.
for cc_temp in $CC""; do
case $cc_temp in
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
\-*) ;;
*) break;;
esac
done
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
wl='-Wl,'
else
case "$host_os" in
aix*)
wl='-Wl,'
;;
darwin*)
case $cc_basename in
xlc*)
wl='-Wl,'
;;
esac
;;
mingw* | pw32* | os2*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
newsos6)
;;
linux*)
case $cc_basename in
icc* | ecc*)
wl='-Wl,'
;;
pgcc | pgf77 | pgf90)
wl='-Wl,'
;;
ccc*)
wl='-Wl,'
;;
como)
wl='-lopt='
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
wl='-Wl,'
;;
esac
;;
esac
;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
sco3.2v5*)
;;
solaris*)
wl='-Wl,'
;;
sunos4*)
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
wl='-Wl,'
;;
sysv4*MP*)
;;
unicos*)
wl='-Wl,'
;;
uts4*)
;;
esac
fi
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
with_gnu_ld=yes
;;
openbsd*)
with_gnu_ld=no
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
# Unlike libtool, we use -rpath here, not --rpath, since the documented
# option of GNU ld is called -rpath, not --rpath.
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
case "$host_os" in
aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we cannot use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
interix3*)
hardcode_direct=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
linux*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
netbsd*)
;;
solaris*)
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
ld_shlibs=no
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
else
ld_shlibs=no
fi
;;
esac
;;
sunos4*)
hardcode_direct=yes
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = no; then
hardcode_libdir_flag_spec=
fi
else
case "$host_os" in
aix3*)
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
;;
esac
fi
hardcode_direct=yes
hardcode_libdir_separator=':'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
hardcode_direct=yes
else
# We have old collect2
hardcode_direct=unsupported
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
;;
esac
fi
# Begin _LT_AC_SYS_LIBPATH_AIX.
echo 'int main () { return 0; }' > conftest.c
${CC} ${LDFLAGS} conftest.c -o conftest
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
fi
if test -z "$aix_libpath"; then
aix_libpath="/usr/lib:/lib"
fi
rm -f conftest.c conftest
# End _LT_AC_SYS_LIBPATH_AIX.
if test "$aix_use_runtimelinking" = yes; then
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
else
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
fi
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
libext=lib
;;
darwin* | rhapsody*)
hardcode_direct=no
if test "$GCC" = yes ; then
:
else
case $cc_basename in
xlc*)
;;
*)
ld_shlibs=no
;;
esac
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
freebsd1*)
ld_shlibs=no
;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
freebsd2*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
freebsd* | kfreebsd*-gnu | dragonfly*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
hpux9*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
hpux10*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
fi
;;
hpux11*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
case $host_cpu in
hppa*64*|ia64*)
hardcode_direct=no
;;
*)
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
newsos6)
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
openbsd*)
hardcode_direct=yes
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
else
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
osf3*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*)
if test "$GCC" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
# Both cc and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
solaris*)
hardcode_libdir_flag_spec='-R$libdir'
;;
sunos4*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
sysv4)
case $host_vendor in
sni)
hardcode_direct=yes # is this really true???
;;
siemens)
hardcode_direct=no
;;
motorola)
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
esac
;;
sysv4.3*)
;;
sysv4*MP*)
if test -d /usr/nec; then
ld_shlibs=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
;;
sysv5* | sco3.2v5* | sco5v6*)
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
hardcode_libdir_separator=':'
;;
uts4*)
hardcode_libdir_flag_spec='-L$libdir'
;;
*)
ld_shlibs=no
;;
esac
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
libname_spec='lib$name'
case "$host_os" in
aix3*)
;;
aix4* | aix5*)
;;
amigaos*)
;;
beos*)
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32*)
shrext=.dll
;;
darwin* | rhapsody*)
shrext=.dylib
;;
dgux*)
;;
freebsd1*)
;;
kfreebsd*-gnu)
;;
freebsd* | dragonfly*)
;;
gnu*)
;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
shrext=.so
;;
hppa*64*)
shrext=.sl
;;
*)
shrext=.sl
;;
esac
;;
interix3*)
;;
irix5* | irix6* | nonstopux*)
case "$host_os" in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
*) libsuff= shlibsuff= ;;
esac
;;
esac
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
linux*)
;;
knetbsd*-gnu)
;;
netbsd*)
;;
newsos6)
;;
nto-qnx*)
;;
openbsd*)
;;
os2*)
libname_spec='$name'
shrext=.dll
;;
osf3* | osf4* | osf5*)
;;
solaris*)
;;
sunos4*)
;;
sysv4 | sysv4.3*)
;;
sysv4*MP*)
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
;;
uts4*)
;;
esac
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
EOF

1658
config.sub vendored Executable file

File diff suppressed because it is too large Load diff

372
configure.ac Normal file
View file

@ -0,0 +1,372 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# Minimum version of autoconf required
AC_PREREQ(2.60)
# UPDATING VERSION NUMBERS FOR RELEASES
#
# libalpm:
# current
# The most recent interface number that this library implements.
# revision
# The implementation number of the current interface.
# age
# The difference between the newest and oldest interfaces that this library
# implements. In other words, the library implements all the interface
# numbers in the range from number current - age to current.
#
# 1. Start with version information of `0:0:0' for each libtool library.
# 2. Update the version information only immediately before a public release of
# your software. More frequent updates are unnecessary, and only guarantee
# that the current interface number gets larger faster.
# 3. If the library source code has changed at all since the last update, then
# increment revision (`c:r:a' becomes `c:r+1:a').
# 4. If any interfaces have been added, removed, or changed since the last
# update, increment current, and set revision to 0.
# 5. If any interfaces have been added since the last public release, then
# increment age.
# 6. If any interfaces have been removed since the last public release, then
# set age to 0.
#
# pacman:
# Extreme huge major changes:
# pacman_version_major += 1
# pacman_version_minor = 0
# pacman_version_micro = 0
#
# Real releases:
# pacman_version_minor += 1
# pacman_version_micro = 0
#
# Bugfix releases:
# pacman_version_micro += 1
m4_define([lib_current], [4])
m4_define([lib_revision], [1])
m4_define([lib_age], [1])
m4_define([pacman_version_major], [3])
m4_define([pacman_version_minor], [2])
m4_define([pacman_version_micro], [2])
m4_define([pacman_version],
[pacman_version_major.pacman_version_minor.pacman_version_micro])
# Autoconf initialization
AC_INIT([pacman], [pacman_version], [pacman-dev@archlinux.org])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
LIB_VERSION=`expr lib_current - lib_age`.lib_age.lib_revision
LIB_VERSION_INFO="lib_current:lib_revision:lib_age"
# Set subsitution values for version stuff in Makefiles and anywhere else,
# and put LIB_VERSION in config.h
AC_SUBST(LIB_VERSION)
AC_SUBST(LIB_VERSION_INFO)
AC_DEFINE_UNQUOTED([LIB_VERSION], ["$LIB_VERSION"], [libalpm version number])
# Help line for root directory
AC_ARG_WITH(root-dir,
AS_HELP_STRING([--with-root-dir=path], [set the location of pacman's root operating directory]),
[ROOTDIR=$withval], [ROOTDIR=/])
# Help line for package extension
AC_ARG_WITH(pkg-ext,
AS_HELP_STRING([--with-pkg-ext=ext], [set the file extension used by packages]),
[PKGEXT=$withval], [PKGEXT=.pkg.tar.gz])
# Help line for source package directory
AC_ARG_WITH(src-ext,
AS_HELP_STRING([--with-src-ext=ext], [set the file extension used by source packages]),
[SRCEXT=$withval], [SRCEXT=.src.tar.gz])
# Help line for database extension
AC_ARG_WITH(db-ext,
AS_HELP_STRING([--with-db-ext=ext], [set the file extension used by the database]),
[DBEXT=$withval], [DBEXT=.db.tar.gz])
# Help line for libdownload/libfetch
AC_ARG_ENABLE(internal-download,
AS_HELP_STRING([--disable-internal-download], [do not build with libdownload/libfetch support]),
[internaldownload=$enableval], [internaldownload=yes])
# Help line for documentation
AC_ARG_ENABLE(doc,
AS_HELP_STRING([--disable-doc], [prevent make from looking at doc/ dir]),
[wantdoc=$enableval], [wantdoc=yes])
# Help line for doxygen
AC_ARG_ENABLE(doxygen,
AS_HELP_STRING([--enable-doxygen], [build your own API docs via Doxygen]),
[wantdoxygen=$enableval], [wantdoxygen=no])
# Help line for debug
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug], [enable debugging support]),
[debug=$enableval], [debug=no])
# Help line for using git version in pacman version string
AC_ARG_ENABLE(git-version,
AS_HELP_STRING([--enable-git-version],
[enable use of git version in version string if available]),
[wantgitver=$enableval], [wantgitver=no])
# Checks for programs.
AC_PROG_AWK
AC_PROG_CC_C99
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_CHECK_PROGS([PYTHON], [python2.5 python2.4 python], [false])
# find installed gettext
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.13.1)
# Check for libarchive
AC_CHECK_LIB([archive], [archive_read_data], ,
AC_MSG_ERROR([libarchive is needed to compile pacman!]))
# Enable or disable usage of libdownload/libfetch
# - this is a nested check- first see if we need a library, if we do then
# check for libdownload first, then fallback to libfetch, then die
AC_MSG_CHECKING(whether to link with download library)
if test "x$internaldownload" = "xyes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE([INTERNAL_DOWNLOAD], , [Use internal download library])
# Check for a download library if it was actually requested
AC_CHECK_LIB([download], [downloadParseURL], ,
AC_CHECK_LIB([fetch], [fetchParseURL], ,
AC_MSG_ERROR([libdownload or libfetch are needed to compile with internal download support])) )
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(INTERNAL_DOWNLOAD, test "x$internaldownload" = "xyes")
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h string.h strings.h sys/ioctl.h sys/param.h sys/statvfs.h sys/syslimits.h sys/time.h syslog.h wchar.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_TYPE_UID_T
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MKTIME
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([geteuid realpath regcomp strcasecmp \
strndup strrchr strsep swprintf \
wcwidth uname])
# Enable large file support if available
AC_SYS_LARGEFILE
# Check if we can use symbol visibility support in GCC
GCC_VISIBILITY_CC
# Check if we have -fgnu89-inline flag
GCC_GNU89_INLINE_CC
# Host-dependant definitions
SIZECMD="stat -c %s"
case "${host_os}" in
*bsd*)
SIZECMD="stat -f %z"
;;
cygwin*)
host_os_cygwin=yes
CFLAGS="$CFLAGS -DCYGWIN"
;;
darwin*)
host_os_darwin=yes
SIZECMD="stat -f %z"
;;
esac
AM_CONDITIONAL([CYGWIN], test "x$host_os_cygwin" = "xyes")
AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
AC_SUBST(SIZECMD)
# Check for architecture, used in default makepkg.conf
# (Note single space left after CARCHFLAGS)
case "${host}" in
i686-*)
CARCH="i686"
CARCHFLAGS="-march=i686 "
;;
x86_64-*)
CARCH="x86_64"
CARCHFLAGS="-march=x86-64 "
;;
ia64-*)
CARCH="ia64"
CARCHFLAGS="-march=ia64 "
;;
sparc-*)
CARCH="sparc"
CARCHFLAGS="-mcpu=v9 "
;;
ppc-* | powerpc-*)
CARCH="ppc"
CARCHFLAGS="-mcpu=750 "
;;
i386-*)
CARCH="i386"
CARCHFLAGS="-march=i386 "
;;
arm-*)
CARCH="arm"
CARCHFLAGS="-march=armv4 "
;;
*)
AC_MSG_WARN([[Your architecture is unknown for makepkg.conf, consider adding it to configure.ac]])
CARCH="unknown"
CARCHFLAGS=""
;;
esac
# Now do some things common to all architectures
CHOST="${host}"
AC_SUBST(CARCH)
AC_SUBST(CARCHFLAGS)
AC_SUBST(CHOST)
# Check for documentation support and status
AC_MSG_CHECKING([for building documentation])
if test "x$wantdoc" = "xyes" ; then
AC_MSG_RESULT([yes])
wantdoc=yes
else
AC_MSG_RESULT([no, disabled by configure])
wantdoc=no
fi
AM_CONDITIONAL(WANT_DOC, test "x$wantdoc" = "xyes")
# Check for doxygen support and status
AC_CHECK_PROGS([DOXYGEN], [doxygen])
AC_MSG_CHECKING([for doxygen])
if test "x$wantdoxygen" = "xyes" ; then
if test $DOXYGEN ; then
AC_MSG_RESULT([yes])
usedoxygen=yes
else
AC_MSG_RESULT([no, doxygen missing])
usedoxygen=no
fi
else
AC_MSG_RESULT([no, disabled by configure])
usedoxygen=no
fi
AM_CONDITIONAL(USE_DOXYGEN, test "x$usedoxygen" = "xyes")
# Enable or disable debug code
AC_MSG_CHECKING(for debug mode request)
if test "x$debug" = "xyes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE([PACMAN_DEBUG], , [Enable debug code])
# Check for mcheck
AC_CHECK_HEADERS([mcheck.h])
# Check for -fstack-protector availability
GCC_STACK_PROTECT_LIB
GCC_STACK_PROTECT_CC
CFLAGS="$CFLAGS -Wall -Werror"
else
AC_MSG_RESULT(no)
CFLAGS="$CFLAGS -Wall"
fi
# Enable or disable use of git version in pacman version string
AC_CHECK_PROGS([GIT], [git])
AC_CHECK_FILE([.git/], hasgitdir=yes)
AC_MSG_CHECKING(whether to use git version if available)
if test "x$wantgitver" = "xyes" ; then
if test $GIT -a "x$hasgitdir" = "xyes"; then
AC_MSG_RESULT([yes])
usegitver=yes
AC_DEFINE([USE_GIT_VERSION], , [Use GIT version in version string])
else
AC_MSG_RESULT([no, git or .git dir missing])
usegitver=no
fi
else
AC_MSG_RESULT([no, disabled by configure])
usegitver=no
fi
AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes")
# Set root directory
AC_SUBST(ROOTDIR)
# Set package file extension
AC_SUBST(PKGEXT)
AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packages])
# Set source package file extension
AC_SUBST(SRCEXT)
AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman source packages])
# Set database file extension
AC_SUBST(DBEXT)
AC_DEFINE_UNQUOTED([DBEXT], "$DBEXT", [The file extension used by pacman databases])
# Configuration files
AC_CONFIG_FILES([
lib/libalpm/Makefile
lib/libalpm/po/Makefile.in
src/pacman/Makefile
src/util/Makefile
scripts/Makefile
doc/Makefile
etc/Makefile
po/Makefile.in
pactest/Makefile
contrib/Makefile
Makefile
])
AC_OUTPUT
echo "
${PACKAGE_NAME}:
Build information:
source code location : ${srcdir}
prefix : ${prefix}
sysconfdir : $(eval echo ${sysconfdir})
conf file : $(eval echo ${sysconfdir})/pacman.conf
localstatedir : $(eval echo ${localstatedir})
database dir : $(eval echo ${localstatedir})/lib/pacman/
cache dir : $(eval echo ${localstatedir})/cache/pacman/pkg/
compiler : ${CC}
compiler flags : ${CFLAGS}
defines : ${DEFS}
Architecture : ${CARCH}
Architecture flags : ${CARCHFLAGS}
Host Type : ${CHOST}
Filesize command : ${SIZECMD}
libalpm version : ${LIB_VERSION}
libalpm version info : ${LIB_VERSION_INFO}
pacman version : ${PACKAGE_VERSION}
using git version : ${usegitver}
Directory and file information:
root working directory : ${ROOTDIR}
package extension : ${PKGEXT}
source pkg extension : ${SRCEXT}
database extension : ${DBEXT}
Compilation options:
Run make in doc/ dir : ${wantdoc}
Use download library : ${internaldownload}
Doxygen support : ${usedoxygen}
debug support : ${debug}
"
# vim:set ts=2 sw=2 noet:

16
contrib/Makefile.am Normal file
View file

@ -0,0 +1,16 @@
EXTRA_DIST = \
PKGBUILD.vim \
bacman \
bash_completion \
gensync \
pacdiff \
paclist \
pacsearch \
pactree \
updatesync \
vimprojects \
wget-xdelta.sh \
zsh_completion \
README
# vim:set ts=2 sw=2 noet:

241
contrib/PKGBUILD.vim Normal file
View file

@ -0,0 +1,241 @@
" Vim syntax file
" Language: PKGBUILD
" Maintainer: Alessio 'mOLOk' Bolognino <themolok at gmail.com>
" Last Change: 2007/05/08
" Version Info: PKGBUILD-0.2 (colorphobic)
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
let b:main_syntax = "sh"
runtime! syntax/sh.vim
" case on
syn case match
" pkgname
" FIXME if '=' is in pkgname/pkgver, it highlights whole string, not just '='
syn keyword pb_k_pkgname pkgname contained
syn match pbValidPkgname /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgname
syn match pbIllegalPkgname /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
syn match pbPkgnameGroup /^pkgname=.*/ contains=pbIllegalPkgname,pb_k_pkgname,shDoubleQuote,shSingleQuote
" pkgver
syn keyword pb_k_pkgver pkgver contained
syn match pbValidPkgver /\([[:alnum:]]\|\.\|+\|_\)/ contained contains=pbIllegalPkgver
syn match pbIllegalPkgver /[^[:alnum:]+=\.\_]\|=.*=/ contained
syn match pbPkgverGroup /^pkgver=.*/ contains=pbIllegalPkgver,pbValidPkgver,pb_k_pkgver,shDoubleQuote,shSingleQuote
" pkgrel
syn keyword pb_k_pkgrel pkgrel contained
syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgver
syn match pbIllegalPkgrel /[^[:digit:]=]\|=.*=/ contained
syn match pbPkgrelGroup /^pkgrel=.*/ contains=pbIllegalPkgrel,pbValidPkgrel,pb_k_pkgrel,shDoubleQuote,shSingleQuote
" pkgdesc
syn keyword pb_k_desc pkgdesc contained
" 90 chars: 80 for description, 8 for pkgdesc and 2 for ''
syn match pbIllegalPkgdesc /.\{90,}\|=['"]\?.*['" ]\+[iI][sS] [aA]/ contained contains=pbPkgdescSign
syn match pbValidPkgdesc /[^='"]\.\{,80}/ contained contains=pbIllegalPkgdesc
syn match pbPkgdescGroup /^pkgdesc=.*/ contains=pbIllegalPkgdesc,pb_k_desc,pbValidPkgdesc,shDoubleQuote,shSingleQuote
syn match pbPkgdescSign /[='"]/ contained
" url
syn keyword pb_k_url url contained
syn match pbValidUrl /['"]*\(https\|http\|ftp\)\:\/.*\.\+.*/ contained
syn match pbIllegalUrl /[^=]/ contained contains=pbValidUrl
syn match pbUrlGroup /^url=.*/ contains=pbValidUrl,pb_k_url,pbIllegalUrl,shDoubleQuote,shSingleQuote
" license
syn keyword pb_k_license license contained
syn keyword pbLicense APACHE CDDL EPL FDL GPL LGPL MPL PHP RUBY ZLIB ISC MIT BSD contained
syn match pbLicenseCustom /custom\(:[[:alnum:]]*\)*/ contained
syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseCustom,pbLicense
syn region pbLicenseGroup start=/^license=(/ end=/)/ contains=pb_k_license,pbLicenseCustom,pbLicense,pbIllegalLicense
" backup
syn keyword pb_k_backup backup contained
syn match pbValidBackup /\.\?[[:alpha:]]*\/[[:alnum:]\{\}+._$-]*]*/ contained
syn region pbBackupGroup start=/^backup=(/ end=/)/ contains=pb_k_backup,pbValidBackup,shDoubleQuote,shSingleQuote
" arch
syn keyword pb_k_arch arch contained
syn keyword pbArch i686 x86_64 ppc contained
syn match pbIllegalArch /[^='"() ]/ contained contains=pbArch
syn region pbArchGroup start=/^arch=(/ end=/)/ contains=pb_k_arch,pbArch,pbIllegalArch
" groups
syn keyword pb_k_groups groups contained
syn match pbValidGroups /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbGroupsGroup start=/^groups=(/ end=/)/ contains=pb_k_groups,pbValidGroups,shDoubleQuote,shSingleQuote
" depends
syn keyword pb_k_depends depends contained
syn match pbValidDepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbDependsGroup start=/^depends=(/ end=/)/ contains=pb_k_depends,pbValidDepends,shDoubleQuote,shSingleQuote
" makedepends
syn keyword pb_k_makedepends makedepends contained
syn match pbValidMakedepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbMakedependsGroup start=/^makedepends=(/ end=/)/ contains=pb_k_makedepends,pbValidMakedepends,shDoubleQuote,shSingleQuote
" optdepends
syn keyword pb_k_optdepends optdepends contained
syn match pbValidOptdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbOptdependsGroup start=/^optdepends=(/ end=/)/ contains=pb_k_optdepends,pbValidOptdepends,shDoubleQuote,shSingleQuote
" conflicts
syn keyword pb_k_conflicts conflicts contained
syn match pbValidConflicts /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbConflictsGroup start=/^conflicts=(/ end=/)/ contains=pb_k_conflicts,pbValidConflicts,shDoubleQuote,shSingleQuote
" provides
syn keyword pb_k_provides provides contained
syn match pbValidProvides /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbProvidesGroup start=/^provides=(/ end=/)/ contains=pb_k_provides,pbValidProvides,shDoubleQuote,shSingleQuote
" replaces
syn keyword pb_k_replaces replaces contained
syn match pbValidReplaces /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbReplacesGroup start=/^replaces=(/ end=/)/ contains=pb_k_replaces,pbValidReplaces,shDoubleQuote,shSingleQuote
" install
" XXX remove install from bashStatement, fix strange bug
syn clear bashStatement
syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch
syn keyword pb_k_install install contained
syn match pbValidInstall /\([[:alnum:]]\|\$\|+\|-\|_\)*\.install/ contained
syn match pbIllegalInstall /[^=]/ contained contains=pbValidInstall
syn match pbInstallGroup /^install=.*/ contains=pb_k_install,pbValidInstall,pbIllegalInstall,shDeref,shDoubleQuote,shSingleQuote
" source:
" XXX remove source from shStatement, fix strange bug
syn clear shStatement
syn keyword shStatement xxx wait getopts return autoload whence printf true popd nohup enable r trap readonly fc fg kill ulimit umask disown stop pushd read history logout times local exit test pwd time eval integer suspend dirs shopt hash false newgrp bg print jobs continue functions exec help cd break unalias chdir type shift builtin let bind
syn keyword pb_k_source source contained
syn match pbIllegalSource /\(http\|ftp\|https\).*\.\+\(dl\|download.\?\)\.\(sourceforge\|sf\).net/
syn region pbSourceGroup start=/^source=(/ end=/)/ contains=pb_k_source,pbIllegalSource,shNumber,shDoubleQuote,shSingleQuote,pbDerefEmulation
syn match pbDerefEmulation /\$[{]\?[[:alnum:]_]*[}]\?/ contained
hi def link pbDerefEmulation PreProc
" md5sums
syn keyword pb_k_md5sums md5sums contained
syn match pbIllegalMd5sums /[^='"()\/ ]/ contained contains=pbValidMd5sums
syn match pbValidMd5sums /[[:alnum:]]\{32\}/ contained
syn region pbMd5sumsGroup start=/^md5sums/ end=/)/ contains=pb_k_md5sums,pbMd5Quotes,pbMd5Hash,pbIllegalMd5sums keepend
syn match pbMd5Quotes /'.*'\|".*"/ contained contains=pbMd5Hash,pbIllegalMd5sums
syn match pbMd5Hash /[[:alnum:]]\+/ contained contains=pbValidMd5sums
hi def link pbMd5Quotes Keyword
hi def link pbMd5Hash Error
hi def link pbValidMd5sums Number
" sha1sums
syn keyword pb_k_sha1sums sha1sums contained
syn match pbIllegalSha1sums /[^='"()\/ ]/ contained contains=pbValidSha1sums
syn match pbValidSha1sums /[[:alnum:]]\{40\}/ contained
syn region pbSha1sumsGroup start=/^sha1sums/ end=/)/ contains=pb_k_sha1sums,pbSha1Quotes,pbSha1Hash,pbIllegalSha1sums keepend
syn match pbSha1Quotes /'.*'\|".*"/ contained contains=pbSha1Hash,pbIllegalSha1sums
syn match pbSha1Hash /[[:alnum:]]\+/ contained contains=pbValidSha1sums
hi def link pbSha1Quotes Keyword
hi def link pbSha1Hash Error
hi def link pbValidSha1sums Number
" options
syn keyword pb_k_options options contained
syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|ccache\|distcc\|makeflags\|force\)/ contained
syn match pbOptionsNeg /\!/ contained
syn match pbOptionsDeprec /no/ contained
syn region pbOptionsGroup start=/^options=(/ end=/)/ contains=pb_k_options,pbOptions,pbOptionsNeg,pbOptionsDeprec,pbIllegalOption,shDoubleQuote,shSingleQuote
syn match pbIllegalOption /[^!"'()= ]/ contained contains=pbOptionsDeprec,pbOptions
" noextract
syn match pbNoextract /[[:alnum:]+._${}-]\+/ contained
syn keyword pb_k_noextract noextract contained
syn region pbNoextractGroup start=/^noextract=(/ end=/)/ contains=pb_k_noextract,pbNoextract,shDoubleQuote,shSingleQuote
" comments
syn keyword pb_k_maintainer Maintainer Contributor contained
syn match pbMaintainerGroup /Maintainer.*/ contains=pbMaintainer contained
syn match pbDate /[0-9]\{4}\/[0-9]\{2}\/[0-9]\{2}/ contained
syn cluster pbCommentGroup contains=pbTodo,pb_k_maintainer,pbMaintainerGroup,pbDate
syn keyword pbTodo contained COMBAK FIXME TODO XXX
syn match pbComment "^#.*$" contains=@pbCommentGroup
syn match pbComment "[^0-9]#.*$" contains=@pbCommentGroup
" quotes are handled by sh.vim
hi def link pbComment Comment
hi def link pbTodo Todo
hi def link pbIllegalPkgname Error
hi def link pb_k_pkgname pbKeywords
hi def link pbIllegalPkgver Error
hi def link pb_k_pkgver pbKeywords
hi def link pbIllegalPkgrel Error
hi def link pb_k_pkgrel pbKeywords
hi def link pbIllegalPkgdesc Error
hi def link pb_k_desc pbKeywords
hi def link pbIllegalUrl Error
hi def link pb_k_url pbKeywords
hi def link pb_k_license pbKeywords
hi def link pbIllegalLicense Error
hi def link pb_k_backup pbKeywords
hi def link pb_k_arch pbKeywords
hi def link pbIllegalArch Error
hi def link pb_k_groups pbKeywords
hi def link pb_k_makedepends pbKeywords
hi def link pb_k_optdepends pbKeywords
hi def link pb_k_depends pbKeywords
hi def link pb_k_replaces pbKeywords
hi def link pb_k_conflicts pbKeywords
hi def link pb_k_provides pbKeywords
hi def link pbIllegalInstall Error
hi def link pb_k_install pbKeywords
hi def link pb_k_source pbKeywords
hi def link pbIllegalSource Error
hi def link pb_k_md5sums pbKeywords
hi def link pbIllegalMd5sums Error
hi def link pb_k_sha1sums pbKeywords
hi def link pbIllegalSha1sums Error
hi def link pb_k_options pbKeywords
hi def link pbOptionsDeprec Todo
hi def link pbIllegalOption Error
hi def link pb_k_noextract pbKeywords
hi def link pbNoextract Normal
hi def link pb_k_maintainer pbKeywords
hi def link pbKeywords Keyword
hi def link pbDate Special
"syntax include @SHELL syntax/sh.vim
"syntax region BUILD start=/^build()/ end=/^}/ contains=@SHELL
"let b:current_syntax = "PKGBUILD"
" vim: ft=vim

37
contrib/README Normal file
View file

@ -0,0 +1,37 @@
Here is a brief description of the files included in this directory:
PKGBUILD.vim - a vim/gvim syntax file for PKGBUILDs. Colors known variable
names, highlights common errors such as invalid characters in pkgname or
pkgver, etc.
bash_completion - a bash completion script for pacman, install in
/etc/bash_completion.d/ for use (but rename to something descriptive!).
zsh_completion - a zsh completion script, install (with a rename) to
/usr/share/zsh/site-functions/.
pacdiff - a simple pacnew/pacorig/pacsave updater for /etc/.
paclist - list all packages installed from a given repository. Useful for
seeing which packages you may have installed from the testing repository,
for instance.
pacsearch - a colorized search combining both -Ss and -Qs output. Installed
packages are easily identified with a *** and local-only packages are also
listed.
pactree - generate a dependency tree of an installed package in textual or
graphical form (using graphviz).
bacman - regenerate a pacman package based on installed files and the pacman
database entries. Useful for reuse, or possible config file extension.
vimprojects - a project file for the vim project plugin.
wget-xdelta.sh - A download script for pacman which allows binary deltas
generated with makepkg to be used instead of downloading full binary packages.
This should cut download sizes for some package upgrades significantly.
gensync, updatesync - The former repository management scripts that have since
been superseded by repo-add and repo-remove. They are here for posterity's
sake, and to show how repo-add and repo-remove can be wrapped in other scripts.

284
contrib/bacman Executable file
View file

@ -0,0 +1,284 @@
#!/bin/bash
#
# bacman: recreate a package from a running system
# This script rebuilds an already installed package using metadata
# stored into the pacman database and system files
#
# (c) 2008 - locci <carlocci_at_gmail_dot_com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
readonly progname="bacman"
readonly progver="0.2.0"
#
# User Friendliness
#
function usage(){
echo "This program recreates a package using pacman's db and system files"
echo "Usage: $progname <installed package name>"
echo "Example: $progname kernel26"
}
if [ $# -ne 1 ] ; then
usage
exit 1
fi
if [ "$1" = "--help" -o "$1" = "-h" ] ; then
usage
exit 0
fi
if [ "$1" = "--version" -o "$1" = "-v" ]; then
echo "$progname version $progver"
echo "Copyright (C) 2008 locci"
exit 0
fi
#
# Fakeroot support
#
if [ $EUID -gt 0 ]; then
if [ -f /usr/bin/fakeroot ]; then
echo "Entering fakeroot environment"
export INFAKEROOT="1"
/usr/bin/fakeroot -u -- $0 $1
exit $?
else
echo "WARNING: installing fakeroot or running ${progname} as root is required to"
echo " preserve the ownership permissions of files in some packages"
echo ""
fi
fi
#
# Setting environmental variables
#
if [ ! -r /etc/pacman.conf ]; then
echo "ERROR: unable to read /etc/pacman.conf"
exit 1
fi
eval $(awk '/DBPath/ {print $1$2$3}' /etc/pacman.conf)
pac_db="${DBPath:-/var/lib/pacman/}/local"
if [ ! -r /etc/makepkg.conf ]; then
echo "ERROR: unable to read /etc/makepkg.conf"
exit 1
fi
source "/etc/makepkg.conf"
if [ -r ~/.makepkg.conf ]; then
source ~/.makepkg.conf
fi
pkg_arch=${CARCH:-'unknown'}
pkg_dest="${PKGDEST:-$PWD}"
pkg_ext=${PKGEXT:-'.pkg.tar.gz'}
pkg_pkger=${PACKAGER:-'Unknown Packager'}
pkg_name="$1"
pkg_dir="$(echo $pac_db/$pkg_name-[0-9]*)"
pkg_namver="${pkg_dir##*/}"
#
# Checks everything is in place
#
if [ ! -d "$pac_db" ] ; then
echo "ERROR: pacman database directory ${pac_db} not found"
exit 1
fi
if [ ! -d "$pkg_dir" ] ; then
echo "ERROR: package ${pkg_name} not found in pacman database"
exit 1
fi
#
# Begin
#
echo Package: ${pkg_namver}
work_dir=$(mktemp -d -p /tmp)
cd "$work_dir" || exit 1
#
# File copying
#
echo "Copying package files..."
cat "$pkg_dir"/files |
while read i; do
if [ -z "$i" ] ; then
continue
fi
if [[ "$i" =~ %[A-Z]*% ]] ; then
current=$i
continue
fi
case $current in
%FILES%)
ret=0
if [ -e "/$i" ]; then
bsdtar -cnf - "/$i" 2> /dev/null | bsdtar -xpf -
# Workaround to bsdtar not reporting a missing file as an error
if [ ! -e "$work_dir/$i" ] && [ -L "$work_dir/$i"]; then
echo ""
echo "ERROR: unable to add /$i to the package"
echo " If your user does not have permssion to read this file then"
echo " you will need to run $progname as root"
rm -rf "$work_dir"
exit 1
fi
else
echo ""
echo "WARNING: package file /$i is missing"
echo ""
fi
;;
esac
done
ret=$?
if [ $ret -ne 0 ]; then
rm -rf "$work_dir"
exit 1
fi
pkg_size=$(du -sk | awk '{print $1 * 1024}')
if [ -f "$pkg_dir/install" ] ; then
cp "$pkg_dir/install" "$work_dir/.INSTALL"
fi
if [ -f $pkg_dir/changelog ] ; then
cp "$pkg_dir/changelog" "$work_dir/.CHANGELOG"
fi
#
# .PKGINFO stuff
#
echo Generating .PKGINFO metadata...
echo "# Generated by $progname $progver" > .PKGINFO
if [ "$INFAKEROOT" = "1" ]; then
echo "# Using $(fakeroot -v)" >> .PKGINFO
fi
echo "# $(LC_ALL=C date)" >> .PKGINFO
echo "#" >> .PKGINFO
cat "$pkg_dir"/{desc,files,depends} |
while read i; do
if [[ -z "$i" ]]; then
continue;
fi
if [[ "$i" =~ %[A-Z]*% ]] ; then
current=$i
continue
fi
case "$current" in
# desc
%NAME%)
echo "pkgname = $i" >> .PKGINFO
;;
%VERSION%)
echo "pkgver = $i" >> .PKGINFO
;;
%DESC%)
echo "pkgdesc = $i" >> .PKGINFO
;;
%URL%)
echo "url = $i" >> .PKGINFO
;;
%LICENSE%)
echo "license = $i" >> .PKGINFO
;;
%ARCH%)
echo "arch = $i" >> .PKGINFO
;;
%BUILDDATE%)
echo "builddate = $(date -u "+%s")" >> .PKGINFO
;;
%PACKAGER%)
echo "packager = $pkg_pkger" >> .PKGINFO
;;
%SIZE%)
echo "size = $pkg_size" >> .PKGINFO
;;
%GROUPS%)
echo "group = $i" >> .PKGINFO
;;
%REPLACES%)
echo "replaces = $i" >> .PKGINFO
;;
%FORCE%)
echo "force = true" >> .PKGINFO
;;
# files
%BACKUP%)
# strip the md5sum after the tab
echo "backup = ${i%%$'\t'*}" >> .PKGINFO
;;
# depends
%DEPENDS%)
echo "depend = $i" >> .PKGINFO
;;
%OPTDEPENDS%)
echo "optdepend = $i" >> .PKGINFO
;;
%CONFLICTS%)
echo "conflict = $i" >> .PKGINFO
;;
%PROVIDES%)
echo "provides = $i" >> .PKGINFO
;;
esac
done
#
# Fixes owner:group and permissions for .PKGINFO, .CHANGELOG, .INSTALL
#
chown root:root "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
chmod 644 "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
#
# Generate the package
#
echo "Generating the package..."
ret=0
bsdtar -czf "$pkg_dest/$pkg_namver-$pkg_arch$pkg_ext" $(ls -A) || ret=$?
if [ $ret -ne 0 ]; then
echo "ERROR: unable to write package to $pkg_dest"
echo " Maybe the disk is full or you do not have write access"
rm -rf "$work_dir"
exit 1
fi
rm -rf "$work_dir"
echo Done
exit 0
# vim: set ts=2 sw=2 noet:

363
contrib/bash_completion Normal file
View file

@ -0,0 +1,363 @@
# vim: set ft=sh ts=2 sw=2 et:
# file: /etc/bash_completion.d/pacman
# Bash completion for pacman
# Original: Manolis Tzanidakis <mtzanidakis@freemail.gr>
#
# Distributed under the terms of the GNU General Public License, v2 or later.
#
## initial functions
rem_selected ()
{
# (Adapted from bash_completion by Ian Macdonald <ian@caliban.org>)
# This removes any options from the list of completions that have
# already been specified on the command line.
COMPREPLY=($(echo "${COMP_WORDS[@]}" | \
(while read -d ' ' i; do
[ "${i}" == "" ] && continue
# flatten array with spaces on either side,
# otherwise we cannot grep on word boundaries of
# first and last word
COMPREPLY=" ${COMPREPLY[@]} "
# remove word from list of completions
COMPREPLY=(${COMPREPLY/ ${i%% *} / })
done
echo ${COMPREPLY[@]})))
return 0
}
_available_repos ()
{
COMPREPLY=( $( compgen -W "$(grep '\[' /etc/pacman.conf | grep -v -e 'options' -e '^#' | tr -d '[]' )" -- $cur ) )
}
_installed_pkgs ()
{
local installed_pkgs
installed_pkgs=$( ls /var/lib/pacman/local/ )
COMPREPLY=( $( compgen -W "$( for i in $installed_pkgs; do echo ${i%-*-*}; done )" -- $cur ) )
}
_available_pkgs ()
{
#find balks easilly on a find /foo/*/* type dir, especially one like
# /var/lib/pacman/*/*
# This little change-up removes the find *and* only uses enabled repos
local available_pkgs
local enabled_repos
enabled_repos=$( grep '\[' /etc/pacman.conf | grep -v -e 'options' -e '^#' | tr -d '[]' )
available_pkgs=$( for r in $enabled_repos; do echo /var/lib/pacman/sync/$r/*; done )
COMPREPLY=( $( compgen -W "$( for i in $available_pkgs; do j=${i##*/}; echo ${j%-*-*}; done )" -- $cur ) )
}
_installed_groups ()
{
local installed_groups
installed_groups=$( find /var/lib/pacman/local -name desc -exec sed -ne '/%GROUPS%/,/^$/{//d; p}' {} \; | sort -u )
COMPREPLY=( $( compgen -W "$( for i in $installed_groups; do echo ${i%-*-*}; done )" -- $cur ) )
}
_available_groups ()
{
#find balks easilly on a find /foo/*/* type dir, especially one like
# /var/lib/pacman/*/*
# This little change-up removes the find *and* only uses enabled repos
local available_groups
local enabled_repos
enabled_repos=$( grep '\[' /etc/pacman.conf | grep -v -e 'options' -e '^#' | tr -d '[]' )
available_groups=$( for r in $enabled_repos; do sed '/%GROUPS%/,/^$/{//d; p}' /var/lib/pacman/sync/$r/*/desc | sort -u; done )
COMPREPLY=( $( compgen -W "$( for i in $available_groups; do echo ${i%-*-*}; done )" -- $cur ) )
}
## makepkg completion
_makepkg ()
{
local cur prev
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
-p)
_filedir
return 0
;;
--help|--cleancache)
COMPREPLY=''
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '\
-A --ignorearch \
-b --builddeps \
-c --clean \
-C --cleancache \
-d --nodeps \
-e --noextract \
-f --force \
-g --geninteg \
-h --help \
-i --install \
-L --log \
-m --nocolor \
-o --nobuild \
-p \
-r --rmdeps \
-s --syncdeps \
--asroot \
--source \
--noconfirm \
--noprogressbar' -- $cur ) )
fi
rem_selected
}
complete -o default -F _makepkg makepkg
## pacman completion
_instring ()
{
str="${1}"
shift 1
for c in "${@}"; do
if [ $(expr index "${str}" "${c}") -gt 0 ]; then
return 0
fi
done
return 1
}
_pacman ()
{
local a arg toparse op mod cur
COMPREPLY=()
# This argument parsing is done so we can check for flag existance later
# right now it's a tad crappy, but does the job
for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
a=${COMP_WORDS[i]}
arg="${a:0:2}"
toparse="${a:2}"
case "${arg}" in
-@(U|R|S|Q|h|V))
op="${arg/-}"
mod="${mod}${a:2}"
;;
--)
arg="${a:2}"
case "${arg}" in
remove) op="R" ;;
upgrade) op="U" ;;
query) op="Q" ;;
sync) op="S" ;;
help) op="h" ;;
version) op="V" ;;
verbose) mod="${mod}v" ;;
root) mod="${mod}r" ;;
dbpath) mod="${mod}b" ;;
nodeps) mod="${mod}d" ;;
force) mod="${mod}f" ;;
groups) mod="${mod}g" ;;
info) mod="${mod}i" ;;
list) mod="${mod}l" ;;
print-uris) mod="${mod}p" ;;
search) mod="${mod}s" ;;
sysupgrade) mod="${mod}u" ;;
upgrades) mod="${mod}u" ;;
downloadonly) mod="${mod}w" ;;
refresh) mod="${mod}y" ;;
changelog) mod="${mod}c" ;;
deps) mod="${mod}d" ;;
explicit) mod="${mod}e" ;;
unrequired) mod="${mod}t" ;;
foreign) mod="${mod}m" ;;
owns) mod="${mod}o" ;;
file) mod="${mod}p" ;;
search) mod="${mod}s" ;;
upgrades) mod="${mod}u" ;;
cascade) mod="${mod}c" ;;
dbonly) mod="${mod}k" ;;
nosave) mod="${mod}n" ;;
recursive) mod="${mod}s" ;;
unneeded) mod="${mod}u" ;;
esac ;;
*) toparse="${a}" ;;
esac
arglen=$(( ${#toparse}-1 ))
for c in $(seq 0 "${arglen}"); do
arg=${toparse:$c:1}
[ "${arg}" != "-" ] && mod="${mod}${arg}"
done
done
cur=${COMP_WORDS[COMP_CWORD]}
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '\
-h --help \
-Q --query \
-R --remove \
-S --sync \
-U --upgrade \
-V --version \
' -- $cur ) )
rem_selected
return 0
fi
if [[ "$cur" == -* ]]; then
case "${op}" in
U)
COMPREPLY=( $( compgen -W '\
--asdeps \
--asexplicit \
-d --nodeps \
-f --force \
-h --help \
--config \
--logfile \
--noconfirm \
--noprogressbar \
--noscriptlet \
-v --verbose \
-r --root \
-b --dbpath \
--cachedir \
' -- $cur ) )
return 0
;;
R)
COMPREPLY=( $( compgen -W '\
-c --cascade \
-d --nodeps \
-h --help \
-k --dbonly \
-n --nosave \
-s --recursive \
-u --unneeded \
--config \
--logfile \
--noconfirm \
--noprogressbar \
--noscriptlet \
-v --verbose \
-r --root \
-b --dbpath \
--cachedir \
' -- $cur ) )
return 0
;;
S)
COMPREPLY=( $( compgen -W '\
--asdeps \
--asexplicit \
-c --clean \
-d --nodeps \
-f --force \
-g --groups \
-h --help \
-i --info \
-l --list \
-p --print-uris \
-s --search \
-u --sysupgrade \
-w --downloadonly \
-y --refresh \
--needed \
--ignore \
--ignoregroup \
--config \
--logfile \
--noconfirm \
--noprogressbar \
--noscriptlet \
-v --verbose \
-r --root \
-b --dbpath \
--cachedir \
' -- $cur ) )
return 0
;;
Q)
COMPREPLY=( $( compgen -W '\
-c --changelog \
-d --deps \
-e --explicit \
-g --groups \
-h --help \
-i --info \
-l --list \
-m --foreign \
-o --owns \
-p --file \
-s --search \
-t --unrequired \
-u --upgrades \
--config \
--logfile \
--noconfirm \
--noprogressbar \
--noscriptlet \
-v --verbose \
-r --root \
-b --dbpath \
--cachedir \
' -- $cur ) )
return 0
;;
esac
rem_selected
else
case "${op}" in
U)
COMPREPLY=( $( compgen -d -- "$cur" ) \
$( compgen -f -X '!*.pkg.tar.gz' -- "$cur" ) )
return 0
;;
h|V)
COMPREPLY=''
return 0
;;
Q)
if _instring $mod g; then
_installed_groups
elif _instring $mod o; then
COMPREPLY=( $( compgen -d -- "$cur" ) \
$( compgen -f -- "$cur" ) )
elif _instring $mod p; then
COMPREPLY=( $( compgen -d -- "$cur" ) \
$( compgen -f -X '!*.pkg.tar.gz' -- "$cur" ) )
elif _instring $mod u; then
COMPREPLY=''
return 0
else
_installed_pkgs
fi
return 0
;;
R)
_installed_pkgs
return 0
;;
S)
if _instring $mod l; then
_available_repos
else
_available_pkgs
fi
return 0
;;
esac
fi
rem_selected
}
complete -o filenames -F _pacman pacman

134
contrib/gensync Executable file
View file

@ -0,0 +1,134 @@
#!/bin/bash
#
# gensync
#
# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
myver='3.1.1'
# functions
usage() {
printf "gensync (pacman) %s\n\n" "$myver"
printf "Usage: %s <root> <destfile> [package_directory]\n\n" "$0"
printf "\
gensync will generate a sync database by reading all PKGBUILD files\n\
from <root>. gensync builds the database in a temporary directory\n\
and then compresses it to <destfile>.\n\n"
printf "\
gensync will calculate md5sums of packages in the same directory as\n\
<destfile>, unless an alternate [package_directory] is specified.\n\n"
printf "\
note: The <destfile> name is important. It must be of the form\n\
{treename}.db.tar.gz where {treename} is the name of the custom\n\
package repository you configured in /etc/pacman.conf. The\n\
generated database must reside in the same directory as your\n\
custom packages (also configured in /etc/pacman.conf)\n\n"
echo "Example: gensync /var/abs/local /home/mypkgs/custom.db.tar.gz"
}
version() {
printf "gensync (pacman) %s\n" "$myver"
printf "\
Copyright (C) 2002-2007 Judd Vinet <jvinet@zeroflux.org>.\n\n\
This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n"
}
error () {
local mesg=$1; shift
printf "==> ERROR: ${mesg}\n" "$@" >&2
}
die () {
error $*
exit 1
}
# PROGRAM START
if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage
exit 0
fi
if [ "$1" = "-V" -o "$1" = "--version" ]; then
version
exit 0
fi
if [ $# -lt 2 ]; then
usage
exit 1
fi
# source system and user makepkg.conf
if [ -r /etc/makepkg.conf ]; then
source /etc/makepkg.conf
else
die "/etc/makepkg.conf not found. Cannot continue."
fi
if [ -r ~/.makepkg.conf ]; then
source ~/.makepkg.conf
fi
d=$(dirname $1)
rootdir="$(cd $d && pwd)/$(basename $1)"
d="$(dirname $2)"
destdir="$(cd $d && pwd)"
destfile="$destdir/$(basename $2)"
pkgdir=""
if [ "$3" != "" ]; then
pkgdir="$3"
fi
[ ! -d "$rootdir" ] && die "invalid root dir: $rootdir"
echo "gensync: building database entries, generating md5sums..." >&2
cd "$destdir"
pkgs=""
for file in $(find "$rootdir"/* -name "$BUILDSCRIPT"); do
unset pkgname pkgver pkgrel options
source $file || die "failed to parse $file"
if [ "$arch" = 'any' ]; then
CARCH='any'
fi
if [ "$pkgdir" != "" ]; then
pkgfile="$pkgdir/$pkgname-$pkgver-$pkgrel-${CARCH}${PKGEXT}"
else
pkgfile="$destdir/$pkgname-$pkgver-$pkgrel-${CARCH}${PKGEXT}"
fi
if [ ! -f "$pkgfile" ]; then
error "could not find %s-%s-%s-%s%s - skipping" $pkgname $pkgver $pkgrel $CARCH $PKGEXT
else
pkgs="$pkgs $pkgfile"
fi
done
echo "creating repo DB..."
# we'll trim the output just a tad, as gensync may be used on large repos
repo-add $destfile $pkgs \
| grep -e "package" -e "database"
# vim: set ts=2 sw=2 noet:

45
contrib/pacdiff Executable file
View file

@ -0,0 +1,45 @@
#!/bin/sh
# pacdiff : a simple pacnew/pacorig/pacsave updater for /etc/
#
# Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Original http://phraktured.net/config/bin/pacdiff
diffprog=${DIFFPROG:-vimdiff}
for x in $(find /etc/ -name "*.pacnew" -o -name "*.pacorig" -o -name "*.pacsave")
do
echo "File: ${x%.pac*}"
chk="$(cmp $x ${x%.pac*})"
if [ -z "${chk}" ]; then
echo " Files are identical, removing..."
rm $x
else
echo -n " File differences found. (V)iew, (S)kip, (R)emove: [v/s/r] "
read c
c="$(echo $c| tr A-Z a-z)" #tolower
if [ "$c" = "r" ]; then
rm $x
elif [ "$c" = "s" ]; then
continue
else
[ "$c" = "n" -o "$c" = "N" ] || $diffprog $x ${x%.pac*}
echo -n " Remove file? [Y/n] "
read c
[ "$c" = "n" -o "$c" = "N" ] || rm $x
fi
fi
done

88
contrib/paclist Executable file
View file

@ -0,0 +1,88 @@
#!/usr/bin/perl
# paclist - List all packages installed from a given repo
#
# Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
my $progname = "paclist";
my $version = "1.0";
if ($#ARGV != 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
print "$progname - List all packages installed from a given repo\n";
print "Usage: $progname <repo>\n";
print "Example: $progname testing\n";
if ($#ARGV != 0) {
exit 1;
}
exit 0;
}
if ( $ARGV[0] eq "--version" || $ARGV[0] eq "-v") {
print "$progname version $version\n";
print "Copyright (C) 2008 Dan McGee\n";
exit 0;
}
# This hash table will be used to store pairs of ('name version', count) from
# the return of both pacman -Sl <repo> and pacman -Q output. We then check to
# see if a value was added twice (count = 2)- if so, we will print that package
# as it is both in the repo we queried and installed on our local system.
my %packages = ();
my $output;
$output = `pacman -Sl $ARGV[0]`;
if ($? != 0) {
exit 1;
}
my @sync = split(/\n/, $output);
# sample output from pacman -Sl:
# testing foobar 1.0-1
foreach $_ (@sync) {
my @info = split(/ /);
# we only want to store 'foobar 1.0-1' in our hash table
my $pkg = $info[1] . " " . $info[2];
$packages{$pkg}++;
}
$output = `pacman -Q`;
if ($? != 0) {
exit 1;
}
# sample output from pacman -Q:
# foobar 1.0-1
my @local = split(/\n/, $output);
foreach $_ (@local) {
# store 'foobar 1.0-1' in our hash table
$packages{$_}++;
}
# run comparison check- if value was added twice, it was in the intersection
my @intersection;
foreach $_ (keys %packages) {
if ($packages{$_} == 2) {
push @{ \@intersection }, $_;
}
}
# print our intersection, and bask in the glory and speed of perl
@intersection = sort @intersection;
foreach $_ (@intersection) {
print $_ . "\n";
}
#vim: set noet:

132
contrib/pacsearch Executable file
View file

@ -0,0 +1,132 @@
#!/usr/bin/perl
# pacsearch - Adds color and install information to a 'pacman -Ss' search
#
# Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>
#
# Based off original shell script version:
# Copyright (C) 2006-2007 Dan McGee <dpmcgee@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#TODO: colors flag on commandline
use strict;
use warnings;
my $progname = "pacsearch";
my $version = "2.0";
if ($#ARGV lt 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
print "$progname - Add color and install information to a pacman -Ss search\n";
print "Usage: $progname <pattern>\n";
print "Example: $progname ^gnome\n";
if ($#ARGV lt 0) {
exit 1;
}
exit 0;
}
if ($ARGV[0] eq "--version" || $ARGV[0] eq "-v") {
print "$progname version $version\n";
print "Copyright (C) 2006-2008 Dan McGee\n";
exit 0;
}
# define our colors to use when printing
my $CLR1 = "\e[0;34m";
my $CLR2 = "\e[0;32m";
my $CLR3 = "\e[0;35m";
my $CLR4 = "\e[0;36m";
my $CLR5 = "\e[0;31m";
my $CLR6 = "\e[0;33m";
my $CLR7 = "\e[1;36m";
my $INST = "\e[1;31m";
my $BASE = "\e[0m";
my $INSTMARK = $INST."***";
# color a "repo/pkgname pkgver" line based on the respository name
sub to_color {
my $line = shift;
$line =~ s/(^core\/.*)/$CLR1$1$BASE/;
$line =~ s/(^extra\/.*)/$CLR2$1$BASE/;
$line =~ s/(^community\/.*)/$CLR3$1$BASE/;
$line =~ s/(^testing\/.*)/$CLR4$1$BASE/;
$line =~ s/(^unstable\/.*)/$CLR5$1$BASE/;
$line =~ s/(^custom\/.*)/$CLR6$1$BASE/;
$line =~ s/(^local\/.*)/$CLR7$1$BASE/;
# any other unknown repository
$line =~ s/(^[\w-]*\/.*)/$CLR6$1$BASE/;
return $line;
}
my %allpkgs = ();
my $syncout = `pacman -Ss '@ARGV'`;
# split each sync search entry into its own array entry
my @syncpkgs = split(/\n^(?=\w)/m, $syncout);
# remove the extra \n from the last desc entry
if ($#syncpkgs >= 0) {
chomp($syncpkgs[$#syncpkgs]);
}
# counter var for packages, used here and in the query loop too
my $cnt = 0;
foreach $_ (@syncpkgs) {
# we grab 3 fields here: repo, name/ver, and desc
my @pkgfields = /^(.*?)\/(.*?)\n(.*)$/s;
# add a fourth field that will indicate install status
push (@pkgfields, "");
# add a fifth field that indicates original order
push (@pkgfields, $cnt++);
# add each sync pkg by name/ver to a hash table for quick lookup
$allpkgs{$pkgfields[1]} = [ @pkgfields ];
}
my $queryout = `pacman -Qs '@ARGV'`;
# split each querysearch entry into its own array entry
my @querypkgs = split(/\n^(?=\w)/m, $queryout);
# remove the extra \n from the last desc entry
if ($#querypkgs >= 0) {
chomp ($querypkgs[$#querypkgs]);
}
foreach $_ (@querypkgs) {
# we grab 3 fields here: repo, name/ver, and desc
my @pkgfields = /^(.*?)\/(.*?)\n(.*)$/s;
# check if the package was listed in the sync out
# if it is we want to mark it with a *** marker
if (exists $allpkgs{$pkgfields[1]}) {
# mark it in our fourth field as installed
@{ $allpkgs{$pkgfields[1]} }[3] = $INSTMARK;
} else {
# add a fourth field that will indicate install status
push (@pkgfields, $INSTMARK);
# add a fifth field that indicates original order (after sync)
push (@pkgfields, $cnt++);
# add our local-only package to the hash
$allpkgs{$pkgfields[1]} = [ @pkgfields ];
}
}
# sort by original order (the fifth field) and print
foreach $_ ( sort{ @{$allpkgs{$a}}[4] <=> @{$allpkgs{$b}}[4] } keys %allpkgs) {
my @v = @{$allpkgs{$_}};
my $line = "$v[0]/$v[1]";
$line = to_color($line);
# print install marker + colorized "repo/pkgname pkgver" string
print "$v[3]$line\n";
print "$v[2]\n";
}
#vim: set noet:

300
contrib/pactree Executable file
View file

@ -0,0 +1,300 @@
#!/bin/bash
# pactree : a simple dependency tree viewer
#
# Copyright (C) 2008 Carlo "carlocci" Bersani <carlocci@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Original http://carlocci.ngi.it/arch/pactree
# Credit to scj for the graphviz idea
# set the colors
branch1_color="\033[0;33m" #Brown
branch2_color="\033[0;37m" #Gray
leaf_color="\033[1;32m" #Light green
leaf2_color="\033[0;32m" #Green
# set the separators
separator=" "
branch_tip1="|--"
branch_tip2="+--"
provides="provides "
# set the graphviz options
# http://www.graphviz.org/doc/info/output.html for available output formats
# http://www.graphviz.org/doc/info/colors.html for available colors
gformat="png" #output format
start_color="red" #START color
nodes_color="green" #color of the nodes
arrow1_color="chocolate4" #color of the normal arrow
arrow2_color="grey" #color of the "provided by" headless arrow
readonly prog_name="pactree"
readonly prog_ver="0.2"
_usage(){
echo "This program generates the dependency tree of an installed package"
echo "Usage: $prog_name [OPTIONS] <installed packages>"
echo
echo " OPTIONS:"
echo " -c, --color Enable color output"
echo " -d, --depth INT Limit the shown dependencies depth"
echo " -g, --graph Use graphviz to make an image of the tree"
echo " -l, --linear Enable linear output"
echo " -s, --silent Shh, let me hear those errors!"
echo " -u, --unique Print the dependency list with no duplicates"
echo
echo " -h, --help Print this help message"
echo " -v, --version Print the program name and version"
echo
echo "Example: $prog_name -c -d 2 readline"
}
_version(){
echo "$prog_name version $prog_ver"
echo "Copyright (C) 2008 Carlo \"carlocci\" Bersani <carlocci@gmail.com>"
}
# end of the friendliness
# grab a field from the database: $1=path/to/file, $2=field to grab
_grabfield(){
for line in $(cat "$1" 2>/dev/null ); do
if [ -z "$line" ]; then
continue;
fi;
if [[ "$line" =~ %[A-Z]*% ]]; then
current="$line"
continue;
fi;
if [ "$current" = "$2" ]; then
echo "$line"
fi;
done
}
# find a dep in the db: $1=dep, $2=field, $3=dbfile, ret=file list
_finddep(){
for line in $(awk 'BEGIN{RS=""}
{
if ($1=="'"$2"'"){
for (i=2 ; i<=NF ; ++i){
if ($i ~ /^'"$1"'([<>=]+.*|)$/ ){
print FILENAME}
}
}
}' $(find $pac_db -name $3)); do
echo "${line%/*}"
done
}
# Recursive function: does all of the work, pays all of the taxes #
_tree(){
pkg_name="$1"
pkg_dirs="$(echo $pac_db/$pkg_name-[0-9]*)"
# Is $pkg_name real or provided?
[ ! -d "$pkg_dirs" ] && pkg_dirs="$(_finddep $pkg_name %PROVIDES% depends)"
for pkg_dir in $pkg_dirs ; do
spaces="$2"
unset provided
branch_tip="$branch_tip1"
branch_color="$branch1_color"
pkg_name="$(_grabfield "$pkg_dir/desc" %NAME%)"
if [ ! "$pkg_name" = "$1" ]; then
provided="$leaf2_color $provides$leaf_color$1"
branch_tip="$branch_tip2"
branch_color="$branch2_color"
if [ $graphviz -eq 1 ] && [[ ! "${dep_list[@]}" =~ _$1_ ]] && [ $spaces -ne $((max_depth+1)) ]; then
echo "\"$1\" -> \"$pkg_name\" [arrowhead=none, color=$arrow2_color];"
dep_list=( "${dep_list[@]}" "_$1_" )
_tree "$pkg_name" $((spaces+1))
continue
fi
fi
# Generate the spacer
spacer=""
for each in $(seq 1 $spaces); do
spacer="$spacer$separator"
done
spacer="$spacer$branch_tip"
[ $silent -ne 1 ] && echo -e "$branch_color$spacer$leaf_color$pkg_name$provided"
[ ! -d "$pkg_dir" ] && echo "No $pkg_name in the database (inconsistent database?)" >&2
if [[ ! " ${dep_list[@]} " =~ " $pkg_name " ]] && [ $spaces -ne $max_depth ]; then
dep_list=( "${dep_list[@]}" "$pkg_name" )
for dep_pkg in $(_grabfield "$pkg_dir/depends" %DEPENDS%); do
spaces=$2 #Bash scoping ;_;
if [ $graphviz -eq 1 ]; then
echo "\"$1\" -> \"${dep_pkg%%[<>=]*}\" [color=$arrow1_color];"
fi
_tree "${dep_pkg%%[<>=]*}" $((spaces+1))
done
fi
done
}
# Main program: gets all of the money, pays none of the taxes
# Command line parameters parser
if [ $# -eq 0 ]; then
_usage
exit 1
fi
options=( "$@" )
len_options=${#options[@]}
for (( n=0 ; n < $len_options ; n++ )); do
if [ "${options[$n]}" = "--" ]; then
unset options[$n]
break
fi
if [ "${options[$n]}" = "-h" -o "${options[$n]}" = "--help" ]; then
_usage
exit 0
fi
if [ "${options[$n]}" = "-v" -o "${options[$n]}" = "--version" ]; then
_version
exit 0
fi
if [ "${options[$n]}" = "-l" -o "${options[$n]}" = "--linear" ]; then
unset options[$n]
linear=1
continue
fi
if [ "${options[$n]}" = "-s" -o "${options[$n]}" = "--silent" ]; then
unset options[$n]
silent=1
continue
fi
if [ "${options[$n]}" = "-u" -o "${options[$n]}" = "--unique" ]; then
unset options[$n]
silent=1
nodup=1
continue
fi
if [ "${options[$n]}" = "-g" -o "${options[$n]}" = "--graph" ]; then
unset options[$n]
graphviz=1
continue
fi
if [ "${options[$n]}" = "-c" -o "${options[$n]}" = "--color" ]; then
unset options[$n]
colored=1
continue
fi
if [[ "${options[$n]}" =~ -d[[:digit:]]+ || "${options[$n]}" == "--depth" ]]; then
if [[ "${options[$n]#-d}" =~ [[:digit:]]+ ]]; then
max_depth="${options[$n]#-d}"
elif [[ ${options[$((n+1))]} =~ [[:digit:]]+ ]]; then
max_depth="${options[$((n+1))]}"
unset options[$((n+1))]
((++n))
fi
unset options[$n]
continue
fi
done
# End of the dumb command line parser
# Env
colored=${colored:-0}
max_depth=${max_depth:--10}
linear=${linear:-0}
silent=${silent:-0}
nodup=${nodup:-0}
graphviz=${graphviz:-0}
if [ $colored -ne 1 ]; then
unset branch1_color
unset leaf_color
unset leaf2_color
unset branch2_color
fi
if [ $linear -eq 1 ]; then
unset separator
unset branch_tip1
unset branch_tip2
unset provides
fi
if [ $graphviz -eq 1 ]; then
silent=1
nodup=0
if [ ! -f /usr/bin/dot ]; then
echo "ERROR: package graphviz is not installed"
echo " Run pacman -S graphviz to install it"
exit 1
fi
fi
if [ ! -r /etc/pacman.conf ]; then
echo "ERROR: unable to read /etc/pacman.conf"
exit 1
else
eval $(awk '/DBPath/ {print $1$2$3}' /etc/pacman.conf)
fi
pac_db="${DBPath:-/var/lib/pacman}/local"
if [ ! -d "$pac_db" ] ; then
echo "ERROR: pacman database directory ${pac_db} not found"
exit 1
fi
# Env End
# Program starts
_main(){
for pkg_name in ${options[@]} ; do
[ $graphviz -eq 1 ] && echo -e "\"START\" -> \"$pkg_name\" ;"
_tree "$pkg_name" 0
if [ $nodup -eq 1 ]; then
for pkg_tree in ${dep_list[@]} ; do
echo "$pkg_tree"
done
fi
done
if [ $silent -eq 0 ]; then
echo -ne '\033[0m' # return colors to normal?
echo -ne '\033[?25h' #return cursor to normal?
fi
}
if [ $graphviz -eq 1 ]; then
root_pkgs="${options[@]}"
# Uncomment for the "generated by pactree" node in graphviz
#advert="xyz [height=0.07, fontsize=8.0, label=\"GENERATED WITH PACTREE\",shape=box,color="black",style=filled,fontcolor="white"];\n"
echo -e "digraph G { START [color=$start_color, style=filled];\n node [style=filled, color=$nodes_color];\n$(_main)\n$advert}" | dot -T$gformat -o "${root_pkgs// /_}.deps.$gformat"
else _main
fi
# vim: set ts=2 sw=2 noet:

137
contrib/updatesync Executable file
View file

@ -0,0 +1,137 @@
#!/bin/bash
#
# updatesync
#
# Copyright (c) 2004 by Jason Chu <jason@archlinux.org>
# Derived from gensync (c) 2002-2006 Judd Vinet <jvinet@zeroflux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
myver='3.1.1'
# functions
usage() {
printf "updatesync (pacman) %s\n\n" "$myver"
printf "Usage: %s <action> <destfile> <option> [package_directory]\n\n" "$0"
printf "\
updatesync will update a sync database by reading a PKGBUILD and\n\
modifying the destfile. updatesync updates the database in a temporary\n\
directory and then compresses it to <destfile>.\n\n"
printf "There are two types of actions:\n\n"
printf "upd - Will update a package's entry or create it if it doesn't exist.\n It takes the package's PKGBUILD as an option.\n"
printf "del - Will remove a package's entry from the db. It takes the package's\n name as an option.\n"
echo
printf "\
updatesync will calculate md5sums of packages in the same directory as\n\
<destfile>, unless an alternate [package_directory] is specified.\n\n"
echo "Example: updatesync upd /home/mypkgs/custom.db.tar.gz PKGBUILD"
}
version() {
printf "updatesync (pacman) %s\n" "$myver"
printf "\
Copyright (C) 2004 Jason Chu <jason@archlinux.org>.\n\n\
This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n"
}
error () {
local mesg=$1; shift
printf "==> ERROR: ${mesg}\n" "$@" >&2
}
die () {
error $*
exit 1
}
# PROGRAM START
if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage
exit 0
fi
if [ "$1" = "-V" -o "$1" = "--version" ]; then
version
exit 0
fi
if [ $# -lt 3 ]; then
usage
exit 1
fi
# source system and user makepkg.conf
if [ -r /etc/makepkg.conf ]; then
source /etc/makepkg.conf
else
die "/etc/makepkg.conf not found. Cannot continue."
fi
if [ -r ~/.makepkg.conf ]; then
source ~/.makepkg.conf
fi
if [ "$1" != "upd" -a "$1" != "del" ]; then
usage
exit 1
fi
action=$1
pkgdb=$2
option=$3
pkgdir="$(pwd)"
if [ "$4" != "" ]; then
pkgdir="$4"
fi
if [ "$action" = "upd" ]; then # INSERT / UPDATE
if [ ! -f "$option" ]; then
die "$option not found"
fi
unset pkgname pkgver pkgrel options
source $option || die "failed to parse $option"
if [ "$arch" = 'any' ]; then
CARCH='any'
fi
pkgfile="$pkgdir/$pkgname-$pkgver-$pkgrel-${CARCH}${PKGEXT}"
if [ ! -f "$pkgfile" ]; then
die "could not find %s-%s-%s-%s%s - aborting" $pkgname $pkgver $pkgrel $CARCH $PKGEXT
fi
repo-add "$pkgdb" "$pkgfile"
else # DELETE
fname="$(basename $option)"
if [ "$fname" = "PKGBUILD" ]; then
if [ ! -f "$option" ]; then
die "%s not found" $option
fi
unset pkgname pkgver pkgrel options
source $option
else
pkgname=$option
fi
repo-remove "$pkgdb" "$pkgname"
fi
exit 0
# vim: set ts=2 sw=2 noet:

25
contrib/vimprojects Normal file
View file

@ -0,0 +1,25 @@
This is a project file
for the vim-project plugin.
Save it as ~/.vimprojects
$ pacman -S vim-project
change the pacman path below
$ vim
:Project
Press \r in the project view
on a project name to generate
the list of files
pacman=~/devel/pacman/ CD=. filter="*.ac *.am" flags=S {
libalpm=lib/libalpm/ filter="*.c *.h *.am" {
}
pacman=src/pacman/ filter="*.c *.h *.am" {
}
scripts=scripts/ filter="*.sh.in *.py.in *.am" {
}
utils=src/util filter="*.c *.h *.am" {
}
contrib=contrib CD=. {
}
}

70
contrib/wget-xdelta.sh Executable file
View file

@ -0,0 +1,70 @@
#!/bin/bash
if [ -r "/etc/makepkg.conf" ]; then
source /etc/makepkg.conf
else
echo "wget-xdelta: Unable to find makepkg.conf"
exit 1
fi
if [ -r ~/.makepkg.conf ]; then
source ~/.makepkg.conf
fi
out_file=$(basename $1)
file_url=$2
if ! [[ "$out_file" =~ "pkg.tar.gz" ]]; then
# If it's not a package file download as normal and exit.
#wget --passive-ftp -c -O "$out_file" "$file_url"
exit $?
fi
# Get the package name and version
[[ "$out_file" =~ "$CARCH" ]] && arch="-$CARCH" || arch=""
pkg_data=$(echo $out_file | \
sed "s|^\(.*\)-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)${arch}${PKGEXT}.part|\1 \2|")
pkgname=$(echo $pkg_data | cut -d ' ' -f 1)
new_version=$(echo $pkg_data | cut -d ' ' -f 2)
base_url=${file_url%/*}
# Look for the last version
for file in $(ls -r /var/cache/pacman/pkg/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do
[[ "$file" =~ "$CARCH" ]] && arch="-$CARCH" || arch=""
check_version=$(echo $file | \
sed "s|^.*/${pkgname}-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)${arch}$PKGEXT$|\1|" | \
grep -v "^/var/cache/pacman/pkg")
[ "$check_version" = "" ] && continue
vercmp=$(vercmp "$check_version" "$old_version")
if [ "$check_version" != "$new_version" -a $vercmp -gt 0 ]; then
old_version=$check_version
old_file=$file
fi
done
if [ "$old_version" != "" -a "$old_version" != "$new_version" ]; then
# Great, we have a cached file, now calculate a patch name from it
delta_name="$pkgname-${old_version}_to_${new_version}-${CARCH}.delta"
echo "wget-xdelta: Attempting to download delta $delta_name..." >&2
if wget --passive-ftp -c "$base_url/$delta_name"; then
echo "wget-xdelta: Applying delta..."
if xdelta patch "$delta_name" "$old_file" "$out_file"; then
echo "wget-xdelta: Delta applied successfully!"
rm "$delta_name"
exit 0
else
echo "wget-xdelta: Failed to apply delta!"
rm $delta_name
fi
fi
fi
echo "wget-xdelta: Downloading new package..."
wget --passive-ftp -c -O "$out_file" "$file_url"
exit $?
# vim:set ts=4 sw=4 noet:

330
contrib/zsh_completion Normal file
View file

@ -0,0 +1,330 @@
#compdef pacman pacman.static=pacman
# copy this file to /usr/share/zsh/site-functions/_pacman
typeset -A opt_args
# options for passing to _arguments: main pacman commands
_pacman_opts_commands=(
'-Q[Query the package database]'
'-R[Remove a package from the system]'
'-S[Synchronize packages]'
'-U[Upgrade a package]'
'-V[Display version and exit]'
'-h[Display usage]'
)
# options for passing to _arguments: options common to all commands
_pacman_opts_common=(
'-b[Alternate database location]:database_location:_files -/'
'-h[Display syntax for the given operation]'
'-r[Set alternate installation root]:installation root:_files -/'
'-v[Be more verbose]'
'--cachedir[Alternate package cache location]:cache_location:_files -/'
'--config[An alternate configuration file]:config file:_files'
'--logfile[An alternate log file]:config file:_files'
'--noconfirm[Do not ask for confirmation]'
'--noprogressbar[Do not show a progress bar when downloading files]'
'--noscriptlet[Do not execute the install scriptlet if one exists]'
)
# options for passing to _arguments: options for --upgrade commands
_pacman_opts_pkgfile=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'*:package file:_files -g "*.pkg.tar.gz(.)"'
)
# options for passing to _arguments: subactions for --query command
_pacman_opts_query_actions=(
'-g[View all members of a package group]:*:package groups:->query_group'
'-o[Query the package that owns a file]:file:_files'
'-p[Package file to query]:*:package file:->query_file'
'-s[Search package names and descriptions]:*:search text:->query_search'
)
# options for passing to _arguments: options for --query and subcommands
_pacman_opts_query_modifiers=(
'-c[List package changelog]'
'-d[List packages installed as dependencies]'
'-e[List packages explicitly installed]'
'-i[View package information]'
'-ii[View package information including backup files]'
'-l[List package contents]'
'-m[List installed packages not found in sync db(s)]'
'-t[List packages not required by any package]'
'-u[List packages that can be upgraded]'
)
# options for passing to _arguments: options for --remove command
_pacman_opts_remove=(
'-c[Remove all dependent packages]'
'-d[Skip dependency checks]'
'-k[Only remove database entry, do not remove files]'
'-n[Remove protected configuration files]'
'-s[Remove dependencies not required by other packages]'
'*:installed package:_pacman_completions_installed_packages'
)
# options for passing to _arguments: options for --sync command
_pacman_opts_sync_actions=(
'*-c[Remove old packages from cache]:*:clean:->sync_clean'
'*-cc[Remove all packages from cache]:*:clean:->sync_clean'
'-g[View all members of a package group]:*:package groups:->sync_group'
'-s[Search package names and descriptions]:*:search text:->sync_search'
)
# options for passing to _arguments: options for --sync command
_pacman_opts_sync_modifiers=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'-i[View package information]'
'-l[List all packages in a repository]'
'-p[Print download URIs for each package to be installed]'
'-u[Upgrade all out-of-date packages]'
'-w[Download packages only]'
'-y[Download fresh package databases]'
'*--ignore[Ignore a package upgrade]:package:
_pacman_completions_all_packages'
'*--ignoregroup[Ignore a group upgrade]:package group:
_pacman_completions_all_groups'
'--asdeps[Install packages as non-explicitly installed]'
'--asexplicit[Install packages as explicitly installed]'
)
# handles --help subcommand
_pacman_action_help() {
_arguments -s : \
"$_pacman_opts_commands[@]"
}
# handles cases where no subcommand has yet been given
_pacman_action_none() {
_arguments -s : \
"$_pacman_opts_commands[@]"
}
# handles --query subcommand
_pacman_action_query() {
local context state line
typeset -A opt_args
# _arguments -s : \
# "$_pacman_opts_common[@]" \
# "$_pacman_opts_query_actions[@]" \
# "$_pacman_opts_query_modifiers[@]"
case $state in
query_file)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package file:_files -g "*.pkg.tar.gz"'
;;
query_group)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:groups:_pacman_completions_installed_groups'
;;
query_owner)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:file:_files'
;;
query_search)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:search text: '
;;
*)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_actions[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package:_pacman_completions_installed_packages'
;;
esac
}
# handles --remove subcommand
_pacman_action_remove() {
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_remove[@]"
}
# handles --sync subcommand
_pacman_action_sync() {
local context state line
typeset -A opt_args
# _arguments -s : \
# "$_pacman_opts_common[@]" \
# "$_pacman_opts_sync_actions[@]" #\
# #"$_pacman_opts_sync_modifiers[@]"
case $state in
sync_clean)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*-c[Remove old packages from cache]' \
;;
sync_group)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:package group:_pacman_completions_all_groups'
;;
sync_search)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:search text: '
;;
*)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:package:_pacman_completions_all_packages'
;;
esac
}
# handles --upgrade subcommand
_pacman_action_upgrade() {
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_pkgfile[@]"
}
# handles --version subcommand
_pacman_action_version() {
# no further arguments
return 0
}
# provides completions for package groups
_pacman_completions_all_groups() {
local -a cmd groups
_pacman_get_command
groups=( $(_call_program groups $cmd[@] -Sg) )
compadd "$@" -a groups
}
# provides completions for packages available from repositories
# these can be specified as either 'package' or 'repository/package'
_pacman_completions_all_packages() {
local -a cmd packages repositories packages_long
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
typeset -U repositories
packages_long=(/var/lib/pacman/sync/${^repositories}/*(/))
packages=(${(o)${${packages_long/\/var\/lib\/pacman\/sync\//}#*/}%-*-*} )
typeset -U packages
_wanted packages expl "packages" compadd - "${(@)packages}"
if [[ $PREFIX != */* ]] ; then
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
typeset -U repositories
_wanted repo_packages expl "repository/package" compadd -S "/" $repositories
else
compset -P '*/'
packages_long=(/var/lib/pacman/sync/$IPREFIX*(/))
packages=(${(o)${${packages_long/\/var\/lib\/pacman\/sync\//}#*/}%-*-*} )
typeset -U packages
_wanted repo_packages expl "repository/package" compadd ${(@)packages}
fi
}
# provides completions for package groups
_pacman_completions_installed_groups() {
local -a cmd groups
_pacman_get_command
groups=(${(o)${(f)"$(pacman -Qg)"}% *})
typeset -U groups
compadd "$@" -a groups
}
# provides completions for installed packages
_pacman_completions_installed_packages() {
local -a cmd packages packages_long
packages_long=(/var/lib/pacman/local/*(/))
packages=( ${${packages_long/\/var\/lib\/pacman\/local\//}%-*-*} )
compadd "$@" -a packages
}
# provides completions for repository names
_pacman_completions_repositories() {
local -a cmd repositories
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
# Uniq the array
typeset -U repositories
compadd "$@" -a repositories
}
# builds command for invoking pacman in a _call_program command - extracts
# relevant options already specified (config file, etc)
# $cmd must be declared by calling function
_pacman_get_command() {
# this is mostly nicked from _perforce
cmd=( "pacman" )
integer i
for (( i = 2; i < CURRENT - 1; i++ )); do
if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then
cmd+=( ${words[i,i+1]} )
fi
done
}
# main dispatcher
_pacman() {
case $words[2] in
-Q*g*) # ipkg groups
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:groups:_pacman_completions_installed_groups'
;;
-Q*o*) # file
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package file:_files'
;;
-Q*p*) # file *.pkg.tar.gz
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package file:_files -g "*.pkg.tar.gz"'
;;
-Q*) _pacman_action_query ;;
-R*) _pacman_action_remove ;;
-S*c*) # no completion
return 0
;;
-S*l*) # repos
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:package repo:_pacman_completions_repositories' \
;;
-S*g*) # pkg groups
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:package group:_pacman_completions_all_groups'
;;
-S*) _pacman_action_sync ;;
-U*) _pacman_action_upgrade ;;
-V*) _pacman_action_version ;;
-h*) _pacman_action_help ;;
- ) _pacman_action_none ;;
* ) return 1 ;;
esac
}
# run the main dispatcher
_pacman "$@"

584
depcomp Executable file
View file

@ -0,0 +1,584 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2006-10-15.18
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

15
doc/.gitignore vendored
View file

@ -1,9 +1,10 @@
*.[1-8]
asciidoc-manpage.css
asciidoc.css
asciidoc.js
*.html
PKGBUILD.5
libalpm.3
makepkg.8
makepkg.conf.5
pacman.8
pacman.conf.5
repo-add.8
repo-remove.8
*.xml
man3
website.tar.gz
Doxyfile

View file

@ -1,79 +0,0 @@
BUILDINFO(5)
============
Name
----
BUILDINFO - Makepkg package build information file
Synopsis
--------
This manual page describes the format of a BUILDINFO file found in the root of
a package created by makepkg. The file contains a description of the package's
build environment. The information is formatted in key-value pairs separated by
a '=', one value per line. Arrays are represented as multiple key-value pairs
having the same key.
Description
-----------
This is a description of the contents of version '2' of the
BUILDINFO file format.
*format*::
Denotes the file format version, represented by a plain positive integer.
*pkgname*::
The name of the package.
*pkgbase*::
The base name of a package, usually the same as the pkgname except for
split packages.
*pkgver*::
The version of the package including pkgrel and epoch.
*pkgarch*::
The architecture of the package.
*pkgbuild_sha256sum*::
The sha256sum in hex format of the PKGBUILD used to build the package.
*packager*::
The details of the packager that built the package.
*builddate*::
The build date of the package in epoch.
*builddir*::
The directory where the package was built.
*startdir*::
The directory from which makepkg was executed.
*buildtool*::
The name of the tool ecosystem used to set up the build environment. Used
for defining a spec for reproducible builds, e.g. the source of the
linkman:makepkg.conf[5] used.
*buildtoolver*::
The full version of the 'buildtool', for example:
"$pkgver-$pkgrel-$pkgarch".
*buildenv (array)*::
The build environment specified in makepkg.conf.
*options (array)*::
The options set specified when building the package.
*installed (array)*::
The installed packages at build time including the version information of
the package. Formatted as "$pkgname-$pkgver-$pkgrel-$pkgarch".
See Also
--------
linkman:makepkg[8], linkman:pacman[8], linkman:makepkg.conf[5]
include::footer.asciidoc[]

View file

@ -1,16 +1,13 @@
# Doxyfile 1.9.3
# Doxyfile 1.5.5
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = libalpm
PROJECT_NUMBER =
PROJECT_BRIEF = "Arch Linux Package Manager Library"
PROJECT_LOGO =
OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
PROJECT_NUMBER =
OUTPUT_DIRECTORY = ./
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
@ -28,51 +25,36 @@ ABBREVIATE_BRIEF = "The $name class" \
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
JAVADOC_BANNER = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
PYTHON_DOCSTRING = YES
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
OPTIMIZE_OUTPUT_SLICE = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 5
AUTOLINK_SUPPORT = YES
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
GROUP_NESTED_COMPOUNDS = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = YES
TYPEDEF_HIDES_STRUCT = YES
LOOKUP_CACHE_SIZE = 0
NUM_PROC_THREADS = 1
TYPEDEF_HIDES_STRUCT = NO
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_PRIV_VIRTUAL = NO
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
RESOLVE_UNNAMED_PARAMS = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
@ -80,66 +62,51 @@ HIDE_IN_BODY_DOCS = YES
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_HEADERFILE = YES
SHOW_INCLUDE_FILES = YES
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
SHOW_DIRECTORIES = NO
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_IF_INCOMPLETE_DOC = YES
WARN_NO_PARAMDOC = NO
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = @INPUT_DIRECTORY@/../lib/libalpm/alpm.h \
@INPUT_DIRECTORY@/../lib/libalpm/alpm_list.h
INPUT = ../lib/libalpm/
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS = _alpm_* \
__alpm_*
EXAMPLE_PATH =
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# Configuration options related to source browsing
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
@ -147,140 +114,90 @@ STRIP_CODE_COMMENTS = NO
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
IGNORE_PREFIX =
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = NO
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_EXTRA_STYLESHEET =
HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_DYNAMIC_MENUS = YES
HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_FEEDURL =
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
HTML_DYNAMIC_SECTIONS = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
GENERATE_TREEVIEW = NO
FULL_SIDEBAR = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
OBFUSCATE_EMAILS = YES
HTML_FORMULA_FORMAT = png
FORMULA_FONTSIZE = 10
FORMULA_MACROFILE =
USE_MATHJAX = NO
MATHJAX_VERSION = MathJax_2
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
MATHJAX_EXTENSIONS =
MATHJAX_CODEFILE =
SEARCHENGINE = NO
SERVER_BASED_SEARCH = NO
EXTERNAL_SEARCH = NO
SEARCHENGINE_URL =
SEARCHDATA_FILE = searchdata.xml
EXTERNAL_SEARCH_ID =
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
LATEX_MAKEINDEX_CMD = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = letter
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
LATEX_EXTRA_STYLESHEET =
LATEX_EXTRA_FILES =
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_BIB_STYLE = plain
LATEX_EMOJI_DIRECTORY =
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# Configuration options related to the man page output
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = YES
MAN_OUTPUT = .
MAN_EXTENSION = .3
MAN_SUBDIR =
MAN_LINKS = NO
#---------------------------------------------------------------------------
# Configuration options related to the XML output
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
XML_NS_MEMB_FILE_SCOPE = NO
#---------------------------------------------------------------------------
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# Configuration options related to the Perl module output
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
@ -289,35 +206,29 @@ SEARCH_INCLUDES = YES
INCLUDE_PATH = ../..
INCLUDE_FILE_PATTERNS = *.h
PREDEFINED = HAVE_CONFIG_H= \
SYMEXPORT= \
HAVE_LIBARCHIVE \
HAVE_LIBCURL \
HAVE_LIBGPGME
EXPAND_AS_DEFINED =
SYMHIDDEN= \
SYMEXPORT=
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration options related to external references
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
DIA_PATH =
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
DOT_NUM_THREADS = 0
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
UML_LIMIT_NUM_FIELDS = 10
DOT_UML_DETAILS = NO
DOT_WRAP_THRESHOLD = 17
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
@ -325,18 +236,16 @@ CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DIR_GRAPH_MAX_DEPTH = 1
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
PLANTUML_CFG_FILE =
PLANTUML_INCLUDE_PATH =
DOT_PATH =
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 3
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

87
doc/Makefile.am Normal file
View file

@ -0,0 +1,87 @@
# We have to do some funny stuff here with the manpages. In order to ensure
# a dist tarball doesn't get put out there without manpages, we keep those
# files listed in EXTRA_DIST no matter what. However, we only add them to
# man_MANS if --enable-asciidoc and/or --enable-doxygen are used.
ASCIIDOC_MANS = \
pacman.8 \
makepkg.8 \
repo-add.8 \
PKGBUILD.5 \
makepkg.conf.5 \
pacman.conf.5 \
libalpm.3
DOXYGEN_MANS = $(wildcard man3/*.3)
EXTRA_DIST = \
asciidoc.conf \
pacman.8.txt \
makepkg.8.txt \
repo-add.8.txt \
PKGBUILD.5.txt \
PKGBUILD-example.txt \
makepkg.conf.5.txt \
pacman.conf.5.txt \
libalpm.3.txt \
footer.txt \
Doxyfile \
$(ASCIIDOC_MANS) \
$(DOXYGEN_MANS)
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = *.xml $(ASCIIDOC_MANS)
# Ensure manpages are fresh when building a dist tarball
dist-hook:
$(MAKE) $(AM_MAKEFLAGS) clean
$(MAKE) $(AM_MAKEFLAGS) all
if USE_GIT_VERSION
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 | sed s/^v//')-dirty
REAL_PACKAGE_VERSION = $(GIT_VERSION)
else
REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
endif
man_MANS =
dist_man_MANS = $(ASCIIDOC_MANS) repo-remove.8
if USE_DOXYGEN
man_MANS += $(DOXYGEN_MANS)
all-local: doxygen.in
doxygen.in:
$(DOXYGEN) $(srcdir)/Doxyfile
endif
ASCIIDOC_OPTS = \
-f asciidoc.conf \
-a pacman_version="$(REAL_PACKAGE_VERSION)" \
-a pacman_date="`date +%Y-%m-%d`" \
-a sysconfdir=$(sysconfdir)
A2X_OPTS = \
--no-xmllint \
-d manpage \
-f manpage \
--xsltproc-opts='-param man.endnotes.list.enabled 0' \
--xsltproc-opts='-param man.endnotes.are.numbered 0'
# These rules are due to the includes and files of the asciidoc text
$(ASCIIDOC_MANS): asciidoc.conf footer.txt
a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS)" $@.txt
pacman.8: pacman.8.txt
makepkg.8: makepkg.8.txt
repo-add.8: repo-add.8.txt
PKGBUILD.5: PKGBUILD.5.txt PKGBUILD-example.txt
makepkg.conf.5: makepkg.conf.5.txt
pacman.conf.5: pacman.conf.5.txt
libalpm.3: libalpm.3.txt
# this one is just a symlink
repo-remove.8: repo-add.8
rm -f repo-remove.8
$(LN_S) repo-add.8 repo-remove.8
# vim:set ts=2 sw=2 noet:

View file

@ -1,27 +1,20 @@
# Maintainer: Joe User <joe.user@example.com>
pkgname=patch
pkgver=2.7.1
pkgrel=1
pkgver=2.5.4
pkgrel=3
pkgdesc="A utility to apply patch files to original sources"
arch=('i686' 'x86_64')
url="https://www.gnu.org/software/patch/patch.html"
arch=(i686 x86_64)
url="http://www.gnu.org/software/patch/patch.html"
license=('GPL')
groups=('base-devel')
depends=('glibc')
makedepends=('ed')
optdepends=('ed: for "patch -e" functionality')
source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig})
sha256sums=('9124ba46db0abd873d0995c2ca880e81252676bb6c03e0a37dfc5f608a9b0ceb'
'SKIP')
depends=('glibc' 'ed')
source=(ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz)
md5sums=('ee5ae84d115f051d87fcaaef3b4ae782')
build() {
cd "$srcdir/$pkgname-$pkgver"
./configure --prefix=/usr
make
}
package() {
cd "$srcdir/$pkgname-$pkgver"
make DESTDIR="$pkgdir/" install
cd $srcdir/$pkgname-$pkgver
./configure --prefix=/usr
make || return 1
make prefix=$pkgdir/usr install
}

View file

@ -1,544 +0,0 @@
PKGBUILD(5)
===========
Name
----
PKGBUILD - Package build description file
Synopsis
--------
PKGBUILD
Description
-----------
This manual page describes general rules about PKGBUILDs. Once a
PKGBUILD is written, the actual package is built using makepkg and installed
with pacman.
NOTE: An example PKGBUILD, useful for reference, is located in '{pkgdatadir}'
along with other example files such as an install script. You can copy the
provided PKGBUILD.proto file to a new package build directory and make
customizations to suit your needs.
Options and Directives
----------------------
The following is a list of standard options and directives available for use
in a PKGBUILD. These are all understood and interpreted by makepkg, and most
of them will be directly transferred to the built package. The mandatory
fields for a minimally functional PKGBUILD are *pkgname*, *pkgver*, *pkgrel*
and *arch*.
If you need to create any custom variables for use in your build process, it is
recommended to prefix their name with an '_' (underscore).
This will prevent any possible name clashes with internal makepkg variables.
For example, to store the base kernel version in a variable, use something
similar to `$_basekernver`.
*pkgname (array)*::
Either the name of the package or an array of names for split packages.
Valid characters for members of this array are alphanumerics, and any of
the following characters: ```@ . _ + -`''. Additionally, names are not
allowed to start with hyphens or dots.
*pkgver*::
The version of the software as released from the author (e.g., '2.7.1').
The variable is not allowed to contain colons, forward slashes, hyphens
or whitespace.
+
The `pkgver` variable can be automatically updated by providing a `pkgver()`
function in the PKGBUILD that outputs the new package version.
This is run after downloading and extracting the sources and running the
`prepare()` function (if present), so it can use those files in determining the
new `pkgver`. This is most useful when used with sources from version control
systems (see below).
*pkgrel*::
This is the release number specific to the distribution. This
allows package maintainers to make updates to the package's configure
flags, for example. This is typically set to '1' for each new upstream
software release and incremented for intermediate PKGBUILD updates. The
variable is a positive integer, with an optional subrelease level
specified by adding another positive integer separated by a period
(i.e. in the form x.y).
*epoch*::
Used to force the package to be seen as newer than any previous versions
with a lower epoch, even if the version number would normally not trigger
such an upgrade. This value is required to be a positive integer; the
default value if left unspecified is '0'. This is useful when the version
numbering scheme of a package changes (or is alphanumeric), breaking normal
version comparison logic. See linkman:pacman[8] for more information on
version comparisons.
*pkgdesc*::
This should be a brief description of the package and its functionality.
Try to keep the description to one line of text and to not use the package's
name.
*url*::
This field contains a URL that is associated with the software being
packaged. This is typically the project's web site.
*license (array)*::
This field specifies the license(s) that apply to the package.
If multiple licenses are applicable, list all of them:
`license=('GPL' 'FDL')`.
*install*::
Specifies a special install script that is to be included in the package.
This file should reside in the same directory as the PKGBUILD and will
be copied into the package by makepkg. It does not need to be included
in the source array (e.g., `install=$pkgname.install`).
*changelog*::
Specifies a changelog file that is to be included in the package.
The changelog file should end in a single newline.
This file should reside in the same directory as the PKGBUILD and will
be copied into the package by makepkg. It does not need to be included
in the source array (e.g., `changelog=$pkgname.changelog`).
*source (array)*::
An array of source files required to build the package. Source files
must either reside in the same directory as the PKGBUILD, or be a
fully-qualified URL that makepkg can use to download the file.
To simplify the maintenance of PKGBUILDs, use the `$pkgname` and `$pkgver`
variables when specifying the download location, if possible.
Compressed files will be extracted automatically unless found in the
noextract array described below.
+
Additional architecture-specific sources can be added by appending an
underscore and the architecture name e.g., 'source_x86_64=()'. There must be a
corresponding integrity array with checksums, e.g. 'cksums_x86_64=()'.
+
It is also possible to change the name of the downloaded file, which is helpful
with weird URLs and for handling multiple source files with the same
name. The syntax is: `source=('filename::url')`.
+
makepkg also supports building developmental versions of packages using sources
downloaded from version control systems (VCS). For more information, see
<<VCS,Using VCS Sources>> below.
+
Files in the source array with extensions `.sig`, `.sign` or, `.asc` are
recognized by makepkg as PGP signatures and will be automatically used to verify
the integrity of the corresponding source file.
*validpgpkeys (array)*::
An array of PGP fingerprints. If this array is non-empty, makepkg will
only accept signatures from the keys listed here and will ignore the
trust values from the keyring. If the source file was signed with a
subkey, makepkg will still use the primary key for comparison.
+
Only full fingerprints are accepted. They must be uppercase and must not
contain whitespace characters.
*noextract (array)*::
An array of file names corresponding to those from the source array. Files
listed here will not be extracted with the rest of the source files. This
is useful for packages that use compressed data directly.
*cksums (array)*::
This array contains CRC checksums for every source file specified in the
source array (in the same order). makepkg will use this to verify source
file integrity during subsequent builds. If 'SKIP' is put in the array
in place of a normal hash, the integrity check for that source file will
be skipped. To easily generate cksums, run ``makepkg -g >> PKGBUILD''.
If desired, move the cksums line to an appropriate location. Note that
checksums generated by "makepkg -g" should be verified using checksum
values provided by the software developer.
*md5sums, sha1sums, sha224sums, sha256sums, sha384sums, sha512sums, b2sums (arrays)*::
Alternative integrity checks that makepkg supports; these all behave
similar to the cksums option described above. To enable use and generation
of these checksums, be sure to set up the `INTEGRITY_CHECK` option in
linkman:makepkg.conf[5].
*groups (array)*::
An array of symbolic names that represent groups of packages, allowing
you to install multiple packages by requesting a single target. For
example, one could install all KDE packages by installing the 'kde' group.
*arch (array)*::
Defines on which architectures the given package is available (e.g.,
`arch=('i686' 'x86_64')`). Packages that contain no architecture specific
files should use `arch=('any')`. Valid characters for members of this array
are alphanumerics and ```_`''.
*backup (array)*::
An array of file names, without preceding slashes, that
should be backed up if the package is removed or upgraded. This is
commonly used for packages placing configuration files in '/etc'. See
`"Handling Config Files"` in linkman:pacman[8] for more information.
*depends (array)*::
An array of packages this package depends on to run. Entries in
this list should be surrounded with single quotes and contain at least
the package name. Entries can also include a version requirement of the
form 'name<>version', where `<>` is one of five comparisons: `>=` (greater
than or equal to), `<=` (less than or equal to), `=` (equal to), `>`
(greater than), or `<` (less than).
+
Additional architecture-specific depends can be added by appending an
underscore and the architecture name e.g., 'depends_x86_64=()'.
*makedepends (array)*::
An array of packages this package depends on to build but are not
needed at runtime. Packages in this list follow the same format as
depends.
+
Additional architecture-specific makedepends can be added by appending an
underscore and the architecture name e.g., 'makedepends_x86_64=()'.
*checkdepends (array)*::
An array of packages this package depends on to run its test suite
but are not needed at runtime. Packages in this list follow the same
format as depends. These dependencies are only considered when the
check() function is present and is to be run by makepkg.
+
Additional architecture-specific checkdepends can be added by appending an
underscore and the architecture name e.g., 'checkdepends_x86_64=()'.
*optdepends (array)*::
An array of packages (and accompanying reasons) that are not essential for
base functionality, but may be necessary to make full use of the contents
of this package. optdepends are currently for informational purposes only
and are not utilized by pacman during dependency resolution. Packages in
this list follow the same format as depends, with an optional description
appended. The format for specifying optdepends descriptions is:
optdepends=('python: for library bindings')
+
Additional architecture-specific optdepends can be added by appending an
underscore and the architecture name e.g., 'optdepends_x86_64=()'.
*conflicts (array)*::
An array of packages that will conflict with this package (i.e. they
cannot both be installed at the same time). This directive follows the
same format as depends. Versioned conflicts are supported using the
operators as described in `depends`.
+
Additional architecture-specific conflicts can be added by appending an
underscore and the architecture name e.g., 'conflicts_x86_64=()'.
*provides (array)*::
An array of ``virtual provisions'' this package provides. This allows
a package to provide dependencies other than its own package name. For
example, the dcron package can provide 'cron', which allows packages to
depend on 'cron' rather than 'dcron OR fcron'.
+
Versioned provisions are also possible, in the 'name=version' format. For
example, dcron can provide 'cron=2.0' to satisfy the 'cron>=2.0' dependency of
other packages. Provisions involving the `>` and `<` operators are invalid as
only specific versions of a package may be provided.
+
Additional architecture-specific provides can be added by appending an
underscore and the architecture name e.g., 'provides_x86_64=()'.
*replaces (array)*::
An array of packages this package should replace. This can be used
to handle renamed/combined packages. For example, if the 'j2re' package
is renamed to 'jre', this directive allows future upgrades to continue
as expected even though the package has moved. Versioned replaces are
supported using the operators as described in `depends`.
+
Sysupgrade is currently the only pacman operation that utilizes this field.
A normal sync or upgrade will not use its value.
+
Additional architecture-specific replaces can be added by appending an
underscore and the architecture name e.g., 'replaces_x86_64=()'.
*options (array)*::
This array allows you to override some of makepkg's default behavior
when building packages. To set an option, just include the option name
in the options array. To reverse the default behavior, place an ``!'' at
the front of the option. Only specify the options you specifically want
to override, the rest will be taken from linkman:makepkg.conf[5].
*NOTE:* 'force' is a now-removed option in favor of the top level 'epoch'
variable.
*strip*;;
Strip symbols from binaries and libraries. If you frequently
use a debugger on programs or libraries, it may be helpful to
disable this option.
*docs*;;
Save doc directories. If you wish to delete doc directories,
specify `!docs` in the array.
*libtool*;;
Leave libtool (.la) files in packages. Specify `!libtool` to
remove them.
*staticlibs*;;
Leave static library (.a) files in packages. Specify `!staticlibs` to
remove them (if they have a shared counterpart).
*emptydirs*;;
Leave empty directories in packages.
*zipman*;;
Compress man and info pages with gzip.
*ccache*;;
Allow the use of ccache during `build()`. More useful in its negative
form `!ccache` with select packages that have problems building
with ccache.
*distcc*;;
Allow the use of distcc during `build()`. More useful in its negative
form `!distcc` with select packages that have problems building
with distcc.
*buildflags*;;
Allow the use of user-specific buildflags (CPPFLAGS, CFLAGS, CXXFLAGS,
LDFLAGS) during `build()` as specified in linkman:makepkg.conf[5]. More
useful in its negative form `!buildflags` with select packages that
have problems building with custom buildflags.
*makeflags*;;
Allow the use of user-specific makeflags during `build()` as specified
in linkman:makepkg.conf[5]. More useful in its negative form
`!makeflags` with select packages that have problems building with
custom makeflags such as `-j2` (or higher).
*debug*;;
Add the user-specified debug flags (DEBUG_CFLAGS, DEBUG_CXXFLAGS) to
their counterpart buildflags as specified in linkman:makepkg.conf[5].
When used in combination with the `strip' option, a separate package
containing the debug symbols is created.
*lto*;;
Enable building packages using link time optimization. Adds '-flto'
to both CFLAGS and CXXFLAGS.
*xdata (array)*::
This array allows you to add additional metadata to the package.
This data is neither used by pacman nor by makepkg;
It has purely informational purpose, or may be interpreted by third-party tools.
+
All entries in that array must have the form 'key=value', where
'key' is an arbitrary non-empty string and 'value' must not contain an equal sign.
Furthermore, the key ``pkgtype'' is reserved for the makepkg program.
Packaging Functions
-------------------
In addition to the above directives, PKGBUILDs require a set of functions that
provide instructions to build and install the package. As a minimum, the
PKGBUILD must contain a `package()` function which installs all the package's
files into the packaging directory, with optional `prepare()`, `build()`, and
`check()` functions being used to create those files from source.
This is directly sourced and executed by makepkg, so anything that Bash or the
system has available is available for use here. Be sure any exotic commands
used are covered by the `makedepends` array.
If you create any variables of your own in any of these functions, it is
recommended to use the Bash `local` keyword to scope the variable to inside the
function.
*package() Function*::
The `package()` function is used to install files into the directory that
will become the root directory of the built package and is run after all
the optional functions listed below. The packaging stage is run using
fakeroot to ensure correct file permissions in the resulting package.
All other functions will be run as the user calling makepkg.
This function is run inside `$srcdir`.
*verify() Function*::
An optional `verify()` function can be specified to implement arbitrary
source authentication. The function should return a non-zero exit code when
verification fails. This function is run before sources are extracted.
This function is run inside `$startdir`.
*prepare() Function*::
An optional `prepare()` function can be specified in which operations to
prepare the sources for building, such as patching, are performed. This
function is run after the source extraction and before the `build()`
function. The `prepare()` function is skipped when source extraction
is skipped.
This function is run inside `$srcdir`.
*build() Function*::
The optional `build()` function is used to compile and/or adjust the source
files in preparation to be installed by the `package()` function.
This function is run inside `$srcdir`.
*check() Function*::
An optional `check()` function can be specified in which a package's
test-suite may be run. This function is run between the `build()` and
`package()` functions. Be sure any exotic commands used are covered by the
`checkdepends` array.
This function is run inside `$srcdir`.
All of the above variables such as `$pkgname` and `$pkgver` are available for
use in the packaging functions. In addition, makepkg defines the following
variables:
*srcdir*::
This contains the directory where makepkg extracts, or copies, all source
files.
+
*pkgdir*::
This contains the directory where makepkg bundles the installed package.
This directory will become the root directory of your built package. This
variable should only be used in the `package()` function.
*startdir*::
This contains the absolute path to the directory where the PKGBUILD is
located, which is usually the output of `$(pwd)` when makepkg is started.
Use of this variable is deprecated and strongly discouraged.
Package Splitting
-----------------
makepkg supports building multiple packages from a single PKGBUILD. This is
achieved by assigning an array of package names to the `pkgname` directive.
Each split package uses a corresponding packaging function with name
`package_foo()`, where `foo` is the name of the split package.
All options and directives for the split packages default to the global values
given in the PKGBUILD. Nevertheless, the following ones can be overridden within
each split package's packaging function:
`pkgdesc`, `arch`, `url`, `license`, `groups`, `depends`, `optdepends`,
`provides`, `conflicts`, `replaces`, `backup`, `options`, `install`, and
`changelog`.
Note that makepkg does not consider split package `depends` when checking
if dependencies are installed before package building and with `--syncdeps`.
All packages required to make the package are required to be specified in
the global `depends` and `makedepends` arrays.
An optional global directive is available when building a split package:
*pkgbase*::
The name used to refer to the group of packages in the output of makepkg
and in the naming of source-only tarballs. If not specified, the first
element in the `pkgname` array is used. Valid characters for this
variable are alphanumerics, and any of the following characters:
```@ . _ + -`''. Additionally, the variable is not allowed to start with
hyphens or dots.
Install/Upgrade/Remove Scripting
--------------------------------
Pacman has the ability to store and execute a package-specific script when it
installs, removes, or upgrades a package. This allows a package to configure
itself after installation and perform an opposite action upon removal.
The exact time the script is run varies with each operation, and should be
self-explanatory. Note that during an upgrade operation, none of the install
or remove functions will be called.
Scripts are passed either one or two ``full version strings'', where a full
version string is either 'pkgver-pkgrel' or 'epoch:pkgver-pkgrel', if epoch is
non-zero.
*pre_install*::
Run right before files are extracted. One argument is passed:
new package full version string.
*post_install*::
Run right after files are extracted. One argument is passed:
new package full version string.
*pre_upgrade*::
Run right before files are extracted. Two arguments are passed in this
order: new package full version string, old package full version string.
*post_upgrade*::
Run after files are extracted. Two arguments are passed in this order:
new package full version string, old package full version string.
*pre_remove*::
Run right before files are removed. One argument is passed:
old package full version string.
*post_remove*::
Run right after files are removed. One argument is passed:
old package full version string.
To use this feature, create a file such as 'pkgname.install' and put it in the
same directory as the PKGBUILD script. Then use the install directive:
install=pkgname.install
The install script does not need to be specified in the source array. A
template install file is available in '{pkgdatadir}' as 'proto.install' for
reference with all of the available functions defined.
Using VCS Sources[[VCS]]
------------------------
Building a developmental version of a package using sources from a version
control system (VCS) is enabled by specifying the source in the form:
source=('directory::url#fragment?query')
Currently makepkg supports the Bazaar, Git, Subversion, Fossil and Mercurial
version control systems. For other version control systems, manual cloning of
upstream repositories must be done in the `prepare()` function.
Some <<VCS,VCS Sources>> like Git support pinning the checkout by a checksum of
its content using deterministic export functionality like ``git archive''.
The source URL is divided into four components:
*directory*::
(optional) Specifies an alternate directory name for makepkg to download
the VCS source into.
*url*::
The URL to the VCS repository. This must include the VCS in the URL protocol
for makepkg to recognize this as a VCS source. If the protocol does not
include the VCS name, it can be added by prefixing the URL with `vcs+`. For
example, using a Git repository over HTTPS would have a source URL in the
form:
`git+https://...`.
*fragment*::
(optional) Allows specifying a revision number or branch for makepkg to checkout
from the VCS. A fragment has the form `type=value`, for example to checkout a
given revision the source line would be `source=(url#revision=123)`. The
available types depends on the VCS being used:
*bzr*;;
revision (see `'bzr help revisionspec'` for details)
*fossil*;;
branch, commit, tag
*git*;;
branch, commit, tag
*hg*;;
branch, revision, tag
*svn*;;
revision
*query*::
(optional) Allows specifying whether a VCS checkout should be checked for
PGP-signed revisions. The source line should have the format
`source=(url#fragment?signed)` or `source=(url?signed#fragment)`. Currently
only supported by Git.
Example
-------
The following is an example PKGBUILD for the 'patch' package. For more
examples, look through the build files of your distribution's packages.
[source,sh]
-------------------------------
include::PKGBUILD-example.txt[]
-------------------------------
See Also
--------
linkman:makepkg[8], linkman:pacman[8], linkman:makepkg.conf[5]
include::footer.asciidoc[]

381
doc/PKGBUILD.5.txt Normal file
View file

@ -0,0 +1,381 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
PKGBUILD(5)
===========
Name
----
PKGBUILD - Arch Linux package build description file
Synopsis
--------
PKGBUILD
Description
-----------
This manual page is meant to describe general rules about PKGBUILDs. Once a
PKGBUILD is written, the actual package is built using makepkg and installed
with pacman.
NOTE: If you are using Arch Linux and have a local copy of the Arch Build
System (ABS) tree on your computer, or are using another distribution that
provides a similar tree of build files, you can copy the provided
PKGBUILD.proto file to a new package build directory and make customizations to
suit your needs. An up to date prototype file can also be found in the source
distribution of this package.
Options and Directives
----------------------
The following is a list of standard options and directives available for use
in a PKGBUILD. These are all understood and interpreted by makepkg, and most
will be directly transferred to the built package.
If you need to create any custom variables for use in your build process, it is
recommended to name your custom variables with an '_' (underscore) prefix.
This will prevent any possible name clashes with internal makepkg variables.
For example, to store the base kernel version in a variable, use something
similar to `$_basekernver`.
*pkgname*::
The name of the package. This has be a unix-friendly name as it will be
used in the package filename.
*pkgver*::
The version of the software as released from the author (e.g. '2.7.1').
*pkgrel*::
This is the release number specific to the Arch Linux release. This
allows package maintainers to make updates to the package's configure
flags, for example. A pkgrel of 1 is typically used for each upstream
software release and is incremented for intermediate PKGBUILD updates.
*pkgdesc*::
This should be a brief description of the package and its functionality.
Try to keep the description to one line of text.
*url*::
This field contains a URL that is associated with the software being
packaged. This is typically the project's website.
*license (array)*::
This field specifies the license(s) that apply to the package.
Commonly-used licenses are found in '/usr/share/licenses/common'. If you
see the package's license there, simply reference it in the license
field (e.g. `$$license=('GPL')$$`). If the package provides a license not
found in '/usr/share/licenses/common', then you should include the license
in the package itself and set `$$license=('custom')$$` or
`$$license=('custom:LicenseName')$$`. The license should be placed in
'$pkgdir/usr/share/licenses/$pkgname' when building the package. If
multiple licenses are applicable for a package, list all of them:
`$$license=('GPL' 'FDL')$$`.
*install*::
Specifies a special install script that is to be included in the package.
This file should reside in the same directory as the PKGBUILD, and will
be copied into the package by makepkg. It does not need to be included
in the source array (e.g. `$$install=pkgname.install$$`).
*source (array)*::
An array of source files required to build the package. Source files
must either reside in the same directory as the PKGBUILD file, or be a
fully-qualified URL that makepkg will use to download the file. In order
to make the PKGBUILD as useful as possible, use the $pkgname and $pkgver
variables if possible when specifying the download location. Any files
that are compressed will automatically be extracted, unless found in
the noextract array listed below.
+
It is also possible to specify an optional filename, which is helpful
with weird URLs and for handling multiple source files with the same
name. The syntax is: `$$source=('filename::url')$$`
*noextract (array)*::
An array of filenames corresponding to those from the source array. Files
listed here will not be extracted with the rest of the source files. This
is useful for packages which use compressed data which is downloaded but
not necessary to uncompress.
*md5sums (array)*::
This array contains an MD5 hash for every source file specified in the
source array (in the same order). makepkg will use this to verify source
file integrity during subsequent builds. To easily generate md5sums, run
``makepkg -g >> PKGBUILD''. If desired, move the md5sums line to an
appropriate location.
*sha1sums, sha256sums, sha384sums, sha512sums (arrays)*::
Alternative integrity checks that makepkg supports; these all behave
similar to the md5sums option described above. To enable use and generation
of these checksums, be sure to set up the `INTEGRITY_CHECK` option in
linkman:makepkg.conf[5].
*groups (array)*::
An array of symbolic names that represent groups of packages, allowing
you to install multiple packages by requesting a single target. For
example, one could install all KDE packages by installing the 'kde' group.
*arch (array)*::
Defines on which architectures the given package is available (e.g.
`$$arch=('i686' 'x86_64')$$`).
*backup (array)*::
A space-delimited array of filenames, without preceding slashes, that
should be backed up if the package is removed or upgraded. This is
commonly used for packages placing configuration files in /etc. See
Handling Config Files in linkman:pacman[8] for more information.
*depends (array)*::
An array of packages that this package depends on to run. Packages in
this list should be surrounded with single quotes and contain at least
the package name. Entries can also include a version requirement of the
form 'name<>version', where <> is one of five comparisons: >= (greater
than or equal to), <= (less than or equal to), = (equal to), > (greater
than), or < (less than).
*makedepends (array)*::
An array of packages that this package depends on to build, but are not
needed at runtime. Packages in this list follow the same format as
depends.
*optdepends (array)*::
An array of optional packages (and accompanying reasons) that are not
essential to the package, but would offer increased functionality or other
features when installed. optdepends are currently for informational
purposes only and are not utilized by pacman during dependency resolution.
The format should be similar to the following:
optdepends=('fakeroot: for makepkg usage as normal user')
*conflicts (array)*::
An array of packages that will conflict with this package (i.e. they
cannot both be installed at the same time). This directive follows the
same format as depends. Versioned conflicts are also supported.
*provides (array)*::
An array of ``virtual provisions'' that this package provides. This allows
a package to provide dependencies other than its own package name. For
example, the dcron package can provide 'cron', which allows packages to
depend on 'cron' rather than 'dcron OR fcron'.
Versioned provisions are also possible, in the 'name=version' format.
For example, dcron can provide 'cron=2.0' to satisfy the 'cron>=2.0'
dependency of other packages. Provisions involving the '>' and '<'
operators are invalid as only specifc versions of a package may be
provided.
*replaces (array)*::
An array of packages that this package should replace, and can be used
to handle renamed/combined packages. For example, if the 'j2re' package
is renamed to 'jre', this directive allows future upgrades to continue
as expected even though the package has moved. Sysupgrade is currently
the only pacman operation that utilizes this field, a normal sync will
not use its value.
*options (array)*::
This array allows you to override some of makepkg's default behavior
when building packages. To set an option, just include the option name
in the options array. To reverse the default behavior, place an ``!'' at
the front of the option. Only specify the options you specifically want
to override, the rest will be taken from linkman:makepkg.conf[5].
*NOTE:* 'force' is a special option only used in a linkman:PKGBUILD[5],
do not use it unless you know what you are doing.
*strip*;;
Strip symbols from binaries and libraries. If you frequently
use a debugger on programs or libraries, it may be helpful to
disable this option.
*docs*;;
Save doc and info directories. If you wish to delete doc and
info directories, specify `!docs` in the array.
*libtool*;;
Leave libtool (.la) files in packages. Specify `!libtool` to
remove them.
*emptydirs*;;
Leave empty directories in packages.
*zipman*;;
Compress man pages with gzip.
*ccache*;;
Allow the use of ccache during build. More useful in its negative
form `!ccache` with select packages that have problems building
with ccache.
*distcc*;;
Allow the use of distcc during build. More useful in its negative
form `!distcc` with select packages that have problems building
with distcc.
*makeflags*;;
Allow the use of user-specific makeflags during build as specified
in linkman:makepkg.conf[5]. More useful in its negative form
`!makeflags` with select packages that have problems building with
custom makeflags such as `-j2` (or higher).
*force*;;
Force the package to be upgraded by a pacman system upgrade
operation, even if the version number would normally not trigger
such an upgrade. This is useful when the version numbering scheme
of a package changes (or is alphanumeric). See linkman:pacman[8] for
more infomation on version comparisons.
build() Function
----------------
In addition to the above directives, the build() bash function comprises the
remainder of the PKGBUILD. This is directly sourced and executed by makepkg, so
anything that bash or the system has available is available for use here. Be
sure any exotic commands used are covered by `makedepends`.
All of the above variables such as `pkgname` and `pkgver` are available for use
in the build function. In addition, makepkg defines three variables for your
use during the build and install process. These three variables are as follows:
*startdir*::
This contains the absolute path to the directory where the PKGBUILD was
located, which is usually the output of `$(pwd)` when makepkg is started.
$$startdir$$ was most often used in combination with `/src` or `/pkg`
postfixes, but use of the `srcdir` and `pkgdir` variables is preferred.
*srcdir*::
This points to the directory where makepkg extracts or copies all source
files. Although it currently is an alias for `$startdir/src`, this
assumption should not be assumed true for all future revisions of makepkg.
*pkgdir*::
This points to the directory where makepkg bundles the installed package
(this directory will become the root directory of your built package).
Although it currently is an alias for `$startdir/pkg`, this assumption
should not be assumed true for all future revisions of makepkg.
If you create any variables of your own in the build function, it is
recommended to use the bash `local` keyword to scope the variable to inside
the build function.
Install/Upgrade/Remove Scripting
--------------------------------
Pacman has the ability to store and execute a package-specific script when it
installs, removes, or upgrades a package. This allows a package to configure
itself after installation and perform an opposite action upon removal.
The exact time the script is run varies with each operation:
*pre_install*::
script is run right before files are extracted. One argument is passed:
new package version.
*post_install*::
script is run right after files are extracted. One argument is passed:
new package version.
*pre_upgrade*::
script is run right before files are extracted. Two arguments are passed
in the following order: new package version, old package version.
*post_upgrade*::
script is run after files are extracted. Two arguments are passed
in the following order: new package version, old package version.
*pre_remove*::
script is run right before files are removed. One argument is passed:
old package version.
*post_remove*::
script is run right after files are removed. One argument is passed:
old package version.
To use this feature, create a file such as 'pkgname.install' and put it in the
same directory as the PKGBUILD script. Then use the install directive:
install=pkgname.install
The install script does not need to be specified in the source array. A
template install file is available with the source distribution of this
program, or one may be provided by your distribution. For example, Arch Linux
provides prototype install files in the ABS tree.
Development Directives
----------------------
makepkg supports building development versions of packages without having to
manually update the pkgver in the PKGBUILD. This was formerly done using the
separate utility 'versionpkg'. In order to utilize this functionality, your
PKGBUILD must use correct variable names depending on the SCM being fetched
from.
*CVS*::
The generated pkgver will be the date the package is built.
*_cvsroot*;;
The root of the CVS repository.
*_cvsmod*;;
The CVS module to fetch.
*SVN*::
The generated pkgver will be the latest SVN revision number.
*_svntrunk*;;
The trunk of the SVN repository.
*_svnmod*;;
The SVN module to fetch.
*Git*::
The generated pkgver will be one formatted by the 'git-describe'
command, with '-' characters converted to '_' characters.
*_gitroot*;;
The URL (all protocols supported) to the GIT repository.
*_gitname*;;
GIT tag or branch to use.
*Mercurial*::
The generated pkgver will be the hg tip revision number.
*_hgroot*;;
The URL of the mercurial repository.
*_hgrepo*;;
The repository to follow.
*Darcs*::
The generated pkgver will be the date the package is built.
*_darcstrunk*;;
URL to the repository trunk.
*_darcsmod*;;
Darcs module to use.
*Bazaar*::
The generated pkgver will be the latest Bazaar revision number (revno).
*_bzrtrunk*;;
URL to the bazaar repository.
*_bzrmod*;;
Bazaar module to use.
Example
-------
The following is an example PKGBUILD for the 'patch' package. For more
examples, look through the build files of your distribution's packages. For
those using Arch Linux, consult the ABS tree.
[source,sh]
-------------------------------
include::PKGBUILD-example.txt[]
-------------------------------
See Also
--------
linkman:makepkg[8], linkman:pacman[8], linkman:makepkg.conf[5]
include::footer.txt[]

View file

@ -1,133 +0,0 @@
alpm-hooks(5)
=============
NAME
----
alpm-hooks - alpm hook file format
SYNOPSIS
--------
--------
[Trigger] (Required, Repeatable)
Operation = Install|Upgrade|Remove (Required, Repeatable)
Type = Path|Package (Required)
Target = <Path|PkgName> (Required, Repeatable)
[Action] (Required)
Description = ... (Optional)
When = PreTransaction|PostTransaction (Required)
Exec = <Command> (Required)
Depends = <PkgName> (Optional)
AbortOnFail (Optional, PreTransaction only)
NeedsTargets (Optional)
--------
DESCRIPTION
-----------
libalpm provides the ability to specify hooks to run before or after
transactions based on the packages and/or files being modified. Hooks consist
of a single '[Action]' section describing the action to be run and one or more
'[Trigger]' section describing which transactions it should be run for.
Hooks are read from files located in the system hook directory
+{datarootdir}/libalpm/hooks+, and additional custom directories specified in
linkman:pacman.conf[5] (the default is +{sysconfdir}/pacman.d/hooks+). The
file names are required to have the suffix ".hook". Hooks are run in
alphabetical order of their file name, where the ordering ignores the suffix.
TRIGGERS
--------
Hooks must contain at least one '[Trigger]' section that determines which
transactions will cause the hook to run. If multiple trigger sections are
defined the hook will run if the transaction matches *any* of the triggers.
*Operation =* Install|Upgrade|Remove::
Select the type of operation to match targets against. May be specified
multiple times. Installations are considered an upgrade if the package or
file is already present on the system regardless of whether the new package
version is actually greater than the currently installed version. For Path
triggers, this is true even if the file changes ownership from one package
to another. Required.
*Type =* Path|Package::
Select whether targets are matched against transaction packages or files.
See CAVEATS for special notes regarding Path triggers. 'File' is a deprecated
alias for 'Path' and will be removed in a future release. Required.
*Target =* <path|package>::
The path or package name to match against the active transaction.
Paths refer to the files in the package archive; the installation root
should *not* be included in the path. Shell-style glob patterns are
allowed. It is possible to invert matches by prepending a target with an
exclamation mark. May be specified multiple times. Required.
ACTIONS
-------
*Description =* ...::
An optional description that describes the action being taken by the
hook for use in front-end output.
*Exec =* <command>::
Command to run. Command arguments are split on whitespace. Values
containing whitespace should be enclosed in quotes. Required.
*When =* PreTransaction|PostTransaction::
When to run the hook. Required.
*Depends =* <package>::
Packages that must be installed for the hook to run. May be specified
multiple times.
*AbortOnFail*::
Causes the transaction to be aborted if the hook exits non-zero. Only
applies to PreTransaction hooks.
*NeedsTargets*::
Causes the list of matched trigger targets to be passed to the running hook
on 'stdin'.
OVERRIDING HOOKS
----------------
Hooks may be overridden by placing a file with the same name in a higher
priority hook directory. Hooks may be disabled by overriding them with
a symlink to '/dev/null'.
EXAMPLES
--------
--------
# Force disks to sync to reduce the risk of data corruption
[Trigger]
Operation = Install
Operation = Upgrade
Operation = Remove
Type = Package
Target = *
[Action]
Depends = coreutils
When = PostTransaction
Exec = /usr/bin/sync
--------
CAVEATS
-------
There are situations when path triggers may act in unexpected ways. Hooks are
triggered using the file list of the installed, upgraded, or removed package.
When installing or upgrading a file that is extracted with a '.pacnew'
extension, the original file name is used in triggering the hook. When
removing a package, all files owned by that package can trigger a hook whether
or not they were actually present on the file system before package removal.
PostTransaction hooks will *not* run if the transaction fails to complete for
any reason.
include::footer.asciidoc[]

View file

@ -1,7 +0,0 @@
table th, table td {
padding: 0.2em 1em;
}
table td p.table {
margin: 0;
}

View file

@ -1,5 +1,5 @@
## linkman: macro
# Inspired by/borrowed from the Git source tree at Documentation/asciidoc.conf
# Inspired by/borrowed from the GIT source tree at Documentation/asciidoc.conf
#
# Usage: linkman:command[manpage-section]
#
@ -8,20 +8,12 @@
# Show man link as: <command>(<section>); if section is defined, else just show
# the command.
[macros]
(?su)[\\]?(?P<name>linkman):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
[attributes]
asterisk=&#42;
plus=&#43;
caret=&#94;
startsb=&#91;
endsb=&#93;
backslash=&#92;
tilde=&#126;
apostrophe=&#39;
backtick=&#96;
litdd=&#45;&#45;
ifdef::backend-docbook[]
[linkman-inlinemacro]
@ -38,7 +30,13 @@ ifndef::docbook-xsl-172[]
[listingblock]
<example><title>{title}</title>
<literallayout>
ifdef::doctype-manpage[]
&#10;.ft C&#10;
endif::doctype-manpage[]
|
ifdef::doctype-manpage[]
&#10;.ft&#10;
endif::doctype-manpage[]
</literallayout>
{title#}</example>
endif::docbook-xsl-172[]
@ -50,7 +48,7 @@ ifdef::backend-docbook[]
template::[header-declarations]
<refentry>
<refentryinfo>
<date>{localdate}</date>
<date>{pacman_date}</date>
</refentryinfo>
<refmeta>
<refentrytitle>{mantitle}</refentrytitle>

View file

@ -1,36 +0,0 @@
See the pacman website at https://archlinux.org/pacman/[] for current
information on pacman and its related tools.
Bugs
----
Bugs? You must be kidding; there are no bugs in this software. But if we
happen to be wrong, please report them to the issue tracker at
link:https://gitlab.archlinux.org/pacman/pacman/-/issues[] with specific
information such as your command-line, the nature of the bug, and even
the package database if it helps.
Authors
-------
Current maintainers:
* Allan McRae <allan@archlinux.org>
* Andrew Gregory <andrew.gregory.8@gmail.com>
* Morgan Adamiec <morganamilo@archlinux.org>
Past major contributors:
* Judd Vinet <jvinet@zeroflux.org>
* Aurelien Foret <aurelien@archlinux.org>
* Aaron Griffin <aaron@archlinux.org>
* Dan McGee <dan@archlinux.org>
* Xavier Chantry <shiningxc@gmail.com>
* Nagy Gabor <ngaba@bibl.u-szeged.hu>
* Dave Reisner <dreisner@archlinux.org>
* Eli Schwartz <eschwartz@archlinux.org>
For additional contributors, use `git shortlog -s` on the pacman.git
repository.

30
doc/footer.txt Normal file
View file

@ -0,0 +1,30 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
See the pacman website at http://www.archlinux.org/pacman/[] for current
information on pacman and its related tools.
Bugs
----
Bugs? You must be kidding, there are no bugs in this software. But if we
happen to be wrong, send us an email with as much detail as possible to
mailto:pacman-dev@archlinux.org[].
Authors
-------
Current maintainers:
* Dan McGee <dan@archlinux.org>
* Xavier Chantry <shiningxc@gmail.com>
* Aaron Griffin <aaron@archlinux.org>
Past contributors:
* Judd Vinet <jvinet@zeroflux.org>
* Aurelien Foret <aurelien@archlinux.org>
See the 'AUTHORS' file for additional contributors.

View file

@ -1,258 +0,0 @@
Pacman Home Page
================
A simple library-based package manager.
Introduction
------------
pacman is a utility which manages software packages in Linux. It uses simple
compressed files as a package format, and maintains a text-based package
database (more of a hierarchy), just in case some hand tweaking is necessary.
pacman does not strive to "do everything." It will add, remove and upgrade
packages in the system, and it will allow you to query the package database for
installed packages, files and owners. It also attempts to handle dependencies
automatically and can download packages from a remote server.
History
~~~~~~~
Version 2.0 of pacman introduced the ability to sync packages (the '\--sync'
option) with a master server through the use of package databases. Prior to
this, packages would have to be installed manually using the '\--add' and
'\--upgrade' operations.
Version 3.0 was the switch to a two-part pacman -- a back-end named libalpm
(library for Arch Linux Package Management) and the familiar pacman front-end.
Speed in many cases was improved, along with dependency and conflict resolution
being able to handle a much wider variety of cases. The switch to a
library-based program should also make it easier in the future to develop
alternative front ends.
Version 4.0 added package signing and verification capabilities to the entire
makepkg/repo-add/pacman toolchain via GnuPG and GPGME.
Version 5.0 added support for pre/post-transaction hooks and sync database file
list operations.
Version 6.0 added support for parallel downloads.
Documentation
-------------
Man Pages
~~~~~~~~~
There are several man pages available for the programs, utilities, and
configuration files dealing with pacman.
* linkman:alpm-hooks[5]
* linkman:BUILDINFO[5]
* linkman:PKGBUILD[5]
* linkman:libalpm[3]
* linkman:makepkg[8]
* linkman:makepkg-template[1]
* linkman:makepkg.conf[5]
* linkman:pacman[8]
* linkman:pacman-key[8]
* linkman:pacman-conf[8]
* linkman:pacman.conf[5]
* linkman:repo-add[8]
* linkman:vercmp[8]
Changelog
~~~~~~~~~
For a good idea of what is going on in pacman development, take a look at the
link:https://gitlab.archlinux.org/pacman/pacman[Git summary page] for the
project.
See the most recent
link:https://gitlab.archlinux.org/pacman/pacman/-/blob/master/NEWS[NEWS]
file for a not-as-frequently-updated list of changes. However, this should
contain the biggest changes in a format more concise than the commit log.
Releases
--------
[frame="none",grid="none",options="autowidth",cols="3*a"]
|======
|
[frame="topbot",grid="none",options="header,autowidth"]
!======
!Version !Date
!7.0.0 !2024-07-14
!6.1.0 !2024-03-04
!6.0.1 !2021-09-04
!6.0.0 !2021-05-20
!6.0.0alpha1 !2020-12-04
!5.2.1 !2019-11-01
!5.2.0 !2019-10-21
!5.1.3 !2019-03-01
!5.1.2 !2018-12-25
!5.1.1 !2018-07-27
!5.1.0 !2018-05-28
!5.0.2 !2017-06-03
!5.0.1 !2016-02-23
!5.0.0 !2016-01-30
!4.2.1 !2015-02-20
!4.2.0 !2014-12-19
!4.1.2 !2013-06-18
!4.1.1 !2013-05-07
!4.1.0 !2013-04-01
!4.1.0rc1 !2013-03-09
!4.0.3 !2012-04-07
!4.0.2 !2012-02-11
!4.0.1 !2011-11-20
!4.0.0 !2011-10-13
!4.0.0rc2 !2011-09-22
!4.0.0rc1 !2011-08-11
!3.5.4 !2011-08-10
!3.5.3 !2011-06-07
!3.5.2 !2011-04-18
!3.5.1 !2011-03-23
!3.5.0 !2011-03-16
!3.4.3 !2011-01-22
!3.4.2 !2010-12-29
!3.4.1 !2010-09-03
!======
|
[frame="topbot",grid="none",options="header,autowidth"]
!======
!Version !Date
!3.4.0 !2010-06-16
!3.3.3 !2009-11-10
!3.3.2 !2009-10-05
!3.3.1 !2009-09-22
!3.3.0 !2009-08-02
!3.2.2 !2009-01-05
!3.2.1 !2008-08-26
!3.2.0 !2008-07-30
!3.1.4 !2008-04-01
!3.1.3 !2008-03-06
!3.1.2 !2008-02-20
!3.1.1 !2008-01-20
!3.1.0 !2008-01-09
!3.0.6 !2007-09-16
!3.0.5 !2007-06-17
!3.0.4 !2007-05-08
!3.0.3 !2007-04-28
!3.0.2 !2007-04-23
!3.0.1 !2007-04-04
!3.0.0 !2007-03-25
!2.9.8 !2006-02-02
!2.9.7 !2005-09-16
!2.9.7-TEST3 !2005-09-11
!2.9.7-TEST2 !2005-09-07
!2.9.7-TEST !2005-08-19
!2.9.6 !2005-06-10
!2.9.5 !2005-01-11
!2.9.4 !2004-12-20
!2.9.3 !2004-12-19
!2.9.2 !2004-09-25
!2.9.1 !2004-09-25
!2.9 !2004-09-18
!2.8.4 !2004-08-23
!2.8.3 !2004-08-04
!======
|
[frame="topbot",grid="none",options="header,autowidth"]
!======
!Version !Date
!2.8.2 !2004-07-22
!2.8.1 !2004-07-17
!2.8 !2004-07-03
!2.7.9 !2004-04-30
!2.7.8 !2004-04-29
!2.7.7 !2004-04-15
!2.7.6 !2004-04-04
!2.7.5 !2004-03-02
!2.7.4 !2004-02-18
!2.7.3 !2004-02-07
!2.7.2 !2004-01-04
!2.7.1 !2003-12-21
!2.7 !2003-11-25
!2.6.4 !2003-10-17
!2.6.3 !2003-10-01
!2.6.2 !2003-09-29
!2.6.1 !2003-09-15
!2.6 !2003-09-03
!2.5.1 !2003-07-12
!2.5 !2003-05-30
!2.4.1 !2003-04-19
!2.4 !2003-04-11
!2.3.2 !2003-03-17
!2.3.1 !2003-03-14
!2.3 !2003-02-27
!2.2 !2002-12-11
!2.1 !2002-09-16
!2.0 !2002-08-09
!1.23 !2002-04-30
!1.22 !2002-04-12
!1.21 !2002-04-03
!1.2 !2002-03-18
!1.1 !2002-03-10
!1.0 !2002-02-25
!======
|======
Source code for releases since moving to gitlab is available at
link:https://gitlab.archlinux.org/pacman/pacman/-/releases[].
Source code for historical releases is available at
link:https://sources.archlinux.org/other/pacman/[]. To install, download the newest
available source tarball, unpack it in a directory, and run the three magic
commands:
$ meson build
$ ninja -C build
# ninja -C build install
You may wish to read the options presented by `meson` in order to
set appropriate paths and build options that are correct for your system.
Development
-----------
Mailing List
~~~~~~~~~~~~
There is a mailing list devoted to pacman development, hosted by Arch Linux.
link:https://lists.archlinux.org/listinfo/pacman-dev/[Subscribe] or
link:https://lists.archlinux.org/pipermail/pacman-dev/[view the archives].
Source Code
~~~~~~~~~~~
Development of pacman is currently done in Git. The central repository is
hosted by Arch Linux, although some of the developers have their own trees (ask
on the above mailing lists if you are interested in finding the locations of
these trees).
The current development tree can be fetched with the following command:
git clone https://gitlab.archlinux.org/pacman/pacman.git
which will fetch the full development history into a directory named pacman.
You can browse the source as well using
link:https://gitlab.archlinux.org/pacman/pacman/[gitlab].
If you are interested in hacking on pacman, it is highly recommended you join
the mailing list mentioned above, as well as take a quick glance at our
link:HACKING.html[HACKING] document.
link:submitting-patches.html[submitting-patches] is also a recommended read.
Not as familiar with code as you'd like to be, but still want to help out? If
you speak a foreign language, you can help by either creating or updating a
translation file for your native language. Instructions can be found in
link:translation-help.html[translation-help].
Bugs
----
If you find bugs (which is quite likely), please report them to the issue
tracker at link:https://gitlab.archlinux.org/pacman/pacman/-/issues[] with
specific information such as your command-line, the nature of the bug, and even
the package database if it helps.
Copyright
---------
pacman is Copyright (C) 2006-2025 Pacman Development Team
<pacman-dev@lists.archlinux.org> and Copyright (C) 2002-2006 Judd Vinet
<jvinet@zeroflux.org> and is licensed through the GNU General Public License,
version 2 or later.

39
doc/libalpm.3.txt Normal file
View file

@ -0,0 +1,39 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
libalpm(3)
==========
Name
----
libalpm - Arch Linux Package Management (ALPM) library
Synopsis
--------
For ease of access, the libalpm manual has been split up into several sections.
*TODO:* Yes, this man page needs a lot of work. Once we get around to doing
good Doxygen documentation, it will improve. We promise.
*alpm_databases*:: Database Functions
*alpm_interface*:: Interface Functions
*alpm_list*:: List Functions
*alpm_log*:: Logging Functions
*alpm_misc*:: Miscellaneous Functions
*alpm_packages*:: Package Functions
*alpm_sync*:: Sync Functions
*alpm_trans*:: Transaction Functions
Configuration
-------------
See linkman:pacman.conf[5] for more details on configuring libalpm using the
'pacman.conf' file.
See Also
--------
linkman:pacman[8], linkman:makepkg[8], linkman:pacman.conf[5]
include::footer.txt[]

View file

@ -1,118 +0,0 @@
makepkg-template(1)
===================
Name
----
makepkg-template - package build templating utility
Synopsis
--------
'makepkg-template' [options]
Description
-----------
'makepkg-template' is a script to ease the work of maintaining multiple similar
PKGBUILDs. It allows you to move most of the code from the PKGBUILD into a
template file and uses markers to allow in-place updating of existing PKGBUILDs
if the template has been changed.
Template files can contain any code allowed in a PKGBUILD. You can think of
them like external files included with "." or "source", but they will be
inlined into the PKGBUILD by 'makepkg-template' so you do not depend on the
template file when building the package.
Markers are bash comments in the form of:
# template start; key=value; key2=value2; ...
and
# template end;
Currently used keys are: name (mandatory) and version. Template names are limited to
alphanumerics, "@", "+", ".", "-", and "_". Versions are limited to numbers and ".".
For initial creation there is a one line short cut which does not need an end marker:
# template input; key=value;
Using this short-cut will result in 'makepkg-template' replacing it with start
and end markers and the template code on the first run.
Template files should be stored in one directory and filenames should be
"$template_name-$version.template" with a symlink "$template_name.template"
pointing to the most recent template. If the version is not set in the marker,
'makepkg-template' will automatically use the target of "$template_name.template",
otherwise the specified version will be used. This allows for easier
verification of untrusted PKGBUILDs if the template is trusted. You verify the
non-template code and then use a command similar to this:
diff -u <(makepkg-template -o -) PKGBUILD
Template files may also contain markers leading to nested templates in the
resulting PKGBUILD. If you use markers in a template, please set the version
you used/tested with in the start/input marker so other people can properly
recreate from templates.
Options
-------
*-p, \--input* <build script>::
Read the package script `build script` instead of the default.
*-o, \--output* <build script>::
Write the updated file to `build script` instead of overwriting the input file.
*-n, \--newest*::
Always use the newest available template file.
*\--template-dir* <dir>::
Change the dir where we are looking for template files. This option may be
given multiple times in which case files found in directory given last will
take precedence.
Example PKGBUILD
----------------
pkgname=perl-config-simple
pkgver=4.58
pkgrel=1
pkgdesc="simple configuration file class"
arch=('any')
license=('PerlArtistic' 'GPL')
depends=('perl')
source=("http://search.cpan.org/CPAN/authors/id/S/SH/SHERZODR/Config-Simple-${pkgver}.tar.gz")
sha256sums=('dd9995706f0f9384a15ccffe116c3b6e22f42ba2e58d8f24ed03c4a0e386edb4')
_distname="Config-Simple"
# template start; name=perl-module; version=1.0;
_distdir="${_distname}-${pkgver}"
url="https://metacpan.org/release/${_distname}"
options+=('!emptydirs')
build() {
cd "$srcdir/$_distdir"
perl Makefile.PL INSTALLDIRS=vendor
make
}
check() {
cd "$srcdir/$_distdir"
make test
}
package() {
cd "$srcdir/$_distdir"
make DESTDIR="$pkgdir" install
}
# template end;
See Also
--------
linkman:makepkg[8], linkman:PKGBUILD[5]
include::footer.asciidoc[]

View file

@ -1,382 +0,0 @@
makepkg(8)
==========
Name
----
makepkg - package build utility
Synopsis
--------
'makepkg' [options] [ENVVAR=value] [ENVVAR+=value] ...
Description
-----------
'makepkg' is a script to automate the building of packages. The requirements for
using the script are a build-capable *nix platform and a custom build script
for each package you wish to build (known as a PKGBUILD). See
linkman:PKGBUILD[5] for details on creating your own build scripts.
The advantage to a script-based build is that the work is only done once. Once
you have the build script for a package, 'makepkg' will do the rest: download and
validate source files, check dependencies, configure the build-time settings,
build the package, install the package into a temporary root, make
customizations, generate meta-info, and package the whole thing up for pacman
to use.
NOTE: 'makepkg' uses your current locale by default and does not unset it when
building packages. If you wish to share your build output with others when
seeking help or for other purposes, you may wish to run "`LC_ALL=C makepkg`" so
your logs and output are not localized.
Options
-------
*-A, \--ignorearch*::
Ignore a missing or incomplete arch field in the build script. This is
for rebuilding packages from source when the PKGBUILD may be slightly
outdated and not updated with an `arch=('yourarch')` field.
*-c, \--clean*::
Clean up leftover work files and directories after a successful build.
*\--config* <file>::
Use an alternate configuration file instead of the +{sysconfdir}/makepkg.conf+
default.
*-d, \--nodeps*::
Do not perform any dependency checks. This will let you override and
ignore any dependencies required. There is a good chance this option
will break the build process if all of the dependencies are not
installed.
*-e, \--noextract*::
Do not extract source files or run the prepare() function (if present);
use whatever source already exists in the $srcdir/ directory. This is
handy if you want to go into $srcdir/ and manually patch or tweak code,
then make a package out of the result. Keep in mind that creating a
patch may be a better solution to allow others to use your PKGBUILD.
*\--verifysource*::
For each source file in the source array of PKGBUILD, download the file
if required and perform the integrity checks. No extraction or build is
performed. Dependencies specified in the PKGBUILD will not be handled
unless `--syncdeps` is used. Useful for performing subsequent offline
builds.
*-f, \--force*::
makepkg will not build a package if a built package already exists in
the `PKGDEST` (set in linkman:makepkg.conf[5]) directory, which may
default to the current directory. This allows the built package to be
overwritten.
*-g, \--geninteg*::
For each source file in the source array of PKGBUILD, download the file
if required and generate integrity checks. The integrity checks generated
are determined by the checks present in the PKGBUILD, falling back to the
value of the INTEGRITY_CHECK array in makepkg.conf(5) if these are absent.
This output can be redirected into your PKGBUILD for source validation
using "`makepkg -g >> PKGBUILD`".
*--skipinteg*::
Do not perform any integrity checks (checksum and PGP) on source files.
*\--skipchecksums*::
Do not verify checksums of source files.
*\--skippgpcheck*::
Do not verify PGP signatures of source files.
*-h, \--help*::
Output syntax and command line options.
*--holdver*::
When using VCS sources (linkman:PKGBUILD[5]) any currently checked out source
will not be updated to the latest revision.
*-i, \--install*::
Install or upgrade the package after a successful build using
linkman:pacman[8].
*-L, \--log*::
Enable logging. This will use the *tee* program to send the output of each
of the PKGBUILD functions to both the console and to a text file in the
build directory named `pkgbase-pkgver-pkgrel-arch-<function>.log`.
As mentioned above, the logs will be localized so you may want to set your
locale accordingly if sharing the log output with others.
*-m, \--nocolor*::
Disable color in output messages.
*-o, \--nobuild*::
Download and extract files, run the prepare() function, but do not build
them. Useful with the '\--noextract' option if you wish to tweak the files
in $srcdir/ before building.
*-p* <buildscript>::
Read the package script `buildscript` instead of the `PKGBUILD` default;
see linkman:PKGBUILD[5]. The `buildscript` must be located in the directory
makepkg is called from.
*-r, \--rmdeps*::
Upon successful build, remove any dependencies installed by makepkg
during dependency auto-resolution and installation when using `-s`.
*-R, \--repackage*::
Repackage contents of the package without rebuilding the package. This
is useful if you forgot, for example, a dependency or install file in your
PKGBUILD and the build itself will not change.
*-s, \--syncdeps*::
Install missing dependencies using pacman. When build-time or run-time
dependencies are not found, pacman will try to resolve them. If
successful, the missing packages will be downloaded and installed.
*-S, \--source*::
Do not actually build the package, but build a source-only tarball that
does not include sources that can be fetched via a download URL. This is
useful for passing a single tarball to another program such as a chroot,
remote builder, or a tarball upload. Because integrity checks are verified,
all source files of the package need to be present or downloadable.
*-V, \--version*::
Display version information.
*-C, \--cleanbuild*::
Clean build artifacts from previous runs of makepkg in the current
directory by removing $srcdir before building the package.
*-D* <dir>, *\--dir* <dir> ::
Change to directory <dir> before reading the PKGBUILD or doing anything else.
*\--allsource*::
Do not actually build the package, but build a source-only tarball that
includes all sources, including those that are normally downloaded via
makepkg. This is useful for passing a single tarball to another program
such as a chroot or remote builder. It will also satisfy requirements of
the GPL when distributing binary packages.
*\--check*::
Run the check() function in the PKGBUILD, overriding the setting in
linkman:makepkg.conf[5].
*\--noarchive*::
Do not create the archive at the end of the build process. This can be
useful to test the package() function or if your target distribution does
not use pacman.
*\--nocheck*::
Do not run the check() function in the PKGBUILD or handle the checkdepends.
*\--noprepare*::
Do not run the prepare() function in the PKGBUILD.
*\--noverify*::
Do not run the verify() function in the PKGBUILD.
*\--sign*::
Sign the resulting package with gpg, overriding the setting in
linkman:makepkg.conf[5].
*\--nosign*::
Do not create a signature for the built package.
*\--key* <key>::
Specify a key to use when signing packages, overriding the GPGKEY setting
in linkman:makepkg.conf[5]. If not specified in either location, the
default key from the keyring will be used.
*\--noconfirm*::
(Passed to pacman) Prevent pacman from waiting for user input before
proceeding with operations.
*\--needed*::
(Passed to pacman) Tell pacman not to reinstall a target if it is already
up-to-date. (used with '-i' / '\--install').
*\--asdeps*::
(Passed to pacman) Install packages as non-explicitly installed (used
with '-i' / '\--install').
*\--noprogressbar*::
(Passed to pacman) Prevent pacman from displaying a progress bar;
useful if you are redirecting makepkg output to file.
*\--packagelist*::
List the package filenames that would be produced without building. Listed
package filenames include PKGDEST and PKGEXT.
*\--printsrcinfo*::
Generate and print the SRCINFO file to stdout.
Additional Features
-------------------
makepkg supports building development versions of packages without having to
manually update the pkgver in the PKGBUILD. This was formerly done using the
separate utility 'versionpkg'. See linkman:PKGBUILD[5] for details on how to
set up a development PKGBUILD.
Reproducibility
---------------
makepkg is designed to be compatible with
link:https://reproducible-builds.org/docs/[Reproducible Builds]. If the
**SOURCE_DATE_EPOCH** environment variable is set, it will be exported to
subprocesses, and source and package file modification times and package
metadata will be unified based on the timestamp specified.
If the **SOURCE_DATE_EPOCH** environment variable is not set, makepkg will use
its own start date for internal use, but will not unify source file timestamps
before building.
Environment Variables
---------------------
**MAKEPKG_LIBRARY**="/path/to/directory"::
Use an alternative libmakepkg path instead of the {libmakepkgdir} default.
**PACMAN**::
The command that will be used to check for missing dependencies and to
install and remove packages. Pacman's '-Qq', '-Rns', '-S', '-T', and '-U'
operations must be supported by this command. If the variable is not
set or empty, makepkg will fall back to `pacman'.
**MAKEPKG_CONF=**"/path/to/file"::
Use an alternate config file instead of the +{sysconfdir}/makepkg.conf+
default.
**MAKEPKG_GIT_CONFIG=**"/path/to/file"::
Use an alternate config file for Git instead of the
+{sysconfdir}/makepkg.d/gitconfig+ default. makepkg always prevents Git
from loading any other config files.
**PKGDEST=**"/path/to/directory"::
Directory where the resulting packages will be stored. Overrides the
corresponding value defined in linkman:makepkg.conf[5].
**SRCDEST=**"/path/to/directory"::
Directory where the downloaded sources will be stored. Overrides the
corresponding value defined in linkman:makepkg.conf[5].
**SRCPKGDEST=**"/path/to/directory"::
Directory where source package files will be stored. Overrides the
corresponding value defined in linkman:makepkg.conf[5].
**LOGDEST=**"/path/to/directory"::
Directory where generated log files will be stored. Overrides the
corresponding value defined in linkman:makepkg.conf[5].
**PACKAGER=**"John Doe <john@doe.com>"::
String to identify the creator of the resulting package. Overrides
the corresponding value defined in linkman:makepkg.conf[5].
**BUILDDIR=**"/path/to/directory"::
Directory where the package will be built. Overrides the corresponding
value defined in linkman:makepkg.conf[5].
**CARCH=**"(i686|x86_64)"::
Force build for a specific architecture. Useful for cross-compiling.
Overrides the corresponding value defined in linkman:makepkg.conf[5].
**PKGEXT=**".pkg.tar.gz", **SRCEXT=**".src.tar.gz"::
Sets the compression used when making compiled or source packages.
Overrides the corresponding value defined in linkman:makepkg.conf[5].
**GNUPGHOME=**"/path/to/directory"::
Directory where the gpg keyring for signing the built package is stored.
**GPGKEY=**"keyid"::
Specify a key to use when signing packages, overriding the GPGKEY setting
in linkman:makepkg.conf[5].
**SOURCE_DATE_EPOCH=**"<date>"::
Used for link:https://reproducible-builds.org/docs/[Reproducible Builds].
**BUILDTOOL=**"<name>"::
The name of a tool ecosystem used to set up the build environment. Used for
defining a spec for reproducible builds, e.g. the linkman:makepkg.conf[5]
used.
**BUILDTOOLVER=**"<version>"::
The version of the '$BUILDTOOL' used.
**MAKEPKG_LINT_PKGBUILD=**0::
Setting to 0 disables PKGBUILD linting within makepkg. Useful on systems
with slow bash subshell operations, or on PKGBUILDs with extreme amounts of
package splitting.
Configuration
-------------
See linkman:makepkg.conf[5] for more details on configuring makepkg using the
'makepkg.conf' file.
Errors
------
On exit, makepkg will return one of the following error codes.
0::
Normal exit condition.
1::
Unknown cause of failure.
2::
Error in configuration file.
3::
User specified an invalid option.
4::
Error in user-supplied function in PKGBUILD.
5::
Failed to create a viable package.
6::
A source or auxiliary file specified in the PKGBUILD is
missing.
7::
The PKGDIR is missing.
8::
Failed to install dependencies.
9::
Failed to remove dependencies.
10::
User attempted to run makepkg as root.
11::
User lacks permissions to build or install to a given
location.
12::
Error parsing PKGBUILD.
13::
A package has already been built.
14::
The package failed to install.
15::
Programs necessary to run makepkg are missing.
16::
Specified GPG key does not exist or failed to sign package.
17::
The local repository is not a clone of the source repository
specified in PKGBUILD.
See Also
--------
linkman:makepkg.conf[5], linkman:PKGBUILD[5], linkman:pacman[8]
include::footer.asciidoc[]

171
doc/makepkg.8.txt Normal file
View file

@ -0,0 +1,171 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
makepkg(8)
==========
Name
----
makepkg - package build utility
Synopsis
--------
makepkg [options]
Description
-----------
makepkg is a script to automate the building of packages. The requirements for
using the script are a build-capable \*nix platform and a custom build script
for each package you wish to build (known as a PKGBUILD). See
linkman:PKGBUILD[5] for details on creating your own build scripts.
The advantage to a script-based build is that the work is only done once. Once
you have the build script for a package, makepkg will do the rest: download and
validate source files, check dependencies, configure the build-time settings,
build the package, install the package into a temporary root, make
customizations, generate meta-info, and package the whole thing up for pacman
to use.
NOTE: makepkg uses your current locale by default and does not unset it when
building packages. If you wish to share your build output with others when
seeking help or for other purposes, you may wish to run "`LC_ALL=C makepkg`" so
your logs and output are not localized.
Options
-------
*\--asroot*::
Allow makepkg to run as root. This is for security purposes as it is
normally dangerous to do so. This will also disable use of fakeroot and
sudo.
*-A, \--ignorearch*::
Ignore a missing or incomplete arch field in the build script. This is
for rebuilding packages from source when the PKGBUILD may be slightly
outdated and not updated with an `$$arch=('yourarch')$$` field.
*-c, \--clean*::
Clean up leftover work files and directories after a successful build.
*-C, \--cleancache*::
Removes all cached source files from the directory specified in `SRCDEST`
in linkman:makepkg.conf[5].
*-d, \--nodeps*::
Do not perform any dependency checks. This will let you override and
ignore any dependencies required. There is a good chance this option
will break the build process if all of the dependencies are not
installed.
*-e, \--noextract*::
Do not extract source files; use whatever source already exists in the
src/ directory. This is handy if you want to go into src/ and manually
patch or tweak code, then make a package out of the result. Keep in mind
that creating a patch may be a better solution to allow others to use
your PKGBUILD.
*-f, \--force*::
makepkg will not build a package if a built package already exists in
the `PKGDEST` (set in linkman:makepkg.conf[5]) directory, which may
default to the current directory. This allows the built package to be
overwritten.
*--forcever*::
This is a hidden option that should *not* be used unless you really know
what you are doing. makepkg uses this internally when calling itself to
set the new development pkgver of the package.
*-g, \--geninteg*::
For each source file in the source array of PKGBUILD, download the file
if required and generate integrity checks. The integrity checks
generated are determined by the value of the INTEGRITY_CHECK array in
linkman:makepkg.conf[5]. This output can be redirected into your
PKGBUILD for source validation using "`makepkg -g >> PKGBUILD`".
*-h, \--help*::
Output syntax and command line options.
*\--holdver*::
Useful when building development versions of packages. Prevents makepkg
from automatically bumping the pkgver to the latest revision number in
the package's development tree.
*-i, \--install*::
Install or upgrade the package after a successful build using
linkman:pacman[8].
*-L, \--log*::
Enable makepkg build logging. This will use the *tee* program to send
output of the `build()` function to both the console and to a text file in
the build directory named `pkgname-pkgver-pkgrel-arch.log`. As mentioned
above, the build log will be localized so you may want to set your locale
accordingly if sharing the log output with others.
*-m, \--nocolor*::
Disable color in output messages.
*-o, \--nobuild*::
Download and extract files only, but do not build them. Useful with the
`\--noextract` option if you wish to tweak the files in src/ before
building.
*-p* <`buildscript`>::
Read the package script `buildscript` instead of the `PKGBUILD` default;
see linkman:PKGBUILD[5].
*-r, \--rmdeps*::
Upon successful build, remove any dependencies installed by makepkg
during dependency auto-resolution and installation when using `-s`.
*-R, \--repackage*::
Repackage contents of pkg/ without rebuilding the package. This is
useful if you forgot a depend or install file in your PKGBUILD and the
build itself will not change.
*-s, \--syncdeps*::
Install missing dependencies using pacman. When build-time or run-time
dependencies are not found, pacman will try to resolve them. If
successful, the missing packages will be downloaded and installed.
*\--allsource*::
Do not actually build the package, but build a source-only tarball that
includes all sources, including those that are normally download via
makepkg. This is useful for passing a single tarball to another program
such as a chroot or remote builder. It will also satisfy requirements of
the GPL when distributing binary packages.
*\--source*::
Do not actually build the package, but build a source-only tarball that
does not include sources that can be fetched via a download URL. This is
useful for passing a single tarball to another program such as a chroot,
remote builder, or a tarball upload.
*\--noconfirm*::
(Passed to pacman) Prevent pacman from waiting for user input before
proceeding with operations.
*\--noprogressbar*::
(Passed to pacman) Prevent pacman from displaying a progress bar;
useful if you are redirecting makepkg output to file.
Additional Features
-------------------
makepkg supports building development versions of packages without having to
manually update the pkgver in the PKGBUILD. This was formerly done using the
separate utility 'versionpkg'. See linkman:PKGBUILD[5] for details on how to
set up a development PKGBUILD.
Configuration
-------------
See linkman:makepkg.conf[5] for more details on configuring makepkg using the
'makepkg.conf' file.
See Also
--------
linkman:makepkg.conf[5], linkman:PKGBUILD[5], linkman:pacman[8]
include::footer.txt[]

View file

@ -1,312 +0,0 @@
makepkg.conf(5)
===============
Name
----
makepkg.conf - makepkg configuration file
Synopsis
--------
{sysconfdir}/makepkg.conf, $XDG_CONFIG_HOME/pacman/makepkg.conf, ~/.makepkg.conf
Description
-----------
Configuration options for makepkg are stored in makepkg.conf. This file is
sourced so you can include any special compiler flags you wish to use. This is
helpful when building for different architectures or with different
optimizations. However, only the variables described below are exported to the
build environment.
NOTE: This does not guarantee that all package Makefiles will use your exported
variables. Some of them are non-standard.
The system-wide configuration file is found in {sysconfdir}/makepkg.conf.
Specific additions (e.g. build flags for additional languages) can be placed
in {sysconfdir}/makepkg.conf.d/*.conf.
Individual options can be overridden (or added to) on a per-user basis in
$XDG_CONFIG_HOME/pacman/makepkg.conf or ~/.makepkg.conf, with the former
taking priority.
The default file is fairly well commented, so it may be easiest to simply
follow directions given there for customization.
Options
-------
**DLAGENTS=(**\'protocol::/path/to/command [options]' ...**)**::
Sets the download agents used to fetch source files specified with a URL in
the linkman:PKGBUILD[5] file. Options can be specified for each command as
well, and any protocol can have a download agent. Any spaces in option
arguments are required to be escaped to avoid being split. Several
examples are provided in the default makepkg.conf.
+
If present, `%u` will be replaced with the download URL. Otherwise, the
download URL will be placed on the end of the command. If present, `%o` will
be replaced with the local file name, plus a ``.part'' extension, which allows
makepkg to handle resuming file downloads.
**VCSCLIENTS=(**\'protocol::package' ...**)**::
Sets the packages required to fetch version controlled source files. When
required, makepkg will check that these packages are installed or are included
in the `depends` or `makedepends` arrays in the PKGBUILD.
**CARCH=**"carch"::
Specifies your computer architecture; possible values include such things
as ``i686'', ``x86_64'', ``ppc'', etc. This should be automatically set on
installation.
**CHOST=**"chost"::
A string such as ``i686-pc-linux-gnu''; do not touch this unless you know what
you are doing. This can be commented out by most users if desired.
**NPROC=**""::
Sets the number of processors to use for parallel jobs in makepkg.
Note: this does not affect parallelization of tasks during ``build()`` and
related functions.
**CPPFLAGS=**"cppflags"::
Flags used for the C preprocessor; see CFLAGS for more information.
**CFLAGS=**"cflags"::
Flags used for the C compiler. This is a key part to the use of makepkg.
Usually several options are specified, and the most common string resembles
something like this: ``-march=i686 -O2 -pipe''. Another useful option may
be `-mcpu` in place of `-march`. Read gcc(1) for more details on the wide
variety of compiler flags available.
**CXXFLAGS=**"cxxflags"::
Flags used for the C++ compiler; see CFLAGS for more info.
**LDFLAGS=**"ldflags"::
Flags used for the linker. Several options may be specified with common
usage resembling ``-Wl,--hash-style=gnu''. Read ld(1) for more details on
available linker flags.
**LTOFLAGS=**"ltoflags"::
Additional compiler and linker flags appended to `CFLAGS`, `CXXFLAGS`
and `LDFLAGS` when building with link time optimization. If empty,
``-flto'' is used.
**MAKEFLAGS=**"makeflags"::
This is often used to set the number of jobs used; for example, `-j2`.
Other flags that make accepts can also be passed.
**DEBUG_CFLAGS=**"debug_cflags"::
Additional compiler flags appended to `CFLAGS` for use in debugging. Usually
this would include: ``-g''. Read gcc(1) for more details on the wide
variety of compiler flags available.
**DEBUG_CXXFLAGS=**"debug_cxxflags"::
Debug flags used for the C++ compiler; see DEBUG_CFLAGS for more info.
**BUILDENV=(**!distcc !color !ccache check !sign**)**::
This array contains options that affect the build environment; the defaults
are shown here. All options should always be left in the array; to enable
or disable an option, simply remove or add an ``!'' at the front of the
option. If an option is specified multiple times, the final value takes
precedence. Each option works as follows:
*distcc*;;
Use the distributed C/C++/ObjC compiler to spread compilation among
multiple machines. If this is enabled, `DISTCC_HOSTS` must be specified
as well.
*color*;;
Colorize output messages, making output easier to read.
*ccache*;;
Use ccache to cache compilation by default. This allows for faster
compiles if you are continuously recompiling the same packages. It can
be disabled for individual packages by placing `!ccache` in the
PKGBUILD options array.
*check*;;
Run the check() function if present in the PKGBUILD. This can be
enabled or disabled for individual packages through the use of
makepkg's '\--check' and '\--nocheck' options, respectively.
*sign*;;
Generate a PGP signature file using GnuPG. This will execute 'gpg
\--detach-sign' on the built package to generate a detached
signature file, using the GPG agent, if it is available. The signature
file will be the entire file name of the package with a ``.sig''
extension.
**DISTCC_HOSTS=**"host1 ..."::
If using DistCC, this is used to specify a space-delimited list of hosts
running in the DistCC cluster. In addition, you will want to modify your
`MAKEFLAGS`.
**BUILDDIR=**"/path/to/directory"::
If this value is not set, packages will, by default, be built in
subdirectories of the directory that makepkg is called from. This
option allows setting the build location to another directory.
Incorrect use of `$startdir` in a PKGBUILD may cause building with
this option to fail.
**GPGKEY=**""::
Specify a key to use for GPG signing instead of the default key in the
keyring. Can be overridden with makepkg's '\--key' option.
**OPTIONS=(**!strip docs libtool staticlibs emptydirs ...**)**::
This array contains options that affect default packaging. They are
equivalent to options that can be placed in the PKGBUILD; the defaults are
shown here. All options should always be left in the array; to enable or
disable an option, simply remove or add an ``!'' at the front of the
option. If an option is specified multiple times, the final value takes
precedence. Each option works as follows:
*strip*;;
Strip symbols from binaries and libraries. If you frequently use a
debugger on programs or libraries, it may be helpful to disable this
option.
*docs*;;
Save doc directories. If you wish to delete doc directories, specify
`!docs` in the array. The directories affected are specified by the
`DOC_DIRS` variable.
*libtool*;;
Leave libtool (.la) files in packages. Specify `!libtool` to remove
them.
*staticlibs*;;
Leave static library (.a) files in packages. Specify `!staticlibs` to
remove them, if they have a shared counterpart.
*emptydirs*;;
Leave empty directories in packages.
*zipman*;;
Compress manual (man and info) pages with gzip. The directories
affected are specified by the `MAN_DIRS` variable.
*purge*;;
Remove files specified by the `PURGE_TARGETS` variable from the
package.
*debug*;;
Add the user-specified debug flags as specified in DEBUG_CFLAGS and
DEBUG_CXXFLAGS to their counterpart buildflags. Creates a separate
package containing the debug symbols when used with `strip'.
*lto*;;
Enable building packages using link time optimization. Adds the
flags specified in LTOFLAGS to CFLAGS, CXXFLAGS and LDFLAGS (or
``-flto'' if LTOFLAGS is empty).
*autodeps*;;
Enable the automatic addition of libraries to the depends and
provides arrays. Search library directories are controlled by
the LIB_DIRS variable defined below.
**INTEGRITY_CHECK=(**check1 ...**)**::
File integrity checks to use. Multiple checks may be specified; this
affects both generation and checking. The current valid options are:
`ck`, `md5`, `sha1`, `sha224`, `sha256`, `sha384`, `sha512`, and `b2`.
**STRIP_BINARIES=**"--strip-all"::
Options to be used when stripping binaries. See linkman:strip[1]
for details.
**STRIP_SHARED=**"--strip-unneeded"::
Options to be used when stripping shared libraries or PIE executables.
See linkman:strip[1] for details.
**STRIP_STATIC=**"--strip-debug"::
Options to be used when stripping static libraries. See linkman:strip[1]
for details.
**MAN_DIRS=(**{usr{,/local}{,/share},opt/*}/{man,info} ...**)**::
If `zipman` is specified in the `OPTIONS` array, this variable will
instruct makepkg where to look to compress manual (man and info)
pages. If you build packages that are located in opt/, you may need
to add the directory to this array. *NOTE:* Do not add the leading
slash to the directory name.
**DOC_DIRS=(**usr/{,share/}{doc,gtk-doc} ...**)**::
If `!docs` is specified in the `OPTIONS` array, this variable will
instruct makepkg where to look to remove docs. If you build packages
that are located in opt/, you may need to add the directory to this
array. *NOTE:* Do not add the leading slash to the directory name.
**LIB_DIRS=(**lib:usr/lib ...**)**::
If `autodeps` is specified in the `OPTIONS` array, this variable will
instruct makepkg where to look to find libraries to add to the `provides`
array. The format is "prefix:path", where provides will be added for
libraries found in "path" with the specified prefix added.
**PURGE_TARGETS=(**usr/{,share}/info/dir .podlist *.pod...**)**::
If `purge` is specified in the `OPTIONS` array, this variable will
instruct makepkg which files to remove from the package. This is
useful for index files that are added by multiple packages.
**DBGSRCDIR=**"/usr/src/debug"::
If `strip` and `debug` are specified in the `OPTIONS` array, this variable
will instruct makepkg where to place source files for installed binaries.
The binaries will be modified to link this directory for the debugger
search path.
**PKGDEST=**"/path/to/directory"::
If this value is not set, packages will, by default, be placed in the
current directory (location of the linkman:PKGBUILD[5]). Many people
like to keep all their packages in one place so this option allows
for this behavior. A common location is ``/home/packages''.
**SRCDEST=**"/path/to/directory"::
If this value is not set, downloaded source files will only be stored
in the current directory. Many people like to keep all source files in
a central location for easy cleanup, so this path can be set here.
**SRCPKGDEST=**"/path/to/directory"::
If this value is not set, source package files will be stored in
in the current directory. Many people like to keep all source package files
in a central location for easy cleanup, so this path can be set here.
**LOGDEST=**"/path/to/directory"::
If this value is not set, log files are written to the current
directory. This centralizes the log location, facilitating cleanup
and compression.
**PACKAGER=**"John Doe <john@example.com>"::
This value is used when querying a package to see who was the builder.
The given format is required for PGP key lookup through WKD.
It is recommended to change this to your name and email address.
**COMPRESSGZ=**"(gzip -c -f -n)"::
**COMPRESSBZ2=**"(bzip2 -c -f)"::
**COMPRESSXZ=**"(xz -c -z -)"::
**COMPRESSZST=**"(zstd -c -z -)"::
**COMPRESSLZO**"(lzop -q)"::
**COMPRESSLRZ=**"(lrzip -q)"::
**COMPRESSLZ4=**"(lz4 -q)"::
**COMPRESSZ=**"(compress -c -f)"::
**COMPRESSLZ=**"(lzip -c -f)"::
Sets the command and options used when compressing compiled or source
packages in the named format.
**PKGEXT=**"{pkgext}", **SRCEXT=**"{srcext}"::
Sets the compression used when making compiled or source packages.
Valid suffixes are `.pkg` or `.src` (for PKGEXT and SRCEXT respectively)
followed by one of `.tar.gz`, `.tar.bz2`, `.tar.xz`, `.tar.zst`, `.tar.lzo`,
`.tar.lrz`, `.tar.lz4`, `.tar.lz` and `.tar.Z`, or simply `.tar` to
disable compression entirely.
**PACMAN_AUTH=()**::
Specify a command prefix for running pacman as root. If unset, makepkg will
check for the presence of sudo(8) and su(1) in turn, and try the first one
it finds.
+
If present, `%c` will be replaced with the shell-quoted form of the command
to run. Otherwise, the command to run is appended to the auth command.
See Also
--------
linkman:makepkg[8], linkman:pacman[8], linkman:PKGBUILD[5]
include::footer.asciidoc[]

168
doc/makepkg.conf.5.txt Normal file
View file

@ -0,0 +1,168 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
makepkg.conf(5)
===============
Name
----
makepkg.conf - makepkg configuration file
Synopsis
--------
{sysconfdir}/makepkg.conf, ~/.makepkg.conf
Description
-----------
Configuration options for makekpg are stored in makepkg.conf. This file is
sourced, so you can include any special compiler flags you wish to use. This is
helpful for building for different architectures, or with different
optimizations. However, only the variables described below are exported to the
build environment.
NOTE: This does not guarantee that all package Makefiles will use your exported
variables. Some of them are non-standard.
The default file is fairly well commented, so it may be easiest to simply
follow directions given there for customization.
Options
-------
**DLAGENTS=(**\'protocol::/path/to/command [options]' ...**)**::
Sets the download agents used to fetch source files specified with a URL in
the linkman:PKGBUILD[5] file. Options can be specified for each command as
well, and any protocol can have a download agent. Several examples are provided
in the default makepkg.conf.
+
If present, `%u` will be replaced with the download URL. Otherwise, the
download URL will be placed on the end of the command. If present, `%o` will
be replaced with the local filename, plus a ``.part'' extension, which allows
makepkg to handle resuming file downloads.
**CARCH=**"carch"::
Specifies your computer architecture; possible values include such things
as ``i686'', ``x86_64'', ``ppc'', etc. This should be automatically set on
installation.
**CHOST=**"chost"::
A string such as ``i686-pc-linux-gnu'', do not touch unless you know what
you are doing. This can be commented out by most users if desired.
**CFLAGS=**"cflags"::
Flags used for the C compiler. This is a key part to the use of makepkg.
Usually several options are specified, and the most common string resembles
something like this: ``-march=i686 -O2 -pipe''. Another useful option may
be `-mcpu` in place of `-march`. Read gcc(1) for more details on the wide
variety of compiler flags available.
**CXXFLAGS=**"cxxflags"::
Flags used for the C++ compiler; see CFLAGS for more info.
**MAKEFLAGS=**"makeflags"::
This is often used to set the number of jobs used, for example, `-j2`.
Other flags that make accepts can also be passed.
**BUILDENV=(**fakeroot !distcc color !ccache !xdelta**)**::
This array contains options that affect the build environment, the defaults
are shown here. All options should always be left in the array; to enable
or disable an option simply remove or place an ``!'' at the front of the
option. Each works as follows:
*fakeroot*;;
Allow building packages as a non-root user. This is highly recommended.
*distcc*;;
Use the distributed C/C++/ObjC compiler to spread compilation among
multiple machines. If this is enabled, `DISTCC_HOSTS` must be specified
as well.
*color*;;
Colorize output messages, making output easier to read.
*ccache*;;
Use ccache to cache compilation by default. This allows for faster
compiles if you are continuously recompiling the same packages. It can
be disabled for individual packages by placing `!ccache` in the
PKGBUILD options array.
*xdelta*;;
Generate an xdelta binary patch from previous to current package. The
previous package must be available in the makepkg cache directory for
this to occur.
**DISTCC_HOSTS=**"host1 ..."::
If using DistCC, this is used to specify a space-delimited list of hosts
running in the DistCC cluster. In addition, you will want to modify your
`MAKEFLAGS`.
**OPTIONS=(**strip docs libtool emptydirs zipman**)**::
This array contains options that affect the default packaging. They are
equivalent to options that can be placed in the PKGBUILD; the defaults are
shown here. All options should always be left in the array; to enable or
disable an option simply remove or place an ``!'' at the front of the
option. Each works as follows:
*strip*;;
Strip symbols from binaries and libraries. If you frequently use a
debugger on programs or libraries, it may be helpful to disable this
option.
*docs*;;
Save doc and info directories. If you wish to delete doc and info
directories, specify `!docs' in the array.
*libtool*;;
Leave libtool (.la) files in packages. Specify `!libtool' to remove
them.
*emptydirs*;;
Leave empty directories in packages.
*zipman*;;
Compress man pages with gzip.
**INTEGRITY_CHECK=(**check1 ...**)**::
File integrity checks to use. Multiple checks may be specified; this
affects both generation and checking. The current valid options are:
`md5`, `sha1`, `sha256`, `sha384`, and `sha512`.
**DOC_DIRS=(**usr/{,share/}{info,doc} ...**)**::
If "!docs" is specified in the OPTIONS array, this variable will
instruct makepkg where to look to remove docs. If you build packages
that are located in opt/, you may need to add the directory to this
array. *NOTE:* Do not add the leading slash to the directory name.
**STRIP_DIRS=(**bin lib sbin usr/{bin,lib} ...**)**::
If "strip" is specified in the OPTIONS array, this variable will
instruct makepkg where to look to for files to strip. If you build
packages that are located in opt/, you may need to add the directory
to this array. *NOTE:* Do not add the leading slash to the directory
name.
**PKGDEST=**"/path/to/folder"::
If this value is not set, packages will by default be placed in the
current directory (location of the linkman:PKGBUILD[5]). Many people
like to keep all their packages in one place so this option allows
this behavior. A common location is ``/home/packages''.
**SRCDEST=**"/path/to/folder"::
If this value is not set, downloaded source files will only be stored
in the current directory. Many people like to keep all source files in
a central location for easy cleanup, so this path can be set here.
**PACKAGER=**"John Doe <john@doe.com>"::
This value is used when querying a package to see who was the builder.
It is recommended you change this to your name and email address.
*BUILDSCRIPT*, *PKGEXT*, *SRCEXT*, *DB_COMPRESSION*, *DB_CHECKSUMS*::
Do not touch these unless you know what you are doing.
See Also
--------
linkman:makepkg[8], linkman:pacman[8], linkman:PKGBUILD[5]
include::footer.txt[]

View file

@ -1,157 +0,0 @@
manpages = [
{ 'name': 'alpm-hooks.5' },
{ 'name': 'pacman.8' },
{ 'name': 'makepkg.8' },
{ 'name': 'makepkg-template.1' },
{ 'name': 'repo-add.8' },
{ 'name': 'vercmp.8' },
{ 'name': 'testpkg.8' },
{ 'name': 'pacman-key.8' },
{ 'name': 'pacman-db-upgrade.8' },
{ 'name': 'PKGBUILD.5', 'extra_depends' : [ 'PKGBUILD-example.txt' ] },
{ 'name': 'makepkg.conf.5' },
{ 'name': 'pacman.conf.5' },
{ 'name': 'BUILDINFO.5' },
{ 'name': 'pacman-conf.8' },
]
sitepages = [
{ 'name': 'submitting-patches' },
{ 'name': 'translation-help' },
{ 'name': 'HACKING', 'source': '../HACKING' },
{ 'name': 'index' },
]
asciidoc_conf = join_paths(meson.current_source_dir(), 'asciidoc.conf')
asciidoc_opts = [
'-f', asciidoc_conf,
'-a', 'pacman_version="@0@"'.format(PACKAGE_VERSION),
'-a', 'srcext=@0@'.format(get_option('src-ext')),
'-a', 'pkgext=@0@'.format(get_option('pkg-ext')),
'-a', 'pkgdatadir=@0@'.format(PKGDATADIR),
'-a', 'keyringdir=@0@'.format(KEYRINGDIR),
'-a', 'localstatedir=@0@'.format(LOCALSTATEDIR),
'-a', 'sysconfdir=@0@'.format(SYSCONFDIR),
'-a', 'datarootdir=@0@'.format(DATAROOTDIR),
'-a', 'rootdir=@0@'.format(ROOTDIR),
'-a', 'libmakepkgdir=@0@'.format(LIBMAKEPKGDIR),
]
html_targets = []
html_files = []
foreach page : manpages
manpage = page['name']
htmlpage = '@0@.html'.format(manpage)
input = '@0@.asciidoc'.format(manpage)
section = page['name'].split('.')[-1]
mandirn = join_paths(MANDIR, 'man' + section)
custom_target(
manpage,
command : [
A2X,
'--no-xmllint',
'-d', 'manpage',
'-f', 'manpage',
'--xsltproc-opts', '-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0',
'-D', '@OUTDIR@',
'--asciidoc-opts', ' '.join(asciidoc_opts),
'@INPUT@',
],
input : input,
output : [manpage],
depend_files : [
asciidoc_conf,
] + page.get('extra_depends', []),
install : true,
install_dir : mandirn,
)
endforeach
foreach page: manpages + sitepages
manpage = page['name']
htmlpage = '@0@.html'.format(manpage)
input = page.get('source', '@0@.asciidoc'.format(manpage))
html = custom_target(
htmlpage,
command : [
ASCIIDOC,
] + asciidoc_opts + [
'-a', 'linkcss',
'-a', 'toc',
'-a', 'icons',
'-a', 'max-width=960px',
'-a', 'stylesheet=asciidoc-override.css',
'-o', '@OUTPUT@',
'@INPUT@',
],
input : input,
output : [htmlpage],
depend_files : [
asciidoc_conf,
'asciidoc-override.css',
] + page.get('extra_depends', []),
build_by_default : false,
install : false,
)
html_targets += [html]
html_files += [htmlpage]
endforeach
run_target('html',
command : ['/bin/true'],
depends : html_targets)
custom_target(
'website.tar.gz',
command : [
'bsdtar', 'czf', '@OUTPUT@',
'-C', meson.current_build_dir(),
] + html_files + [
'-C', meson.current_source_dir(),
'asciidoc-override.css',
'-C', '/etc/asciidoc/stylesheets/',
'asciidoc.css',
'-C', '/etc/asciidoc/javascripts/',
'asciidoc.js',
'-C', '/etc/asciidoc/',
'images',
],
output : ['website.tar.gz'],
build_by_default : false,
depends : html_targets,
)
meson.add_install_script(MESON_MAKE_SYMLINK,
'repo-add.8',
join_paths(MANDIR, 'man8/repo-remove.8'))
meson.add_install_script(MESON_MAKE_SYMLINK,
'alpm-hooks.5',
join_paths(MANDIR, 'man5/pacman-hooks.5'))
doxygen = find_program('doxygen', required : get_option('doxygen'))
if doxygen.found() and not get_option('doxygen').disabled()
doxyconf = configuration_data()
doxyconf.set('INPUT_DIRECTORY', meson.current_source_dir())
doxyconf.set('OUTPUT_DIRECTORY', meson.current_build_dir())
doxyfile = configure_file(
input : 'Doxyfile.in',
output : 'Doxyfile',
configuration : doxyconf,
install : false)
custom_target(
'doxygen',
input : doxyfile,
output : ['man3'],
command : [doxygen, doxyfile],
build_by_default : true,
install : true,
install_dir : MANDIR)
endif

View file

@ -1,67 +0,0 @@
pacman-conf(8)
==============
Name
----
pacman-conf - query pacman's configuration file
Synopsis
--------
'pacman-conf' [options] [<directive> ...]
'pacman-conf' (--repo-list|--help|--version)
Description
-----------
'pacman-conf' is a utility for parsing the 'pacman' configuration file
and returning script-friendly output. It is designed to properly handle
non-trivial configuration features such as variable interpolation and
the use of the Include directive, and guarantees that it will return the
same configuration values which 'pacman' itself would use.
'pacman-conf' will output the fully-resolved contents of the
configuration file by default, or, if provided with the name of a
configuration directive, output the contents of the given directive alone.
Options
-------
*-c, \--config* <path>::
Specify an alternate configuration file.
*-R, \--rootdir* <path>::
Specify an alternate installation root (default is `/`).
*-r, \--repo* <repository>::
Query options for a specific repository.
*-v, \--verbose*::
Always shown directive names.
*-l, \--repo-list*::
List configured repositories.
*-h, \--help*::
Output syntax and command line options.
*-V, \--version*::
Display version and exit.
Examples
--------
pacman-conf -r core Usage::
Show the value of the Usage configuration option for core repository.
pacman-conf HoldPkg::
Show the value of the HoldPkg configuration option.
See Also
--------
linkman:pacman.conf[5]
include::footer.asciidoc[]

View file

@ -1,36 +0,0 @@
pacman-db-upgrade(8)
====================
Name
----
pacman-db-upgrade - upgrade the local pacman database to a newer format
Synopsis
--------
'pacman-db-upgrade' [options]
Description
-----------
'pacman-db-upgrade' is a script that upgrades the local database used
by linkman:pacman[8] to a newer format.
Options
--------------
*-h, \--help*::
Show the built-in help message and exit.
*-V, \--version*::
Show version information and exit.
*-d, \--dbpath* <path>::
Set an alternate database location.
*-r, \--root* <path>::
Set an alternate installation root.
*\--config* <path>::
Set an alternate configuration file.
*\--nocolor*::
Remove color from output.
See Also
--------
linkman:pacman[8]
include::footer.asciidoc[]

View file

@ -1,151 +0,0 @@
pacman-key(8)
=============
Name
----
pacman-key - manage pacman's list of trusted keys
Synopsis
--------
'pacman-key' [options] operation [targets]
Description
-----------
'pacman-key' is a wrapper script for GnuPG used to manage pacman's keyring, which
is the collection of PGP keys used to check signed packages and databases. It
provides the ability to import and export keys, fetch keys from keyservers and
update the key trust database.
More complex keyring management can be achieved using GnuPG directly combined with
the '\--homedir' option pointing at the pacman keyring (located in
+{sysconfdir}/pacman.d/gnupg+ by default).
Invoking pacman-key consists of supplying an operation with any potential
options and targets to operate on. Depending on the operation, a 'target' may
be a valid key identifier, filename, or directory.
Operations
----------
*-a, \--add*::
Add the key(s) contained in the specified file or files to pacman's
keyring. If a key already exists, update it.
*-d, \--delete*::
Remove the key(s) identified by the specified keyid(s) from pacman's
keyring.
*-e, \--export*::
Export key(s) identified by the specified keyid(s) to 'stdout'. If no keyid
is specified, all keys will be exported.
*\--edit-key*::
Present a menu for key management task on the specified keyid(s). Useful
for adjusting a keys trust level.
*-f, \--finger*::
List a fingerprint for each specified keyid, or for all known keys if no
keyids are specified.
*-h, \--help*::
Output syntax and command line options.
*\--import*::
Imports keys from `pubring.gpg` into the public keyring from the specified
directories.
*\--import-trustdb*::
Imports ownertrust values from `trustdb.gpg` into the shared trust database
from the specified directories.
*\--init*::
Ensure the keyring is properly initialized and has the required access
permissions.
*-l, \--list-keys*::
Lists all or specified keys from the public keyring.
*\--list-sigs*::
Same as '\--list-keys', but the signatures are listed too.
*\--lsign-key*::
Locally sign the given key. This is primarily used to root the web of trust
in the local private key generated by '\--init'.
*\--nocolor*::
Disable colored output from pacman-key.
*-r, \--recv-keys*::
Equivalent to '\--recv-keys' in GnuPG.
*\--refresh-keys*::
Equivalent to '\--refresh-keys' in GnuPG.
*\--populate*::
Reload the default keys from the (optionally provided) keyrings in
+{keyringdir}+. For more information, see
<<PK,Providing a Keyring for Import>> below.
*-u, \--updatedb*::
Equivalent to '\--check-trustdb' in GnuPG. This operation can be specified with
other operations.
*-V, \--version*::
Displays the program version.
*-v, \--verify*::
Assume that the first argument is a signature and verify it. If a second
argument is provided, it is the file to be verified.
+
With only one argument given, assume that the signature is a detached
signature, and look for a matching data file to verify by stripping the file
extension. If no matching data file is found, fall back on GnuPG semantics and
attempt to verify a file with an embedded signature.
Options
-------
*\--config* <file>::
Use an alternate configuration file instead of the +{sysconfdir}/pacman.conf+
default.
*\--gpgdir* <dir>::
Set an alternate home directory for GnuPG. If unspecified, the value is
read from +{sysconfdir}/pacman.conf+.
*\--keyserver* <keyserver>::
Use the specified keyserver if the operation requires one. This will take
precedence over any keyserver option specified in a `gpg.conf`
configuration file. Running '\--init' with this option will set the default
keyserver if one was not already configured.
Providing a Keyring for Import[[PK]]
------------------------------------
A distribution or other repository provided may want to provide a set of
PGP keys used in the signing of its packages and repository databases that can
be readily imported into the pacman keyring. This is achieved by providing a
PGP keyring file `foo.gpg` that contains the keys for the foo keyring in the
directory +{keyringdir}+.
Optionally, the file `foo-trusted` can be provided containing a list of trusted
key IDs for that keyring. This is a file in a format compatible with 'gpg
\--export-ownertrust' output. This file will inform the user which keys a user
needs to verify and sign to build a local web of trust, in addition to
assigning provided owner trust values.
Also optionally, the file `foo-revoked` can be provided containing a list of
revoked key IDs for that keyring. Revoked is defined as "no longer valid for
any signing", so should be used with prudence. A key being marked as revoked
will be disabled in the keyring and no longer treated as valid, so this always
takes priority over it's trusted state in any other keyring.
See Also
--------
linkman:pacman[8], linkman:pacman.conf[5]
include::footer.asciidoc[]

View file

@ -1,583 +0,0 @@
pacman(8)
=========
Name
----
pacman - package manager utility
Synopsis
--------
'pacman' <operation> [options] [targets]
Description
-----------
Pacman is a package management utility that tracks installed packages on a Linux
system. It features dependency support, package groups, install and uninstall
scripts, and the ability to sync your local machine with a remote repository to
automatically upgrade packages. Pacman packages are a zipped tar format.
Since version 3.0.0, pacman has been the front-end to linkman:libalpm[3], the
``Arch Linux Package Management'' library. This library allows alternative
front-ends to be written (for instance, a GUI front-end).
Invoking pacman involves specifying an operation with any potential options and
targets to operate on. A 'target' is usually a package name, file name, URL, or
a search string. Targets can be provided as command line arguments.
Additionally, if stdin is not from a terminal and a single hyphen (-) is passed
as an argument, targets will be read from stdin.
Operations
----------
*-D, \--database*::
Operate on the package database. This operation allows you to modify
certain attributes of the installed packages in pacman's database. It
also allows you to check the databases for internal consistency.
See <<DO,Database Options>> below.
*-Q, \--query*::
Query the package database. This operation allows you to view installed
packages and their files, as well as meta-information about individual
packages (dependencies, conflicts, install date, build date, size). This
can be run against the local package database or can be used on
individual package files. In the first case, if no package names
are provided in the command line, all installed packages will be
queried. Additionally, various filters can be applied on the package
list. See <<QO,Query Options>> below.
*-R, \--remove*::
Remove package(s) from the system. Groups can also be specified to be
removed, in which case every package in that group will be removed.
Files belonging to the specified package will be deleted, and the
database will be updated. Most configuration files will be saved
with a '.pacsave' extension unless the '\--nosave' option is used.
See <<RO,Remove Options>> below.
*-S, \--sync*::
Synchronize packages. Packages are installed directly from the remote
repositories, including all dependencies required to run the packages. For
example, `pacman -S qt` will download and install qt and all the
packages it depends on. If a package name exists in more than one
repository, the repository can be explicitly specified to clarify the
package to install: `pacman -S testing/qt`. You can also specify version
requirements: `pacman -S "bash>=3.2"`. Quotes are needed, otherwise the
shell interprets ">" as redirection to a file.
+
In addition to packages, groups can be specified as well. For example, if
gnome is a defined package group, then `pacman -S gnome` will provide a
prompt allowing you to select which packages to install from a numbered list.
The package selection is specified using a space- and/or comma-separated list of
package numbers. Sequential packages may be selected by specifying the first
and last package numbers separated by a hyphen (`-`). Excluding packages is
achieved by prefixing a number or range of numbers with a caret (`^`).
+
Packages that provide other packages are also handled. For example, `pacman -S
foo` will first look for a foo package. If foo is not found, packages that
provide the same functionality as foo will be searched for. If any package is
found, it will be installed. A selection prompt is provided if multiple packages
providing foo are found.
+
You can also use `pacman -Su` to upgrade all packages that are out-of-date. See
<<SO,Sync Options>> below. When upgrading, pacman performs version comparison
to determine which packages need upgrading. This behavior operates as follows:
Alphanumeric:
1.0a < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0 < 1.0.a < 1.0.1
Numeric:
1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
+
Additionally, version strings can have an 'epoch' value defined that will
overrule any version comparison, unless the epoch values are equal. This is
specified in an `epoch:version-rel` format. For example, `2:1.0-1` is always
greater than `1:3.6-1`.
*-T, \--deptest*::
Check dependencies; this is useful in scripts such as makepkg to check
installed packages. This operation will check each dependency specified and
return a list of dependencies that are not currently satisfied on the system.
This operation accepts no other options. Example usage: `pacman -T qt
"bash>=3.2"`.
*-U, \--upgrade*::
Upgrade or add package(s) to the system and install the required
dependencies from sync repositories. Either a URL or file path can be
specified. This is a ``remove-then-add'' process. See <<UO,Upgrade
Options>> below; also see <<HCF,Handling Config Files>> for an explanation
on how pacman takes care of configuration files.
*-F, \--files*::
Query the files database. This operation allows you to look for packages
owning certain files or display files owned by certain packages. Only
packages that are part of your sync databases are searched. See
<<FO,File Options>> below.
*-V, \--version*::
Display version and exit.
*-h, \--help*::
Display syntax for the given operation. If no operation was supplied,
then the general syntax is shown.
Options
-------
*-b, \--dbpath* <path>::
Specify an alternative database location (the default is
+{localstatedir}/lib/pacman+). This should not be used unless you know what
you are doing.
*NOTE*: If specified, this is an absolute path, and the root path is
not automatically prepended.
*-r, \--root* <path>::
Specify an alternative installation root (default is +{rootdir}+). This should
not be used as a way to install software into `/usr/local` instead of
`/usr`.
*NOTE*: If database path or log file are not specified on either the
command line or in linkman:pacman.conf[5], their default location will
be inside this root path.
*NOTE*: This option is not suitable for performing operations on a mounted
guest system. See '\--sysroot' instead.
*-v, \--verbose*::
Output paths such as the Root, Conf File, DB Path, Cache Dirs, etc.
*\--arch* <arch>::
Specify an alternate architecture.
*\--cachedir* <dir>::
Specify an alternative package cache location (the default is
+{localstatedir}/cache/pacman/pkg+). Multiple cache directories can be
specified, and they are tried in the order they are passed to pacman.
*NOTE*: This is an absolute path, and the root path is not automatically
prepended. If DownloadUser is set in linkman:pacman.conf[5], then the
specified user must have permission to access the cache directory.
*\--color* <when>::
Specify when to enable coloring. Valid options are 'always', 'never', or
'auto'. 'always' forces colors on; 'never' forces colors off; and 'auto' only
automatically enables colors when outputting onto a tty.
*\--config* <file>::
Specify an alternate configuration file.
*\--debug*::
Display debug messages. When reporting bugs, this option is recommended
to be used.
*\--gpgdir* <dir>::
Specify a directory of files used by GnuPG to verify package signatures
(the default is +{sysconfdir}/pacman.d/gnupg+). This directory should contain
two files: `pubring.gpg` and `trustdb.gpg`. `pubring.gpg` holds the public keys
of all packagers. `trustdb.gpg` contains a so-called trust database, which
specifies that the keys are authentic and trusted. *NOTE*: This is an absolute
path, and the root path is not automatically prepended.
*\--hookdir* <dir>::
Specify a alternative directory containing hook files (the default is
+{sysconfdir}/pacman.d/hooks+). Multiple hook directories can be specified
with hooks in later directories taking precedence over hooks in earlier
directories. *NOTE*: This is an absolute path, and the root path is not
automatically prepended.
*\--logfile* <file>::
Specify an alternate log file. This is an absolute path, regardless of
the installation root setting.
*\--noconfirm*::
Bypass any and all ``Are you sure?'' messages. It's not a good idea to do
this unless you want to run pacman from a script.
*\--confirm*::
Cancels the effects of a previous '\--noconfirm'.
*\--disable-download-timeout*::
Disable defaults for low speed limit and timeout on downloads. Use this
if you have issues downloading files with proxy and/or security gateway.
*\--sysroot* <dir>:: Specify an alternative system root. This path will be
prepended to all other configuration directories and any repository servers
beginning with `file://`. Any paths or URLs passed as targets will not be
modified. This allows mounted guest systems to be properly operated on.
*\--disable-sandbox*::
Disable the default sandbox applied to the process downloading files on Linux
systems. Useful if experiencing landlock related failures while downloading
files when running a Linux kernel that does not support this feature.
Transaction Options (apply to '-S', '-R' and '-U')
--------------------------------------------------
*-d, \--nodeps*::
Skips dependency version checks. Package names are still checked. Normally,
pacman will always check a package's dependency fields to ensure that all
dependencies are installed and there are no package conflicts in the
system. Specify this option twice to skip all dependency checks.
*\--assume-installed* <package=version>::
Add a virtual package "package" with version "version" to the transaction
to satisfy dependencies. This allows disabling the specific dependency checks
without affecting all dependency checks. To disable all dependency
checking, see the '\--nodeps' option.
*\--dbonly*::
Adds/removes the database entry only, leaving all files in place.
*\--noprogressbar*::
Do not show a progress bar when downloading files. This can be useful
for scripts that call pacman and capture the output.
*\--noscriptlet*::
If an install scriptlet exists, do not execute it. Do not use this
unless you know what you are doing.
*-p, \--print*::
Only print the targets instead of performing the actual operation (sync,
remove or upgrade). Use '\--print-format' to specify how targets are
displayed. The default format string is "%l", which displays URLs with
'-S', file names with '-U', and pkgname-pkgver with '-R'.
*\--print-format* <format>::
Specify a printf-like format to control the output of the '\--print'
operation. The possible attributes are: "%a" for arch, "%b" for
builddate, "%d" for description, "%e" for pkgbase, "%f" for filename,
"%g" for base64 encoded PGP signature, "%h" for sha256sum, "%m" for
md5sum, "%n" for pkgname, "%p" for packager, "%v" for pkgver, "%l" for
location, "%r" for repository, "%s" for size, "%C" for checkdepends,
"%D" for depends, "%G" for groups, "%H" for conflicts, "%L" for
licenses, "%M" for makedepends, "%O" for optional depends, "%P" for
provides and "%R" for replaces.
Implies '\--print'.
Upgrade Options (apply to '-S' and '-U')[[UO]]
----------------------------------------------
*-w, \--downloadonly*::
Retrieve all packages from the server, but do not install/upgrade anything.
*\--asdeps*::
Install packages non-explicitly; in other words, fake their install reason
to be installed as a dependency. This is useful for makepkg and other
build-from-source tools that need to install dependencies before building
the package.
*\--asexplicit*::
Install packages explicitly; in other words, fake their install reason to
be explicitly installed. This is useful if you want to mark a dependency
as explicitly installed so it will not be removed by the '\--recursive'
remove operation.
*\--ignore* <package>::
Directs pacman to ignore upgrades of package even if there is one
available. Multiple packages can be specified by separating them
with a comma.
*\--ignoregroup* <group>::
Directs pacman to ignore upgrades of all packages in 'group', even if
there is one available. Multiple groups can be specified by
separating them with a comma.
*\--needed*::
Do not reinstall the targets that are already up-to-date.
*\--overwrite* <glob>::
Bypass file conflict checks and overwrite conflicting files. If the
package that is about to be installed contains files that are already
installed and match 'glob', this option will cause all those files to be
overwritten. Using '\--overwrite' will not allow overwriting a directory
with a file or installing packages with conflicting files and directories.
Multiple patterns can be specified by separating them with a comma. May be
specified multiple times. Patterns can be negated, such that files
matching them will not be overwritten, by prefixing them with an
exclamation mark. Subsequent matches will override previous ones. A leading
literal exclamation mark or backslash needs to be escaped.
Query Options (apply to '-Q')[[QO]]
-----------------------------------
*-c, \--changelog*::
View the ChangeLog of a package if it exists.
*-d, \--deps*::
Restrict or filter output to packages installed as dependencies. This
option can be combined with '-t' for listing real orphans - packages that
were installed as dependencies but are no longer required by any
installed package.
*-e, \--explicit*::
Restrict or filter output to explicitly installed packages. This option
can be combined with '-t' to list explicitly installed packages that
are not required by any other package.
*-g, \--groups*::
Display all packages that are members of a named group. If a name is not
specified, list all grouped packages.
*-i, \--info*::
Display information on a given package. The '-p' option can be used if
querying a package file instead of the local database. Passing two
'\--info' or '-i' flags will also display the list of backup files and
their modification states.
*-k, \--check*::
Check that all files owned by the given package(s) are present on the
system. If packages are not specified or filter flags are not provided,
check all installed packages. Specifying this option twice will perform
more detailed file checking (including permissions, file sizes, and
modification times) for packages that contain the needed mtree file.
*-l, \--list*::
List all files owned by a given package. Multiple packages can be
specified on the command line.
*-m, \--foreign*::
Restrict or filter output to packages that were not found in the sync
database(s). Typically these are packages that were downloaded manually
and installed with '\--upgrade'.
*-n, \--native*::
Restrict or filter output to packages that are found in the sync
database(s). This is the inverse filter of '\--foreign'.
*-o, \--owns* <file>::
Search for packages that own the specified file(s). The path can be
relative or absolute, and one or more files can be specified.
*-p, \--file*::
Signifies that the package supplied on the command line is a file and
not an entry in the database. The file will be decompressed and queried.
This is useful in combination with '\--info' and '\--list'.
*-q, \--quiet*::
Show less information for certain query operations. This is useful when
pacman's output is processed in a script. Search will only show package
names and not version, group, and description information; owns will
only show package names instead of "file is owned by pkg" messages; group
will only show package names and omit group names; list will only show
files and omit package names; check will only show pairs of package names
and missing files; a bare query will only show package names
rather than names and versions.
*-s, \--search* <regexp>::
Search each locally-installed package for names or descriptions that
match `regexp`. When including multiple search terms, only packages
with descriptions matching ALL of those terms are returned.
*-t, \--unrequired*::
Restrict or filter output to print only packages neither required nor
optionally required by any currently installed package. Specify this
option twice to include packages which are optionally, but not directly,
required by another package.
*-u, \--upgrades*::
Restrict or filter output to packages that are out-of-date on the local
system. Only package versions are used to find outdated packages;
replacements are not checked here. This option works best if the sync
database is refreshed using '-Sy'.
Remove Options (apply to '-R')[[RO]]
------------------------------------
*-c, \--cascade*::
Remove all target packages, as well as all packages that depend on one
or more target packages. This operation is recursive and must be used
with care, since it can remove many potentially needed packages.
*-n, \--nosave*::
Instructs pacman to ignore file backup designations. Normally, when a
file is removed from the system, the database is checked to see if the
file should be renamed with a '.pacsave' extension.
*-s, \--recursive*::
Remove each target specified including all of their dependencies, provided
that (A) they are not required by other packages; and (B) they were not
explicitly installed by the user. This operation is recursive and analogous
to a backwards '\--sync' operation, and it helps keep a clean system without
orphans. If you want to omit condition (B), pass this option twice.
*-u, \--unneeded*::
Removes targets that are not required by any other packages.
This is mostly useful when removing a group without using the '-c' option,
to avoid breaking any dependencies.
Sync Options (apply to '-S')[[SO]]
----------------------------------
*-c, \--clean*::
Remove packages that are no longer installed from the cache as well as
currently unused sync databases to free up disk space. When pacman
downloads packages, it saves them in a cache directory. In addition,
databases are saved for every sync DB you download from and are not
deleted even if they are removed from the configuration file
linkman:pacman.conf[5]. Use one '\--clean' switch to only remove
packages that are no longer installed; use two to remove all files
from the cache. In both cases, you will have a yes or no option to
remove packages and/or unused downloaded databases.
+
If you use a network shared cache, see the 'CleanMethod' option in
linkman:pacman.conf[5].
*-g, \--groups*::
Display all the members for each package group specified. If no group
names are provided, all groups will be listed; pass the flag twice to
view all groups and their members.
*-i, \--info*::
Display information on a given sync database package. Passing two '\--info'
or '-i' flags will also display those packages in all repositories that
depend on this package.
*-l, \--list*::
List all packages in the specified repositories. Multiple repositories
can be specified on the command line.
*-q, \--quiet*::
Show less information for certain sync operations. This is useful when
pacman's output is processed in a script. Search will only show package
names and not repository, version, group, and description information; list
will only show package names and omit databases and versions; group will
only show package names and omit group names.
*-s, \--search* <regexp>::
This will search each package in the sync databases for names or
descriptions that match `regexp`. When you include multiple search
terms, only packages with descriptions matching ALL of those terms will
be returned.
*-u, \--sysupgrade*::
Upgrades all packages that are out-of-date. Each currently-installed
package will be examined and upgraded if a newer package exists. A
report of all packages to upgrade will be presented, and the operation
will not proceed without user confirmation. Dependencies are
automatically resolved at this level and will be installed/upgraded if
necessary.
+
Pass this option twice to enable package downgrades; in this case, pacman will
select sync packages whose versions do not match with the local versions. This
can be useful when the user switches from a testing repository to a stable one.
+
Additional targets can also be specified manually, so that '-Su foo' will do a
system upgrade and install/upgrade the "foo" package in the same operation.
*-y, \--refresh*::
Download a fresh copy of the master package databases '(repo.db)' from the
server(s) defined in linkman:pacman.conf[5]. This should typically be used
each time you use '\--sysupgrade' or '-u'. Passing two '\--refresh' or '-y'
flags will force a refresh of all package databases, even if they appear to
be up-to-date.
Database Options (apply to '-D')[[QO]]
--------------------------------------
*\--asdeps* <package>::
Mark a package as non-explicitly installed; in other words, set their install
reason to be installed as a dependency.
*\--asexplicit* <package>::
Mark a package as explicitly installed; in other words, set their install
reason to be explicitly installed. This is useful if you want to keep a
package installed even when it was initially installed as a dependency
of another package.
*-k, \--check*::
Check the local package database is internally consistent. This will
check all required files are present and that installed packages have
the required dependencies, do not conflict and that multiple packages
do not own the same file. Specifying this option twice will perform
a check on the sync databases to ensure all specified dependencies
are available.
*-q, \--quiet*::
Suppress messages on successful completion of database operations.
File Options (apply to '-F')[[FO]]
----------------------------------
*-y, --refresh*::
Download fresh package file databases '(repo.files)' from the server.
Use twice to force a refresh even if databases are up to date.
*-l, \--list*::
List the files owned by the queried package.
*-x, --regex*::
Interpret each query as a regular expression.
*-q, \--quiet*::
Show less information for certain file operations. This is useful when
pacman's output is processed in a script, however, you may want to use
'--machinereadable' instead.
*--machinereadable*::
Print each match in a machine readable output format. The format is
'repository\0pkgname\0pkgver\0path\n' with '\0' being the NULL character
and '\n' a linefeed.
Handling Config Files[[HCF]]
----------------------------
Pacman uses the same logic as 'rpm' to determine action against files that are
designated to be backed up. During an upgrade, three MD5 hashes are used for
each backup file to determine the required action: one for the original file
installed, one for the new file that is about to be installed, and one for the
actual file existing on the file system. After comparing these three hashes, the
following scenarios can result:
original=X, current=X, new=X::
All three files are the same, so overwrites are not an issue. Install the
new file.
original=X, current=X, new=Y::
The current file is the same as the original, but the new one differs.
Since the user did not ever modify the file, and the new one may contain
improvements or bug fixes, install the new file.
original=X, current=Y, new=X::
Both package versions contain the exact same file, but the one on the
file system has been modified. Leave the current file in place.
original=X, current=Y, new=Y::
The new file is identical to the current file. Install the new file.
original=X, current=Y, new=Z::
All three files are different, so install the new file with a '.pacnew'
extension and warn the user. The user must then manually merge any
necessary changes into the original file.
original=NULL, current=Y, new=Z::
The package was not previously installed, and the file already exists on the
file system. Install the new file with a '.pacnew' extension and warn the
user. The user must then manually merge any necessary changes into the
original file.
Examples
--------
pacman -Ss ne.hack::
Search for regexp "ne.hack" in package database.
pacman -S gpm::
Download and install gpm including dependencies.
pacman -U /home/user/ceofhack-0.6-1-x86_64.pkg.tar.gz::
Install ceofhack-0.6-1 package from a local file.
pacman -Syu::
Update package list and upgrade all packages afterwards.
pacman -Syu gpm::
Update package list, upgrade all packages, and then install gpm if it
wasn't already installed.
Configuration
-------------
See linkman:pacman.conf[5] for more details on configuring pacman using the
'pacman.conf' file.
See Also
--------
linkman:alpm-hooks[5], linkman:libalpm[3], linkman:makepkg[8],
linkman:pacman.conf[5]
include::footer.asciidoc[]

365
doc/pacman.8.txt Normal file
View file

@ -0,0 +1,365 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
pacman(8)
=========
Name
----
pacman - package manager utility
Synopsis
--------
'pacman' <operation> [options] [packages]
Description
-----------
Pacman is a package management utility that tracks installed packages on a Linux
system. It features dependency support, package groups, install and uninstall
hooks, and the ability to sync your local machine with a remote ftp server to
automatically upgrade packages. Pacman packages are a zipped tar format.
Since version 3.0.0, pacman has been the frontend to linkman:libalpm[3], the
"Arch Linux Package Management" library. This library allows alternative front
ends to be written (for instance, a GUI front end).
Operations
----------
*-Q, \--query*::
Query the package database. This operation allows you to view installed
packages and their files, as well as meta-information about individual
packages (dependencies, conflicts, install date, build date, size). This
can be run against the local package database or can be used on
individual '.tar.gz' packages. See <<QO,Query Options>> below.
*-R, \--remove*::
Remove a package from the system. Groups can also be specified to be
removed, in which case every package in that group will be removed.
Files belonging to the specified package will be deleted, and the
database will be updated. Most configuration files will be saved
with a `.pacsave` extension unless the '\--nosave' option is used.
See <<RO,Remove Options>> below.
*-S, \--sync*::
Synchronize packages. Packages are installed directly from the ftp
servers, including all dependencies required to run the packages. For
example, `pacman -S qt` will download and install qt and all the
packages it depends on. If a package name exists in more than one repo, the
repo can be explicitly specified to clarify the package to install:
`pacman -S testing/qt`. You can also specify version requirements:
`pacman -S "bash>=3.2"`. (Quotes are needed, otherwise your shell
interprets ">" as redirection to file.)
+
In addition to packages, groups can be specified as well. For example, if
gnome is a defined package group, then `pacman -S gnome` will install every
package in the gnome group, as well as the dependencies of those packages.
+
Packages which provide other packages are also handled. For example, `pacman -S
foo` will first look for a foo package. If foo is not found, packages which
provide the same functionality as foo will be searched for. If any package is
found, it will be installed.
+
You can also use `pacman -Su` to upgrade all packages that are out of date. See
<<SO,Sync Options>> below. When upgrading, pacman performs version comparison
to determine which packages need upgrading. This behavior operates as follows:
Alphanumeric:
1.0a < 1.0alpha < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0
Numeric:
1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
*-U, \--upgrade*::
Upgrade or add a package to the system. Either a URL or file path can be
specified. This is a "remove-then-add" process. See <<HCF,Handling Config
Files>> for an explanation on how pacman takes care of config files.
*-V, \--version*::
Display version and exit.
*-h, \--help*::
Display syntax for the given operation. If no operation was supplied
then the general syntax is shown.
Options
-------
*\--asdeps*::
Install packages non-explicitly; in other words, fake their install reason
to be installed as a dependency. This is useful for makepkg and other
build from source tools that need to install dependencies before building
the package.
*\--asexplicit*::
Install packages explicitly; in other words, fake their install reason to
be explicitly installed. This is useful if you want to mark a dependency
as explicitly installed so it will not be removed by the '\--recursive'
remove operation.
*-b, \--dbpath* <'path'>::
Specify an alternative database location (a typical default is
``/var/lib/pacman''). This should not be used unless you know what you are
doing. *NOTE*: if specified, this is an absolute path and the root path is
not automatically prepended.
*-d, \--nodeps*::
Skips all dependency checks. Normally, pacman will always check a
package's dependency fields to ensure that all dependencies are
installed and there are no package conflicts in the system.
*-f, \--force*::
Bypass file conflict checks and overwrite conflicting files. If the
package that is about to be installed contains files that are already
installed, this option will cause all those files to be overwritten.
This option should be used with care, ideally not at all.
*-r, \--root* <'path'>::
Specify an alternative installation root (default is ``/''). This should
not be used as a way to install software into ``/usr/local'' instead of
``/usr''. This option is used if you want to install a package on a
temporary mounted partition which is "owned" by another system.
*NOTE*: if database path or logfile are not specified on either the
command line or in linkman:pacman.conf[5], their default location will
be inside this root path.
*-v, --verbose*::
Output paths such as as the Root, Conf File, DB Path, Cache Dirs, etc.
*\--cachedir* <'dir'>::
Specify an alternative package cache location (a typical default is
``/var/cache/pacman/pkg''). Multiple cache directories can be specified,
and they are tried in the order they are passed to pacman. *NOTE*: this
is an absolute path, the root path is not automatically prepended.
*\--config* <'file'>::
Specify an alternate configuration file.
*\--logfile* <'file'>::
Specify an alternate log file. This is an absolute path, regardless of
the installation root setting.
*\--noconfirm*::
Bypass any and all "Are you sure?" messages. It's not a good idea to do
this unless you want to run pacman from a script.
*\--noprogressbar*::
Do not show a progress bar when downloading files. This can be useful
for scripts that call pacman and capture the output.
*\--noscriptlet*::
If an install scriptlet exists, do not execute it. Do not use this
unless you know what you are doing.
Query Options[[QO]]
-------------------
*-c, \--changelog*::
View the ChangeLog of a package. Not every package will provide one but
it will be shown if available.
*-d, \--deps*::
List all packages installed as dependencies. This option can be combined
with '-t' for listing real orphans- packages that were installed as
dependencies but are no longer required by any installed package. ('-Qdt'
is equivalent to the pacman 3.0.X '-Qe' option.)
*-e, \--explicit*::
List all packages explicitly installed. This option can be combined with
'-t' to list top-level packages- those packages that were explicitly
installed but are not required by any other package. ('-Qet' is equivalent
to the pacman 2.9.X '-Qe' option.)
*-g, \--groups*::
Display all packages that are members of a named group. If a name is not
specified, list all grouped packages.
*-i, \--info*::
Display information on a given package. The '-p' option can be used if
querying a package file instead of the local database. Passing two
'\--info' or '-i' flags will also display the list of backup files and
their modification states.
*-l, \--list*::
List all files owned by a given package. Multiple packages can be
specified on the command line.
*-m, \--foreign*::
Restrict or filter output to packages that were not found in the sync
database(s). Typically these are packages that were downloaded manually
and installed with '\--upgrade'.
*-o, \--owns* <'file'>::
Search for the package that owns file. The path can be relative or
absolute.
*-p, \--file*::
Signifies that the package supplied on the command line is a file and
not an entry in the database. The file will be decompressed and queried.
This is useful in combination with '\--info' and '\--list'.
*-q, \--quiet*::
Show less information for certain query operations. Search will only show
package names and not version, group, and description information; a bare
query will only show package names rather than names and versions.
*-s, \--search* <'regexp'>::
This will search each locally-installed package for names or
descriptions that match `regexp`.
*-t, \--unrequired*::
Restrict or filter output to packages not required by any currently
installed package.
*-u, \--upgrades*::
Lists all packages that are out of date on the local system. This option
works best if the sync database is refreshed using '-Sy'.
Remove Options[[RO]]
--------------------
*-c, \--cascade*::
Remove all target packages, as well as all packages that depend on one
or more target packages. This operation is recursive, and must be used
with care since it can remove many potentially needed packages.
*-k, \--keep*::
Removes the database entry only. Leaves all files in place.
*-n, \--nosave*::
Instructs pacman to ignore file backup designations. Normally, when a
file is removed from the system the database is checked to see if the
file should be renamed with a ``.pacsave'' extension.
*-s, \--recursive*::
Remove each target specified including all of their dependencies, provided
that (A) they are not required by other packages; and (B) they were not
explicitly installed by the user. This operation is recursive and analogous
to a backwards '\--sync' operation, and helps keep a clean system without
orphans. If you want to omit condition (B), pass this option twice.
*-u, \--unneeded*::
Removes the targets that are not required by any other packages.
This is mostly useful when removing a group without using the '-c' option,
to avoid breaking any dependencies.
Sync Options[[SO]]
------------------
*-c, \--clean*::
Remove packages that are no longer installed from the cache as well as
currently unused sync databases to free up disk space. When pacman
downloads packages, it saves them in a cache directory. In addition,
databases are saved for every sync DB you download from, and are not
deleted even if they are removed from the configuration file
linkman:pacman.conf[5]. Use one '\--clean' switch to only remove
packages that are no longer installed; use two to remove all packages
from the cache. In both cases, you will have a yes or no option to
remove packages and/or unused downloaded databases.
+
If you use a network shared cache, see the 'CleanMethod' option in
linkman:pacman.conf[5].
*-g, \--groups*::
Display all the members for each package group specified. If no group
names are provided, all groups will be listed; pass the flag twice to
view all groups and their members.
*-i, \--info*::
Display dependency and other information for a given package. This will
search through all repositories for a matching package.
*-l, \--list*::
List all packages in the specified repositories. Multiple repositories
can be specified on the command line.
*-p, \--print-uris*::
Print out URIs for each package that will be installed, including any
dependencies yet to be installed. These can be piped to a file and
downloaded at a later time, using a program like wget.
*-q, \--quiet*::
Show less information for certain sync operations. Search will only show
package names and not version, group, and description information; list
will only show package names and omit databases and versions.
*-s, \--search* <'regexp'>::
This will search each package in the sync databases for names or
descriptions that match `regexp`.
*-u, \--sysupgrade*::
Upgrades all packages that are out of date. Each currently-installed
package will be examined and upgraded if a newer package exists. A
report of all packages to upgrade will be presented and the operation
will not proceed without user confirmation. Dependencies are
automatically resolved at this level and will be installed/upgraded if
necessary.
*-w, \--downloadonly*::
Retrieve all packages from the server, but do not install/upgrade
anything.
*-y, \--refresh*::
Download a fresh copy of the master package list from the server(s)
defined in linkman:pacman.conf[5]. This should typically be used each time
you use '\--sysupgrade' or '-u'. Passing two '\--refresh' or '-y' flags
will force a refresh of all package lists even if they are thought to be up
to date.
*\--needed*::
Don't reinstall the targets that are already up-to-date.
*\--ignore* <'package'>::
Directs pacman to ignore upgrades of package even if there is one
available. Multiple packages can be specified by separating them
with a comma.
*\--ignoregroup* <'group'>::
Directs pacman to ignore upgrades of all packages in 'group' even if
there is one available. Multiple groups can be specified by
separating them with a comma.
Handling Config Files[[HCF]]
----------------------------
Pacman uses the same logic as rpm to determine action against files that are
designated to be backed up. During an upgrade, 3 md5 hashes are used for each
backup file to determine the required action: one for the original file
installed, one for the new file that's about to be installed, and one for the
actual file existing on the filesystem. After comparing these 3 hashes, the
follow scenarios can result:
original=X, current=X, new=X::
All three files are the same, so overwrites are not an issue Install the
new file.
original=X, current=X, new=Y::
The current file is the same as the original but the new one differs.
Since the user did not ever modify the file, and the new one may contain
improvements or bugfixes, install the new file.
original=X, current=Y, new=X::
Both package versions contain the exact same file, but the one on the
filesystem has been modified. Leave the current file in place.
original=X, current=Y, new=Y::
The new file is identical to the current file. Install the new file.
original=X, current=Y, new=Z::
All three files are different, so install the new file with a '.pacnew'
extension and warn the user. The user must then manually merge any
necessary changes into the original file.
Configuration
-------------
See linkman:pacman.conf[5] for more details on configuring pacman using the
'pacman.conf' file.
See Also
--------
linkman:pacman.conf[5], linkman:makepkg[8], linkman:libalpm[3]
include::footer.txt[]

View file

@ -1,382 +0,0 @@
pacman.conf(5)
==============
Name
----
pacman.conf - pacman package manager configuration file
Synopsis
--------
{sysconfdir}/pacman.conf
Description
-----------
Pacman, using linkman:libalpm[3], will attempt to read pacman.conf each time it
is invoked. This configuration file is divided into sections or repositories.
Each section defines a package repository that pacman can use when searching
for packages in '\--sync' mode. The exception to this is the options section,
which defines global options.
Comments are only supported by beginning a line with the hash (#) symbol.
Comments cannot begin in the middle of a line.
Example
-------
--------
#
# pacman.conf
#
[options]
NoUpgrade = etc/passwd etc/group etc/shadow
NoUpgrade = etc/fstab
[core]
Include = /etc/pacman.d/core
[custom]
Server = file:///home/pkgs
--------
NOTE: Each directive must be in CamelCase. If the case isn't respected, the
directive won't be recognized. For example. noupgrade or NOUPGRADE will not
work.
Options
-------
*RootDir =* /path/to/root/dir::
Set the default root directory for pacman to install to. This option is
used if you want to install a package on a temporary mounted partition
which is "owned" by another system, or for a chroot install.
*NOTE*: If database path or log file are not specified on either the
command line or in linkman:pacman.conf[5], their default location will
be inside this root path.
*DBPath =* /path/to/db/dir::
Overrides the default location of the toplevel database directory. The
default is +{localstatedir}/lib/pacman/+. Most users will not need to set
this option. *NOTE*: if specified, this is an absolute path and the root
path is not automatically prepended.
*CacheDir =* /path/to/cache/dir::
Overrides the default location of the package cache directory. The
default is +{localstatedir}/cache/pacman/pkg/+. Multiple cache directories can be
specified, and they are tried in the order they are listed in the config
file. If a file is not found in any cache directory, it will be downloaded
to the first cache directory with write access. *NOTE*: this is an absolute
path, the root path is not automatically prepended.
*HookDir =* /path/to/hook/dir::
Add directories to search for alpm hooks in addition to the system hook
directory (+{datarootdir}/libalpm/hooks/+). The default is
+{sysconfdir}/pacman.d/hooks+. Multiple directories can be specified with
hooks in later directories taking precedence over hooks in earlier
directories. *NOTE*: this is an absolute path, the root path is not
automatically prepended. For more information on the alpm hooks, see
linkman:alpm-hooks[5].
*GPGDir =* /path/to/gpg/dir::
Overrides the default location of the directory containing configuration
files for GnuPG. The default is +{sysconfdir}/pacman.d/gnupg/+.
This directory should contain two files: `pubring.gpg` and `trustdb.gpg`.
`pubring.gpg` holds the public keys of all packagers. `trustdb.gpg`
contains a so-called trust database, which specifies that the keys are
authentic and trusted.
*NOTE*: this is an absolute path, the root path is not automatically
prepended.
*LogFile =* /path/to/log/file::
Overrides the default location of the pacman log file. The default
is +{localstatedir}/log/pacman.log+. This is an absolute path and the root directory
is not prepended.
*HoldPkg =* package ...::
If a user tries to '\--remove' a package that's listed in `HoldPkg`,
pacman will ask for confirmation before proceeding. Shell-style glob
patterns are allowed.
*IgnorePkg =* package ...::
Instructs pacman to ignore any upgrades for this package when performing
a '\--sysupgrade'. Shell-style glob patterns are allowed.
*IgnoreGroup =* group ...::
Instructs pacman to ignore any upgrades for all packages in this
group when performing a '\--sysupgrade'. Shell-style glob patterns are
allowed.
*Include =* /path/to/config/file::
Include another configuration file. This file can include repositories or
general configuration options. Wildcards in the specified paths will get
expanded based on linkman:glob[7] rules.
*Architecture =* auto &| i686 &| x86_64 | ...::
If set, pacman will only allow installation of packages with the given
architectures (e.g. 'i686', 'x86_64', etc). The special value 'auto' will
use the system architecture, provided via ``uname -m''. If unset, no
architecture checks are made. *NOTE*: Packages with the special
architecture 'any' can always be installed, as they are meant to be
architecture independent.
*XferCommand =* /path/to/command %u [%o]::
If set, an external program will be used to download all remote files.
All instances of `%u` will be replaced with the download URL. If present,
instances of `%o` will be replaced with the local filename, plus a
``.part'' extension, which allows programs like wget to do file resumes
properly.
+
This option is useful for users who experience problems with built-in
HTTP/FTP support, or need the more advanced proxy support that comes with
utilities like wget.
*NoUpgrade =* file ...::
All files listed with a `NoUpgrade` directive will never be touched during
a package install/upgrade, and the new files will be installed with a
'.pacnew' extension.
These files refer to files in the package archive, so do not include the
leading slash (the RootDir) when specifying them. Shell-style glob patterns
are allowed. It is possible to invert matches by prepending a file with
an exclamation mark. Inverted files will result in previously blacklisted
files being whitelisted again. Subsequent matches will override previous
ones. A leading literal exclamation mark or backslash needs to be escaped.
*NoExtract =* file ...::
All files listed with a `NoExtract` directive will never be extracted from
a package into the filesystem. This can be useful when you don't want part
of a package to be installed. For example, if your httpd root uses an
'index.php', then you would not want the 'index.html' file to be extracted
from the 'apache' package.
These files refer to files in the package archive, so do not include the
leading slash (the RootDir) when specifying them. Shell-style glob patterns
are allowed. It is possible to invert matches by prepending a file with
an exclamation mark. Inverted files will result in previously blacklisted
files being whitelisted again. Subsequent matches will override previous
ones. A leading literal exclamation mark or backslash needs to be escaped.
*CleanMethod =* KeepInstalled &| KeepCurrent::
If set to `KeepInstalled` (the default), the '-Sc' operation will clean
packages that are no longer installed (not present in the local database).
If set to `KeepCurrent`, '-Sc' will clean outdated packages (not present in
any sync database).
The second behavior is useful when the package cache is shared among
multiple machines, where the local databases are usually different, but the
sync databases in use could be the same. If both values are specified,
packages are only cleaned if not installed locally and not present in any
known sync database.
*SigLevel =* ...::
Set the default signature verification level. For more information, see
<<SC,Package and Database Signature Checking>> below.
*LocalFileSigLevel =* ...::
Set the signature verification level for installing packages using the "-U"
operation on a local file. Uses the value from SigLevel as the default.
*RemoteFileSigLevel =* ...::
Set the signature verification level for installing packages using the "-U"
operation on a remote file URL. Uses the value from SigLevel as the default.
*UseSyslog*::
Log action messages through syslog(). This will insert log entries into
+{localstatedir}/log/messages+ or equivalent.
*Color*::
Automatically enable colors only when pacman's output is on a tty.
*NoProgressBar*::
Disables progress bars. This is useful for terminals which do
not support escape characters.
*CheckSpace*::
Performs an approximate check for adequate available disk space before
installing packages.
*VerbosePkgLists*::
Displays name, version and size of target packages formatted
as a table for upgrade, sync and remove operations.
*DisableDownloadTimeout*::
Disable defaults for low speed limit and timeout on downloads. Use this
if you have issues downloading files with proxy and/or security gateway.
*ParallelDownloads =* ...::
Specifies number of concurrent download streams. The value needs to be a
positive integer. If this config option is not set then only one download
stream is used (i.e. downloads happen sequentially).
*DownloadUser =* username::
Specifies the user to switch to for downloading files. If this config
option is not set then the downloads are done as the user running pacman.
*DisableSandbox*::
Disable the default sandbox applied to the process downloading files on Linux
systems. Useful if experiencing landlock related failures while downloading
files when running a Linux kernel that does not support this feature.
Repository Sections
-------------------
Each repository section defines a section name and at least one location where
the packages can be found. The section name is defined by the string within
square brackets (the two above are 'core' and 'custom'). Repository names
must be unique and the name 'local' is reserved for the database of installed
packages. Locations are defined with the 'Server' directive and follow a URL
naming structure. If you want to use a local directory, you can specify the
full path with a ``file://'' prefix, as shown above.
A common way to define DB locations utilizes the 'Include' directive. For each
repository defined in the configuration file, a single 'Include' directive can
contain a file that lists the servers for that repository.
--------
[core]
# use this server first
Server = ftp://ftp.archlinux.org/$repo/os/$arch
# next use servers as defined in the mirrorlist below
Include = /etc/pacman.d/mirrorlist
--------
The order of repositories in the configuration files matters; repositories
listed first will take precedence over those listed later in the file when
packages in two repositories have identical names, regardless of version
number.
*Include =* path::
Include another config file. This file can include repositories or
general configuration options. Wildcards in the specified paths will get
expanded based on linkman:glob[7] rules.
*CacheServer =* url::
A full URL to a location where the packages, and signatures (if
available) for this repository can be found. Cache servers will be tried
before any non-cache servers, will not be removed from the server pool for
404 download errors, and will not be used for database files.
*Server =* url::
A full URL to a location where the database, packages, and signatures (if
available) for this repository can be found.
+
During parsing, pacman will define the `$repo` variable to the name of the
current section. This is often utilized in files specified using the 'Include'
directive so all repositories can use the same mirrorfile. pacman also defines
the `$arch` variable to the first (or only) value of the `Architecture` option,
so the same mirrorfile can even be used for different architectures.
*SigLevel =* ...::
Set the signature verification level for this repository. For more
information, see <<SC,Package and Database Signature Checking>> below.
*Usage =* ...::
Set the usage level for this repository. This option takes a list of tokens
which must be at least one of the following:
*Sync*;;
Enables refreshes for this repository.
*Search*;;
Enables searching for this repository.
*Install*;;
Enables installation of packages from this repository during a '\--sync'
operation.
*Upgrade*;;
Allows this repository to be a valid source of packages when performing
a '\--sysupgrade'.
*All*;;
Enables all of the above features for the repository. This is the default
if not specified.
+
Note that an enabled repository can be operated on explicitly, regardless of the Usage
level set.
Package and Database Signature Checking[[SC]]
---------------------------------------------
The 'SigLevel' directive is valid in both the `[options]` and repository
sections. If used in `[options]`, it sets a default value for any repository
that does not provide the setting.
* If set to *Never*, no signature checking will take place.
* If set to *Optional* , signatures will be checked when present, but unsigned
databases and packages will also be accepted.
* If set to *Required*, signatures will be required on all packages and
databases.
Alternatively, you can get more fine-grained control by combining some of
the options and prefixes described below. All options in a config file are
processed in top-to-bottom, left-to-right fashion, where later options override
and/or supplement earlier ones. If 'SigLevel' is specified in a repository
section, the starting value is that from the `[options]` section, or the
built-in system default as shown below if not specified.
The options are split into two main groups, described below. Terms used such as
``marginally trusted'' are terms used by GnuPG, for more information please
consult linkman:gpg[1].
When to Check::
These options control if and when signature checks should take place.
*Never*;;
All signature checking is suppressed, even if signatures are present.
*Optional* (default);;
Signatures are checked if present; absence of a signature is not an
error. An invalid signature is a fatal error, as is a signature from a
key not in the keyring.
*Required*;;
Signatures are required; absence of a signature or an invalid signature
is a fatal error, as is a signature from a key not in the keyring.
What is Allowed::
These options control what signatures are viewed as permissible. Note that
neither of these options allows acceptance of invalid or expired
signatures, or those from revoked keys.
*TrustedOnly* (default);;
If a signature is checked, it must be in the keyring and fully trusted;
marginal trust does not meet this criteria.
*TrustAll*;;
If a signature is checked, it must be in the keyring, but is not
required to be assigned a trust level (e.g., unknown or marginal
trust).
Options in both groups can additionally be prefixed with either *Package* or
*Database*, which will cause it to only take effect on the specified object
type. For example, `PackageTrustAll` would allow marginal and unknown trust
level signatures for packages.
The built-in default is the following:
--------
SigLevel = Optional TrustedOnly
--------
Using Your Own Repository
-------------------------
If you have numerous custom packages of your own, it is often easier to generate
your own custom local repository than install them all with the '\--upgrade'
option. All you need to do is generate a compressed package database in the
directory with these packages so pacman can find it when run with '\--refresh'.
repo-add /home/pkgs/custom.db.tar.gz /home/pkgs/*.pkg.tar.gz
The above command will generate a compressed database named
'/home/pkgs/custom.db.tar.gz'. Note that the database must be of the form
'\{treename\}.db.tar.{ext}', where '\{treename\}' is the name of the section
defined in the configuration file and '\{ext\}' is a valid compression type as
documented in linkman:repo-add[8]. That's it! Now configure your custom section
in the configuration file as shown in the config example above. Pacman will now
use your package repository. If you add new packages to the repository,
remember to re-generate the database and use pacman's '\--refresh' option.
For more information on the repo-add command, see ``repo-add \--help'' or
linkman:repo-add[8].
See Also
--------
linkman:pacman[8], linkman:libalpm[3]
include::footer.asciidoc[]

213
doc/pacman.conf.5.txt Normal file
View file

@ -0,0 +1,213 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
pacman.conf(5)
==============
Name
----
pacman.conf - pacman package manager configuration file
Synopsis
--------
{sysconfdir}/pacman.conf
Description
-----------
Pacman, using linkman:libalpm[3], will attempt to read pacman.conf each time it
is invoked. This configuration file is divided into sections or repositories.
Each section defines a package repository that pacman can use when searching
for packages in '\--sync' mode. The exception to this is the options section,
which defines global options.
Example
-------
--------
#
# pacman.conf
#
[options]
NoUpgrade = etc/passwd etc/group etc/shadow
NoUpgrade = etc/fstab
[core]
Include = /etc/pacman.d/core
[custom]
Server = file:///home/pkgs
--------
NOTE: Each directive must be in CamelCase. If the case isn't respected, the
directive won't be recognized. For example. noupgrade or NOUPGRADE will not
work.
Options
-------
*RootDir =* path/to/root::
Set the default root directory for pacman to install to. This option is
used if you want to install a package on a temporary mounted partition
which is "owned" by another system, or for a chroot install.
*NOTE*: If database path or logfile are not specified on either the
command line or in linkman:pacman.conf[5], their default location will
be inside this root path.
*DBPath =* path/to/db/dir::
Overrides the default location of the toplevel database directory. A
typical default is ``/var/lib/pacman/''. Most users will not need to set
this option. *NOTE*: if specified, this is an absolute path and the root
path is not automatically prepended.
*CacheDir =* path/to/cache/dir::
Overrides the default location of the package cache directory. A typical
default is ``/var/cache/pacman/pkg/''. Multiple cache directories can be
specified, and they are tried in the order they are listed in the config
file. If a file is not found in any cache directory, it will be downloaded
to the first cache directory with write access. *NOTE*: this is an absolute
path, the root path is not automatically prepended.
*LogFile =* '/path/to/file'::
Overrides the default location of the pacman log file. A typical default
is ``/var/log/pacman.log''. This is an absolute path and the root directory
is not prepended.
*HoldPkg =* package ...::
If a user tries to '\--remove' a package that's listed in `HoldPkg`,
pacman will ask for confirmation before proceeding.
*IgnorePkg =* package ...::
Instructs pacman to ignore any upgrades for this package when performing
a '\--sysupgrade'.
*SyncFirst =* package ...::
Instructs pacman to check for newer version of these packages before any
sync operation. The user will have the choice to either cancel the current
operation and upgrade these packages first or go on with the current operation.
This option is typically used with the 'pacman' package.
*IgnoreGroup =* group ...::
Instructs pacman to ignore any upgrades for all packages in this
group when performing a '\--sysupgrade'.
*Include =* path::
Include another config file. This file can include repositories or
general configuration options.
*XferCommand =* /path/to/command %u::
If set, an external program will be used to download all remote files.
All instances of `%u` will be replaced with the download URL. If present,
instances of `%o` will be replaced with the local filename, plus a
``.part'' extension, which allows programs like wget to do file resumes
properly.
+
This option is useful for users who experience problems with built-in
http/ftp support, or need the more advanced proxy support that comes with
utilities like wget.
*NoPassiveFtp*::
Disables passive ftp connections when downloading packages. (aka Active Mode)
*NoUpgrade =* file ...::
All files listed with a `NoUpgrade` directive will never be touched during
a package install/upgrade.
These files refer to files in the package archive, so do not include the
leading slash (the RootDir) when specifying them.
*NoExtract =* file ...::
All files listed with a `NoExtract` directive will never be extracted from
a package into the filesystem. This can be useful when you don't want part
of a package to be installed. For example, if your httpd root uses an
'index.php', then you would not want the 'index.html' file to be extracted
from the 'apache' package.
These files refer to files in the package archive, so do not include the
leading slash (the RootDir) when specifying them.
*CleanMethod =* KeepInstalled | KeepCurrent::
If set to `KeepInstalled` (the default), the '-Sc' operation will clean
packages that are no longer installed (not present in the local database).
If set to `KeepCurrent`, '-Sc' will clean outdated packages (not present in
any sync database).
The second behavior is useful when the package cache is shared among
multiple machines, where the local databases are usually different, but the
sync databases in use could be the same.
*UseSyslog*::
Log action messages through syslog(). This will insert log entries into
``/var/log/messages'' or equivalent.
*ShowSize*::
Display the size of individual packages for '\--sync' and '\--query' modes.
*UseDelta*::
Download delta files instead of complete packages if possible. Requires
the xdelta program to be installed.
*TotalDownload*::
When downloading, display the amount downloaded, download rate, ETA,
and completed percentage of the entire download list rather
than the percent of each individual download target. The progress
bar is still based solely on the current file download.
Repository Sections
-------------------
Each repository section defines a section name and at least one location where
the packages can be found. The section name is defined by the string within
square brackets (the two above are 'current' and 'custom'). Locations are
defined with the 'Server' directive and follow a URL naming structure. If you
want to use a local directory, you can specify the full path with a ``file://''
prefix, as shown above.
A common way to define DB locations utilizes the 'Include' directive. For each
repository defined in the configuration file, a single 'Include' directive can
contain a file that lists the servers for that repository.
--------
[core]
# use this repository first
Server = ftp://ftp.archlinux.org/core/os/arch
# next use servers as defined in the mirrorlist below
Include = /etc/pacman.d/mirrorlist
--------
During parsing, pacman will define the `$repo` variable to the name of the
current section. This is often utilized in files specified using the 'Include'
directive so all repositories can use the same mirrorfile.
--------
Server = ftp://ftp.archlinux.org/$repo/os/arch
--------
The order of repositories in the configuration files matters; repositories
listed first will take precedence over those listed later in the file when
packages in two repositories have identical names, regardless of version
number.
Using Your Own Repository
-------------------------
If you have numerous custom packages of your own, it is often easier to generate
your own custom local repository than install them all with the '\--upgrade'
option. All you need to do is generate a compressed package database in the
directory with these packages so pacman can find it when run with '\--refresh'.
repo-add /home/pkgs/custom.db.tar.gz /home/pkgs/*.pkg.tar.gz
The above command will generate a compressed database named
'/home/pkgs/custom.db.tar.gz'. Note that the database must be of the form
'{treename}.db.tar.gz', where '{treename}' is the name of the section defined in
the configuration file. That's it! Now configure your custom section in the
configuration file as shown in the config example above. Pacman will now use your
package repository. If you add new packages to the repository, remember to
re-generate the database and use pacman's '\--refresh' option.
For more information on the repo-add command, see ``repo-add \--help'' or
linkman:repo-add[8].
See Also
--------
linkman:pacman[8], linkman:libalpm[3]
include::footer.txt[]

View file

@ -1,95 +0,0 @@
repo-add(8)
==========
Name
----
repo-add - package database maintenance utility
Synopsis
--------
'repo-add' [options] <path-to-db> <package> [<package> ...]
'repo-remove' [options] <path-to-db> <packagename> [<packagename> ...]
Description
-----------
'repo-add' and 'repo-remove' are two scripts to help build a package database for
packages built with linkman:makepkg[8] and installed with linkman:pacman[8].
'repo-add' will update a package database by reading a built package file.
Multiple packages to add can be specified on the command line.
If a matching ``.sig'' file is found alongside a package file, the signature
will automatically be embedded into the database.
'repo-remove' will update a package database by removing the package name
specified on the command line. Multiple packages to remove can be specified
on the command line.
A package database is a tar file, optionally compressed. Valid extensions are
``.db'' followed by an archive extension of ``.tar'', ``.tar.bz2'',
``.tar.gz'', ``.tar.lrz'', ``.tar.lz'', ``.tar.lz4'', ``.tar.lzo'',
``.tar.xz'', ``.tar.zst'' or ``.tar.Z''. The file does not need to exist, but
all parent directories must exist.
Common Options
--------------
*-q, \--quiet*::
Force this program to keep quiet and run silently except for warning and
error messages.
*-s, \--sign*::
Generate a PGP signature file using GnuPG. This will execute `gpg
--detach-sign` on the generated database to generate a detached
signature file, using the GPG agent if it is available. The signature file
will be the entire filename of the database with a ``.sig'' extension.
*-k, \--key* <key>::
Specify a key to use when signing packages. Can also be specified using
the GPGKEY environment variable. If not specified in either location, the
default key from the keyring will be used.
*-v, \--verify*::
Verify the PGP signature of the database before updating the database.
If the signature is invalid, an error is produced and the update does not
proceed.
*\--nocolor*::
Remove color from 'repo-add' and 'repo-remove' output.
*-R, \--remove*::
Remove old package files from the disk when updating or removing their
entry in the database.
*-w, \--wait-for-lock*::
Wait for the lock file to be acquired. If unset, command will fail with
exit code 2 if acquiring the lock fails. If set, it will retry to acquire
lock until success.
repo-add Options
----------------
*-n, \--new*::
Only add packages that are not already in the database. Warnings will be
printed upon detection of existing packages, but they will not be re-added.
*\--include-sigs*::
Include package PGP signatures in the repository database (if available)
Example
-------
'repo-add' foo.db.tar.xz <pkg1> [<pkg2> ...]
This creates two separate databases; a smaller database ``foo.db.tar.xz'' used by
pacman and a large database containing package file lists ``foo.files.tar.xz'' for
use by other utilities. While pacman can use the large database (if renamed with a
db.tar* extension), there is currently no additional benefit for the larger download.
See Also
--------
linkman:makepkg[8], linkman:pacman[8]
include::footer.asciidoc[]

48
doc/repo-add.8.txt Normal file
View file

@ -0,0 +1,48 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
repo-add(8)
==========
Name
----
////
* If we use this below line, the manpage name comes out all weird. We also
* can't use two separate lines, which is quite annoying. *
repo-add, repo-remove - package database maintenance utilities
////
repo-add - package database maintenance utility
Synopsis
--------
repo-add [-q] <path-to-db> <package1> [<package2> ...]
repo-remove [-q] <path-to-db> <packagename> [<packagename2> ...]
Description
-----------
repo-add and repo-remove are two scripts to help build a package database for
packages built with linkman:makepkg[8] and installed with linkman:pacman[8].
repo-add will update a package database by reading a built package file.
Multiple packages to add can be specified on the command line.
repo-remove will update a package database by removing the package name
specified on the command line. Multiple packages to remove can be specified
on the command line.
Options
-------
*-q, \--quiet*::
Force this program to keep quiet and run silent except for warning and
error messages.
See Also
--------
linkman:makepkg[8], linkman:pacman[8]
include::footer.txt[]

View file

@ -1,20 +0,0 @@
testpkg(8)
==========
Name
----
testpkg - test a pacman package for validity
Synopsis
--------
'testpkg' <package file>
Description
-----------
'testpkg' is a script used to make sure that a pacman package is valid.
See Also
--------
linkman:pacman[8]
include::footer.asciidoc[]

View file

@ -1,159 +0,0 @@
Pacman - Translating
====================
This document is here to guide you in helping translate pacman messages,
libalpm messages, and the manual pages for the entire pacman package.
We are currently using https://app.transifex.com/[Transifex] as the translation
platform for pacman and libalpm. You will need to sign up for an account there
and then register with a translation team on the
https://explore.transifex.com/toofishes/archlinux-pacman/[pacman project page].
NOTE: This may be old information due to our switch to Transifex, but the
gettext website is a very useful guide to read before embarking on translation
work, as it describes many of the commands in more detail than I will here:
https://www.gnu.org/software/gettext/manual/html_node/gettext.html[].
Translating Messages
--------------------
Overview
~~~~~~~~
There are two separate message catalogs in pacman: one for the back-end
(libalpm) and one for the front-end (pacman and scripts). These correspond to
the `lib/libalpm/po` and `po` directories in the pacman source, respectively.
Translation message files are a specially formatted text file containing the
original message and the corresponding translation. These po files can then
either be hand-edited, or modified with a tool such as poedit, gtranslator or
kbabel. Using a translation tool tends to make the job easier.
Please read up on Transifex usage using the
https://help.transifex.com/[Transifex Help] if you are not familiar.
Transifex provides a command-line client to help with translations. Here is
an example set of commands if you have a source code checkout and are not
worried about any local translations being overwritten. The .tx/ directory is
checked into the git repository so is preconfigured with the two project
resources (See `tx status` output for a quick overview).
tx pull -f
poedit po/<mylang>.po
poedit lib/libalpm/po/<mylang>.po
tx push -t -l <mylang>
Or to just push one of the two available resources:
tx push -r archlinux-pacman.pacman-pot -t -l <mylang>
tx push -r archlinux-pacman.libalpm-pot -t -l <mylang>
See the <<Notes,Notes>> section for additional hints on translating.
Pre-release Updates
~~~~~~~~~~~~~~~~~~~
A week or two before each release, the codebase will go into a string freeze
and an email will be sent to the mailto:pacman-dev@lists.archlinux.org[pacman-dev]
mailing list asking for translations. An announcement in Transifex is also made,
which reaches everyone that is member of the translation team.
At this time, the latest `.po` language files will be made available at the
Transifex project page. Each language will have three files available (libalpm,
pacman and pacman-scripts). Translators interested in helping are encouraged to use the
features of Transifex to let others know they are currently translating their
language.
Once a translator has completed the translation offline (*OR* realizes they do not have
time to finish), please upload your progress back to the Transifex site.
NOTE: Please upload your translations as soon as possible - this will give other
speakers of your language time to review your translations and update them as
necessary.
Incremental Updates
~~~~~~~~~~~~~~~~~~~
If you have more advanced needs you will have to get a copy of the pacman
repository.
git clone https://gitlab.archlinux.org/pacman/pacman.git
Next, you will need to configure the build environment. From the base directory,
run:
meson setup . build
If any required dependencies are missing, please install. After that,
update the template translation (.pot) files to the latest state of
the source code by running:
meson compile -C build pacman-scripts-pot pacman-pot libalpm-pot
We need to first update the main message catalog file. Navigate into either
the `lib/libalpm/po`, `scripts/po` or `src/pacman/po` directory depending
on which translation you wish to work on first, and execute the following
command to update your specific language's translation file
(replace `lang_code` with your language code e.g. 'pt_BR', and `pot_file`
with `libalpm.pot`, `pacman.pot` or `pacman-scripts.pot`):
msgmerge --update --previous <lang_code>.po <pot_filename>.pot
At this point, you can do the translation. To submit your changes, either email
the new `.po` file to the mailing-list with *[translation]* in the subject, or
submit a Git-formatted patch (please do not include any `.pot` file changes).
As a shortcut, all translation files (including `.pot` files) can be updated
with the following command:
./build-aux/update-po
Adding a New Language
~~~~~~~~~~~~~~~~~~~~~
Making a new language is not too hard, but be sure to follow all the steps.
You will have to do the following steps in both the `lib/libalpm/po/` and `po/`
directories, substituting where appropriate. First, edit the `LINGUAS` file and
add your new language code at the bottom. Next, run the following command,
substituting `libalpm.pot` or `pacman.pot` for potfile depending on which
directory you are currently working in:
msginit -l <lang_code> -o <lang_code>.po -i <potfile>
You can then also add your language code to the end of the `LINGUAS` file
located in each po directory.
Look at the current message files for more guidance if necessary. Once you
create the new language file, you may need to slightly modify the headers;
try to make them look similar to the other .po file headers. In addition, for
all new translations we would strongly recommend using UTF-8 encoding.
Notes[[Notes]]
~~~~~~~~~~~~~~
msgid and msgstr 'variables' can be on as many lines as necessary. Line breaks
are ignored; if you need a literal line break, use an `\n` in your string. The
following two translations are equivalent:
msgstr "This is a test translation"
msgstr ""
"This is a test translation"
If you want to test the translation (copy the .po file you want to test,
you may ignore the rest), replacing `<lang_code>` accordingly:
meson compile -C build pacman-scripts-gmo pacman-gmo libalpm-gmo
cp ./build/lib/libalpm/po/<lang_code>/LC_MESSAGES/libalpm.mo /usr/share/locale/<lang_code>/LC_MESSAGES/libalpm.mo
cp ./build/scripts/po/<lang_code>/LC_MESSAGES/pacman-scripts.mo /usr/share/locale/<lang_code>/LC_MESSAGES/pacman-scripts.mo
cp ./build/src/pacman/po/<lang_code>/LC_MESSAGES/pacman.mo /usr/share/locale/<lang_code>/LC_MESSAGES/pacman.mo
Translating Manpages
--------------------
There are currently no efforts underway to include translated manual pages in
the pacman codebase. However, this is not to say translations are unwelcome. If
someone has experience with i18n man pages and how to best include them with our
source, please contact the pacman-dev mailing list at
mailto:pacman-dev@lists.archlinux.org[].

View file

@ -1,72 +0,0 @@
vercmp(8)
=========
Name
----
vercmp - version comparison utility
Synopsis
--------
'vercmp' [-h] [--help] <version1> <version2>
Description
-----------
'vercmp' is used to determine the relationship between two given version
numbers. It outputs values as follows:
* < 0 : if ver1 < ver2
* = 0 : if ver1 == ver2
* > 0 : if ver1 > ver2
Version comparison operates as follows:
Alphanumeric:
1.0a < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0 < 1.0.a < 1.0.1
Numeric:
1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
Additionally, version strings can have an 'epoch' value defined that will
overrule any version comparison, unless the epoch values are equal. This is
specified in an `epoch:version-rel` format. For example, `2:1.0-1` is always
greater than `1:3.6-1`.
Keep in mind that the 'pkgrel' is only compared if it is available on both
versions given to this tool. For example, comparing `1.5-1` and `1.5` will
yield 0; comparing `1.5-1` and `1.5-2` will yield < 0 as expected. This is
mainly for supporting versioned dependencies that do not include the 'pkgrel'.
Options
-------
*-h, \--help*::
Display summary of the available return codes. Must be the first option
specified.
Examples
--------
$ vercmp 1 2
-1
$ vercmp 2 1
1
$ vercmp 2.0-1 1.7-6
1
$ vercmp 2.0 2.0-13
0
$ vercmp 4.34 1:001
-1
See Also
--------
linkman:pacman[8], linkman:makepkg[8], linkman:libalpm[3]
include::footer.asciidoc[]

30
etc/Makefile.am Normal file
View file

@ -0,0 +1,30 @@
dist_sysconf_DATA = makepkg.conf pacman.conf
EXTRA_DIST = makepkg.conf.in pacman.conf.in
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = $(dist_sysconf_DATA)
#### Taken from the autoconf scripts Makefile.am ####
edit = sed \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
-e 's|@prefix[@]|$(prefix)|g' \
-e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
-e 's|@PKGEXT[@]|$(PKGEXT)|g' \
-e 's|@SRCEXT[@]|$(SRCEXT)|g' \
-e 's|@CARCH[@]|$(CARCH)|g' \
-e 's|@CHOST[@]|$(CHOST)|g' \
-e 's|@ARCHSWITCH[@]|$(ARCHSWITCH)|g' \
-e 's|@CARCHFLAGS[@]|$(CARCHFLAGS)|g' \
-e 's|@ROOTDIR[@]|$(ROOTDIR)|g'
$(dist_sysconf_DATA): Makefile
rm -f $@ $@.tmp
$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
mv $@.tmp $@
makepkg.conf: $(srcdir)/makepkg.conf.in
pacman.conf: $(srcdir)/pacman.conf.in
# vim:set ts=2 sw=2 noet:

View file

@ -1,18 +0,0 @@
#!/hint/bash
#
# @sysconfdir@/makepkg.conf.d/fortran.conf
#
#########################################################################
# FORTRAN LANGUAGE SUPPORT
#########################################################################
# Flags used for the Fortran compiler, similar in spirit to CFLAGS. Read
# linkman:gfortran[1] for more details on the available flags.
#FFLAGS="-O2 -pipe"
#FCFLAGS="$FFLAGS"
# Additional compiler flags appended to `FFLAGS` and `FCFLAGS` for use in debugging. Usually
# this would include: ``-g''. Read linkman:gfortran[1] for more details on the wide
# variety of compiler flags available.
#DEBUG_FFLAGS="-g"

View file

@ -1,17 +0,0 @@
#!/hint/bash
#
# @sysconfdir@/makepkg.conf.d/rust.conf
#
#########################################################################
# RUST LANGUAGE SUPPORT
#########################################################################
# Flags used for the Rust compiler, similar in spirit to CFLAGS. Read
# linkman:rustc[1] for more details on the available flags.
#RUSTFLAGS="-C opt-level=3"
# Additional compiler flags appended to `RUSTFLAGS` for use in debugging.
# Usually this would include: ``-C debuginfo=2''. Read linkman:rustc[1] for
# more details on the available flags.
#DEBUG_RUSTFLAGS="-C debuginfo=2"

View file

@ -1,4 +1,3 @@
#!/hint/bash
#
# @sysconfdir@/makepkg.conf
#
@ -9,25 +8,16 @@
#
#-- The download utilities that makepkg should use to acquire sources
# Format: 'protocol::agent'
DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
'ftp::/usr/bin/curl -qgfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
'http::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'https::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'rsync::/usr/bin/rsync --no-motd -z %u %o'
DLAGENTS=('ftp::/usr/bin/wget -c --passive-ftp -t 3 --waitretry=3 -O %o %u'
'http::/usr/bin/wget -c -t 3 --waitretry=3 -O %o %u'
'https::/usr/bin/wget -c -t 3 --waitretry=3 --no-check-certificate -O %o %u'
'rsync::/usr/bin/rsync -z %u %o'
'scp::/usr/bin/scp -C %u %o')
# Other common tools:
# /usr/bin/snarf
# /usr/bin/lftpget -c
# /usr/bin/wget
#-- The package required by makepkg to download VCS sources
# Format: 'protocol::package'
VCSCLIENTS=('bzr::breezy'
'fossil::fossil'
'git::git'
'hg::mercurial'
'svn::subversion')
# /usr/bin/curl
#########################################################################
# ARCHITECTURE, COMPILE FLAGS
@ -36,82 +26,55 @@ VCSCLIENTS=('bzr::breezy'
CARCH="@CARCH@"
CHOST="@CHOST@"
#NPROC=2
#-- Compiler and Linker Flags
#CPPFLAGS=""
#CFLAGS="-O2 -pipe"
#CXXFLAGS="-O2 -pipe"
#LDFLAGS=""
#LTOFLAGS="-flto"
#-- Exclusive: will only run on @CARCHFLAGS@
# -march (or -mcpu) builds exclusively for an architecture
# -mtune optimizes for an architecture, but builds for whole processor family
CFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
CXXFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"
#-- Debugging flags
#DEBUG_CFLAGS="-g"
#DEBUG_CXXFLAGS="-g"
#########################################################################
# BUILD ENVIRONMENT
#########################################################################
#
# Makepkg defaults: BUILDENV=(!distcc !color !ccache check !sign)
# Defaults: BUILDENV=(fakeroot !distcc color !ccache !xdelta)
# A negated environment option will do the opposite of the comments below.
#
#-- fakeroot: Allow building packages as a non-root user
#-- distcc: Use the Distributed C/C++/ObjC compiler
#-- color: Colorize output messages
#-- ccache: Use ccache to cache compilation
#-- check: Run the check() function if present in the PKGBUILD
#-- sign: Generate PGP signature file
#-- xdelta: Generate delta patch from previous to current package
#
BUILDENV=(!distcc color !ccache check !sign)
BUILDENV=(fakeroot !distcc color !ccache !xdelta)
#
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
#-- specify a space-delimited list of hosts running in the DistCC cluster.
#DISTCC_HOSTS=""
#
#-- Specify a directory for package building.
#BUILDDIR=/tmp/makepkg
#########################################################################
# GLOBAL PACKAGE OPTIONS
# These are default values for the options=() settings
#########################################################################
#
# Makepkg defaults:
# OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto !autodeps)
# Default: OPTIONS=(strip docs libtool emptydirs zipman)
# A negated option will do the opposite of the comments below.
#
#-- strip: Strip symbols from binaries/libraries
#-- docs: Save doc directories specified by DOC_DIRS
#-- libtool: Leave libtool (.la) files in packages
#-- staticlibs: Leave static library (.a) files in packages
#-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
#-- purge: Remove files specified by PURGE_TARGETS
#-- debug: Add debugging flags as specified in DEBUG_* variables
#-- lto: Add compile flags for building with link time optimization
#-- autodeps: Automatically add depends/provides
#-- strip: Strip symbols from binaries/libraries
#-- docs: Save doc and info directories
#-- libtool: Leave libtool (.la) files in packages
#-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manpages with gzip
#
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug !lto !autodeps)
OPTIONS=(strip docs libtool emptydirs zipman)
#-- File integrity checks to use. Valid: ck, md5, sha1, sha224, sha256, sha384, sha512, b2
INTEGRITY_CHECK=(ck)
#-- Options to be used when stripping binaries. See `man strip' for details.
STRIP_BINARIES="@STRIP_BINARIES@"
#-- Options to be used when stripping shared libraries. See `man strip' for details.
STRIP_SHARED="@STRIP_SHARED@"
#-- Options to be used when stripping static libraries. See `man strip' for details.
STRIP_STATIC="@STRIP_STATIC@"
#-- Manual (man and info) directories to compress (if zipman is specified)
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
#-- Doc directories to remove (if !docs is specified)
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
#-- Files to be removed from all packages (if purge is specified)
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
#-- Directory to store source code in for debug packages
DBGSRCDIR="/usr/src/debug"
#-- Prefix and directories for library autodeps
LIB_DIRS=('lib:usr/lib' 'lib32:usr/lib32')
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
INTEGRITY_CHECK=(md5)
#-- Info and doc directories to remove (if option set correctly above)
DOC_DIRS=(usr/{,share/}{info,doc,gtk-doc} opt/*/{info,doc,gtk-doc})
#-- Directories to be searched for the strip option (if option set correctly above)
STRIP_DIRS=(bin lib sbin usr/{bin,lib,sbin,local/{bin,lib,sbin}} opt/*/{bin,lib,sbin})
#########################################################################
# PACKAGE OUTPUT
@ -123,39 +86,20 @@ LIB_DIRS=('lib:usr/lib' 'lib32:usr/lib32')
#PKGDEST=/home/packages
#-- Source cache: specify a fixed directory where source files will be cached
#SRCDEST=/home/sources
#-- Source packages: specify a fixed directory where all src packages will be placed
#SRCPKGDEST=/home/srcpackages
#-- Log files: specify a fixed directory where all log files will be placed
#LOGDEST=/home/makepkglogs
#-- Packager: name/email of the person or organization building packages
#PACKAGER="John Doe <john@doe.com>"
#-- Specify a key to use for package signing
#GPGKEY=""
#########################################################################
# COMPRESSION DEFAULTS
# BUILDSCRIPT/EXTENSION DEFAULTS
#########################################################################
#
COMPRESSGZ=(gzip -c -f -n)
COMPRESSBZ2=(bzip2 -c -f)
COMPRESSXZ=(xz -c -z -)
COMPRESSZST=(zstd -c -z -q -)
COMPRESSLRZ=(lrzip -q)
COMPRESSLZO=(lzop -q)
COMPRESSZ=(compress -c -f)
COMPRESSLZ4=(lz4 -q)
COMPRESSLZ=(lzip -c -f)
#########################################################################
# EXTENSION DEFAULTS
#########################################################################
# WARNING: Do NOT modify these variables unless you know what you are
# doing.
#
BUILDSCRIPT='PKGBUILD'
PKGEXT='@PKGEXT@'
SRCEXT='@SRCEXT@'
DB_COMPRESSION='gz'
DB_CHECKSUMS=(md5)
#########################################################################
# OTHER
#########################################################################
#
#-- Command used to run pacman as root, instead of trying sudo and su
PACMAN_AUTH=()
# vim: set ft=sh ts=2 sw=2 et:

View file

@ -13,13 +13,12 @@
#DBPath = @localstatedir@/lib/pacman/
#CacheDir = @localstatedir@/cache/pacman/pkg/
#LogFile = @localstatedir@/log/pacman.log
#GPGDir = @sysconfdir@/pacman.d/gnupg/
#HookDir = @sysconfdir@/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
# If upgrades are available for these packages they will be asked for first
SyncFirst = pacman
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#XferCommand = /usr/bin/curl %u > %o
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
@ -28,20 +27,12 @@ Architecture = auto
#NoUpgrade =
#NoExtract =
# Misc options
# Misc options (all disabled by default)
#NoPassiveFtp
#UseSyslog
#Color
#NoProgressBar
CheckSpace
#VerbosePkgLists
ParallelDownloads = 5
#DownloadUser = alpm
#DisableSandbox
# PGP signature checking
#SigLevel = Optional
#LocalFileSigLevel = Optional
#RemoteFileSigLevel = Optional
#ShowSize
#UseDelta
#TotalDownload
#
# REPOSITORIES
@ -51,7 +42,6 @@ ParallelDownloads = 5
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
@ -67,13 +57,12 @@ ParallelDownloads = 5
# servers immediately after the header and they will be used before the
# default mirrors.
#[core]
#SigLevel = Required
#Server = ftp://ftp.example.com/foobar/$repo/os/$arch/
#Server = ftp://ftp.example.com/foobar/$repo/os/i686/
# The file referenced here should contain a list of 'Server = ' lines.
#Include = @sysconfdir@/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/packages
#Server = file:///home/custompkgs

507
install-sh Executable file
View file

@ -0,0 +1,507 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2006-10-14.15
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
posix_glob=
posix_mkdir=
# Desired mode of installed file.
mode=0755
chmodcmd=$chmodprog
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
shift
shift
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
done
if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix=/ ;;
-*) prefix=./ ;;
*) prefix= ;;
esac
case $posix_glob in
'')
if (set -f) 2>/dev/null; then
posix_glob=true
else
posix_glob=false
fi ;;
esac
oIFS=$IFS
IFS=/
$posix_glob && set -f
set fnord $dstdir
shift
$posix_glob && set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dst"; then
$doit $rmcmd -f "$dst" 2>/dev/null \
|| { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
&& { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
|| {
echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
} || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -2,4 +2,3 @@
.libs
*.lo
*.la
libalpm.pc

51
lib/libalpm/Makefile.am Normal file
View file

@ -0,0 +1,51 @@
AUTOMAKE_OPTIONS = gnu
SUBDIRS = po
lib_LTLIBRARIES = libalpm.la
include_HEADERS = alpm_list.h alpm.h
DEFS = -DLOCALEDIR=\"@localedir@\" @DEFS@
AM_CFLAGS = -pedantic -D_GNU_SOURCE
if ENABLE_VISIBILITY_CC
if DARWIN
AM_CFLAGS += -fvisibility=hidden
else
AM_CFLAGS += -fvisibility=internal
endif
endif
if ENABLE_GNU89_INLINE_CC
AM_CFLAGS += -fgnu89-inline
endif
libalpm_la_SOURCES = \
add.h add.c \
alpm.h alpm.c \
alpm_list.h alpm_list.c \
backup.h backup.c \
be_files.c \
be_package.c \
cache.h cache.c \
conflict.h conflict.c \
db.h db.c \
delta.h delta.c \
deps.h deps.c \
dload.h dload.c \
error.c \
graph.h \
group.h group.c \
handle.h handle.c \
log.h log.c \
md5.h md5.c \
package.h package.c \
remove.h remove.c \
sync.h sync.c \
trans.h trans.c \
util.h util.c
libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO)
libalpm_la_LIBADD = $(LTLIBINTL)
# vim:set ts=2 sw=2 noet:

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,7 @@
/*
* add.h
*
* Copyright (c) 2006-2025 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,13 +16,17 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ALPM_ADD_H
#define ALPM_ADD_H
#ifndef _ALPM_ADD_H
#define _ALPM_ADD_H
#include "db.h"
#include "alpm_list.h"
#include "trans.h"
int _alpm_upgrade_packages(alpm_handle_t *handle);
int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name);
int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data);
int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db);
#endif /* ALPM_ADD_H */
#endif /* _ALPM_ADD_H */
/* vim: set ts=2 sw=2 noet: */

View file

@ -1,8 +1,7 @@
/*
* alpm.c
*
* Copyright (c) 2006-2025 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
@ -21,115 +20,69 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_LIBCURL
#include <curl/curl.h>
#endif
#include <errno.h>
#include <pwd.h>
#include "config.h"
/* libalpm */
#include "alpm.h"
#include "alpm_list.h"
#include "handle.h"
#include "log.h"
#include "util.h"
alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
alpm_errno_t *err)
/* Globals */
enum _pmerrno_t pm_errno SYMEXPORT;
/** \addtogroup alpm_interface Interface Functions
* @brief Functions to initialize and release libalpm
* @{
*/
/** Initializes the library. This must be called before any other
* functions are called.
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
int SYMEXPORT alpm_initialize(void)
{
alpm_errno_t myerr;
const char *lf = "db.lck";
char *hookdir;
size_t hookdirlen, lockfilelen;
struct passwd const *pw = NULL;
alpm_handle_t *myhandle = _alpm_handle_new();
ASSERT(handle == NULL, RET_ERR(PM_ERR_HANDLE_NOT_NULL, -1));
if(myhandle == NULL) {
goto nomem;
}
if((myerr = _alpm_set_directory_option(root, &(myhandle->root), 1))) {
goto cleanup;
}
if((myerr = _alpm_set_directory_option(dbpath, &(myhandle->dbpath), 1))) {
goto cleanup;
handle = _alpm_handle_new();
if(handle == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
}
/* to concatenate myhandle->root (ends with a slash) with SYSHOOKDIR (starts
* with a slash) correctly, we skip SYSHOOKDIR[0]; the regular +1 therefore
* disappears from the allocation */
hookdirlen = strlen(myhandle->root) + strlen(SYSHOOKDIR);
MALLOC(hookdir, hookdirlen, goto nomem);
snprintf(hookdir, hookdirlen, "%s%s", myhandle->root, &SYSHOOKDIR[1]);
myhandle->hookdirs = alpm_list_add(NULL, hookdir);
/* set default database extension */
STRDUP(myhandle->dbext, ".db", goto nomem);
lockfilelen = strlen(myhandle->dbpath) + strlen(lf) + 1;
MALLOC(myhandle->lockfile, lockfilelen, goto nomem);
snprintf(myhandle->lockfile, lockfilelen, "%s%s", myhandle->dbpath, lf);
if(_alpm_db_register_local(myhandle) == NULL) {
myerr = myhandle->pm_errno;
goto cleanup;
}
#ifdef HAVE_LIBCURL
curl_global_init(CURL_GLOBAL_ALL);
myhandle->curlm = curl_multi_init();
#endif
myhandle->parallel_downloads = 1;
/* set default sandboxuser */
ASSERT((pw = getpwuid(0)) != NULL, myerr = errno; goto cleanup);
STRDUP(myhandle->sandboxuser, pw->pw_name, goto nomem);
#ifdef ENABLE_NLS
bindtextdomain("libalpm", LOCALEDIR);
#endif
return myhandle;
return(0);
}
nomem:
myerr = ALPM_ERR_MEMORY;
cleanup:
_alpm_handle_free(myhandle);
if(err) {
*err = myerr;
/** Release the library. This should be the last alpm call you make.
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
int SYMEXPORT alpm_release(void)
{
ALPM_LOG_FUNC;
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
if(alpm_db_unregister_all() == -1) {
return(-1);
}
return NULL;
_alpm_handle_free(handle);
return(0);
}
/* check current state and free all resources including storage locks */
int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
{
CHECK_HANDLE(myhandle, return -1);
ASSERT(myhandle->trans == NULL, RET_ERR(myhandle, ALPM_ERR_TRANS_NOT_NULL, -1));
/** @} */
_alpm_handle_unlock(myhandle);
_alpm_handle_free(myhandle);
/** @defgroup alpm_misc Miscellaneous Functions
* @brief Various libalpm functions
*/
return 0;
/* Get the version of library */
const char SYMEXPORT *alpm_version(void) {
return(LIB_VERSION);
}
const char SYMEXPORT *alpm_version(void)
{
return LIB_VERSION;
}
int SYMEXPORT alpm_capabilities(void)
{
return 0
#ifdef ENABLE_NLS
| ALPM_CAPABILITY_NLS
#endif
#ifdef HAVE_LIBCURL
| ALPM_CAPABILITY_DOWNLOADER
#endif
#ifdef HAVE_LIBGPGME
| ALPM_CAPABILITY_SIGNATURES
#endif
| 0;
}
/* vim: set ts=2 sw=2 noet: */

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,7 @@
/*
* alpm_list.c
*
* Copyright (c) 2006-2025 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2002-2008 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,19 +19,32 @@
#include <stdlib.h>
#include <string.h>
/* Note: alpm_list.{c,h} are intended to be standalone files. Do not include
* any other libalpm headers.
*/
#include <stdio.h>
/* libalpm */
#include "alpm_list.h"
/* check exported library symbols with: nm -C -D <lib> */
#define SYMEXPORT __attribute__((visibility("default")))
#define SYMHIDDEN __attribute__((visibility("internal")))
/**
* @addtogroup alpm_list List Functions
* @brief Functions to manipulate alpm_list_t lists.
*
* These functions are designed to create, destroy, and modify lists of
* type alpm_list_t. This is an internal list type used by libalpm that is
* publicly exposed for use by frontends if desired.
*
* @{ */
/* Allocation */
/**
* @brief Free a list, but not the contained data.
*
* @param list the list to free
*/
void SYMEXPORT alpm_list_free(alpm_list_t *list)
{
alpm_list_t *it = list;
@ -44,77 +56,80 @@ void SYMEXPORT alpm_list_free(alpm_list_t *list)
}
}
/**
* @brief Free the internal data of a list structure.
*
* @param list the list to free
* @param fn a free function for the internal data
*/
void SYMEXPORT alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn)
{
alpm_list_t *it = list;
if(fn) {
while(it) {
if(it->data) {
fn(it->data);
}
it = it->next;
while(it) {
if(fn && it->data) {
fn(it->data);
}
it = it->next;
}
}
/* Mutators */
/**
* @brief Add a new item to the end of the list.
*
* @param list the list to add to
* @param data the new item to be added to the list
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_add(alpm_list_t *list, void *data)
{
alpm_list_append(&list, data);
return list;
}
alpm_list_t *ptr, *lp;
alpm_list_t SYMEXPORT *alpm_list_append(alpm_list_t **list, void *data)
{
alpm_list_t *ptr;
ptr = malloc(sizeof(alpm_list_t));
ptr = calloc(1, sizeof(alpm_list_t));
if(ptr == NULL) {
return NULL;
return(list);
}
ptr->data = data;
ptr->next = NULL;
/* Special case: the input list is empty */
if(*list == NULL) {
*list = ptr;
if(list == NULL) {
ptr->prev = ptr;
} else {
alpm_list_t *lp = alpm_list_last(*list);
lp->next = ptr;
ptr->prev = lp;
(*list)->prev = ptr;
return(ptr);
}
return ptr;
}
alpm_list_t SYMEXPORT *alpm_list_append_strdup(alpm_list_t **list, const char *data)
{
alpm_list_t *ret;
char *dup;
if((dup = strdup(data)) && (ret = alpm_list_append(list, dup))) {
return ret;
} else {
free(dup);
return NULL;
}
lp = alpm_list_last(list);
lp->next = ptr;
ptr->prev = lp;
list->prev = ptr;
return(list);
}
/**
* @brief Add items to a list in sorted order.
*
* @param list the list to add to
* @param data the new item to be added to the list
* @param fn the comparison function to use to determine order
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn)
{
if(!fn || !list) {
return alpm_list_add(list, data);
return(alpm_list_add(list, data));
} else {
alpm_list_t *add = NULL, *prev = NULL, *next = list;
add = malloc(sizeof(alpm_list_t));
add = calloc(1, sizeof(alpm_list_t));
if(add == NULL) {
return list;
return(list);
}
add->data = data;
@ -130,32 +145,43 @@ alpm_list_t SYMEXPORT *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_
add->prev = list->prev; /* list != NULL */
add->next = list;
list->prev = add;
return add;
return(add);
} else if(next == NULL) { /* another special case: add last element */
add->prev = prev;
add->next = NULL;
prev->next = add;
list->prev = add;
return list;
return(list);
} else {
add->prev = prev;
add->next = next;
next->prev = add;
prev->next = add;
return list;
return(list);
}
}
}
/**
* @brief Join two lists.
* The two lists must be independent. Do not free the original lists after
* calling this function, as this is not a copy operation. The list pointers
* passed in should be considered invalid after calling this function.
*
* @param first the first list
* @param second the second list
*
* @return the resultant joined list
*/
alpm_list_t SYMEXPORT *alpm_list_join(alpm_list_t *first, alpm_list_t *second)
{
alpm_list_t *tmp;
if(first == NULL) {
return second;
if (first == NULL) {
return(second);
}
if(second == NULL) {
return first;
if (second == NULL) {
return(first);
}
/* tmp is the last element of the first list */
tmp = first->prev;
@ -166,26 +192,28 @@ alpm_list_t SYMEXPORT *alpm_list_join(alpm_list_t *first, alpm_list_t *second)
/* set the back reference to the tail */
second->prev = tmp;
return first;
return(first);
}
alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right,
alpm_list_fn_cmp fn)
/**
* @brief Merge the two sorted sublists into one sorted list.
*
* @param left the first list
* @param right the second list
* @param fn comparison function for determining merge order
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn)
{
alpm_list_t *newlist, *lp, *tail_ptr, *left_tail_ptr, *right_tail_ptr;
alpm_list_t *newlist, *lp;
if(left == NULL) {
if (left == NULL)
return right;
}
if(right == NULL) {
if (right == NULL)
return left;
}
/* Save tail node pointers for future use */
left_tail_ptr = left->prev;
right_tail_ptr = right->prev;
if(fn(left->data, right->data) <= 0) {
if (fn(left->data, right->data) <= 0) {
newlist = left;
left = left->next;
}
@ -197,8 +225,8 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right,
newlist->next = NULL;
lp = newlist;
while((left != NULL) && (right != NULL)) {
if(fn(left->data, right->data) <= 0) {
while ((left != NULL) && (right != NULL)) {
if (fn(left->data, right->data) <= 0) {
lp->next = left;
left->prev = lp;
left = left->next;
@ -211,202 +239,235 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right,
lp = lp->next;
lp->next = NULL;
}
if(left != NULL) {
if (left != NULL) {
lp->next = left;
left->prev = lp;
tail_ptr = left_tail_ptr;
}
else if(right != NULL) {
else if (right != NULL) {
lp->next = right;
right->prev = lp;
tail_ptr = right_tail_ptr;
}
else {
tail_ptr = lp;
}
newlist->prev = tail_ptr;
/* Find our tail pointer
* TODO maintain this in the algorithm itself */
lp = newlist;
while(lp && lp->next) {
lp = lp->next;
}
newlist->prev = lp;
return newlist;
return(newlist);
}
alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, size_t n,
alpm_list_fn_cmp fn)
/**
* @brief Sort a list of size `n` using mergesort algorithm.
*
* @param list the list to sort
* @param n the size of the list
* @param fn the comparison function for determining order
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn)
{
if(n > 1) {
size_t half = n / 2;
size_t i = half - 1;
alpm_list_t *left = list, *lastleft = list, *right;
while(i--) {
lastleft = lastleft->next;
}
right = lastleft->next;
/* tidy new lists */
if (n > 1) {
alpm_list_t *left = list;
alpm_list_t *lastleft = alpm_list_nth(list, n/2 - 1);
alpm_list_t *right = lastleft->next;
/* terminate first list */
lastleft->next = NULL;
right->prev = left->prev;
left->prev = lastleft;
left = alpm_list_msort(left, half, fn);
right = alpm_list_msort(right, n - half, fn);
left = alpm_list_msort(left, n/2, fn);
right = alpm_list_msort(right, n - (n/2), fn);
list = alpm_list_mmerge(left, right, fn);
}
return list;
return(list);
}
alpm_list_t SYMEXPORT *alpm_list_remove_item(alpm_list_t *haystack,
alpm_list_t *item)
/**
* @brief Remove an item from the list.
*
* @param haystack the list to remove the item from
* @param needle the data member of the item we're removing
* @param fn the comparison function for searching
* @param data output parameter containing data of the removed item
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data)
{
if(haystack == NULL || item == NULL) {
return haystack;
}
if(item == haystack) {
/* Special case: removing the head node which has a back reference to
* the tail node */
haystack = item->next;
if(haystack) {
haystack->prev = item->prev;
}
item->prev = NULL;
} else if(item == haystack->prev) {
/* Special case: removing the tail node, so we need to fix the back
* reference on the head node. We also know tail != head. */
if(item->prev) {
/* i->next should always be null */
item->prev->next = item->next;
haystack->prev = item->prev;
item->prev = NULL;
}
} else {
/* Normal case, non-head and non-tail node */
if(item->next) {
item->next->prev = item->prev;
}
if(item->prev) {
item->prev->next = item->next;
}
}
return haystack;
}
alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack,
const void *needle, alpm_list_fn_cmp fn, void **data)
{
alpm_list_t *i = haystack;
alpm_list_t *i = haystack, *tmp = NULL;
if(data) {
*data = NULL;
}
if(needle == NULL) {
return haystack;
return(haystack);
}
while(i) {
if(i->data == NULL) {
i = i->next;
continue;
}
tmp = i->next;
if(fn(i->data, needle) == 0) {
haystack = alpm_list_remove_item(haystack, i);
/* we found a matching item */
if(i == haystack) {
/* Special case: removing the head node which has a back reference to
* the tail node */
haystack = i->next;
if(haystack) {
haystack->prev = i->prev;
}
i->prev = NULL;
} else if(i == haystack->prev) {
/* Special case: removing the tail node, so we need to fix the back
* reference on the head node. We also know tail != head. */
if(i->prev) {
/* i->next should always be null */
i->prev->next = i->next;
haystack->prev = i->prev;
i->prev = NULL;
}
} else {
/* Normal case, non-head and non-tail node */
if(i->next) {
i->next->prev = i->prev;
}
if(i->prev) {
i->prev->next = i->next;
}
}
if(data) {
*data = i->data;
}
i->data = NULL;
free(i);
break;
i = NULL;
} else {
i = i->next;
i = tmp;
}
}
return haystack;
return(haystack);
}
/**
* @brief Remove a string from a list.
*
* @param haystack the list to remove the item from
* @param needle the data member of the item we're removing
* @param data output parameter containing data of the removed item
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_remove_str(alpm_list_t *haystack,
const char *needle, char **data)
{
return alpm_list_remove(haystack, (const void *)needle,
(alpm_list_fn_cmp)strcmp, (void **)data);
return(alpm_list_remove(haystack, (const void *)needle,
(alpm_list_fn_cmp)strcmp, (void **)data));
}
/**
* @brief Create a new list without any duplicates.
*
* This does NOT copy data members.
*
* @param list the list to copy
*
* @return a new list containing non-duplicate items
*/
alpm_list_t SYMEXPORT *alpm_list_remove_dupes(const alpm_list_t *list)
{
const alpm_list_t *lp = list;
alpm_list_t *newlist = NULL;
while(lp) {
if(!alpm_list_find_ptr(newlist, lp->data)) {
if(alpm_list_append(&newlist, lp->data) == NULL) {
alpm_list_free(newlist);
return NULL;
}
newlist = alpm_list_add(newlist, lp->data);
}
lp = lp->next;
}
return newlist;
return(newlist);
}
/**
* @brief Copy a string list, including data.
*
* @param list the list to copy
*
* @return a copy of the original list
*/
alpm_list_t SYMEXPORT *alpm_list_strdup(const alpm_list_t *list)
{
const alpm_list_t *lp = list;
alpm_list_t *newlist = NULL;
while(lp) {
if(alpm_list_append_strdup(&newlist, lp->data) == NULL) {
FREELIST(newlist);
return NULL;
}
newlist = alpm_list_add(newlist, strdup(lp->data));
lp = lp->next;
}
return newlist;
return(newlist);
}
/**
* @brief Copy a list, without copying data.
*
* @param list the list to copy
*
* @return a copy of the original list
*/
alpm_list_t SYMEXPORT *alpm_list_copy(const alpm_list_t *list)
{
const alpm_list_t *lp = list;
alpm_list_t *newlist = NULL;
while(lp) {
if(alpm_list_append(&newlist, lp->data) == NULL) {
alpm_list_free(newlist);
return NULL;
}
newlist = alpm_list_add(newlist, lp->data);
lp = lp->next;
}
return newlist;
return(newlist);
}
/**
* @brief Copy a list and copy the data.
* Note that the data elements to be copied should not contain pointers
* and should also be of constant size.
*
* @param list the list to copy
* @param size the size of each data element
*
* @return a copy of the original list, data copied as well
*/
alpm_list_t SYMEXPORT *alpm_list_copy_data(const alpm_list_t *list,
size_t size)
{
const alpm_list_t *lp = list;
alpm_list_t *newlist = NULL;
while(lp) {
void *newdata = malloc(size);
void *newdata = calloc(1, size);
if(newdata) {
memcpy(newdata, lp->data, size);
if(alpm_list_append(&newlist, newdata) == NULL) {
free(newdata);
FREELIST(newlist);
return NULL;
}
newlist = alpm_list_add(newlist, newdata);
lp = lp->next;
} else {
FREELIST(newlist);
return NULL;
}
}
return newlist;
return(newlist);
}
/**
* @brief Create a new list in reverse order.
*
* @param list the list to copy
*
* @return a new list in reverse order
*/
alpm_list_t SYMEXPORT *alpm_list_reverse(alpm_list_t *list)
{
const alpm_list_t *lp;
alpm_list_t *newlist = NULL, *backup;
if(list == NULL) {
return NULL;
return(NULL);
}
lp = alpm_list_last(list);
@ -415,236 +476,205 @@ alpm_list_t SYMEXPORT *alpm_list_reverse(alpm_list_t *list)
list->prev = NULL;
while(lp) {
if(alpm_list_append(&newlist, lp->data) == NULL) {
alpm_list_free(newlist);
list->prev = backup;
return NULL;
}
newlist = alpm_list_add(newlist, lp->data);
lp = lp->prev;
}
list->prev = backup; /* restore tail pointer */
return newlist;
return(newlist);
}
/* Accessors */
alpm_list_t SYMEXPORT *alpm_list_nth(const alpm_list_t *list, size_t n)
/**
* @brief Get the first element of a list.
*
* @param list the list
*
* @return the first element in the list
*/
inline alpm_list_t SYMEXPORT *alpm_list_first(const alpm_list_t *list)
{
if(list) {
return((alpm_list_t*)list);
} else {
return(NULL);
}
}
/**
* @brief Return nth element from list (starting from 0).
*
* @param list the list
* @param n the index of the item to find (n < alpm_list_count(list) IS needed)
*
* @return an alpm_list_t node for index `n`
*/
alpm_list_t SYMEXPORT *alpm_list_nth(const alpm_list_t *list, int n)
{
const alpm_list_t *i = list;
while(n--) {
i = i->next;
}
return (alpm_list_t *)i;
return((alpm_list_t*)i);
}
/**
* @brief Get the next element of a list.
*
* @param node the list node
*
* @return the next element, or NULL when no more elements exist
*/
inline alpm_list_t SYMEXPORT *alpm_list_next(const alpm_list_t *node)
{
if(node) {
return node->next;
return(node->next);
} else {
return NULL;
}
}
inline alpm_list_t SYMEXPORT *alpm_list_previous(const alpm_list_t *list)
{
if(list && list->prev->next) {
return list->prev;
} else {
return NULL;
return(NULL);
}
}
/**
* @brief Get the last item in the list.
*
* @param list the list
*
* @return the last element in the list
*/
alpm_list_t SYMEXPORT *alpm_list_last(const alpm_list_t *list)
{
if(list) {
return list->prev;
return(list->prev);
} else {
return NULL;
return(NULL);
}
}
/**
* @brief Get the data member of a list node.
*
* @param node the list node
*
* @return the contained data, or NULL if none
*/
void SYMEXPORT *alpm_list_getdata(const alpm_list_t *node)
{
if(node == NULL) return(NULL);
return(node->data);
}
/* Misc */
size_t SYMEXPORT alpm_list_count(const alpm_list_t *list)
/**
* @brief Get the number of items in a list.
*
* @param list the list
*
* @return the number of list items
*/
int SYMEXPORT alpm_list_count(const alpm_list_t *list)
{
size_t i = 0;
unsigned int i = 0;
const alpm_list_t *lp = list;
while(lp) {
++i;
lp = lp->next;
}
return i;
return(i);
}
/**
* @brief Find an item in a list.
*
* @param needle the item to search
* @param haystack the list
* @param fn the comparison function for searching (!= NULL)
*
* @return `needle` if found, NULL otherwise
*/
void SYMEXPORT *alpm_list_find(const alpm_list_t *haystack, const void *needle,
alpm_list_fn_cmp fn)
{
const alpm_list_t *lp = haystack;
while(lp) {
if(lp->data && fn(lp->data, needle) == 0) {
return lp->data;
return(lp->data);
}
lp = lp->next;
}
return NULL;
return(NULL);
}
/* trivial helper function for alpm_list_find_ptr */
static int ptr_cmp(const void *p, const void *q)
{
return (p != q);
return(p != q);
}
void SYMEXPORT *alpm_list_find_ptr(const alpm_list_t *haystack,
const void *needle)
/**
* @brief Find an item in a list.
*
* Search for the item whos data matches that of the `needle`.
*
* @param needle the data to search for (== comparison)
* @param haystack the list
*
* @return `needle` if found, NULL otherwise
*/
void SYMEXPORT *alpm_list_find_ptr(const alpm_list_t *haystack, const void *needle)
{
return alpm_list_find(haystack, needle, ptr_cmp);
return(alpm_list_find(haystack, needle, ptr_cmp));
}
/**
* @brief Find a string in a list.
*
* @param needle the string to search for
* @param haystack the list
*
* @return `needle` if found, NULL otherwise
*/
char SYMEXPORT *alpm_list_find_str(const alpm_list_t *haystack,
const char *needle)
{
return (char *)alpm_list_find(haystack, (const void *)needle,
(alpm_list_fn_cmp)strcmp);
return((char *)alpm_list_find(haystack, (const void*)needle,
(alpm_list_fn_cmp)strcmp));
}
int SYMEXPORT alpm_list_cmp_unsorted(const alpm_list_t *left,
const alpm_list_t *right, alpm_list_fn_cmp fn)
{
const alpm_list_t *l = left;
const alpm_list_t *r = right;
int *matched;
/* short circuiting length comparison */
while(l && r) {
l = l->next;
r = r->next;
}
if(l || r) {
return 0;
}
/* faster comparison for if the lists happen to be in the same order */
while(left && fn(left->data, right->data) == 0) {
left = left->next;
right = right->next;
}
if(!left) {
return 1;
}
matched = calloc(alpm_list_count(right), sizeof(int));
if(matched == NULL) {
return -1;
}
for(l = left; l; l = l->next) {
int found = 0;
int n = 0;
for(r = right; r; r = r->next, n++) {
/* make sure we don't match the same value twice */
if(matched[n]) {
continue;
}
if(fn(l->data, r->data) == 0) {
found = 1;
matched[n] = 1;
break;
}
}
if(!found) {
free(matched);
return 0;
}
}
free(matched);
return 1;
}
void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left,
const alpm_list_t *right, alpm_list_fn_cmp fn,
alpm_list_t **onlyleft, alpm_list_t **onlyright)
{
const alpm_list_t *l = left;
const alpm_list_t *r = right;
if(!onlyleft && !onlyright) {
return;
}
while(l != NULL && r != NULL) {
int cmp = fn(l->data, r->data);
if(cmp < 0) {
if(onlyleft) {
*onlyleft = alpm_list_add(*onlyleft, l->data);
}
l = l->next;
}
else if(cmp > 0) {
if(onlyright) {
*onlyright = alpm_list_add(*onlyright, r->data);
}
r = r->next;
} else {
l = l->next;
r = r->next;
}
}
while(l != NULL) {
if(onlyleft) {
*onlyleft = alpm_list_add(*onlyleft, l->data);
}
l = l->next;
}
while(r != NULL) {
if(onlyright) {
*onlyright = alpm_list_add(*onlyright, r->data);
}
r = r->next;
}
}
/**
* @brief Find the items in list `lhs` that are not present in list `rhs`.
*
* Entries are not duplicated. Operation is O(m*n). The first list is stepped
* through one node at a time, and for each node in the first list, each node
* in the second list is compared to it.
*
* @param lhs the first list
* @param rhs the second list
* @param fn the comparison function
*
* @return a list containing all items in `lhs` not present in `rhs`
*/
alpm_list_t SYMEXPORT *alpm_list_diff(const alpm_list_t *lhs,
const alpm_list_t *rhs, alpm_list_fn_cmp fn)
{
alpm_list_t *left, *right;
const alpm_list_t *i, *j;
alpm_list_t *ret = NULL;
for(i = lhs; i; i = i->next) {
int found = 0;
for(j = rhs; j; j = j->next) {
if(fn(i->data, j->data) == 0) {
found = 1;
break;
}
}
if(!found) {
ret = alpm_list_add(ret, i->data);
}
}
left = alpm_list_copy(lhs);
left = alpm_list_msort(left, alpm_list_count(left), fn);
right = alpm_list_copy(rhs);
right = alpm_list_msort(right, alpm_list_count(right), fn);
alpm_list_diff_sorted(left, right, fn, &ret, NULL);
alpm_list_free(left);
alpm_list_free(right);
return ret;
return(ret);
}
void SYMEXPORT *alpm_list_to_array(const alpm_list_t *list, size_t n,
size_t size)
{
size_t i;
const alpm_list_t *item;
char *array;
/** @} */
if(n == 0) {
return NULL;
}
array = malloc(n * size);
if(array == NULL) {
return NULL;
}
for(i = 0, item = list; i < n && item; i++, item = item->next) {
memcpy(array + i * size, item->data, size);
}
return array;
}
/* vim: set ts=2 sw=2 noet: */

View file

@ -1,8 +1,7 @@
/*
* alpm_list.h
*
* Copyright (c) 2006-2025 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,379 +16,71 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ALPM_LIST_H
#define ALPM_LIST_H
#ifndef _ALPM_LIST_H
#define _ALPM_LIST_H
#include <stdlib.h> /* size_t */
/* Note: alpm_list.{c,h} are intended to be standalone files. Do not include
* any other libalpm headers.
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* @ingroup libalpm
* @addtogroup libalpm_list libalpm_list(3)
* @brief Functions to manipulate alpm_list_t lists.
*
* These functions are designed to create, destroy, and modify lists of
* type alpm_list_t. This is an internal list type used by libalpm that is
* publicly exposed for use by frontends if desired.
* @brief Linked list type used by libalpm.
*
* It is exposed so front ends can use it to prevent the need to reimplement
* lists of their own; however, it is not required that the front end uses
* it.
* @{
*/
/** A doubly linked list */
typedef struct _alpm_list_t {
typedef struct __alpm_list_t {
/** data held by the list node */
void *data;
/** pointer to the previous node */
struct _alpm_list_t *prev;
struct __alpm_list_t *prev;
/** pointer to the next node */
struct _alpm_list_t *next;
struct __alpm_list_t *next;
} alpm_list_t;
/** Frees a list and its contents */
#define FREELIST(p) do { alpm_list_free_inner(p, free); alpm_list_free(p); p = NULL; } while(0)
/** item deallocation callback.
* @param item the item to free
*/
typedef void (*alpm_list_fn_free)(void * item);
/** item comparison callback */
typedef int (*alpm_list_fn_cmp)(const void *, const void *);
typedef void (*alpm_list_fn_free)(void *); /* item deallocation callback */
typedef int (*alpm_list_fn_cmp)(const void *, const void *); /* item comparison callback */
/* allocation */
/** Free a list, but not the contained data.
*
* @param list the list to free
*/
void alpm_list_free(alpm_list_t *list);
/** Free the internal data of a list structure but not the list itself.
*
* @param list the list to free
* @param fn a free function for the internal data
*/
void alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn);
/* item mutators */
/** Add a new item to the end of the list.
*
* @param list the list to add to
* @param data the new item to be added to the list
*
* @return the resultant list
*/
alpm_list_t *alpm_list_add(alpm_list_t *list, void *data);
/**
* @brief Add a new item to the end of the list.
*
* @param list the list to add to
* @param data the new item to be added to the list
*
* @return the newly added item
*/
alpm_list_t *alpm_list_append(alpm_list_t **list, void *data);
/**
* @brief Duplicate and append a string to a list.
*
* @param list the list to append to
* @param data the string to duplicate and append
*
* @return the newly added item
*/
alpm_list_t *alpm_list_append_strdup(alpm_list_t **list, const char *data);
/**
* @brief Add items to a list in sorted order.
*
* @param list the list to add to
* @param data the new item to be added to the list
* @param fn the comparison function to use to determine order
*
* @return the resultant list
*/
alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn);
/**
* @brief Join two lists.
* The two lists must be independent. Do not free the original lists after
* calling this function, as this is not a copy operation. The list pointers
* passed in should be considered invalid after calling this function.
*
* @param first the first list
* @param second the second list
*
* @return the resultant joined list
*/
alpm_list_t *alpm_list_join(alpm_list_t *first, alpm_list_t *second);
/**
* @brief Merge the two sorted sublists into one sorted list.
*
* @param left the first list
* @param right the second list
* @param fn comparison function for determining merge order
*
* @return the resultant list
*/
alpm_list_t *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn);
/**
* @brief Sort a list of size `n` using mergesort algorithm.
*
* @param list the list to sort
* @param n the size of the list
* @param fn the comparison function for determining order
*
* @return the resultant list
*/
alpm_list_t *alpm_list_msort(alpm_list_t *list, size_t n, alpm_list_fn_cmp fn);
/**
* @brief Remove an item from the list.
* item is not freed; this is the responsibility of the caller.
*
* @param haystack the list to remove the item from
* @param item the item to remove from the list
*
* @return the resultant list
*/
alpm_list_t *alpm_list_remove_item(alpm_list_t *haystack, alpm_list_t *item);
/**
* @brief Remove an item from the list.
*
* @param haystack the list to remove the item from
* @param needle the data member of the item we're removing
* @param fn the comparison function for searching
* @param data output parameter containing data of the removed item
*
* @return the resultant list
*/
alpm_list_t *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn);
alpm_list_t *alpm_list_remove(alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data);
/**
* @brief Remove a string from a list.
*
* @param haystack the list to remove the item from
* @param needle the data member of the item we're removing
* @param data output parameter containing data of the removed item
*
* @return the resultant list
*/
alpm_list_t *alpm_list_remove_str(alpm_list_t *haystack, const char *needle, char **data);
/**
* @brief Create a new list without any duplicates.
*
* This does NOT copy data members.
*
* @param list the list to copy
*
* @return a new list containing non-duplicate items
*/
alpm_list_t *alpm_list_remove_dupes(const alpm_list_t *list);
/**
* @brief Copy a string list, including data.
*
* @param list the list to copy
*
* @return a copy of the original list
*/
alpm_list_t *alpm_list_strdup(const alpm_list_t *list);
/**
* @brief Copy a list, without copying data.
*
* @param list the list to copy
*
* @return a copy of the original list
*/
alpm_list_t *alpm_list_copy(const alpm_list_t *list);
/**
* @brief Copy a list and copy the data.
* Note that the data elements to be copied should not contain pointers
* and should also be of constant size.
*
* @param list the list to copy
* @param size the size of each data element
*
* @return a copy of the original list, data copied as well
*/
alpm_list_t *alpm_list_copy_data(const alpm_list_t *list, size_t size);
/**
* @brief Create a new list in reverse order.
*
* @param list the list to copy
*
* @return a new list in reverse order
*/
alpm_list_t *alpm_list_reverse(alpm_list_t *list);
/* item accessors */
/**
* @brief Return nth element from list (starting from 0).
*
* @param list the list
* @param n the index of the item to find (n < alpm_list_count(list) IS needed)
*
* @return an alpm_list_t node for index `n`
*/
alpm_list_t *alpm_list_nth(const alpm_list_t *list, size_t n);
/**
* @brief Get the next element of a list.
*
* @param list the list node
*
* @return the next element, or NULL when no more elements exist
*/
alpm_list_t *alpm_list_first(const alpm_list_t *list);
alpm_list_t *alpm_list_nth(const alpm_list_t *list, int n);
alpm_list_t *alpm_list_next(const alpm_list_t *list);
/**
* @brief Get the previous element of a list.
*
* @param list the list head
*
* @return the previous element, or NULL when no previous element exist
*/
alpm_list_t *alpm_list_previous(const alpm_list_t *list);
/**
* @brief Get the last item in the list.
*
* @param list the list
*
* @return the last element in the list
*/
alpm_list_t *alpm_list_last(const alpm_list_t *list);
void *alpm_list_getdata(const alpm_list_t *entry);
/* misc */
/**
* @brief Get the number of items in a list.
*
* @param list the list
*
* @return the number of list items
*/
size_t alpm_list_count(const alpm_list_t *list);
/**
* @brief Find an item in a list.
*
* @param needle the item to search
* @param haystack the list
* @param fn the comparison function for searching (!= NULL)
*
* @return `needle` if found, NULL otherwise
*/
int alpm_list_count(const alpm_list_t *list);
void *alpm_list_find(const alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn);
/**
* @brief Find an item in a list.
*
* Search for the item whose data matches that of the `needle`.
*
* @param needle the data to search for (== comparison)
* @param haystack the list
*
* @return `needle` if found, NULL otherwise
*/
void *alpm_list_find_ptr(const alpm_list_t *haystack, const void *needle);
/**
* @brief Find a string in a list.
*
* @param needle the string to search for
* @param haystack the list
*
* @return `needle` if found, NULL otherwise
*/
char *alpm_list_find_str(const alpm_list_t *haystack, const char *needle);
/**
* @brief Check if two lists contain the same data, ignoring order.
*
* Lists are considered equal if they both contain the same data regardless
* of order.
*
* @param left the first list
* @param right the second list
* @param fn the comparison function
*
* @return 1 if the lists are equal, 0 if not equal, -1 on error.
*/
int alpm_list_cmp_unsorted(const alpm_list_t *left,
const alpm_list_t *right, alpm_list_fn_cmp fn);
/**
* @brief Find the differences between list `left` and list `right`
*
* The two lists must be sorted. Items only in list `left` are added to the
* `onlyleft` list. Items only in list `right` are added to the `onlyright`
* list.
*
* @param left the first list
* @param right the second list
* @param fn the comparison function
* @param onlyleft pointer to the first result list
* @param onlyright pointer to the second result list
*
*/
void alpm_list_diff_sorted(const alpm_list_t *left, const alpm_list_t *right,
alpm_list_fn_cmp fn, alpm_list_t **onlyleft, alpm_list_t **onlyright);
/**
* @brief Find the items in list `lhs` that are not present in list `rhs`.
*
* @param lhs the first list
* @param rhs the second list
* @param fn the comparison function
*
* @return a list containing all items in `lhs` not present in `rhs`
*/
alpm_list_t *alpm_list_diff(const alpm_list_t *lhs, const alpm_list_t *rhs, alpm_list_fn_cmp fn);
/**
* @brief Copy a list and data into a standard C array of fixed length.
* Note that the data elements are shallow copied so any contained pointers
* will point to the original data.
*
* @param list the list to copy
* @param n the size of the list
* @param size the size of each data element
*
* @return an array version of the original list, data copied as well
*/
void *alpm_list_to_array(const alpm_list_t *list, size_t n, size_t size);
/* End of alpm_list */
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* ALPM_LIST_H */
#endif /* _ALPM_LIST_H */
/* vim: set ts=2 sw=2 noet: */

View file

@ -1,7 +1,6 @@
/*
* backup.c
*
* Copyright (c) 2006-2025 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2005 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@ -21,6 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
@ -30,71 +31,82 @@
#include "log.h"
#include "util.h"
/* split a backup string "file\thash" into the relevant components */
int _alpm_split_backup(const char *string, alpm_backup_t **backup)
/* split a backup string "file\thash" into two strings : file and hash */
int _alpm_backup_split(const char *string, char **file, char **hash)
{
char *str, *ptr;
STRDUP(str, string, return -1);
char *str = strdup(string);
char *ptr;
/* tab delimiter */
ptr = str ? strchr(str, '\t') : NULL;
ptr = strchr(str, '\t');
if(ptr == NULL) {
(*backup)->name = str;
(*backup)->hash = NULL;
return 0;
if(file) {
*file = str;
} else {
/* don't need our dup as the fname wasn't requested, so free it */
FREE(str);
}
return(0);
}
*ptr = '\0';
ptr++;
/* now str points to the filename and ptr points to the hash */
STRDUP((*backup)->name, str, FREE(str); return -1);
STRDUP((*backup)->hash, ptr, FREE((*backup)->name); FREE(str); return -1);
if(file) {
*file = strdup(str);
}
if(hash) {
*hash = strdup(ptr);
}
FREE(str);
return 0;
return(1);
}
/* Look for a filename in a alpm_pkg_t.backup list. If we find it,
* then we return the full backup entry.
char *_alpm_backup_file(const char *string)
{
char *file = NULL;
_alpm_backup_split(string, &file, NULL);
return(file);
}
char *_alpm_backup_hash(const char *string)
{
char *hash = NULL;
_alpm_backup_split(string, NULL, &hash);
return(hash);
}
/* Look for a filename in a pmpkg_t.backup list. If we find it,
* then we return the md5 hash (parsed from the same line)
*/
alpm_backup_t *_alpm_needbackup(const char *file, alpm_pkg_t *pkg)
char *_alpm_needbackup(const char *file, const alpm_list_t *backup)
{
const alpm_list_t *lp;
if(file == NULL || pkg == NULL) {
return NULL;
ALPM_LOG_FUNC;
if(file == NULL || backup == NULL) {
return(NULL);
}
for(lp = alpm_pkg_get_backup(pkg); lp; lp = lp->next) {
alpm_backup_t *backup = lp->data;
/* run through the backup list and parse out the hash for our file */
for(lp = backup; lp; lp = lp->next) {
char *filename = NULL;
char *hash = NULL;
if(strcmp(file, backup->name) == 0) {
return backup;
/* no hash found */
if(!_alpm_backup_split((char *)lp->data, &filename, &hash)) {
FREE(filename);
continue;
}
if(strcmp(file, filename) == 0) {
FREE(filename);
return(hash);
}
FREE(filename);
FREE(hash);
}
return NULL;
return(NULL);
}
void _alpm_backup_free(alpm_backup_t *backup)
{
ASSERT(backup != NULL, return);
FREE(backup->name);
FREE(backup->hash);
FREE(backup);
}
alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup)
{
alpm_backup_t *newbackup;
CALLOC(newbackup, 1, sizeof(alpm_backup_t), return NULL);
STRDUP(newbackup->name, backup->name, goto error);
STRDUP(newbackup->hash, backup->hash, goto error);
return newbackup;
error:
free(newbackup->name);
free(newbackup);
return NULL;
}
/* vim: set ts=2 sw=2 noet: */

View file

@ -1,8 +1,7 @@
/*
* backup.h
*
* Copyright (c) 2006-2025 Pacman Development Team <pacman-dev@lists.archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,15 +16,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ALPM_BACKUP_H
#define ALPM_BACKUP_H
#ifndef _ALPM_BACKUP_H
#define _ALPM_BACKUP_H
#include "alpm_list.h"
#include "alpm.h"
int _alpm_split_backup(const char *string, alpm_backup_t **backup);
alpm_backup_t *_alpm_needbackup(const char *file, alpm_pkg_t *pkg);
void _alpm_backup_free(alpm_backup_t *backup);
alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup);
char *_alpm_backup_file(const char *string);
char *_alpm_backup_hash(const char *string);
char *_alpm_needbackup(const char *file, const alpm_list_t *backup);
#endif /* ALPM_BACKUP_H */
#endif /* _ALPM_BACKUP_H */
/* vim: set ts=2 sw=2 noet: */

View file

@ -1,196 +0,0 @@
/*
* RFC 1521 base64 encoding/decoding
*
* Copyright (C) 2006-2010, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Pacman Notes:
*
* Taken from the PolarSSL project at www.polarssl.org under terms of the
* GPL. This is from version 0.14.2 of the library, and has been modified
* as following, which may be helpful for future updates:
* * remove "polarssl/config.h" include
* * change include from "polarssl/base64.h" to "base64.h"
* * removal of SELF_TEST code
*/
#include <stdint.h>
#include "base64.h"
#if 0
static const unsigned char base64_enc_map[64] =
{
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', '+', '/'
};
#endif
static const unsigned char base64_dec_map[128] =
{
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 62, 127, 127, 127, 63, 52, 53,
54, 55, 56, 57, 58, 59, 60, 61, 127, 127,
127, 64, 127, 127, 127, 0, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 127, 127, 127, 127, 127, 127, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 127, 127, 127, 127, 127
};
#if 0
/*
* Encode a buffer into base64 format
*/
int base64_encode( unsigned char *dst, size_t *dlen,
const unsigned char *src, size_t slen )
{
size_t i, n;
int C1, C2, C3;
unsigned char *p;
if( slen == 0 )
return( 0 );
n = (slen << 3) / 6;
switch( (slen << 3) - (n * 6) )
{
case 2: n += 3; break;
case 4: n += 2; break;
default: break;
}
if( *dlen < n + 1 )
{
*dlen = n + 1;
return( POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL );
}
n = (slen / 3) * 3;
for( i = 0, p = dst; i < n; i += 3 )
{
C1 = *src++;
C2 = *src++;
C3 = *src++;
*p++ = base64_enc_map[(C1 >> 2) & 0x3F];
*p++ = base64_enc_map[(((C1 & 3) << 4) + (C2 >> 4)) & 0x3F];
*p++ = base64_enc_map[(((C2 & 15) << 2) + (C3 >> 6)) & 0x3F];
*p++ = base64_enc_map[C3 & 0x3F];
}
if( i < slen )
{
C1 = *src++;
C2 = ((i + 1) < slen) ? *src++ : 0;
*p++ = base64_enc_map[(C1 >> 2) & 0x3F];
*p++ = base64_enc_map[(((C1 & 3) << 4) + (C2 >> 4)) & 0x3F];
if( (i + 1) < slen )
*p++ = base64_enc_map[((C2 & 15) << 2) & 0x3F];
else *p++ = '=';
*p++ = '=';
}
*dlen = p - dst;
*p = 0;
return( 0 );
}
#endif
/*
* Decode a base64-formatted buffer
*/
int base64_decode( unsigned char *dst, size_t *dlen,
const unsigned char *src, size_t slen )
{
size_t i, n;
uint32_t j, x;
unsigned char *p;
for( i = j = n = 0; i < slen; i++ )
{
if( ( slen - i ) >= 2 &&
src[i] == '\r' && src[i + 1] == '\n' )
continue;
if( src[i] == '\n' )
continue;
if( src[i] == '=' && ++j > 2 )
return( POLARSSL_ERR_BASE64_INVALID_CHARACTER );
if( src[i] > 127 || base64_dec_map[src[i]] == 127 )
return( POLARSSL_ERR_BASE64_INVALID_CHARACTER );
if( base64_dec_map[src[i]] < 64 && j != 0 )
return( POLARSSL_ERR_BASE64_INVALID_CHARACTER );
n++;
}
if( n == 0 )
return( 0 );
n = ((n * 6) + 7) >> 3;
if( *dlen < n )
{
*dlen = n;
return( POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL );
}
for( j = 3, n = x = 0, p = dst; i > 0; i--, src++ )
{
if( *src == '\r' || *src == '\n' )
continue;
j -= ( base64_dec_map[*src] == 64 );
x = (x << 6) | ( base64_dec_map[*src] & 0x3F );
if( ++n == 4 )
{
n = 0;
if( j > 0 ) *p++ = (unsigned char)( x >> 16 );
if( j > 1 ) *p++ = (unsigned char)( x >> 8 );
if( j > 2 ) *p++ = (unsigned char)( x );
}
}
*dlen = p - dst;
return( 0 );
}

View file

@ -1,72 +0,0 @@
/**
* \file base64.h
*
* Copyright (C) 2006-2010, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BASE64_H
#define BASE64_H
#include <string.h>
#define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL -0x0010 /**< Output buffer too small. */
#define POLARSSL_ERR_BASE64_INVALID_CHARACTER -0x0012 /**< Invalid character in input. */
#if 0
/**
* \brief Encode a buffer into base64 format
*
* \param dst destination buffer
* \param dlen size of the buffer
* \param src source buffer
* \param slen amount of data to be encoded
*
* \return 0 if successful, or POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL.
* *dlen is always updated to reflect the amount
* of data that has (or would have) been written.
*
* \note Call this function with *dlen = 0 to obtain the
* required buffer size in *dlen
*/
int base64_encode( unsigned char *dst, size_t *dlen,
const unsigned char *src, size_t slen );
#endif
/**
* \brief Decode a base64-formatted buffer
*
* \param dst destination buffer
* \param dlen size of the buffer
* \param src source buffer
* \param slen amount of data to be decoded
*
* \return 0 if successful, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, or
* POLARSSL_ERR_BASE64_INVALID_DATA if the input data is not
* correct. *dlen is always updated to reflect the amount
* of data that has (or would have) been written.
*
* \note Call this function with *dlen = 0 to obtain the
* required buffer size in *dlen
*/
int base64_decode( unsigned char *dst, size_t *dlen,
const unsigned char *src, size_t slen );
#endif /* base64.h */

895
lib/libalpm/be_files.c Normal file
View file

@ -0,0 +1,895 @@
/*
* be_files.c
*
* Copyright (c) 2006 by Christian Hamar <krics@linuxforum.hu>
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdint.h> /* uintmax_t, intmax_t */
#include <sys/stat.h>
#include <dirent.h>
#include <ctype.h>
#include <time.h>
#include <limits.h> /* PATH_MAX */
#include <locale.h> /* setlocale */
/* libalpm */
#include "db.h"
#include "alpm_list.h"
#include "cache.h"
#include "log.h"
#include "util.h"
#include "alpm.h"
#include "handle.h"
#include "package.h"
#include "delta.h"
#include "deps.h"
#include "dload.h"
/*
* Return the last update time as number of seconds from the epoch.
* Returns 0 if the value is unknown or can't be read.
*/
static time_t getlastupdate(const pmdb_t *db)
{
FILE *fp;
char *file;
time_t ret = 0;
ALPM_LOG_FUNC;
if(db == NULL) {
return(ret);
}
/* db->path + '.lastupdate' + NULL */
MALLOC(file, strlen(db->path) + 12, RET_ERR(PM_ERR_MEMORY, ret));
sprintf(file, "%s.lastupdate", db->path);
/* get the last update time, if it's there */
if((fp = fopen(file, "r")) == NULL) {
free(file);
return(ret);
} else {
char line[64];
if(fgets(line, sizeof(line), fp)) {
ret = atol(line);
}
}
fclose(fp);
free(file);
return(ret);
}
/*
* writes the dbpath/.lastupdate file with the value in time
*/
static int setlastupdate(const pmdb_t *db, time_t time)
{
FILE *fp;
char *file;
int ret = 0;
ALPM_LOG_FUNC;
if(db == NULL || time == 0) {
return(-1);
}
/* db->path + '.lastupdate' + NULL */
MALLOC(file, strlen(db->path) + 12, RET_ERR(PM_ERR_MEMORY, ret));
sprintf(file, "%s.lastupdate", db->path);
if((fp = fopen(file, "w")) == NULL) {
free(file);
return(-1);
}
if(fprintf(fp, "%ju", (uintmax_t)time) <= 0) {
ret = -1;
}
fclose(fp);
free(file);
return(ret);
}
/** Update a package database
* @param force if true, then forces the update, otherwise update only in case
* the database isn't up to date
* @param db pointer to the package database to update
* @return 0 on success, > 0 on error (pm_errno is set accordingly), < 0 if up
* to date
*/
int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
{
alpm_list_t *lp;
char *dbfile, *dbfilepath;
time_t newmtime = 0, lastupdate = 0;
const char *dbpath;
size_t len;
int ret;
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
ASSERT(db != NULL && db != handle->db_local, RET_ERR(PM_ERR_WRONG_ARGS, -1));
/* Verify we are in a transaction. This is done _mainly_ because we need a DB
* lock - if we update without a db lock, we may kludge some other pacman
* process that _has_ a lock.
*/
ASSERT(handle->trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(handle->trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
ASSERT(handle->trans->type == PM_TRANS_TYPE_SYNC, RET_ERR(PM_ERR_TRANS_TYPE, -1));
if(!alpm_list_find_ptr(handle->dbs_sync, db)) {
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
}
if(!force) {
/* get the lastupdate time */
lastupdate = getlastupdate(db);
if(lastupdate == 0) {
_alpm_log(PM_LOG_DEBUG, "failed to get lastupdate time for %s\n",
db->treename);
}
}
len = strlen(db->treename) + strlen(DBEXT) + 1;
MALLOC(dbfile, len, RET_ERR(PM_ERR_MEMORY, -1));
sprintf(dbfile, "%s" DBEXT, db->treename);
dbpath = alpm_option_get_dbpath();
ret = _alpm_download_single_file(dbfile, db->servers, dbpath,
lastupdate, &newmtime);
free(dbfile);
if(ret == 1) {
/* mtimes match, do nothing */
pm_errno = 0;
return(1);
} else if(ret == -1) {
/* pm_errno was set by the download code */
_alpm_log(PM_LOG_DEBUG, "failed to sync db: %s\n", alpm_strerrorlast());
return(-1);
} else {
/* remove the old dir */
_alpm_log(PM_LOG_DEBUG, "flushing database %s\n", db->path);
for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
pmpkg_t *pkg = lp->data;
if(pkg && _alpm_db_remove(db, pkg) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not remove database entry %s%s\n"),
db->treename, pkg->name);
RET_ERR(PM_ERR_DB_REMOVE, -1);
}
}
/* Cache needs to be rebuilt */
_alpm_db_free_pkgcache(db);
/* form the path to the db location */
len = strlen(dbpath) + strlen(db->treename) + strlen(DBEXT) + 1;
MALLOC(dbfilepath, len, RET_ERR(PM_ERR_MEMORY, -1));
sprintf(dbfilepath, "%s%s" DBEXT, dbpath, db->treename);
/* uncompress the sync database */
ret = _alpm_unpack(dbfilepath, db->path, NULL);
if(ret) {
free(dbfilepath);
RET_ERR(PM_ERR_SYSTEM, -1);
}
unlink(dbfilepath);
free(dbfilepath);
/* if we have a new mtime, set the DB last update value */
if(newmtime) {
_alpm_log(PM_LOG_DEBUG, "sync: new mtime for %s: %ju\n",
db->treename, (uintmax_t)newmtime);
setlastupdate(db, newmtime);
}
}
return(0);
}
int _alpm_db_open(pmdb_t *db)
{
ALPM_LOG_FUNC;
if(db == NULL) {
RET_ERR(PM_ERR_DB_NULL, -1);
}
_alpm_log(PM_LOG_DEBUG, "opening database from path '%s'\n", db->path);
db->handle = opendir(db->path);
if(db->handle == NULL) {
RET_ERR(PM_ERR_DB_OPEN, -1);
}
return(0);
}
void _alpm_db_close(pmdb_t *db)
{
ALPM_LOG_FUNC;
if(db == NULL) {
return;
}
if(db->handle) {
closedir(db->handle);
db->handle = NULL;
}
}
static int splitname(const char *target, pmpkg_t *pkg)
{
/* the format of a db entry is as follows:
* package-version-rel/
* package name can contain hyphens, so parse from the back- go back
* two hyphens and we have split the version from the name.
*/
char *tmp, *p, *q;
if(target == NULL || pkg == NULL) {
return(-1);
}
STRDUP(tmp, target, RET_ERR(PM_ERR_MEMORY, -1));
p = tmp + strlen(tmp);
/* do the magic parsing- find the beginning of the version string
* by doing two iterations of same loop to lop off two hyphens */
for(q = --p; *q && *q != '-'; q--);
for(p = --q; *p && *p != '-'; p--);
if(*p != '-' || p == tmp) {
return(-1);
}
/* copy into fields and return */
if(pkg->version) {
FREE(pkg->version);
}
STRDUP(pkg->version, p+1, RET_ERR(PM_ERR_MEMORY, -1));
/* insert a terminator at the end of the name (on hyphen)- then copy it */
*p = '\0';
if(pkg->name) {
FREE(pkg->name);
}
STRDUP(pkg->name, tmp, RET_ERR(PM_ERR_MEMORY, -1));
free(tmp);
return(0);
}
int _alpm_db_populate(pmdb_t *db)
{
int count = 0;
struct dirent *ent = NULL;
struct stat sbuf;
char path[PATH_MAX];
ALPM_LOG_FUNC;
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
rewinddir(db->handle);
while((ent = readdir(db->handle)) != NULL) {
const char *name = ent->d_name;
pmpkg_t *pkg;
if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
continue;
}
/* stat the entry, make sure it's a directory */
snprintf(path, PATH_MAX, "%s%s", db->path, name);
if(stat(path, &sbuf) != 0 || !S_ISDIR(sbuf.st_mode)) {
continue;
}
pkg = _alpm_pkg_new();
if(pkg == NULL) {
return(-1);
}
/* split the db entry name */
if(splitname(name, pkg) != 0) {
_alpm_log(PM_LOG_ERROR, _("invalid name for database entry '%s'\n"),
name);
_alpm_pkg_free(pkg);
continue;
}
/* explicitly read with only 'BASE' data, accessors will handle the rest */
if(_alpm_db_read(db, pkg, INFRQ_BASE) == -1) {
_alpm_log(PM_LOG_ERROR, _("corrupted database entry '%s'\n"), name);
_alpm_pkg_free(pkg);
continue;
}
pkg->origin = PKG_FROM_CACHE;
pkg->origin_data.db = db;
/* add to the collection */
_alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",
pkg->name, db->treename);
db->pkgcache = alpm_list_add(db->pkgcache, pkg);
count++;
}
db->pkgcache = alpm_list_msort(db->pkgcache, count, _alpm_pkg_cmp);
return(count);
}
/* Note: the return value must be freed by the caller */
static char *get_pkgpath(pmdb_t *db, pmpkg_t *info)
{
size_t len;
char *pkgpath;
len = strlen(db->path) + strlen(info->name) + strlen(info->version) + 3;
MALLOC(pkgpath, len, RET_ERR(PM_ERR_MEMORY, NULL));
sprintf(pkgpath, "%s%s-%s/", db->path, info->name, info->version);
return(pkgpath);
}
int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
{
FILE *fp = NULL;
char path[PATH_MAX];
char line[513];
char *pkgpath = NULL;
ALPM_LOG_FUNC;
if(db == NULL) {
RET_ERR(PM_ERR_DB_NULL, -1);
}
if(info == NULL || info->name == NULL || info->version == NULL) {
_alpm_log(PM_LOG_DEBUG, "invalid package entry provided to _alpm_db_read, skipping\n");
return(-1);
}
if(info->origin == PKG_FROM_FILE) {
_alpm_log(PM_LOG_DEBUG, "request to read database info for a file-based package '%s', skipping...\n", info->name);
return(-1);
}
/* bitmask logic here:
* infolevel: 00001111
* inforeq: 00010100
* & result: 00000100
* == to inforeq? nope, we need to load more info. */
if((info->infolevel & inforeq) == inforeq) {
/* already loaded this info, do nothing */
return(0);
}
_alpm_log(PM_LOG_FUNCTION, "loading package data for %s : level=0x%x\n",
info->name, inforeq);
/* clear out 'line', to be certain - and to make valgrind happy */
memset(line, 0, 513);
pkgpath = get_pkgpath(db, info);
if(access(pkgpath, F_OK)) {
/* directory doesn't exist or can't be opened */
_alpm_log(PM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'\n",
info->name, info->version, db->treename);
goto error;
}
/* DESC */
if(inforeq & INFRQ_DESC) {
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
if(fgets(line, 256, fp) == NULL) {
break;
}
_alpm_strtrim(line);
if(strcmp(line, "%NAME%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
if(strcmp(_alpm_strtrim(line), info->name) != 0) {
_alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: name "
"mismatch on package %s\n"), db->treename, info->name);
}
} else if(strcmp(line, "%VERSION%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
if(strcmp(_alpm_strtrim(line), info->version) != 0) {
_alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: version "
"mismatch on package %s\n"), db->treename, info->name);
}
} else if(strcmp(line, "%FILENAME%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
STRDUP(info->filename, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%DESC%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
STRDUP(info->desc, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%GROUPS%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->groups = alpm_list_add(info->groups, linedup);
}
} else if(strcmp(line, "%URL%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
STRDUP(info->url, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%LICENSE%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->licenses = alpm_list_add(info->licenses, linedup);
}
} else if(strcmp(line, "%ARCH%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
STRDUP(info->arch, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%BUILDDATE%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
_alpm_strtrim(line);
char first = tolower(line[0]);
if(first > 'a' && first < 'z') {
struct tm tmp_tm = {0}; //initialize to null incase of failure
setlocale(LC_TIME, "C");
strptime(line, "%a %b %e %H:%M:%S %Y", &tmp_tm);
info->builddate = mktime(&tmp_tm);
setlocale(LC_TIME, "");
} else {
info->builddate = atol(line);
}
} else if(strcmp(line, "%INSTALLDATE%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
_alpm_strtrim(line);
char first = tolower(line[0]);
if(first > 'a' && first < 'z') {
struct tm tmp_tm = {0}; //initialize to null incase of failure
setlocale(LC_TIME, "C");
strptime(line, "%a %b %e %H:%M:%S %Y", &tmp_tm);
info->installdate = mktime(&tmp_tm);
setlocale(LC_TIME, "");
} else {
info->installdate = atol(line);
}
} else if(strcmp(line, "%PACKAGER%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
STRDUP(info->packager, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%REASON%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
info->reason = (pmpkgreason_t)atol(_alpm_strtrim(line));
} else if(strcmp(line, "%SIZE%") == 0 || strcmp(line, "%CSIZE%") == 0) {
/* NOTE: the CSIZE and SIZE fields both share the "size" field
* in the pkginfo_t struct. This can be done b/c CSIZE
* is currently only used in sync databases, and SIZE is
* only used in local databases.
*/
if(fgets(line, 512, fp) == NULL) {
goto error;
}
info->size = atol(_alpm_strtrim(line));
/* also store this value to isize if isize is unset */
if(info->isize == 0) {
info->isize = info->size;
}
} else if(strcmp(line, "%ISIZE%") == 0) {
/* ISIZE (installed size) tag only appears in sync repositories,
* not the local one. */
if(fgets(line, 512, fp) == NULL) {
goto error;
}
info->isize = atol(_alpm_strtrim(line));
} else if(strcmp(line, "%MD5SUM%") == 0) {
/* MD5SUM tag only appears in sync repositories,
* not the local one. */
if(fgets(line, 512, fp) == NULL) {
goto error;
}
STRDUP(info->md5sum, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%REPLACES%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->replaces = alpm_list_add(info->replaces, linedup);
}
} else if(strcmp(line, "%FORCE%") == 0) {
info->force = 1;
}
}
fclose(fp);
fp = NULL;
}
/* FILES */
if(inforeq & INFRQ_FILES) {
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(fgets(line, 256, fp)) {
_alpm_strtrim(line);
if(strcmp(line, "%FILES%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->files = alpm_list_add(info->files, linedup);
}
} else if(strcmp(line, "%BACKUP%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->backup = alpm_list_add(info->backup, linedup);
}
}
}
fclose(fp);
fp = NULL;
}
/* DEPENDS */
if(inforeq & INFRQ_DEPENDS) {
snprintf(path, PATH_MAX, "%sdepends", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
fgets(line, 255, fp);
_alpm_strtrim(line);
if(strcmp(line, "%DEPENDS%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
pmdepend_t *dep = _alpm_splitdep(_alpm_strtrim(line));
info->depends = alpm_list_add(info->depends, dep);
}
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->optdepends = alpm_list_add(info->optdepends, linedup);
}
} else if(strcmp(line, "%CONFLICTS%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->conflicts = alpm_list_add(info->conflicts, linedup);
}
} else if(strcmp(line, "%PROVIDES%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->provides = alpm_list_add(info->provides, linedup);
}
}
}
fclose(fp);
fp = NULL;
}
/* DELTAS */
if(inforeq & INFRQ_DELTAS) {
snprintf(path, PATH_MAX, "%sdeltas", pkgpath);
if((fp = fopen(path, "r"))) {
while(!feof(fp)) {
fgets(line, 255, fp);
_alpm_strtrim(line);
if(strcmp(line, "%DELTAS%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
pmdelta_t *delta = _alpm_delta_parse(line);
if(delta) {
info->deltas = alpm_list_add(info->deltas, delta);
}
}
}
}
fclose(fp);
fp = NULL;
}
}
/* INSTALL */
if(inforeq & INFRQ_SCRIPTLET) {
snprintf(path, PATH_MAX, "%sinstall", pkgpath);
if(access(path, F_OK) == 0) {
info->scriptlet = 1;
}
}
/* internal */
info->infolevel |= inforeq;
free(pkgpath);
return(0);
error:
free(pkgpath);
if(fp) {
fclose(fp);
}
return(-1);
}
int _alpm_db_prepare(pmdb_t *db, pmpkg_t *info)
{
mode_t oldmask;
int retval = 0;
char *pkgpath = NULL;
oldmask = umask(0000);
pkgpath = get_pkgpath(db, info);
if((retval = mkdir(pkgpath, 0755)) != 0) {
_alpm_log(PM_LOG_ERROR, _("could not create directory %s: %s\n"), pkgpath, strerror(errno));
}
free(pkgpath);
umask(oldmask);
return(retval);
}
int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
{
FILE *fp = NULL;
char path[PATH_MAX];
mode_t oldmask;
alpm_list_t *lp = NULL;
int retval = 0;
int local = 0;
char *pkgpath = NULL;
ALPM_LOG_FUNC;
if(db == NULL || info == NULL) {
return(-1);
}
pkgpath = get_pkgpath(db, info);
/* make sure we have a sane umask */
oldmask = umask(0022);
if(strcmp(db->treename, "local") == 0) {
local = 1;
}
/* DESC */
if(inforeq & INFRQ_DESC) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s DESC information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
retval = -1;
goto cleanup;
}
fprintf(fp, "%%NAME%%\n%s\n\n"
"%%VERSION%%\n%s\n\n", info->name, info->version);
if(info->desc) {
fprintf(fp, "%%DESC%%\n"
"%s\n\n", info->desc);
}
if(info->groups) {
fputs("%GROUPS%\n", fp);
for(lp = info->groups; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->replaces) {
fputs("%REPLACES%\n", fp);
for(lp = info->replaces; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->force) {
fprintf(fp, "%%FORCE%%\n\n");
}
if(local) {
if(info->url) {
fprintf(fp, "%%URL%%\n"
"%s\n\n", info->url);
}
if(info->licenses) {
fputs("%LICENSE%\n", fp);
for(lp = info->licenses; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->arch) {
fprintf(fp, "%%ARCH%%\n"
"%s\n\n", info->arch);
}
if(info->builddate) {
fprintf(fp, "%%BUILDDATE%%\n"
"%ju\n\n", (uintmax_t)info->builddate);
}
if(info->installdate) {
fprintf(fp, "%%INSTALLDATE%%\n"
"%ju\n\n", (uintmax_t)info->installdate);
}
if(info->packager) {
fprintf(fp, "%%PACKAGER%%\n"
"%s\n\n", info->packager);
}
if(info->isize) {
/* only write installed size, csize is irrelevant once installed */
fprintf(fp, "%%SIZE%%\n"
"%ju\n\n", (intmax_t)info->isize);
}
if(info->reason) {
fprintf(fp, "%%REASON%%\n"
"%u\n\n", info->reason);
}
} else {
if(info->size) {
fprintf(fp, "%%CSIZE%%\n"
"%ju\n\n", (intmax_t)info->size);
}
if(info->isize) {
fprintf(fp, "%%ISIZE%%\n"
"%ju\n\n", (intmax_t)info->isize);
}
if(info->md5sum) {
fprintf(fp, "%%MD5SUM%%\n"
"%s\n\n", info->md5sum);
}
}
fclose(fp);
fp = NULL;
}
/* FILES */
if(local && (inforeq & INFRQ_FILES)) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s FILES information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
retval = -1;
goto cleanup;
}
if(info->files) {
fprintf(fp, "%%FILES%%\n");
for(lp = info->files; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->backup) {
fprintf(fp, "%%BACKUP%%\n");
for(lp = info->backup; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
fclose(fp);
fp = NULL;
}
/* DEPENDS */
if(inforeq & INFRQ_DEPENDS) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s DEPENDS information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%sdepends", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
retval = -1;
goto cleanup;
}
if(info->depends) {
fputs("%DEPENDS%\n", fp);
for(lp = info->depends; lp; lp = lp->next) {
char *depstring = alpm_dep_get_string(lp->data);
fprintf(fp, "%s\n", depstring);
free(depstring);
}
fprintf(fp, "\n");
}
if(info->optdepends) {
fputs("%OPTDEPENDS%\n", fp);
for(lp = info->optdepends; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->conflicts) {
fputs("%CONFLICTS%\n", fp);
for(lp = info->conflicts; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->provides) {
fputs("%PROVIDES%\n", fp);
for(lp = info->provides; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
fclose(fp);
fp = NULL;
}
/* INSTALL */
/* nothing needed here (script is automatically extracted) */
cleanup:
umask(oldmask);
free(pkgpath);
if(fp) {
fclose(fp);
}
return(retval);
}
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info)
{
int ret = 0;
char *pkgpath = NULL;
ALPM_LOG_FUNC;
if(db == NULL || info == NULL) {
RET_ERR(PM_ERR_DB_NULL, -1);
}
pkgpath = get_pkgpath(db, info);
ret = _alpm_rmrf(pkgpath);
free(pkgpath);
if(ret != 0) {
ret = -1;
}
return(ret);
}
/* vim: set ts=2 sw=2 noet: */

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more