Commit Graph

279 Commits

Author SHA1 Message Date
Allan McRae 298cbf2cb1 makepkg: use regex to match options for privilege escalation
Eases maintanence if we need to add further options in the future.

Extracted from a patch supplied by Andres P <aepd87@gmail.com>

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:49:44 -05:00
Thomas Bächler 8155571183 makepkg: Allow creation of uncompressed packages
When performing local testing, it may be useful to add PKGEXT='.pkg.tar'
to the PKGBUILD to save time, especially with big packages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-08 10:24:24 -05:00
Dan McGee ddc4130c97 Merge branch 'maint' 2010-07-27 10:18:35 -05:00
Dave Reisner 7f5c486666 Always treat PKGLIST as an array.
Fixes repackaging issues when multiple package names are passed to the
--pkg option.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 10:10:55 -05:00
Dan McGee 686b8c1463 Merge branch 'maint'
Conflicts:
	scripts/makepkg.sh.in
2010-07-02 18:29:37 -05:00
Andres P 1a9db4cac7 makepkg: undeclared local variables
Variables that are only meaningful within the function they are declared in are
now prefixed by "local".

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: fix whitespace]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-02 18:27:27 -05:00
Allan McRae 622326bb37 makepkg: fix sudo/su calling of pacman
This fixes two issues:

1) using "sudo -l" results in excess password asking under certian
configurations.  Revert to the pre 3.4 behaviour of always using
sudo if it is installed.

2) Properly escape the command so that that versioned dependencies,
such as "foo>4", do not get treated as output redirection when using
su.  This also unifies the generation of the pacman line and its
privilege escalation.

Based on patches supplied by Andres P <aepd87@gmail.com> with minor
adjustments for suitability for the maint branch.

Original-work-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-07-01 00:23:20 -05:00
Dan McGee 96a1255ead Merge branch 'maint' 2010-06-30 08:41:43 -05:00
Allan McRae c11bf581a3 makepkg: clarify aborting on packaging failure
When makepkg catches a command failure it currently prints "Aborting..."
and exits.  Clarify the reason for aborting from packaging is a failure
during one of the PKGBUILDs functions.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-30 08:32:34 -05:00
Allan McRae 0ea52e3a4f makepkg: try standard paths for coreutils du
Attempt to find "du" from coreutils in the standard paths and if
not revert to the version in the users PATH.  Using the full path
prevents issues such as FS#19932, where a different and incompatible
version of du is put earlier in the users path.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-30 08:27:29 -05:00
Andres P 8b23aa172f makepkg: remove bash4-only parameter expansion in check_sanity
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-30 08:27:29 -05:00
Thomas Bächler d7c98d4e45 makepkg: Only check regular files in $srcdir check
The 'grep -R' in the $srcdir check would not only grep regular files,
but also devices, symlinks (that might potentially point outside of
$pkgdir), pipes and so on. Use find to ensure only regular files are
examined.

This should fix https://bugs.archlinux.org/task/19975

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-30 08:27:29 -05:00
Dan McGee 630e7508ee Merge branch 'maint' 2010-06-24 08:32:33 -05:00
Eric Bélanger 71330a4310 makepkg: Place source packages symlinks in build dir when SRCPKGDEST is used
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>
2010-06-24 08:22:55 -05:00
Andres P c6a94a8d22 makepkg: fix regression in split package function checking
Commit 13748ca052 inversed the nature of one test wherein the if clause would
throw a fatal error if a legitimate package function was defined in PKGBUILD.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-24 08:22:15 -05:00
Allan McRae 07a9effdd0 makepkg: prevent error trap activation in bash-3.2
Running "pacman -T foo" is expected to return a non-zero value when
"foo" is not installed.  This sets of the error trap in bash-3.2 but
not bash 4.x.  Work around this by disabling the error trap around
this pacman call as we are manually checking the return value anyway.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-23 13:32:21 +10:00
Dan McGee 67d71ea932 Merge branch 'maint' 2010-06-20 21:01:32 -05:00
Allan McRae c2cf6a14cf makepkg: revert bash4-ism
Commit 3d67d9b1 introduced multiple bash4 string manipulations.
Revert those in order retain compatibility with bash-3.2 which
is still widely used.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-20 21:00:49 -05:00
Andres P d7dccd5419 makepkg: remove unnecessary use of sort
pacman -Qq output is sorted according to the users LC_COLLATE
setting as is needed for comm.

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: adjust commit message]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:58 +10:00
Andres P f5f107674b makepkg: use parameter expansion instead of basename
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P 1b93a116e7 makepkg: fix inconsistent output when checking dependencies
Instead of writing:
==> Checking Runtime Dependencies...
==> Checking Buildtime Dependencies...
==> Installing missing dependencies...

Just make it homogeneous:
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Installing missing dependencies...

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P 70418e48f6 makepkg: merge in-line splitpkg handling logic
Ease maintainace; the two parts that have been combined into a function were
identical.

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: rename function]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P c7a37d039b makepkg: add to variables without expanding them
Use foo+=" bar" instead of foo="${foo} bar"

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P cd042640c6 makepkg: less code repetition for empty variable checking
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P 13748ca052 makepkg: use "declare -f" to test for function presence
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P 34229c5625 makepkg: fix variable checks when writing pkginfo
Regression caused by c71fe7db. Was checking for "optdepend" and "conflict"
rather than "optdepends" and "conflicts" when populating .PKGINFO.

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: adjust commit message]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Allan McRae dc817a2061 makepkg: fallback to sane defaults for library stripping
If the library stripping variables are not defined in makepkg.conf,
libraries will be fully stripped and become broken.  Fallback to a
sane default stripping level.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-16 23:54:33 -05:00
Nezmer 09aae4b7a5 makepkg: Extract from any file bsdtar can recognize
If "file -bizL" does not return a supported type, check if the file is
recognized by bsdtar and if yes extract from it.

