Commit Graph

267 Commits

Author SHA1 Message Date
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
Allan McRae 104daa16a6 makepkg: allow spaces in source file names
The download command failed with sources that contained spaces.
Remainder of fix for FS#15323.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-12 01:17:25 +10:00
Dan McGee caa0f2205a makepkg: fix breakage with '%' in source filenames
Ensure we don't pass a bare filename to printf that might contain a
lookalike '%' escape sequence. Fixes part of FS#15323.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-12 01:02:25 +10:00
Dan McGee 68c10690ea makepkg: quote filenames when extracting
We currently fall apart on files with spaces in the names.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-12 01:02:21 +10:00
Allan McRae 6092dda177 makepkg: check for package functions when package splitting
Makes sure the required package functions are present when using package
splitting.  Also moves setting of pkgbase variable outside the
check_sanity function to somewhere more appropriate.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:58 +10:00
Allan McRae e72cce352a makepkg: fix pkgdesc restoration with split packaging
A pkgdesc with spaces in it would get restored to an array and thus only
the first word would be restored (FS#15210). Convert that array back to a
string.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:58 +10:00
Allan McRae 621aa26e26 makepkg: Exit on failure within build() or package() functions
Errors in build() functions were only fatal, if "--log" was enabled. Errors in
package() functions were never fatal. Piping these functions through "cat -"
triggers error trapping. This prevents the need for "|| return 1" usage in
PKGBUILDs.

Original-patch-by: Juergen Hoetzel <juergen@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:58 +10:00
Allan McRae b312c820c8 makepkg: fix check for previously built packages with package splitting
Checks if some or all packages are built before overwriting/installing.
Adds some new strings for translation.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:58 +10:00
Allan McRae 617e7d512f makepkg: clean up moving PKGINFO creation to a function
Someone forgot to commit this when pulling in the original patch
to his working branch...

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:57 +10:00
Dan McGee c72b4543b6 Update copyright headers and messages
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01 02:08:33 -05:00
Loui Chang 01f9ae63e7 makepkg: Move .PKGINFO creation into a function.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-22 17:09:16 +10:00
Loui Chang 02acf65ef3 makepkg: Download sources and check checksums for any source package.
It wouldn't be very nice to ship a PKGBUILD with the wrong checksums.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-21 20:32:17 +10:00
Allan McRae ef500b44ce makepkg: fix variable backup/restore for splitpkg
The backup and restore of variables that can be overridden while
making split packages only dealt with the first element, not the
whole array (FS#15010).  Adjust the bash voodoo to fix it...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-13 09:51:18 -05:00
Allan McRae 04d5c4294a makepkg: fix PKGBUILD sanity check
If PKGBUILD was good, the "insane" variable was not defined and so
the if statement failed.  Simplify and fix this check.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-13 09:50:53 -05:00
Dan McGee e61ab1536f makepkg: refactor sanity checking into a function
No new checks, just move it into a function and return 1 rather than exit
directly. This also allows the use of local variables.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-07 15:07:37 -05:00
Pierre Schmitz c301d6aa25 Add support for the xz archive format
This simple patch adds support for the xz archive format to makepkg and repo-
add.
Xz can be used as source, package and package db file type.

Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
[Dan: fixed a few alignment issues]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:16:59 -05:00
Allan McRae 250e66e57b makepkg: fix sourcing BUILDSCRIPT and PATH issues
The bash source command looks in the users PATH for the file to source
before the local directory. This causes issues when someone has a
PKGBUILD somewhere in their path (for unknown some reason...).
Fixes FS#14727.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-16 13:48:10 +10:00
Allan McRae 5e32928a42 makepkg: Document package splitting
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-14 16:30:02 +10:00
Allan McRae de44a0f474 makepkg: do not update pkgver when building source package
When making a source package for a SCM PKGBUILD, makepkg should not
update the pkgver/pkgrel.  Noted in FS#14456.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-14 16:30:01 +10:00
Allan McRae f569c4a042 makepkg: several small fixes
1) Do not attempt to strip compressed binaries
Original-work-by: Marc - A. Dahlhaus <mad@wol.de>

2) Add "\" in "GPL\'ed" so quote mark does not break source code highlighting

3) Add local to docdir paths in makepkg.conf for consistency

