Commit Graph

5750 Commits

Author SHA1 Message Date
Andrew Gregory f0c351b3fa alpm.h: remove outdated pkg_get_backup doxygen
alpm_pkg_get_backup hasn't returned strings since
54ef162a1a in 2011.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:43:16 +10:00
Allan McRae d02efd2f20 Check the version of the local database during validation
When we check the database version directly, there is no longer a
need to scan for depends files.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:43:05 +10:00
Allan McRae 1660ed3cf9 Add version file to empty local database
If a user manually creates the local database directory, or has an empty
local database for some other reason, we silently add a version file

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:27:11 +10:00
Allan McRae 7e9ad22ac2 Add version file when creating local database directory
The version of the local pacman database is stored in its root in the file
ALPM_DB_VERSION.  The version is starting at 9, corresponding to the
next libalpm library version.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:26:55 +10:00
Allan McRae d3f5ab0e70 Create local database directory if it is missing
This means that a missing local database becomes an error (as it
should be immediately created).  Note this only creates the "local"
directory and not its parent, which is checked for during locking.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:25:45 +10:00
Andrew Gregory 793b9c3b42 Extend database upgrade script to handle alpm db version 9
Original-work-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:25:44 +10:00
Andrew Gregory e4773b1b82 pacman-db-upgrade: use pacman-style options
* convert dbpath from argument to option
* add --config and --root options
* read dbpath and root from config file
* if root is set but not dbpath, dbpath is set relative to root

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-16 20:05:42 +10:00
Andrew Gregory 8bf2c753f5 fix improper FREELIST calls
* conflicts need to be freed with alpm_conflict_free
* sync dbs need to be unregistered and are handled by alpm_release

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-16 20:03:33 +10:00
Dave Reisner d9cf14ff1d updpkgsums: use a throwaway build dir
This prevents updpkgsums from potentially dirtying an otherwise pristine
directory (likely $PWD) when makepkg creates the srclinks.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-15 09:33:07 +10:00
lolilolicon ee207d7c7b makepkg: do not eval dlcmd
This eval enables the following in a PKGBUILD to "just work":

  source=('$pkgname-$pkgver.tar.gz'::'https://host/$pkgver.tar.gz')

This has at least two problems:

- It violated the principle of least surprise.
- It could be a security issue since URLs are arbitrary input.

Instead, expand the dlagent command line into an array, replace the %o,
%u place holders, and run the resultant command line as is.

Embedded spaces in the DLAGENTS entry can be escaped with a backslash.

Fixes FS#41682

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-15 09:32:29 +10:00
William Giokas 95e1a1ef82 makepkg: Allow using sources with :: in them
Git has the ability to use helper applications for interfacing with hg,
and from what we had before, the following url::

  foo::git+hg::http://foo.bar/foobar

would get converted to something along the lines of:

  filename: foo
  URL: http://foo.bar/foobar

and the 'git+hg' part would essentially be ignored when it's getting set
up in the 'get_protocol' and 'get_downloadclient' functions. With this
patch it is possible to have a source link with '::' in it, however it
is not possible to have a filename with '::', which is the current
behavior.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-15 09:30:54 +10:00
Dave Reisner 38b6de937c paccache: read default cachedir from pacman.conf
Implements FS#40738.
2014-09-15 09:27:21 +10:00
Maxim Andersson 8122fae51a paccache: add support for multiple cachedirs
Signed-off-by: Maxim Andersson <thesilentboatman@gmail.com>
2014-09-15 09:27:07 +10:00
Dave Reisner b00269d9c8 PKGBUILD(5): arch-specific fields are always additional
Change e10775340 should have included this.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-15 09:26:47 +10:00
Allan McRae 879e4665c4 pacman-key: stricter parsing for -verify
Prevents trust being spoofed by using TRUST_FULLY in the signatory's name
or in an added notation.

