Commit Graph

2821 Commits

Author SHA1 Message Date
Isaac Good 966c815881 makepkg: use bash test operators, part one
* FS#16623, first half of makepkg
* Includes stuff like -o to ||, -a to &&, etc.
* if [ $(type ... preserved due to a bash bug with [[ and set -e and ERR traps

Signed-off-by: Isaac Good <pacman@isaac.otherinbox.com>
[Dan: made commit message useful]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:23:06 -06:00
Cedric Staniewski 5d5070f47d scripts: replace test builtin [ with shell keywords [[ and ((
FS#16623 suggested this change for makepkg; this patch applies it to the
remaining files in the scripts directory.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:22:54 -06:00
Xavier Chantry fb310fc01e pacman.conf : enable resuming for curl
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:20:21 -06:00
Eric Bélanger 77023978c5 makepkg: Clarified error message when a sourceball exist already
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:19:21 -06:00
Cedric Staniewski 77e84bea71 makepkg: fix abortion after sourcing /etc/profile
The source command triggers / might trigger the ERR trap which makes
makepkg abort right after a successful installation of missing
dependencies.

Thanks to Xavier Chantry <shiningxc@gmail.com> for finding this
solution.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:19:11 -06:00
Allan McRae 0199a7ee71 contrib/bacman: fix checking if file has been added
Fixes FS#17140.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:18:56 -06:00
Manuel Tortosa 88706168f2 Add Catalan translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:09:58 -06:00
Dan McGee 7ae15768e5 Merge branch 'maint' 2009-11-10 18:21:19 -06:00
Dan McGee e09253d15b Necessary updates for 3.3.3 release
Should cover everything worth mentioning in NEWS, plus the version number
bumps as usual.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-10 16:18:05 -06:00
Cedric Staniewski db756ed931 makepkg: quote arrays in order to preserve spaces in array items
Fixes FS#16871 and makes the pkgdesc workaround obsolete.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-10 11:24:20 -06:00
Dan McGee 133a39e2bb Fix opendir error condition checks
Thanks to Laszlo Papp <djszapi@archlinux.us> for the following catch:
  opendir(path)) == (DIR *)-1;
is maybe the result of misunderstanding the manpage. If an opendir() call
isn't successful it returns NULL rather than '(DIR *)-1'.

Noticed-by: Laszlo Papp <djszapi@archlinux.us>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-27 21:11:29 -05:00
Dan McGee 3f7cc83e0d Merge branch 'maint' 2009-10-26 21:07:29 -05:00
Laszlo Papp 361a25c086 Fix a small typo in alpm_list.c
Signed-off-by: Laszlo Papp <djszapi@archlinux.us>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 10:27:48 -05:00
Allan McRae fff6d9dc2e makepkg: allow passing arguments with spaces
Currently makepkg takes the commandline arguments, assigns them to a
variable and passes that variable to the next makepkg call (within
fakeroot).

Use a comination of quotes and arrays in this process to ensure any
arguments passed within quotes and containing spaces stay as a single
argument during the second makepkg call.

Thanks to Dan for figuring out how to get this working.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 10:22:34 -05:00
Dan McGee 7f0f319a3e Merge branch 'maint' 2009-10-24 10:10:15 -05:00
Dan McGee 0bc961a8be Reduce unnecessary get_name() function calls
alpm_pkg_get_name() gives us little benefit in backend code besides a NULL
check on the package passed in; we could do that ourself if necessary. By
changing to direct references in the cases where we are sure we have a valid
package, we save a function call each time we need a package name. This
function can't be inlined because it is externally accessible.

This cuts the calls to get_name() from 1.3 million times in a
pacman -Qu operation to around 2400.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 10:10:12 -05:00
Cedric Staniewski 21caf8730f makepkg: change preselected option for cleaning the cache from Y to N
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 10:05:41 -05:00
Cedric Staniewski 748bc8ebd4 makepkg: use tput for terminal-safe colored and bold text
Suggested-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 10:00:52 -05:00
Cedric Staniewski 013fc9a795 makepkg: define escape sequences globally
In doing so, it is possible to get rid of all the tests for colored
messages except for one global one.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 09:59:03 -05:00
Cedric Staniewski 1000c0bd2e makepkg: check for non-empty pkgbase instead of pkgname
pkgbase is used in the following rm calls, and since pkgname can be
present when pkgbase is not, it is safer to check for pkgbase.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 09:56:07 -05:00
Heiko Baums 6ed7d001f6 pacdiff : add diffsearchpath option
Xav: added doc
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 09:55:50 -05:00
Cedric Staniewski c6095e1032 makepkg: remove empty .part files after a failed download
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 09:54:57 -05:00
Allan McRae 3758ccbb52 makepkg: fix testing for built package presence
Commit c7e4d10d introduced a small error in the testing of whether
a package is already built.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 23:32:50 -05:00
Dan McGee 6c635d76a0 Merge branch 'maint' 2009-10-20 22:29:20 -05:00
Allan McRae c7e4d10df3 makepkg: allow overriding arch in split packages
This allows building a mixture of binary and arch=any packages.
Fixes FS#15955.

The value of CARCH is no longer overridden to "any" in when arch=any
is used and the assigning of the "any" arch is delayed to during the
packaging stage. Adjustments were required to fix installing and
checking for pre-built packages of varing arches.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 22:29:08 -05:00
Allan McRae 2020e6297b makepkg: allow overriding pkgver and pkgrel in split packages
Fixing a single package within a split package requires the overriding
or pkgrel.  In very rare (but existing) cases, it is useful to
override pkgver.  Partial fix for FS#15955.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 22:29:02 -05:00
Xavier Chantry 2c2596177d dload.c : clear sigaction flag to make valgrind happy
This fixes the following valgrind warning :

==26831== Syscall param rt_sigaction(act->sa_flags) points to uninitialised
byte(s)
==26831==    at 0x4282547: __libc_sigaction (in /lib/libc-2.10.1.so)
==26831==    by 0x403C693: download_internal (dload.c:152)
==26831==    by 0x403D0E4: _alpm_download_single_file (dload.c:311)
==26831==    by 0x4033B72: alpm_db_update (be_files.c:319)
==26831==    by 0x805205E: pacman_sync (sync.c:257)
==26831==    by 0x804EE54: main (pacman.c:1120)
==26831==  Address 0xbec6cc04 is on thread 1's stack
==26831==
==26831== Syscall param rt_sigaction(act->sa_restorer) points to
uninitialised byte(s)
==26831==    at 0x4282547: __libc_sigaction (in /lib/libc-2.10.1.so)
==26831==    by 0x403C693: download_internal (dload.c:152)
==26831==    by 0x403D0E4: _alpm_download_single_file (dload.c:311)
==26831==    by 0x4033B72: alpm_db_update (be_files.c:319)
==26831==    by 0x805205E: pacman_sync (sync.c:257)
==26831==    by 0x804EE54: main (pacman.c:1120)
==26831==  Address 0xbec6cc08 is on thread 1's stack
==26831==

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 22:25:39 -05:00
Cedric Staniewski 3d67d9b16c makepkg, repo-add: replace external commands with bash substitutions where possible
This also removes the awk dependency from makepkg and repo-add.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 22:24:36 -05:00
Gan Lu 5ffc1ad3cd fix for zh_CN
bash is not able to handle positional parameters

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 22:22:05 -05:00
Laszlo Papp 4281a1a7f2 Size handling was changed in fgets() functions
Pacman's fgets function in the API used hardcoded numbers to identify the size.
This is not good practice, so replace them with sizeof handling.

Signed-off-by: Laszlo Papp <djszapi@archlinux.us>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-19 07:37:53 -05:00
Laszlo Papp f9582c7df2 Replace hardcoded option numbers with enumeration
Pacman's long option parsing used hardcoded numbers to identify them.
This is not good practice, so replace them with enumeration constants.

Signed-off-by: Laszlo Papp <djszapi@archlinux.us>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-12 23:42:36 -05:00
Cedric Staniewski 2cabe336eb Introduce new PKGBUILD variable `changelog`
Currently, a changelog is added to a package if a specific file with a
hardcoded name exists in the PKGBUILD's directory. This approach is not
pretty and also inconsistent with the handling of install files, but it
works.

With the introduction of split PKGBUILDs, however, a drawback in this
old behavior has arisen: you only have the possibility to include one
specific changelog file in either every package defined in the PKGBUILD
or in none.

The use of an additional variable, `changelog`, works around this issue
and makes it possible to include a changelog in only some of the
packages, and besides, each package of the PKGBUILD can have its own
changelog file.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 22:35:20 -05:00
Allan McRae da5fb3ee4f Fix Greek short Y/N translation
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 22:34:43 -05:00
solsTiCe d'Hiver e3ac806262 use bitwise shift operator in enum "bit field"
This offers a cleaner way to deal with constant in enum and allow easy
maintainance

Signed-off-by: solsTiCe d'Hiver <solstice.dhiver@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 22:13:49 -05:00
Cedric Staniewski c7d8601e12 Fix stderr redirection
When redirecting both stderr and stdout and using the 2>&1 construct,
you have to redirect stdout first. Otherwise stderr will be redirected to
the 'old' stdout and not to the new resource.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 16:34:47 -05:00
Laszlo Papp ab3c6f01f5 Remove makepath function from frontend
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:52:12 -05:00
Nagy Gabor 72bc947cbb Fix "-Sd conflict_pkg" bug
If the -d switch was invoked with -S (or -U), the removes list was simply
lost, because trans->remove was computed in an
"if(!(trans->flags & PM_TRANS_FLAG_NODEPS))" block.

I've added a new pactest file, sync045.py (derived from sync043.py) to test
this.

Additionally, I did some other minor cleanups in sync_prepare:
 * preferred list is not needed anymore
 * I removed a needless alpm_list_remove_dupes line (the target list should
   not contain dupes at all)
 * I moved alpm_list_free(remove); to cleanup part to eliminate a possible
   memleak

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:30:52 -05:00
Xavier Chantry 3dc87851cc alpm_list : add new alpm_list_diff_sorted function
This is more efficient than alpm_list_diff since it assumes the two lists
are sorted. And also we get the two sides of the diff.

Even sorting should more efficient than the current list_diff. Sorting the
two lists should be O(n*log(n)+m*log(m)) while the current list_diff is
O(n*m). So I also reimplemented list_diff using list_diff_sorted.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:28:10 -05:00
Xavier Chantry 14ab02e289 Rework the alpm_unpack functions
Add support to extract a list of entries

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:18:47 -05:00
Xavier Chantry 471b1fa543 update sync200 pactest
update download -> fetch

This just meant that we used XferCommand even if internal download was
available, no big deal.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:12:44 -05:00
Xavier Chantry caea098c21 cygwin fix : use unsigned char for ctype function
See http://www.nabble.com/-PATCH-RFA--Distinguish-between-EOF-and-character-with-value-0xff-td23161772.html#a23188494

cygwin 1.7 actually displays a warning when using signed char with the ctype
function, so that compilation fails when using -Wall -Werror.

So we just cast all arguments to unsigned char.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:12:20 -05:00
Xavier Chantry 35bbc96b99 replace rankmirrors by bash clone
This removes python optdepends in pacman package

This bash clone is a courtesy of
Matthew Bruenig <matthewbruenig@gmail.com>

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-10-11 15:08:06 -05:00
Dan McGee 302310c5aa Minor scope/typing cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:42:04 -05:00
Dan McGee 4828d9ef7c libalpm: clean up lock function
We were doing a lot of manual work; leverage the standard library a bit to
do more for us.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:42:04 -05:00
Dan McGee 6e312220ec Reduce calls to list_count() in removing package
We don't need to count the number of packages left once per file when
removing; we only need to do it once per package. Also move a variable into
the correct scope.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:42:04 -05:00
Dan McGee 3bc8c28ce3 Add missing get_usedelta() method
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:42:04 -05:00
Dan McGee 145103aacc typing: a few more fixes for special int types
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:41:59 -05:00
Dan McGee 35dc9b0314 int typing: s/unsigned short/int/ in libalpm
After our recent screwup with size_t and ssize_t in the download code, I
found the `-Wsign-conversion` flag to GCC to see if we were doing anything
else boneheaded. I didn't find anything quite as bad, but we did have some
goofups- most of our public unsigned methods would return -1 on error, which
is a bit odd in an unsigned context.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 13:51:47 -05:00
Dan McGee cf0d619670 Merge branch 'maint' 2009-10-11 12:57:57 -05:00
Xavier Chantry 5e03941ee5 alpm_list : fix a bug in alpm_list_remove
A NULL list element triggered an infinite loop. Not cool :)

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 12:55:55 -05:00