Commit Graph

2206 Commits

Author SHA1 Message Date
Dan McGee 636610432a Allow GIT version to be used in pacman builds
Add a new configure flag, --enable-git-version, that allows the output of
'git describe' to be used in the version string associated with this
package. This could aid in debugging for users that are using a development
version of pacman and we should be able to figure out which cut of code they
are using.

Sample output:
$ pacman --version
Pacman v3.1.4-190-g4cfa-dirty - libalpm v2.3.1

$ makepkg --version
makepkg (pacman) 3.1.4-190-g5861-dirty

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-31 12:06:34 -05:00
Dan McGee 54e1e3e642 Fix versioncmp regression after update
Commit 8428367285 introduced the regression,
and a previous commit introduced the vercmptest.sh test script to track down
these issues. This commit solves the problem by removing the previous
attempt at locating the pkgrel portions and replacing it with something that
performs the correct logic.

While tracking down everything I needed to, I also found a mistake in one of
the pactests which is fixed here as well as increased the functionality and
verbosity of the vercmptest script to both print out each test it is running
as well as automatically run the mirror of each test case.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-30 16:54:15 -05:00
Dan McGee 2cd0a87b3f Add simple vercmp test script
Commit 8428367285 updated the versioncmp code
in libalpm. Unfortunately for us, it also introduced the regression that
becomes apparant with the following upgrade:

warning: sonata: local (1.5-2) is newer than extra (1.5.1-2)

Add a vercmptest.sh test script that is run during the make check phase
which now points out three regressions in the version comparison function
that will need fixing. All current tests in this script pass with the old
versioncmp code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 17:25:37 -05:00
Dan McGee b48f703aa6 Add missing NULL set in group printing
If we don't set the pkgname var to NULL, we run into all sorts of beautiful
segfault behavior when a group spans multiple repositories and we try to
print out the location of the former list. Easy fix.

This regression was introduced in bf86700369.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 17:25:07 -05:00
Dan McGee 009f89c4d2 Merge branch 'maint' 2008-05-29 06:39:38 -05:00
Geoffroy Carrier b32aa81b5e Add trailing / to DESTDIR for stupid Makefiles.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:21 -05:00
Allan McRae 62ee1bfff0 Tidy up of the handle struct in libalpm
Removed unused handle->uid from pmhandle_t. The need to check permissions
should be determined by the frontend (and is in pacman).

Fixed comment on noextract in pmhandle_t.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:21 -05:00
Xavier Chantry 1cca4ef764 Remove PM_TRANS_EVT_EXTRACT_START.
This event was unused, was missing the equivalent EXTRACT_DONE event, and
was useless because we already have ADD / UPGRADE START and DONE events.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:21 -05:00
Xavier Chantry b262ddb2ed be_files : stores REPLACES and FORCE in desc.
repo-add and db_read both assume that REPLACES and FORCE fields are in the
desc file, so do that for db_write as well (instead of depends file).

Note that db_write is currently only used on the local database. And the
only purpose of replaces and force in local database is for information
purpose (available on -Qi operations). So this is not a big problem.

Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-May/011859.html

Acked-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:20 -05:00
Allan McRae f30dab4b5a Pactests for sync operations with NoUpgrade and NoExtract
This adds the sync equivalents of upgrade010.py and upgrade070.py.
Both additional test pass.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Acked-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:20 -05:00
Allan McRae c1a5616c26 makepkg - add check for valid options in PKGBUILD
This patch removes the code block in makepkg that checked for depreciated
options in a PKGBUILD and provided a workaround.  Unknown and depreciated
options are upgraded to error conditions.

Also, removed TODO regarding including install script if exists and $install
is unset.  That should never happen.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:20 -05:00
Nagy Gabor da1c11cc30 Add some verbosity to _alpm_db_read.
Name and version are computed from "/var/lib/pacman/..." pathname. And the
%NAME% and %VERSION% fields from the desc file were not even read. So now,
when we read the desc file, we make sure the %NAME% and %VERSION% fields are
consistent.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:20 -05:00
Nagy Gabor ad54b28680 Fix for remove052.py by moving recursedeps before checkdeps.
In the case of -Rs operation, first pulling the dependencies with
recursedeps before calling checkdeps takes care of the dependency chain of
remove052 pactest.

In the case of -Rcs, we can keep the old behavior because we have no problem
there (any dependency returned by checkdeps will be added to the remove list
because of -Rc) and we have to run recursedeps on the final remove list
anyway to catch all orphans.