Fixes FS#41147.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 17:29:08 +10:00
Jason St. John 3e19cd366a pkgdelta(8): Fix broken example of --min-pkg-size with human-readable values
The example for human-readable values must not contain a space between
the value and the unit; otherwise, pkgdelta will not recognize the
command options and will error out.

In prose, however, there should be a space between the value and the
unit.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 14:19:28 +10:00
Jason St. John ab07dfdeb9 man: Improve grammar and add missing single quotes around command options
Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 14:18:59 +10:00
Jason St. John 37634d22e5 man: Use uniform line spacing between sections
Remove blank lines immediately following section headings.
Ensure two blank lines before the start of a new section.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 14:09:33 +10:00
Jason St. John db14815f46 pacman(8): Improve grammar and quoting
Notable changes:
* Add double quotes around printf-like formatting options for "--print-format"
* Add a missing backslash in '--force'

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 14:08:41 +10:00
Olivier Brunel 99a5017f55 Fix loading invalid package
In 5acfa65f when adding a new variable (hit_mtree), the initialization of a
variable (config) was dropped, which could lead to loading invalid package
files, i.e. files that aren't archive (no metadata loaded) would return a new
alpm_pkg_t with everything set to 0/NULL.

Depending on the operation/use of the package, this could lead to segfault.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 14:08:41 +10:00
Dave Reisner 17ed9eb734 makepkg: replace bare eval with var extraction functions 2014-08-08 13:44:40 +10:00
Dave Reisner 2b556d89de PKGBUILD: handle arch specific attributes
This introduces support for architecture-specific conflicts, depends,
optdepends, makedepends, replaces, and conflicts by appending "_$CARCH"
to the array name. For example, in the global section:

  arch=('i686' 'x86_64')
  depends=('foo')
  depends_x86_64=('bar')

This will generate depends of 'foo' and 'bar' on x86_64, but only 'foo'
on i686. Moreover, this is supported in the package functions with the
same heuristics as the generic names, e.g.

  ...
  arch=('i686' 'x86_64')
  depends=('foo')
  ...

  package_somepkg() {
    depends_x86_64=('bar')

    ...
  }

Again, will cause x86_64 to have depends of 'foo' and 'bar', but only
'foo' for i686.
2014-08-08 13:44:25 +10:00
Dave Reisner cbd6c300b5 makepkg: refactor check_sanity, give it some sanity of its own
Break apart each of the blocks into their own separate functions. And,
instead of the hand crafted eval statements, reuse the logic from
pkgbuild-introspection[0] to abstract away the complexities of parsing
bash.

This commit fixes at least 3 bugs in check_sanity:

1) The wrong variable is shown for the error which would be thrown
when, e.g.  pkgname=('foopkg' 'bar^pkg')
2) The "arch" variable is not sanity checked when the PKGBUILD has
an arch override, but only one output package.
3) https://bugs.archlinux.org/task/40361

Lastly, there's some string changes here which should help to clarify
a few errors emitted in the linting process.

