Commit Graph

218 Commits

Author SHA1 Message Date
Nezmer 9fe27b068a makepkg: skip devel_check() when repackaging
Currently, "makepkg -R" creates a package with a wrong updated $pkgver.

Signed-off-by: Nezmer <Nezmer@allurelinux.org>
[Allan: adjusted comment]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:30:58 -06:00
Cedric Staniewski 05ff276eef makepkg: limit sudo usage to allowed pacman commands
This is particularly useful when using pacman wrappers which call sudo
by themselves and therefore should not be run as root.

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-12-13 23:28:43 -06:00
Cedric Staniewski 66c6d288fd makepkg: allow to specify an alternative pacman command
If PACMAN environment variable is set, makepkg will try to use this
command to check for installed dependencies and to install or remove
packages. Otherwise, makepkg will fall back to pacman.

Implements FS#13028.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: move envvar section in manpage]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:26:54 -06:00
Allan McRae b805fe58ae makepkg: check for references to build root in package
Add a check that the package does not contain references to the
folder it was built in.

Fixes FS#14751

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:22:34 -06:00
Allan McRae f2c9e51eb0 makepkg: allow specifying subsets of packages to build
This allows makepkg to only build a specified subset of packages
from a split PKGBUILD.  This is very useful in combination with the
-R flag or when bumping the pkgrel of a single package.