Ref.: http://www.archlinux.org/pipermail/pacman-dev/2008-April/011569.html

Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:20 -05:00
Allan McRae ae40d1c05b Pactest for removing multiple items in a dependency chain.
This adds a test for when removing multilpe packages recursively from a
chain of dependent packages. This situation can occur when removing
installed dependencies with makepkg if a "makedepend" recursively depends on
a "depend" or if redundant dependancies are included.

Signed-off-by: Allan McRae <mcrae_allan at hotmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:19 -05:00
Allan McRae 9577c07d86 No error in makepkg when removing deps fails
Catches error from when pacman is unable to remove dependencies after
successfully building package and prints warning.  Fixes FS#10039.

Signed-off-by: Allan McRae <mcrae_allan at hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:19 -05:00
Sebastian Nowicki c33cabd675 Use chown 0:0 instead of root.root
On BSD systems using a dot as a separator is not allowed. On Mac OSX it
is deprecated. A colon should be used instead. BSD systems also use the
"wheel" group instead of "root" to indicate the "super user" group. Both
groups use the id of 0.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Acked-by: Aaron Griffin <aaronmgriffin@gmail.com>
Acked-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:14 -05:00
Sebastian Nowicki 20ae871940 Use "legacy mode" on Mac OSX (for file command)
For some reason `file` on Mac OSX has different arguments than BSD and
Linux; -i no longer prints out the mime strings. With the environment
variable COMMAND_MODE set to "legacy", `file` behaves more like it does
on Linux and BSD, i.e., `file -i` prints the mime type.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Acked-by: Dan McGee <dan@archlinux.org>
Acked-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:14 -05:00
Sebastian Nowicki b9369a747d Allow an unprivileged user to create packages without fakeroot
When fakeroot was not in BUILDENV and the user was not root, makepkg still
tried to use fakeroot for building packages.
BUILDENV is now checked to see if fakeroot is enabled. If it is not enabled the
package can still be built, but root will not have ownership of files. This is
useful when users want to make packages for personal use and don't care about
ownership.

Closes FS#10450.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:14 -05:00
Xavier Chantry 149839c539 du -b is not available on BSD, use du -k instead.
This fixes FS#10459.

There is apparently no portable ways to get the apparent size of a file,
like du -b does. So the best compromise seems to get the block size in kB,
and then convert that to byte so that we keep compatibility.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:14 -05:00
Sebastian Nowicki 1d71079c5b Replace usage of "cp -s" with the more portable "ln -s"
The "-s" argument does not exist on BSD, and neither does
"--remove-destination". This patch replaces the calls to "cp -s
--remove-destination" with the equivalent "rm -f" and "ln -s" calls, in
order to increase portability.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:13 -05:00
甘露(Lu.Gan) 398d4aff2d Update of Chinese simplified pacman translation.
Some small adjustements according to feedback from users of chinese forum.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-05-17 12:17:53 +02:00
Dan McGee bf2964dc58 Fix compilation warning on x86_64
Glad we have so many developers using this as their native architecture.
int/size_t issue here.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-14 19:38:58 -05:00
Xavier Chantry fb09d35e6a Disable geteuid in cygwin.
This is one of those rare cases where we actually want to code in a
platform-specific #ifdef. Because you don't need to be the root user on a
Windows box, and fakeroot doesn't exist so we can do easy testing, lets
disable any checking of the UID.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-14 09:17:02 -05:00
Xavier Chantry 33e3182dbd pactest: only use fakeroot when it is found.
Only use fakeroot and fakechroot when they are found AND required.
fakechroot only had the first condition, and fakeroot only the second.

When they are required (user != root) but not found, display a warning.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-14 09:15:14 -05:00
Dan McGee a8ee185413 Remove wrapper call around versioncmp
Actually, just rename _alpm_versioncmp to alpm_pkg_vercmp and get rid of the
need for a wrapper since it did nothing anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-14 00:37:51 -05:00
Dan McGee 8428367285 Update _alpm_versioncmp
This code hasn't been looked at in some time. I grabbed a more recent
version of the RPM source (4.4.2.3) and attempted to sync up any changes
they have made, as well as make the libalpm additional code much cleaner and
limited to only a few added lines of code.