[0] https://github.com/falconindy/pkgbuild-introspection
2014-08-08 13:44:00 +10:00
Allan McRae 8d5d7f6761 Update PKGBUILD documentation for removed override options
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-08 13:41:27 +10:00
Dave Reisner 8a02abcf19 makepkg: disallow pkgver/pkgrel/epoch overrides in packages
This is a confusing feature, and no one uses it.
2014-08-08 13:40:00 +10:00
Dave Reisner b694d84554 remove --destination-dir argument from a2x options
This option is only for HTML output, and we're building manpages here.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-08 13:35:41 +10:00
Allan McRae 1431d244f7 Add Andrew to maintainers list.
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 16:18:18 +10:00
Andrew Gregory 574e45df28 trans_commit: log beginning and end of transaction
This makes it clear whether a transaction successfully completed and
allows log parsers to group related actions.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Ryo Munakata 7c75564af9 filecache_find_url: dereference the 'filebase' pointer
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory 2025279eb6 replace strdup with STRDUP
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory d981f93f18 sync.c: fix style violations
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory 4ccf49d3e7 pacman.c: simplify stdin parsing
Incorporate memory exhaustion and end-of-stream
checks into the main loop.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory 0bf4ae726d handle_unlock: log error when lock file is missing
Problems due to concurrent running instances of pacman can be difficult
to diagnose.  Log a warning to make it more obvious that that's what
happened, that it's a bad idea, and hopefully encourage people who do
things like removing the lock file to run pacman from an install script
to at least be courteous enough to put it back when they're done.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory 03b9bf08ac handle_unlock: log lock removal failure
Rather than have individual callers log failure, just
do it directly in _alpm_handle_unlock.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory 7f1360b440 signing.c: remove useless error check
CHECK_ERR checks gpg_err which is a local variable.  Calling
gpg_op_import_result cannot modify it.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory f4992960ad deps.c: use alpm_list_find_ptr
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory 0c43198ee0 dep_graph_init: filter ignored packages by name
Ignored packages are from the transaction remove list which consists of
duplicated packages so a direct pointer comparison is not appropriate.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory 22e478d203 pactest: delay test object creation
The actual test object is only used to run the test.  Storing test cases
as strings limits the test object scope and allows it to be garbage
collected, reducing memory usage when multiple tests are run.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory 85c80542a5 pactest: only snapshot needed files
Only a few of our tests need file snapshots at all and most of them only
need a few files.  Taking snapshots of the entire test environment for
every single test is a massive waste.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory 32413ad44b handle: factor out string list option handling
Consolidates repeated code and replaces dangerous
strdup calls with STRDUP.

Also fix a couple variables named "pkg" that
refer to file paths.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Allan McRae dce82f9d19 makepkg: skip dependency checking with --verifysource
Dependencies are now handled with --nobuild unless specificially skipped.
Using --verifysource will skip dependency checks unless --syncdeps is
specified.

Fixes FS#35057 and FS#36999.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Allan McRae 7e87614665 makepkg: ensure vcs download tool are installed when required
Add an array VCSCLIENTS to makepkg.conf that matches vcs source protocols
to the package containing the software needed for handling the source.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:56 +10:00
Dave Reisner fbb0945bfb makepkg: improve check and error message for buildfile location
The documentation very clearly states that the buildfile has to be in
$PWD, but the error thrown by makepkg reference some mysterious "build
directory". Simplify this check so that we more directly check that the
file being referred to is in fact in our $PWD. Revise the error message
when the check fails to more plainly point out the problem.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-03 18:46:32 +10:00
Andrew Gregory 9506409c3f sync_prepare: remove useless check for replacers
Since 017184fa, alpm_sync_sysupgrade will not add both a replacement and
a literal upgrade to the transaction.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-03 18:46:32 +10:00
Andrew Gregory 71da296d01 check_pkg_fast: check file type
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Andrew Gregory c3835c157a check_file_exists: replace lstat with llstat
Paths are constructed directly from package file lists and may contain
trailing slashes, causing lstat to dereference symlinks.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Andrew Gregory bbeced26f6 llstat: modify path in place
This makes llstat's signature differ from lstat's, but we never actually
use it on a const string and this saves a large number of strdup's.
This also allows stripping multiple trailing slashes and corrects a bug
where calling llstat on "/" would result in calling lstat on an empty
string.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Andrew Gregory e8de265f80 move _alpm_lstat into util-common
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Andrew Gregory 0e2db97a42 add test for file type check with -Qk
If a directory has been replaced by a symlink, -Qk currently stats the
symlink target rather than the symlink itself and doesn't check that the
actual file type matches the package file list.  This will make it
difficult to discover errors once 4.2 is released and replacing
directories with symlinks is no longer supported.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Allan McRae 79548e0d78 pacdiff: allow DIFFPROG to contain commandline options
Also use 'vim -d' as default diff viewer.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-03 18:46:32 +10:00