If someone gives the pacman binary setuid permissions, the geteuid check
allows it to start running but subsequently fail. As we do not support
setting pacman setuid, use getuid to check permissions instead.
FS#37174.
Signed-off-by: Vladimir A. Nazarenko <naszar@ya.ru>
Signed-off-by: Allan McRae <allan@archlinux.org>
This allows existing front-ends other than pacman to continue working
normally.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Detecting indirect dependencies by traversing a package's entire
dependency tree is prohibitively slow for larger transactions. Instead
add local packages to the dependency graph. This additionally requires
delaying dependency ordering for sync operations so that removed
packages may be excluded from dependency detection.
tests/sync012.py was also updated to ensure that the dependency cycle
was actually detected.
Fixes FS#37380
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Validate the new pkgver efore blindly ramming it into the PKGBUILD.
This gives us good feedback and prevents corrupting the PKGBUILD, e.g.
==> Starting pkgver()...
==> ERROR: pkgver is not allowed to contain colons, hyphens or whitespace.
==> ERROR: pkgver() generated an invalid version: a horse is not a pkgver
As an additional failsafe, exchange a valid for invalid character as
command separator in @SEDINPLACE@ expressions. For even more paranoia,
exit if sed fails for any reason.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Currently you can manually create and then install a package with a
version not containing a pkgrel. The created local database entry is
invalid as the directory name can not be split by _alpm_splitname due
to the assumtion of hyphens separating name-pkgver-pkgrel.
Ensure the package has a valid version when it is loaded. Fixes FS#35514.
Signed-off-by: Allan McRae <allan@archlinux.org>
On 32bit systems, the progress bar intergrity checking can show values
greater than 100% with large transactions. This is due to the total
size of all package files being greater than a size_t. Use uint64_t
for these sizes.
Fixes FS#36608
Signed-off-by: Allan McRae <allan@archlinux.org>
$ ./autogen.sh
./autogen.sh: 3: ./autogen.sh: BASH_SOURCE: parameter not set
The -u flag causes this (and lots of other mysterious problems). Since
there aren't even any variables in this script, it makes no sense to
use it.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
If any package in a sync transaction is missing a required signature,
we give an uninformative error message (which may or may not state that
the missing signature is the issue). Always output the package with
the missing signature.
Signed-off-by: Allan McRae <allan@archlinux.org>
Function pointer gets uselessly compared for NULL in
every iteration. Move the condition to do it just once.
Signed-off-by: slavomir vlcek <svlc@inventati.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Reported by 2to3: optional in Python 2, but required in 3.
Signed-off-by: Jeremy Heiner <ScalaProtractor@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Reported by 2to3. Python 3 throws out the old range, renames the old
xrange to be the new range, leaving no xrange. A shim could be used,
but using the less efficient version does not have a noticeable impact
on the run time. This observed (lack of an) effect is as described in
the Python 2 docs for xrange. The largest range created is only 1000
elements big, and the memory cost of those ranges is negligible when
compared to that of all the pmpkg instances created.
Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
The .items, .keys, and .values methods in Python 2 make copies, so the
test framework uses the .iter* flavors of those methods. But in Python
3 those .iter* (and even the 2.7 .view*) flavors are removed and the
original methods return views.
Measurements were taken under Python2 to see what impact the copying
had, and there was none. Thus it is not worth the effort to avoid.
Reported as a compatibility issue by 2to3.
Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This was the only compatibility issue reported by "python2 -3".
Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Prior to this a test that used a feature too new for the runtime would
blow up when it was "exec"d (possibly in the middle of a run of a
bunch of tests) with an error message that was not very helpful.
Remove Python 2.5 and 2.6 runtimes from the list configure searches.
2.5 suffers the problem described above. The code currently will run
on 2.6 but, as was noted on the dev list, that runtime is at the end
of its life, so 2.7 is a better cutoff.
Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
On invalid combinations of flags we were only printing the unhelpfully
vague message "invalid option".
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
PKG_LOCALITY_LOCAL was confusing because the enum is used with -Q, so
all packages are "local". Also reversed the config->op_q_locality
assignment so that the locality matches the option used.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Running an install script does not fall under "Adds/removes the database
entry only."
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
--print-format is totally useless without --print. Implying --print
will also save us the hassle of checking it when we add transaction
option validation.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Removes the overlap between optflags for different operations that
allowed non-sensical combinations of flags such as:
$ pacman -Si --changelog $package
--changelog is -c, meaning --clean for -S
$ pacman -Q --sysupgrade
--sysupgrade is -u, meaning --upgrades for -Q
Also add a few missing braces.
Original-work-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
strsplit was used in only one place and did the same thing as strtok.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
These targets were part of the old test suite and no longer exist.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
The truncation helped back when the test output appeared when run via
make. But now "make check" logs that output, and it makes little sense
to log the truncated rules.
Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This points makepkg to where is library is located. Can be
overridden by value in the environment.
Signed-off-by: Allan McRae <allan@archlinux.org>
[Ashley: Rebased]
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
Build makepkg to scripts/.lib/makepkg and add a wrapper script to
call it. This is not useful at the moment, but is the first step
to allowing makepkg to be split into smaller pieces.
Signed-off-by: Allan McRae <allan@archlinux.org>
[Ashley: rebased]
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
The separation between downloading and extracting for non-vsc sources
was incomplete due to symlinks being made in $srcdir during the download
stage. Have download_{local,file} just ensure the presence of the files
in $startdir or $SRCDEST (downloading if needed) and then have
extract_file symlink these files into $srcdir.
Also replace "continue" with "return" in extract_file to make it clearer
what is happening.
Signed-off-by: Allan McRae <allan@archlinux.org>
patch -N ignores the previously applied patch but still returns 1.
This causes a git build with a reused source directory to fail.
Signed-off-by: Allan McRae <allan@archlinux.org>
This causes make to update TESTS when tests are added (or updated).
For simplicity, this changes TESTS from a single multi-line list to
individually appending each test file.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
[Allan: use C locale for sorting]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>