The size of this patch might make you think we added code, but bloat-o-meter
actually tells us otherwise:
<function>                                 <old>   <new>  <diff>
_alpm_versioncmp                            1485    1021    -464

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-14 00:30:04 -05:00
Dan McGee dd98aa8564 Simplify _alpm_pkg_new()
Any real call of this function doesn't specify a name or version ahead of
time, so just kill that functionality off. Now to remove those dummy
packages...

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 19:03:54 -05:00
Dan McGee a422f6e39c Remove lazy init code from pkg name and version functions
If we have a package without name and/or version, we are really out of luck.
Speed these functions up by removing unnecessary code. Note that both the
splitname and pkg_load functions, where the name and version of packages are
initially populated for databases and pkg.tar.gz files respectively, enforce
that every new package struct created has a name and version.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 18:56:55 -05:00
Xavier Chantry f671147282 Fix rewinddir regression by cleaning up db_scan
Commit 0460038447 caused a regression when
rereading the pkgcache after updating the on-disk databases. A rewinddir
call was errantly removed.

Instead of replacing the call to rewindir, clean up this whole mess.
db_scan is used only once and with target == NULL so there was actually half
the code of db_scan which was unused. This is gone now and replaced by a
single new db_populate function.

Dan: add_sorted ended up being 3x slower than one msort at the end, so I
changed back to that. I also made one pointer variable const and merged this
whole patch with my original fix for the rewinddir issue.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 18:44:13 -05:00
Dan McGee ae5ef3b90f Remove --builddeps from makepkg
This really should be in an external script, as it is not makepkg's job to
rebuild your system.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 16:01:34 -05:00
Dan McGee 584ffa6aef Remove an outdated exception check in file conflict code
This has been around since at least pacman 2.9.8. Frugalware just dumped it
in commit 113ec73bfcfdc, and deleting it here and running pactest shows that
nothing that we have actually tested changes. If someone can pactest the
edge case where this is needed, then show me the money.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 15:49:02 -05:00
Chantry Xavier d5278ebb3b Add SyncFirst option.
This patch offers a way to fix FS#9228.
By putting "SyncFirst = pacman" in pacman.conf, the version check will
happen before the transaction really starts, and before any replacements is
made.
Otherwise, no version check is done.

The sync301 pactest was updated to use this SyncFirst option.

Example session with SyncFirst = pacman, and a newer pacman version
available :
$ pacman -Su (or pacman -S <any targets>)
:: the following packages should be upgraded first :
    pacman
:: Do you want to cancel the current operation
:: and upgrade these packages now? [Y/n]

resolving dependencies...
looking for inter-conflicts...

Targets: pacman-x.y.z-t

Total Download Size:    x.xx MB
Total Installed Size:   x.xx MB

Proceed with installation? [Y/n] n

As Nagy previously noted, doing this check on any -S operations might look
intrusive, but it can be required.
For example, the case where you want to install a package with versioned
provisions, using a pacman version which didn't support that feature yet
(and there is already a newer pacman in sync db supporting it).

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 15:49:02 -05:00
Chantry Xavier f43805d875 Cleanup usages of alpm_list_find and alpm_list_remove.
* remove obsolete and unused *_cmp helper functions like deppkg_cmp and
_alpm_grp_cmp

* new alpm_list_remove_str function, used 6 times in handle.c

* remove _alpm_prov_cmp / _alpm_db_whatprovides and replace them by
a more general alpm_find_pkg_satisfiers with a cleaner implementation.
before: alpm_db_whatprovides(db, targ)
after: alpm_find_pkg_satisfiers(alpm_db_getpkgcache(db), targ)

* remove satisfycmp and replace alpm_list_find + satisfycmp usage by
_alpm_find_dep_satisfiers.
before : alpm_list_find(_alpm_db_get_pkgcache(db), dep, satisfycmp)
after : _alpm_find_dep_satisfiers(_alpm_db_get_pkgcache(db), dep)

* remove _alpm_pkgname_pkg_cmp, which was used with alpm_list_remove, and
use _alpm_pkg_find + alpm_list_remove with _alpm_pkg_cmp instead.

This commit actually get rids of all complicated and asymmetric _cmp
functions. I first thought these functions were worth it, be caused it
allowed us to reuse list_find and list_remove. But this was at the detriment
of the clarity and also the ease of use of these functions, dangerous
because of their asymmetricity.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 15:49:02 -05:00
Nagy Gabor 8248b4bfb1 Swap the parameters of alpm_pkg_find
Now the syntax is coherent with alpm_list_find and alpm_sync_find.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 15:49:02 -05:00
Dan McGee e80232f24c Remove errant include of error.h
This doesn't exist anymore, the header file was removed a while back in
commit 4c872594da.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 15:49:02 -05:00
Dan McGee 663408532a Merge branch 'maint'
Conflicts:

	lib/libalpm/package.c - comment location moved to be_package.c