Fixes FS#15956.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30 21:22:52 -06:00
Cedric Staniewski 82443e0059 makepkg: move pacman calls to a function
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30 21:19:54 -06:00
Eric Bélanger 93862bd7cb makepkg: Place packages symlinks in build dir when PKGDEST is used
When PKGDEST is used, symlinks to the packages will be put in the build
directory.  This combines the convenience of a global package cache with
the ease of having a package (i.e. a symlink) in the build directory for
testing and installation purpose.

Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
[Allan: add comment documenting clean-up addition]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30 21:12:27 -06:00
Isaac Good 6c8f817040 Replace an ugly while [ with a for (( loop
Signed-off-by: Isaac Good <pacman@isaac.otherinbox.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30 21:06:17 -06:00
Eric Bélanger 120cd312e4 makepkg: Fixed logging for split packages
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:34:09 -06:00
Cedric Staniewski 4d2ec3751c makepkg: allow the use of only a package() function
For some packages, generally the 'any' arch ones, a build step is not
required and therefore can be skipped. In these cases, a package()
function without a build() one is sufficient.

As a side effect, this commit makes meta packages without any function
at all in the PKGBUILD possible.

Fixes FS#15147.

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-15 19:33:03 -06:00
Cedric Staniewski 564352c4a2 makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames
Since commit fb97d32, which brought in this test, support for split
PKGBUILDs was added, and therefore, all values of pkgname and also
pkgbase have to be checked now.

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-15 19:30:23 -06:00
Allan McRae 9c34dfd908 makepkg: Add fallback to package function
makepkg looks for a package() function when building a single package
but package_$pkgname() style package functions when building a split
package.  This patch allows the use of a package_$pkgname() function
when building a single package for consistency.  This is achieved by
having makepkg consider a non-split package with a package_$pkgname()
function as a split package (creating just the one package).

Fixes FS#16622.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:29:24 -06:00
Isaac Good c2999619d2 makepkg: use bash test operators, part two
* FS#16623, second 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>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:26:56 -06:00
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
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
Dan McGee 7ae15768e5 Merge branch 'maint' 2009-11-10 18:21:19 -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 3f7cc83e0d Merge branch 'maint' 2009-10-26 21:07:29 -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
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
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
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
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
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 5bea2c08a3 makepkg: tidy usage output
Various tidying to the usage output
 - change "--config <config>" to "--config <file>" to prevent wrapping in a 80 character wide terminal
 - re-alphabetise options, including moving all long only opts to the end
 - use same indentation for additional pacman options
 - remove useless comment

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-22 19:01:05 -05:00
Dan McGee 6bfca2fd14 Merge branch 'maint'
Message updates made this one a bit messy, but nothing too bad.

Conflicts:
	lib/libalpm/add.c
	lib/libalpm/remove.c
2009-09-20 12:09:10 -05:00
Xavier Chantry 1df3b91931 String improvements
Add more untranslated strings, improve consistency, etc.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-16 19:36:49 -05:00
Xavier Chantry 0845b2f13c sanity check for optdepends syntax
only allow optdepends like:
pkgname: description

some (real) examples of invalid optdepends:
 'tcl, python and/or ruby: to use corresponding binding'
 'xorg-fonts-75dpi : X bitmap fonts needed for the interface'
 'ruby-htmlentities (AUR): for one provider named Deastore'
 'xpdf - for pdf'

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Allan: rebase off de39a1f6 and adjust man page]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 16:52:47 -05:00
Xavier Chantry b53aa87ea9 makepkg : check for invalid backup entry
This implements FS#13551

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:57:30 -05:00
Xavier Chantry cb07265851 makepkg : refactor run_build and run_package
These two functions were very similar.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:57:14 -05:00
Henning Garus 545eac145d makepkg: exit on error during build() or package()
Set the ERR trap to abort upon encountering an error during the execution
of a build or package function.

Activate set -E, which lets functions inherit the ERR trap.

Signed-off-by: Henning Garus <henning.garus@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:56:58 -05:00
Dan McGee b9dd8ce233 Merge branch 'maint' 2009-09-06 15:54:11 -05:00
Francois Charette 1e51b81c63 fix typos in makepkg.sh.in
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:36:56 -05:00
Xavier Chantry 7ddb645bd7 makepkg: always keep sources symlinks
Make bunzip2/xz/gunzip decompressing to stdout, because gzip does not offer
something like a -k option.

The selection of the decompression command for gzip/bzip2/xz compressed
files now also depends on the file suffix, since we need to strip the
extensions to get the output filename.

Thanks to Cedric Staniewski <cedric@gmx.ca> for reporting this issue and
contributing patches.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:33:54 -05:00
Xavier Chantry 82522dd8c1 makepkg: new --skipinteg option
Implements FS#15830

This option allows to build a PKGBUILD with no checksums

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:26:32 -05:00
Dan McGee 7bb9c4098b Merge branch 'maint' 2009-08-08 11:23:38 -05:00
Allan McRae 68200676d2 Be consistent with naming of handle_deps function
All other "dep" functions (check_deps, resolve_deps, remove_deps)
have underscores separating words.

Being consistent, convert handledeps to handle_deps.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:13:48 -05:00
Allan McRae ee43e75ed2 Remove builddeps from option parser
Leftover from commit ae5ef3b9

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:12:05 -05:00
Allan McRae 839bb56269 makepkg: change to pkgdir before creating PKGINFO file
Commit 01f9ae63 moved that creation of the PKGINFO file to before changing
to pkgdir.  This causes issues when using the -R option (FS#15851).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:12:05 -05:00
Cedric Staniewski fb97d325a5 Do not allow pkgnames to start with a hyphen
Commandline arguments starting with a hyphen are usually recognized as
options by unix tools. Therefore, allowing hyphens at the beginning of a
package name requires a different handling of pkgnames as suggested by
rm's manpage.
It would be possible to make the scripts 'hyphen-safe', but
hyphen-prefixed packages will cause trouble for pacman users which do
not know these tricks.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
[Dan: remove the repo-add check]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-26 23:29:55 -05:00
Dan McGee 597118ddd7 Revert "makepkg: Exit on failure within build() or package() functions"
As reported in FS#15210, we have some problems with split packages and
variable overrides because of this patch. For now, in prep for a release, it
is best to back it out and see what we can do later.

This reverts commit 621aa26e26.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-26 12:58:02 -05:00
Allan McRae 4b21504ffc makepkg: add pkgbase to .PKGINFO and database for split packages
With split packages, the pkgbase variable provides a useful way to
find out which packages were build from the same PKGBUILD. Add it
to the packages .PKGINFO file and the repo database only when
package splitting is used.

Original-patch-by: Pierre Schmitz <pierre@archlinux.de>
[Allan: restrict to including only with spilt packages
        and include after pkgname]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-22 06:37:33 -05:00
Allan McRae 5dc0b80c26 makepkg: clean up BUILDSCRIPT usage
FS#15448 (which is made worse by the "fix" for FS#14727...), highlighted
some deficiencies in the usage of the BUILDSCRIPT variable. In particular,
only relative paths worked with "-p" and some output was very strange in
combination with the "-p" flag or reading from /dev/stdin. e.g.
"Please add a license line to your /dev/stdin!".

This patch adds a new variable, BUILDFILE, which contains the full path
to the BUILDSCRIPT.  This defaults to $startdir/$BUILDSCRIPT.

Also, fix a missed quoting of $BUILD{SCRIPT->FILE} and remove warning
about missing BUILDSCRIPT definition in makepkg.conf as the default
BUILDSCRIPT value is now specified during configure. Add check that
BUILDFILE is writable before updating VCS PKGBUILDs. When making a source
package, the BUILDSCRIPT always gets given the default name, regardless
of what it was originally called.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-12 17:32:57 +10:00