Commit Graph

252 Commits

Author SHA1 Message Date
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
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
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
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
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
Allan McRae 90aca75cb9 makepkg: BSD find compatibility fix
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-04-26 18:49:28 -05:00
Allan McRae 6995aed9ae makepkg: deprecate repackaging without a package function
File permissions are not guaranteed to stay the same on exit from fakeroot,
so repackaging may result in files with different permissions. This is
avoided when using a package() function (or split packages) as the
packaging step is rerun.

Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: touched up message for translation purposes]
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-04-26 18:46:41 -05:00
Dan McGee a36ff9404b Bump copyright dates to 2010
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 19:46:59 -05:00
Allan McRae 6f0ffb2386 makepkg: always update symlinks to compressed man pages
When a man page has both symbolic and hard links, any symlink pointing
to other than the alphabetically first hardlink was not "compressed"
and left dangling towards the uncompressed man page. Fixes FS#18569.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:34:27 -05:00
Cedric Staniewski 5fe41df8a9 makepkg: make strip options configurable
The newly added variables STRIP_BINARIES, STRIP_SHARED and STRIP_STATIC,
that are set in makepkg.conf, specify the strip options used on binaries
and shared and static libraries.
In addition, files are now stripped more aggressively by default.

Implements FS#13592 the way it was suggested by Allan in the comments.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:34:16 -05:00
Dan McGee 22331fdadb makepkg: Remove setgid bit on srcdir/pkgdir creation
It was noted in FS#17533 that setgid bits are carried down into any created
subdirectories, and thus could end up being in a built package if the
original package directory was marked g+s. When we create src/ and pkg/,
explicitly chmod them to remove any sticky bits.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-03-14 18:32:44 -05:00
Allan McRae 65d43fbb84 makepkg: abort on missing or non-writable PKGDEST
When PKGDEST pointed to a non-writable location, makepkg would fail
after completing the build process. This patch makes it abort as
soon as PKGDEST is parsed.

Also, move the SRCDEST check to the same point rather than right
before downloading sources (which was after dependency checks).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:30:35 -05:00
Allan McRae a4e3fd1847 makepkg: only strip files that are writable
TODO: http://mailman.archlinux.org/pipermail/pacman-dev/2010-January/010390.html

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:30:23 -05:00
Allan McRae 7ea0a115db makepkg: update required programs
Remove getopt, add xz.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-28 23:23:04 -06:00
Nezmer afc37c58c7 makepkg: Introduce $SRCPKGDEST
Introduce $SRCPKGDEST to define a destination dir for source packages
instead of saving them in $PKGDEST with binary packages.

The simple patch doesn't break old behavior.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19 21:51:51 -06:00
Cedric Staniewski a6cca6e456 makepkg: remove srclinks directory on error exit
When makepkg exits in create_srcpackage(), the (temporary) srclinks
directory is left behind.

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:31:06 -06:00
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