Dan: use '-q' option to prevent needing to seek the entire archive.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Andres P c71fe7db42 makepkg: use printf when writing pkginfo
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Andres P 0e96532096 makepkg: use single redirection when writing PKGINFO
Instead of specifying the output file on every echo, leave it to the
caller of write_pkginfo to specify the target.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Andres P f258ffab25 makepkg: use double brackets
Change all instances of the (test) [ builtin to the [[ keyword.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Andres P 95145d4c52 makepkg: use type -p's return value for PATH checks
Rely on type -p's return value instead of a string check.

And gettext was previously being checked with type -t, which was
inconsistent with the rest of the tests pertaining commands that aren't
expected to be functions nor builtins.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Allan McRae 3c8816f74b makepkg: fallback to sane defaults for library stripping
If the library stripping variables are not defined in makepkg.conf,
libraries will be fully stripped and become broken.  Fallback to a
sane default stripping level.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:32:08 +10:00
Allan McRae d73d055c6f makepkg: use BUILDFILE rather than BUILDSCRIPT
In check_sanity, BUILDFILE needs to be checked rather than
BUILDSCRIPT.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-09 16:52:49 +10:00
Allan McRae b886362282 makepkg: fix errors with multiple install or changelog files
Another issue caused by fe1e3471.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-09 15:58:05 +10:00
Allan McRae ac5c2fd09b Fix creation of source packages
Source packages were getting created with only links to local source
files.  Caused by commit 5cddcc90.

Also, fix dangling symlinks to install and changelog files. Caused
by commit fe1e3471.

Thanks to Christopher Rogers <slaxemulator@gmail.com> for pointing
out areas that were failing.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-09 15:58:05 +10:00
Cedric Staniewski 5cddcc901b makepkg: refactor absolute filename detection
Move the absolute filename detection to a new function to reduce code
duplication.

This patch also fixes the --allsource option that did not include remote
source files if they reside in $startdir instead of $SRCDEST.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-03 18:14:25 -05:00
Cedric Staniewski 3739fe9913 makepkg: print only base filename of install/changelog files
The complete file path of a temporary symlink is really useless
information.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-03 14:15:50 -05:00
Andres P fe1e3471f4 makepkg: remove code duplication in buildscript parsing
Merges code in two almost identical chunks in create_srcpackage and
check_sanity.

Also discards the space kept by regex in ae73d75660 and earlier, since
the for loop discards it later on.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-27 09:18:52 -05:00
Andres P ae73d75660 makepkg: replace unnecessary uses of grep
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-24 21:23:55 -05:00
Allan McRae 3cd237dec3 makepkg: fix permissions on install and changelog files
The .INSTALL and .CHANGELOG files in a package retained the permissions
that they had in $startdir.   Do a chmod after copying to ensure
that the permissions are sane.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-24 21:23:47 -05:00
Andres P 52c3f871db makepkg: don't decompress when stripping binaries
f569c4a042 wrongly relied on file's output.

The fix is to not decompress files in the first place.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-24 21:18:57 -05:00
Allan McRae c1fc00508e makepkg: allow skipping integrity checks when making source package
Extends the use of the --skipinteg option to creating a source
package. Fixes FS#15984.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:35:55 -05:00
Nezmer c6f0fc27ed Resolve dependencies whenever --syncdeps is passed and --nodeps is not
With this patch, dependencies will be resolved and not silently ignored
when running:

makepkg --nobuild --syncdeps
makepkg --repackage --syncdeps

Also, a warning is displayed when repackaging and dependencies are not
being resolved.

Thank you Allan for the feedback.

Signed-off-by: Nezmer <git@nezmer.info>
[Allan: Only warn when repackaging with a package function]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:31:59 -05:00
Dieter Plaetinck d32f6daa66 fix for incorrect checking of return code, which causes syntax errors
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:29:05 -05:00
Allan McRae 2ce444ee10 makepkg: rework --skipinteg
The current --skipinteg is a bit weird.  It does not skip integrity
checks, but instead does them and prints a warning. Change this
behaviour to actually skipping the checks.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 19:31:58 -05:00
Xavier Chantry 79987c92cb makepkg -g: use checksums defined in the pkgbuild
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Allan: amend documentation]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 19:28:49 -05:00
Allan McRae 64c3255b0e makepkg: handle multiple install and changelog files
The presence of all install and changelog files (multiple files may
be used with package splitting) is checked for in check_sanity().

All install and changelog files are copied to the source location
when using --source.  The check for install and changelog file presence
is removed in create_srcpackage() as this is redundant to the checks
performed in check_sanity().

Moved install and changelog handling in create_srcpackage() to after
source array files, as this is more logical and readily allows for the
following.

A check is made when creating a source package that a symlink to an
install file has not already been added.  This can occur if the
install file is used multiple times or if it is listed in the source
array.

Fixes FS#18831, FS#18394 and partially fixes FS#16004

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-05-05 19:27:55 -05:00
Ray Kohler 590606a5d7 makepkg: fall back to su if sudo is not available
Signed-off-by: Ray Kohler <ataraxia937@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 19:26:56 -05:00
Allan McRae ccbef232c9 makepkg: improve removal of installed dependencies
Compare a list of packages on the system before and after dependency
resolution in order to get a complete list of packages to remove.  This
allows makepkg to remove packages installed due to provides.

Bail in cases where packages that were on the system originally have been
removed as there is a risk of breaking the system when removing the new
packages.

Fixes FS#15144.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 19:26:06 -05:00