2008-05-11 20:14:30 -05:00
Dan McGee 13f24a5bda Refactor pkg_load/parse_descfile into a new backend file
alpm_pkg_load() and parse_descfile() are specific to getting information
from package files, just as other code is specific to getting information
into or out of a package database. Move this code out of package.c, which
should eventually only contain operators on the pmpkg_t struct that do not
depend at all on where the data came from.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-11 20:07:55 -05:00
Dan McGee 0460038447 Remove some useless abstraction and start db cleanup
We have some useless abstractions like an alpm_db_rewind function. I've read
somewhere that readdir() was the worst filesystem function call invented,
and what do we do? Add a wrapper around it. Kill this abstraction and move
some other things into be_files that should be there anyway because they
are so tied to how a files backend works.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-11 20:05:59 -05:00
Allan McRae 3c3cb001a4 Make all error messages use pm_fprintf
Tested using many easily generated error conditions.  Also added "malloc
failure" (conf.c) and "segmentation fault" (pacman.c) error messages for
translation.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
[Dan: fix trailing whitespace errors, other compilation issues]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-11 20:05:28 -05:00
Dan McGee 3175faace4 pactest: fix --gdb option
A libtool upgrade broke the gdb option as we need a MODE specified; add the
execute mode to the call.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-11 20:05:14 -05:00
Sebastian Nowicki e3d35b3274 Add detailed description to alpm_pkg_load
It was unclear what "loading the full package" actually did. The
detailed description should clear that up, without having to look at the
code.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 15:10:51 -05:00
Chantry Xavier 0bfc8adf37 contrib/paclist: list packages installed from given repo.
The paclist script provides a simple method for monitoring which packages
are installed from a given repo. This is particularly useful when using a
testing or unstable repository.

Thanks to Allan McRae for the idea and an initial bash script. As suggested
by Dan, I tried to rewrite in perl, and this resulted in much better
performance. Then Dan further cleaned up the script.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: add to Makefile & README, minor script cleanups]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 11:13:24 -05:00
Dan McGee 1ba0d84da2 pacsearch: rewrite in perl
This rewrite in perl blows the socks off the old shell script version for
large searches:

$ time ./pacsearch.perl ^.*$ >/dev/null
real    0m0.836s
user    0m0.593s
sys     0m0.217s

$ time pacsearch.sh ^.*$ >/dev/null
real    1m53.818s
user    1m16.818s
sys     0m33.694s

Functionality and output is identical to the old version with the exception
of the old version's missing EOL after all the output.  It should be a lot
easier to add new things like the --color flag that has been a TODO at the
top of the script for a long time.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 11:04:17 -05:00
Dan McGee b49fc504ac Update makepath to remove PATH_MAX usage
The start of a few commits to remove some PATH_MAX usage from our code. Use
a dynamically allocated string instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 00:51:04 -05:00
Dan McGee 2edd01a973 scripts: add -q/--quiet option to repo-add and repo-remove
They are pretty noisy scripts in their normal course of operations, so allow
all messages to be squashed except for warning and error messages with this
new flag.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 00:48:55 -05:00
Dan McGee 502645c0e3 makepkg: Unify start and end messages
I've always found it odd why the package version is shown at the start but
not the end of the package build. Fix it, and while we are at it, add the
$CARCH variable to the display too.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 00:48:47 -05:00
Dan McGee df5024fd64 Use strdup() instead of a static buffer
We only need a copy of this string once we know we are going to extract it,
and we don't need a static buffer to copy it into since it is coming from a
known-length string.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-08 20:59:59 -05:00
Dan McGee 081ba4816e Update md5 routines
XySSL 0.9 was released; sync our code with the upstream source. Note that
there weren't any real changes besides renaming of macros, so nothing much
to see here.

The biggest change may be the licence- it is now GPL/BSD software rather
than LGPL/BSD. The license header is changed to reflect this.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-08 20:59:18 -05:00
Dan McGee 7fccfc7819 be_files.c: PATH_MAX cleanup
Most of these are not easy to remove, but I could kill the ones in the two
lastupdate functions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-08 20:59:02 -05:00
Dan McGee a13bf74979 pacman-side code cleanups
When taking a look at PATH_MAX usage, I found a few small things we can
clean up or fix.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-08 20:58:33 -05:00