4) Use full path to sed in MacOSX in case users have GNU sed earlier in
path

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-11 21:23:46 -05:00
Allan McRae c27904661e makepkg: make in-place sed portable
Do a sed replacement in-place is not very portable.  On Mac OSX and
BSDs, the syntax is "sed -i ''" where as with GNU sed the command is
"sed -i''" or just "sed -i".  This patch detects which command should
be used during configure.

Credit to Kevin Barry who researched this issue and provided a patch
to work around this using temporary backup files.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-26 09:22:23 -05:00
Dan McGee 93ca155b48 Merge branch 'xav/repo-add' 2009-04-11 13:50:56 -05:00
Dan McGee 101c16b3eb makepkg: fix double check on same path
Commit 142225fd typo-ed this one, as it should look like the rest of the
checks similar to it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:30:38 -05:00
Loui Chang 52d184dae8 makepkg: Fix integrity check when files are missing.
The index in the for loop wasn't being incremented, so
if the first file wasn't found, the second file would be compared to the
first checksum, rather than the second.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 12:52:11 -05:00
Allan McRae 442b91a5dd makepkg: run tidy_install with no package() function
After the splitpkg implementation, the tidy_install function
was not being called in PKGBUILDs with only the build() function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-03-30 17:41:34 +10:00
Allan McRae deff57ce8b makepkg: do not bail on failure to install built package
Fixes FS#13417.  Do no exit makepkg on a failure to install the
built package(s).  This allows clean-up to still occur.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-03-29 16:49:57 +10:00
Allan McRae 7370fd595b makepkg: adjust log clean-up for new filenames
The log files now have -build or -package at the end and there
are separate log files for each *_package() function. Alter
clean_up() to deal with this. Also, move glob outside quotes so
this actually works.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-03-26 01:39:13 +10:00
Allan McRae 4c27a776bd makepkg: adjust install_package for split packages
Install all created packages when using the install option with
package splitting.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-03-25 23:52:27 +10:00
Allan McRae 7a8ba5a978 Refactor testing for color message output
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-03-16 09:18:41 +10:00
Allan McRae 7df0d048d1 makepkg: add pkgbase variable
The pkgbase variable is added to improve informational output and
source package naming when using split packages.  Defaults to
${pkgname[0]} if not set.

Also:
 - move splitpkg detection to after pkgname presence is verified
 - add "cd" line to package_foo() functions in splitpkg proto

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-03-16 09:17:10 +10:00
Xavier Chantry c8beffa790 Fix several issues with xdelta
1) The changes to sync.c look big but there are mostly caused by
the indentation. Fix a bug where download_size == 0 because the packages and
deltas are already in the cache, but we still need to build the deltas list
and apply the deltas to create the final package.

2) Fix the gzip / md5sum issue by switching to xdelta3, disabling external
recompression and using gzip -n in pacman, and disable bsdtar compression
and using gzip -n in makepkg.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:08:36 +01:00
Allan McRae 687f04ab46 Only check checksums if there is a source file
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-03-15 11:38:54 -05:00
Xavier Chantry b4e1365657 makepkg : remove xdelta support
The pkgdelta script can be used instead.

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-02-28 15:42:07 -06:00
Dan McGee 2268981ebf Merge branch 'maint' 2009-02-23 20:40:27 -06:00
Allan McRae a309a016bf makepkg: fix updating pkgrel with pkgver in SCM packages
Commit 1e656c0a introduced the changing of pkgrel to 1 when the
pkgver was updated in SCM PKGBUILDs. However, the output in the
"Making package:" was wrong. Attempting to fix that created
another bug (FS#13416). Interestingly, pkgver was only ever
being updated in the fakeroot stage which caused this problem.
Now both pkgver and pkgrel are updated after the first
devel_check and devel_update. Enjoy the really long explaination
for a two line fix...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-23 20:18:08 -06:00
Dan McGee 04c2b9d4ed Merge branch 'maint' 2009-02-08 11:43:08 -06:00
Sebastian Nowicki ea84819bbb makepkg: Make stripping debug symbols cross-platform
The Linux and BSD versions of strip have the --strip-debug option (as
well as the -S option), however Mac OS X only has -S.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-08 11:33:33 -06:00
Dan McGee 8929769902 makepkg: test fixes, part 2
The goal of this fix was empty string comparisons:
-  if [ "$pkgname" != "" ]; then
+  if [ -n "$pkgname" ]; then

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-18 13:48:31 -06:00
Dan McGee 350c3eb6ec makepkg: clean up test usage
In a lot of places, we had the following construct:
  [ "$foobar" = "0" ]
which is better represented by using the integer tests:
  [ $foobar -eq 0 ]

Attempt to unify makepkg to use the latter rather than the former in all
places. From here on out we should ensure anything that is set to 0, 1, etc.
uses the -eq format rather than =.

In addition, fix a few other test anomalies including usage of double
equals.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-18 13:46:23 -06:00
Allan McRae fba5771fa4 makepkg: repackage rework with package functions
When using the optional package() function or split packages, the
entire packaging step is rerun instead of just final package
creation step.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-17 09:19:35 -06:00
Allan McRae e946ee7745 makepkg: implement creation of split packages
Adds the ability to create multiple packages from one PKGBUILD

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-01-16 22:32:05 +10:00
Allan McRae 21b8a5418d makepkg: Optional argument for run_package and create_package
Generalize run_package to allow the passing of a package name
directing the use of an alternative package function. A similar
adjustment to create_package to prepare split packages.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-01-16 22:26:52 +10:00
Allan McRae 708ce1480f makepkg: hack around tee in run_package function
Piping the package function through tee to log the outut also
clears any variables set in the package function.  This is a
problem in split packages as package variable overrides are done
in the package function.  This is fixed by creating a node which
the output is piped through and duplicated using the tee function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-01-16 22:24:21 +10:00
Allan McRae 9804911c5f makepkg: add functions for backup and restore of package fields
Adds functions for the backup and restoration of package variables
that can be over-ridden during package splitting.  Variables which
can be overridden are given in the splitpkg_overrides variable.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-01-16 22:22:04 +10:00
Allan McRae 08034ceb17 makepkg: add optional package function
This patch allows us to split the building and packaging stages of
a PKGBUILD and minimize fakeroot usage. This can be done with less
code duplication (run_build and run_package look quite similiar) but
the run_package function will be where the package splitting logic
is implemented in the future.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-01-16 22:20:05 +10:00
Dan McGee 7a3a718c7a makepkg: fix my own stupid mistake
We don't want to bail if a certain integrity check wasn't even provided.
Whoops.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-13 20:13:31 -06:00
Aaron Schaefer e3a06961f6 makepkg: use INTEGRITY_CHECK only for generation of checksums
Signed-off-by: Aaron Schaefer <aaron@elasticdog.com>
[Dan: fail if checksum array is incorrectly sized]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-13 19:50:38 -06:00
Xavier Chantry 4ec846f5ac makepkg : fix a lot of breakages caused by Allan
This patch started as a simple typo fix (pugre instead of purge in two
places), as well as a fix of a test which was using PURGE_TARGETS instead of
$PURGE_TARGETS.

It evolved in a slight handling change of the OPTIONS which have a variable
affecting their behavior (strip STRIP_DIRS, docs DOC_DIRS, zipman MAN_DIRS
and purge PURGE_TARGETS), as well as a clarification in makepkg.conf. Now
when a variable is undefined or empty, the corresponding option will have no
effect. It looked weird to have a fallback when a option is defined but
empty, it seems more natural to not have any fallbacks.

Also re-enable docs by default. It seems arbitrary to delete files from
packages by default, and it would be more vanilla and distro agnostic to
keep them. docs was also the only negated option.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 22:28:10 -06:00
Allan McRae 1cc8ad6112 makepkg: Add support for specifying LDFLAGS
Provide support for specifying LDFLAGS within makepkg.conf but leaves
this undefined by default. Fixes FS#12542.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:17:15 -06:00
Allan McRae 8f26bb9052 makepkg: move BUILDSCRIPT from makepkg.conf
Commit 4b183bf9 moved makepkg.conf sourcing to after the parsing
of options, breaking the -p option and --help output.  The solution
is to move BUILDSCRIPT out of makepkg.conf.  This patch moves the
definition BUILDSCRIPT back to makepkg itself and adds configure
option to allow easy changing of this value during build time.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:13:54 -06:00
Allan McRae 9a7f68317a makepkg: Introduce purge option
The purge option, combined with the PURGE_TARGETS variable,
allows makepkg to automatically remove commonly confliting or
removed files (e.g. /usr/share/info/dir, *.pod).

Original work: Tim Yang
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:11:51 -06:00
Allan McRae 774c252753 makepkg: Add used options to PKGINFO file
Adds defined options to the PKGINFO file in the form of "makepkgopt =".
It may be useful to be able to add these to the pacman DB at some point
as that would allow (e.g.) checking which packages have had their docs
striped (FS#7092).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:11:48 -06:00