Commit Graph

570 Commits

Author SHA1 Message Date
lolilolicon 94bc64ae1b makepkg: create tar file for bogus PKGEXT
If PKGEXT is not one of the recognized tar*'s, create_package() would
create an empty package file and fail, since bsdtar on the left side of
the pipe returns 141 on SIGPIPE (broken pipe).

This patch changes the behavior for an invalid PKGEXT. A warning is
printed on stderr, and a tar file is created. Also retire the obsolete
$EXT variable.

Add the obligatory comment why we don't use bsdtar's compression.
Finally, fix mixed-tab-space indentation.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-10-03 10:59:10 -05:00
lolilolicon b0543440ca makepkg: support .tar.Z source packages creation
SRCEXT should allow whatever PKGEXT does.
Also address an uninitialized use of $ret.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-09-30 10:57:44 -05:00
lolilolicon 497501d1c7 makepkg: proper quoting in [[ expression ]]
Always quote the righthand side of expression when the == or != operator
is used, unless intended as a pattern.  Quoting bash(1):

When the == and != operators are used, the string to the right of the
operator is considered a pattern.  Any part of the pattern may be quoted
to force it to be matched as a string.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-09-28 13:06:03 -05:00
Dave Reisner 619c3629ca makepkg: ensure '-' is last in a character glob
If '-' isn't the last item, it's interpreted as a range and not
literally, causing problematic behavior in parsing optdepends.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-27 11:35:17 -04:00
Allan McRae dd82b8d09f makepkg: normalize whitespace for optdepends in .PKGINFO
Many PKGBUILDs use formatting whitespace when specifying optdepends.
This is removed when adding a package to a repo-database so the
output of "pacman -Si <package>" and "pacman -Qip <package file>"
becomes inconsistent.  Instead, do the adjustment when creating
the .PKGINFO file.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-26 16:02:19 -05:00
Allan McRae 6adf502f0d makepkg: allow versioned optdepends with epoch
Allow the specification of versioned optdepends with an epoch.
This also (partially) enforces a whitespace between ":" and the
description which is required for the future optdepends parsing
code.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-26 16:02:19 -05:00
Dave Reisner 4a02350ded makepkg: fix recreation of hardlinks to .gz manpages
4ed12ae tightened up the logic to use only find, but ignored the fact
that since the manpage hard link names were no longer captured. They
were created as separate compressed manpages, rather than as hardlinks.

This also introduces a minor efficiency of deleting all hardlinks at
once and using proper iteration over an array rather than a string.

Note to anyone else touching this code: e2fsprogs and libpcap are useful
for testing this. If that changes in the future, you can use the below
bash to locate others:

  IFS=$'\n' read -rd '' -a a < <(find /usr/share/man -type f \! -links 1)
  pacman -Qqo "${a[@]}" | sort -u

I broke it!

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-14 17:25:29 -04:00
Dave Reisner d1e04c1b67 makepkg: add missing newline on passing gpg sourcecheck
When a sourceball passes this check without any warnings, a newline is
omitted. Similar to the if clause of this else block, print a single new
line at the end of the clause instead of accounting for each output.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-14 14:19:18 -04:00
Dave Reisner 0f69e2ec0b makepkg: check for var existance before file existance
This prevents makepkg from aborting with 'file not found' when
changelog= or install= are declared in a PKGBUILD, but empty.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-12 08:27:13 -04:00
Dave Reisner c736a12e86 makepkg: unset errexit when sourcing /etc/profile
This is a fix for a bash3 specific bug, where a file sourced by
/etc/profile would exit non-zero and make its way back up to makepkg,
forcing it to exit after package installation. Along with unsetting the
ERR handler, temporarily unset errexit to avoid this.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-11 13:47:07 +10:00
Dave Reisner 905ae640cf makepkg: use more awk'ish syntax in sanity checks
This simplifies the flow a bit, making the pipeline a little easier to
grok.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-07 21:05:05 -05:00
Dave Reisner 4ed12aec30 makepkg: avoid for loop in deleting manpage hardlinks
find can do this all on its own and remain portable.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-07 21:05:04 -05:00
Dave Reisner 17c3de3e4f makepkg: act on function return value, not output
Correcting a typo, as this function will never output anything.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-07 21:05:04 -05:00
Dave Reisner 3d9f961d13 makepkg: refactor check_pgpsigs output
- display associated warnings on same line as pass/fail msg, to be more
  consistent with checksum verification output
- properly error on a revoked key (matching pacman's behavior)

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-07 21:05:04 -05:00
Dave Reisner 0e79802c0a makepkg: use globs in place of regex
We seem to enjoy using bash regex capabilities, but never referencing
the result with BASH_REMATCH. Replace almost all regexes with equivalent
globs which are faster and functionally equivalent in these cases.

This enables the extglob shopt.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-06 11:46:01 -05:00
Dave Reisner 29ad9e0a0a makepkg: unset variables as per !{make,build}flags
Don't just set the flag variables to zero length strings, actually unset
them from the environment. This fixes issues with broken gnu Makefies
that use ?= for assigment, where the presence of a var is enough to make
this condition avoid assignment.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-06 08:45:44 -05:00
Dan McGee 11873b70ae makepkg: fix overzealous PGP signature file matching
The regex wasn't rooted at the end of the filename, nor was it matching
a period/dot before the file extension. The end result was this matched a
file named '07_all_sig.patch' which is totally broken.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-01 11:42:55 -05:00
Dave Reisner cf1f014393 makepkg: fix sanity checking in versioning
Read the entire variable, respecting escapes, which are necessary to
retain for the successive eval.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-01 11:32:26 -05:00
Dave Reisner 5bb2d2e0a0 makepkg: read filenames in a while loop
Further improvments on 2ca27ab which will allow the changelog and
install script files to contain whitespace.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-01 11:32:20 -05:00
Dave Reisner 35d8cc8bc8 makepkg: fix breakage in eval'ing quoted strings
Broken in 2ca27a by me, trying to fix another problem.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-01 11:32:14 -05:00
Dave Reisner 2ca27ab3a1 makepkg: quote re-evaluation of simple vars
This is a safety measure to prevent simple code injection.

$ i="foo bar"
$ eval i="$i"
bash: bar: command not found
$ eval i=\"$i\"
$ echo "|$i|"
|foo bar|

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19 09:42:41 -05:00
Allan McRae c28052e45b makepkg: deal with variable substitution when checking sanity
If any of pkgver, pkgrel or epoch contained a variable substitution,
then it needed to be evaluated before checking its value conformed
to the rules.

[Dan: add quotes around RHS]

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:50:17 -05:00
Sebastien Luttringer 4a7f3bbc46 Add makepkg -S which is an alias to makepkg --source
makepkg --source is a often used go make source package like for AUR.
Have a -S shortcut will save the world.

Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18 10:47:41 -05:00
Dan McGee 3ceef97799 Fix trailing whitespace in whole codebase
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17 17:03:19 -05:00
Dave Reisner 71f854dde8 makepkg: don't hardcode path to strip
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15 06:33:01 -05:00
Dan McGee 1d16875db7 Update several translation strings
* Fix typos/capitalization
* Make sure large blocks of text are translated in one unit

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 19:01:26 -05:00
Dave Reisner 1a919a11b8 makepkg: ignore epoch when undeclared
In this case, we skip the epoch versioning entirely, as if it were
declared as 0.

Prevents errors such as:

/usr/bin/makepkg: line 244: ((: !  : syntax error: operand expected
(error token is " ")
==> Finished making: cower-git :20110808-1 (Mon Aug  8 17:17:27 EDT
2011)

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08 16:47:47 -05:00
Allan McRae 49d9426b6a makepkg: refactor checking source integrity
Move the source integrity checking into its own function as the code
was duplicated and is now more complicated with the separation of the
two checks types.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:47:23 -05:00
Allan McRae 2b3405e01b makepkg: more control of skipping integrity checks
Allows the skipping of all integrity checks (checksum and PGP) or
either the checksum or PGP checks individually.

Original-patch-by: Wieland Hoffman <theminew@googlemail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:47:13 -05:00
Wieland Hoffmann 94f61c5b29 makepkg: Add support for verifying pgp signatures
Many projects provide signature files along with the source code
archives. It's good to check these, too, when verifying the integrity
of source code archives.
Not everybody is using gpg so the verification can be disabled with
--skippgpcheck.
Additionally, only a warning is displayed when the key that signed the
source file is unknown.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:47:06 -05:00
Allan McRae ccdb2fa800 makepkg: get package version with overrides
When epoch, pkgver and/or pkgrel were overridden in a split package
function, makepkg failed hard finding the real version for checking
if packages were already built or trying to install packages. Fix
the get_full_version function to deal with overrides and return the
actual package version.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:45:25 -05:00
Allan McRae 03447ce39c makepkg: allow epoch to be overridden
We can override pkgver and pkgrel so it is only logical to add epoch
to that list

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:45:18 -05:00
Allan McRae a7940e7419 makepkg: check arch overrides for required architecture
Check any overrides of the "arch" variable contain the required
architecture.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:45:12 -05:00
Allan McRae 819f675004 makepkg: check overrides for pkgrel and pkgver
Enforce syntax checking for pkgrel and pkgver overrides in package
functions.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:45:06 -05:00
Allan McRae 00949db191 makepkg: pkgver and pkgrel can not have whitespace
There is always someone who tries to break things (cough *Dave* cough...)

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-27 12:44:59 -05:00
Dan McGee 48e2a1a119 Merge branch 'maint' 2011-07-18 10:41:37 -05:00
Allan McRae 297cd7897b makepkg: fix issue with filenames with spaces and noextract
Specifying a filename with spaces in a PKGBUILDs noextract array fails
due to a lack of quoting.

Fixes FS#25100.

Reported-by: Thomas Weißschuh <thomas_weissschuh@lavabit.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:41:27 -05:00
Rogutės Sparnuotos 3a04267cdd makepkg: only test for writable PKGDEST when needed.
There is no need for a writable PKGDEST when using the --nobuild or
--geninteg flags.

Allan: added --geninteg
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18 10:28:19 -05:00
Dave Reisner 6907a22b27 makepkg: remove unused -C option from option list
We nuke it from the completion file as well along with its longopt.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14 15:49:13 -05:00
Dave Reisner 727e03fe19 makepkg: skip devel_check when reading from a pipe
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14 15:44:48 -05:00
DJ Mills 282be6bf4b makepkg: Remove pre-optimization from in_array()
The '[[ -z' test in in_array() is redundant, so remove it.

Signed-off-by: DJ Mills <danielmills1@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-14 15:42:37 -05:00
DJ Mills 7f5b24597b makepkg: Remove OPT_TEMP hack in parse_options call
Instead of hacking around the error trap, simply do an explicit
test for failure.

Signed-off-by: DJ Mills <danielmills1@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-14 15:42:29 -05:00
Dan McGee 36e48573ce Add 'compress' compression format as an available option
This adds the '.tar.Z' option to both repo-add and makepkg for no other
reason than "why not", and because bsdtar supports it natively with the
'-Z' flag. Also update the documentation accordingly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14 14:58:46 -05:00
Florian Pritz 9efd10cd2a fix vim syntax highlighting of .sh files
vim recognises what type of shell script it's dealing with by looking at
the shebang. If detection fails it falls back to sh which doesn't
support some bash features. Adding a normal, possibly broken, shebang
which gets fixed by the Makefile allows vim to detect bash syntax.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 10:44:45 -05:00
Dan McGee c2cce4f3f5 Merge remote-tracking branch 'dave/makepkg' 2011-06-30 10:41:49 -05:00
Dan McGee c2e6a01a28 makepkg: only source user override if using default config file
Otherwise there is no way to easily test or run with a standalone config
file without outside interference.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 10:29:49 -05:00
Rémy Oudompheng 4c80f994c3 makepkg: fix typo (missing quotes)
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 10:28:24 -05:00
Allan McRae e92905a2c8 makepkg: fix removing symbolic link
The path was not being stripped from $file before prefixing with
$srcdir resulting in the attempted removal of a very weird
filename.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30 10:28:18 -05:00
Dave Reisner 9a29888ba7 makepkg: simplify SIGNPKG check
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-28 23:15:58 -04:00
Dave Reisner 5f6e8c9274 makepkg: fix vim syntax highlighting
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-28 23:05:57 -04:00
Dave Reisner 452bf71cec makepkg: remove unneeded echo
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-28 23:05:57 -04:00
Dan McGee 9aab1440ca Revert "Merge branch 'master' of git://projects.archlinux.org/pacman"
This reverts the merge of 2d32a9a3a3,
which reverts the commit 8581694ceb.

Thanks Dave for the dirty branch and non-clean rebase! :) Dave broke it.
2011-06-27 21:43:58 -05:00
Dan McGee a12acbc2ff Merge remote-tracking branch 'dave/repo-add' 2011-06-27 13:30:37 -05:00
Eric Bélanger 51ed7dff0d Remove -f option from ln for POSIX compliance
Fixes FS#24893.

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>
2011-06-27 09:24:41 -05:00
Eric Bélanger f5dc5c46e0 makepkg: Add warning if VCS tool is not present when determining latest VCS revision
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>
2011-06-27 09:24:28 -05:00
Eric Bélanger bdd8ebd631 makepkg: Move check for sudo into check_software function
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>
2011-06-27 09:24:19 -05:00
Dave Reisner 2d32a9a3a3 Merge branch 'master' of git://projects.archlinux.org/pacman
* 'master' of git://projects.archlinux.org/pacman:
  pactree: carry a list of databases for dep resolution
  makepkg: Remove a lone quotation mark
  makepkg: remove the cleancache option
  Don't require a transaction for sync DB updates
  Move locking functions to handle
  Add a 'valid' flag to the database object
  Move database 'version' check to registration time
  Do database signature checking at load time
2011-06-24 14:55:32 -04:00
Wieland Hoffmann 61cb8e76c3 makepkg: Remove a lone quotation mark
Allan broke it in 4bdb868.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 13:36:46 -05:00
Allan McRae c45cfb1741 makepkg: remove the cleancache option
This is a fairly useless feature given all it does is an "rm" on a
directory.  It is also unlikely that you would want to remove the
entire SRCDEST anyway, but rather just the old files.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-24 13:36:38 -05:00
Dave Reisner 8581694ceb makepkg: fix incorrect parenthesis in gettext call
allan broke it in 4bdb868a.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-24 08:36:54 -04:00
Allan McRae 4bdb868ac8 makepkg: clean-up of output messages
There was a lot of inconsistency in how strings that should not be
translated (program names, option flags, PKGBUILD directives, etc) were
handled. This patch moves them all outside the gettext invocation for
consistency and to prevent accidental translation.

Note that some of these may need reverted if they cause difficulties in
translation due to gettext usage in bash not taking positional parameters
for arguments. A quick survey of current translations indicates that this
issue will be rare.  Also, we should be able to catch these before a full
string freeze given we are going to probably need a "developer preview"
release before the next release series.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-24 02:02:21 -05:00
Dan McGee ac7d17f88e Merge branch 'po-split' 2011-06-23 23:44:35 -05:00
Dan McGee a4a7006a13 po/: split into scripts/po/ and src/pacman/po/
This is the first step at separating the pacman message catalog and the
scripts message catalog. Makefiles, configure.ac, and other such files
are adjusted accordingly, as well as renaming files. The TEXTDOMAIN of
scripts is also adjusted.

Note that no actual pot or po files get changed here; these will get
pruned in a future commit so each catalog contains only the necessary
messages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 22:50:01 -05:00
Eric Bélanger eedd56f320 makepkg: Added checks in check_software for distcc, ccache, strip and gzip
Dan: slightly shorten some of the messages.

Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 21:39:37 -05:00
Dan McGee aa89a65a83 makepkg: remove distcc/makeflags option interaction
Way back in c94bfbaba when refactoring makepkg options handling, I added
these lines to unset MAKEFLAGS if '!distcc' was set in a PKGBUILD (not
taking into account makepkg.conf settings). This was an attempt to say
"if it is broken in distcc, it is probably broken even more". However,
this is silly as one should be using '!makeflags' as well. Remove the
linkage.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 21:35:52 -05:00
Dan McGee 886a31ef20 makepkg: fix 'check_sofware' typo
Allan broke it!

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 11:51:58 -05:00
Allan McRae 7468956236 makepkg: add software check function
Add a function that checks for the software needed by makepkg to
process a PKGBUILD with the requested options.  This allows makepkg
to bail early in the packaging process.

Many other checks can be added to this function...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 10:49:33 -05:00
Allan McRae 41f9fa9bed makepkg: move comment into correct place
Oops... Introduced by commit d21f6ca4.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 10:47:12 -05:00
Allan McRae 3497eb4e2c makepkg: adjust libprovides/depends messages
Contractions are less clear for non-native speakers so should be
avoided (and cause syntax highlighting issues).  Also, the 'provides'
and 'depends' strings are not to be translated.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 10:46:38 -05:00
Allan McRae 508b360c24 makepkg: allow specifying alternative build directory
Add a BUILDDIR variable (which can be overridden in the environment)
to specify an alternative location for building the package. This is
useful for people who want to build on a different filesystem for
improved performance (e.g. tmpfs).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 10:45:55 -05:00
Allan McRae b803a33a8f makepkg: Add UPX compression support
This patch enables the automatic compression of executable binaries
using UPX when the 'upx' options is specified in makepkg.conf or the
PKGBUILD.  Additional arguments can be passed to UPX by specifying
the UPXFLAGS variable.

Original-patch-by: Bryce Gibson <bryce@gibson-consulting.com.au>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22 10:45:18 -05:00
Florian Pritz 34876e4fe9 makepkg: fix broken syntax (double $)
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20 00:20:52 -05:00
Allan McRae d21f6ca4aa makepkg: create source package inside fakeroot
Create source package files inside the fakeroot environment to
ensure reasonable ownership of files within the archive.

Fixes FS#24330.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:20:52 -05:00
Allan McRae 6f3a2145b0 makepkg: move option parsing code to separate file
This move the getopt replacement function parse_options out of
makepkg.sh.in and into a separate file.  The code is inserted
into the relevant place in makepkg using m4.

This will allow the reuse of the option parsing code in other
scripts (i.e. pacman-key) while avoiding code duplication.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:16:38 -05:00
Allan McRae 700a5374f1 makepkg: reword purge message
Clarfiy that it is unwanted files are being removed rather than "other"
files (whatever they are...).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:13:02 -05:00
Dan McGee c206b3a6d5 Merge remote-tracking branch 'florian/sodeps' 2011-06-14 08:30:23 -05:00
Dan McGee 8c6a636cd9 Merge branch 'maint'
Conflicts:
	lib/libalpm/add.c
2011-06-07 11:43:12 -05:00
Allan McRae 3df88a1a01 makepkg: fix creation of source package with -p
When creating a source package using an non-local buildscript via
the -p option, the inclusion of changelog and install files would
fail. Fixes FS#24567.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07 10:49:28 -05:00
Florian Pritz 73d5eb1edf makepkg: add libdepends support
The user adds libaries to the depends array without a version. These
must end with .so.
Example: depends=(glibc libc.so)

find_libdepends() looks for ELF files (not symlinks because these could
point outside of pkgdir) in $pkgdir, extracts the library sonames the
binary links to and outputs depends seperated by spaces.
This list contains all libraries needed by the package.
Example: libfoo.so=3-64

write_pkginfo() only keeps .so depends with version information and warns
the user about unneded ones.

Support-by: Thomas Bächler <thomas@archlinux.org>
Support-by: Christoph Schied <Christoph.Schied@uni-ulm.de>
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
2011-06-01 21:34:16 +02:00
Florian Pritz 79f1a3c4a1 makepkg: add libprovides support
The user adds libaries to the provides array without a version. These
must end with .so.
Example: provides=(readline libreadline.so)

find_libprovides() looks for .so files (not symlinks because these could
point outside of pkgdir) in $pkgdir, extracts the library soname (ld
links the binary to this name) and outputs provides seperated by spaces.
This list contains all libraries provided by the package.
Example: libfoo.so=3-64

write_pkginfo() only keeps .so provides with version information and warns
the user about unneded ones.

Support-by: Thomas Bächler <thomas@archlinux.org>
Support-by: Christoph Schied <Christoph.Schied@uni-ulm.de>
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
2011-05-27 13:29:22 +02:00
Dan McGee 991bfb7cbf Merge branch 'maint' 2011-05-04 15:54:42 -05:00
Allan McRae 8fd9037cfd makepkg: quote variable that may contain spaces
Prevents failures when $PKGDEST contains spaces (FS#24002)

Patch-by: Sebastien Duthil
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-02 10:04:36 -05:00
Ivan Kanakarakis 6f19a8c9f7 makepkg, pacman-key: unify help message with other scripts
The help message changed to match the one rankmirrors script has.
It's clearer as to what the --help switch does.

Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21 12:09:18 -05:00
Allan McRae 4c31bc6e3f Add configure option to specify package signing key
Add the "GPGKEY" option to makepkg.conf for specifying signing packages
with the non-default key from the keyring.  Is overridded by makepkg's
--key option.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-20 18:58:55 -05:00
Dan McGee efd8ae483f Merge branch 'maint'
Conflicts:
	lib/libalpm/alpm.h
	lib/libalpm/trans.c

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-15 18:41:49 -05:00
Rémy Oudompheng a93e058b68 makepkg.sh.in: fix a GNU-ism in su invocation
GNU su supports the -c option to specify a command to execute.
However, other flavours of su may have a different interpretation
of the '-c' flag (e.g. FreeBSD and OpenBSD).

The behaviour is correct when '-c' follows an explicit username.

Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-13 10:33:22 -05:00
Dan McGee c5addd94e3 Merge branch 'maint'
Conflicts:
	lib/libalpm/be_sync.c
	lib/libalpm/db.c
	src/pacman/util.c
2011-04-05 00:49:30 -05:00
Rémy Oudompheng 40fd8123a2 makepkg: fix a GNU-ism in awk usage
A non-GNU version of awk may not support the (|...) syntax for
an optional group and require '()' to match an empty string.
The (...)? syntax is more appropriate for this usage.

Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-04 19:03:49 -05:00
Allan McRae 37df0d4f4f makepkg: improve parsing for sanity checks
Trailing backslahses can lead to additional spaces at the front
of extracted entries.  See FS#23524.  Strip these while parsing
the PKGBUILD entries.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-04 19:03:40 -05:00
Allan McRae a164c8405a makepkg: remove unnecessary tr usage
The use of "tr" only leads to trouble.  Remove unnecessary usage
of it from within makepkg.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-30 20:43:36 -05:00
Dave Reisner 541c2470b8 makepkg: avoid usage of tr to sidestep locale issues
to quote dan:
  "turkish will FUCK YOU UP. this is not the first or the last time"

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-30 20:43:11 -05:00
Denis A. Altoé Falqueto e8069cfc3d makepkg: command line options for signing packages
Three new command line options were added:

--sign: forces the generation of a signature for the resulting package,
taking precedence over the value in makepkg.conf

--nosign: do not sign the resulting package

--key <key>: use a different key than the user's default for signing
the package.

A check is performed to ensure the user has (provided) a valid gpg key
for signing.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28 09:03:28 -05:00
Ray Kohler 43dacceb6b makepkg: allow PKGEXT and SRCEXT to be overridden by env variables
Signed-off-by: Ray Kohler <ataraxia937@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:15:52 -05:00
Dave Reisner c02556e290 Rely on the return value of type instead of its output
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27 20:15:20 -05:00
Dan McGee 86e7f60756 Merge branch 'maint' 2011-03-24 21:18:09 -05:00
Jan Steffens 14474a32c9 Make log redirection saner
My main motivation was to remove the "sync", which can stall for
minutes on a busy machine (FS#23378). I also cleaned up the redirection.

Signed-off-by: Jan Steffens <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-24 20:27:56 -05:00
Allan McRae 2f2f53ddc9 makepkg: place signature symlink in build dir
Be consistent in package and signature placements when using
PKGDEST.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-22 23:52:00 -05:00
Dan McGee 82e22596d8 makepkg: allow signatures to work with split packages
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-22 23:52:00 -05:00
Geoffroy Carrier ee34869e89 Add GPG signature support to makepkg
This is a rather simple patch to add signing support to makepkg. Add a
create_signature() to makepkg, add a 'sign' BUILDENV option in makepkg.conf,
and document the changes in the makepkg.conf manpage.

Signed-off-by: Geoffroy Carrier <geoffroy.carrier@koon.fr>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-22 23:52:00 -05:00
Allan McRae b6cada3eed makepkg: Improve optdepends extraction
Prevents issues where optdepends descriptions contain a bracket.
Also, strip all comments from arrays before joining them.

Fixes FS#23307.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 11:15:34 -05:00
Dan McGee 09ce8b446c Fix some easy to find double translations
A lot of these were places that should have used the same message but
didn't, or were very easy to convert to using the same message and
letting some of the burden off of the translators.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 17:50:23 -06:00
Dan McGee 62fc966882 Ensure pkgbase/epoch are defined before doing anything
When generating integrity sums, we could get some weird output before due to
epoch being uninitialized:

    /usr/bin/makepkg: line 234: [[: 2.6.37: syntax error: invalid arithmetic operator (error token is ".6.37")

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:23:43 -06:00
Allan McRae bb071f4eb2 makepkg: more bash-3.2 compatibility
Adding the "|| true" to the subshell prevents bash-3.2 setting off the
error_trap but requires changing the if statement.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-06 12:52:59 -06:00
Allan McRae f892775366 makepkg: initialize local arrays to empty
Fixes bash-3.2 compatibility.

Thanks-to: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-02 20:47:08 -06:00
Allan McRae 35a8cf134b makepkg: error on invalid optdepends
Missed in commit a88cb03a.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-02 18:46:47 -06:00
Cedric Staniewski d8c4b12c66 makepkg: make SRCPKGDEST default to $startdir
The current behaviour, which is placing source packages in PKGDEST if
SRCPKGDEST is not set, is inconsistent with {SRC,PKG}DEST handling and
there is no real advantage in doing so.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-02 18:46:39 -06:00
Nezmer 332dd86912 makepkg: Fix the check for references to srcdir/pkgdir
At least in FreeBSD, find always returns 0 if it finds stuff
(imagine that). It doesn't care about the exit status of whatever is
passed to -exec.

This patch makes the checks compatible with this behaviour.

Using xargs and not using grep directly because packages with too many
files would cause grep to complain about argument list being too long.

This should also fix the false positive in packages with no files.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-02 18:46:23 -06:00
Cedric Staniewski 3444146b48 makepkg: fix indention to follow style guide
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-01 10:04:44 -06:00
Dan McGee b8ab96a270 makepkg: encode epoch in version specifier if > 0
This makes things consistent with everywhere else we are incorporating the
new optional epoch field. Add a helper function that forms the version
string for you and use it in makepkg where I found 'pkgver.*-.*pkgrel'.

This exposes a few shortcomings in a previous "Override pkgver" patch
(2020e629) in the install package and check if built functions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:02:09 -06:00
Dan McGee bf46e04614 Remove epoch as an independent field
Instead, go the same route we have always taken with version-release in
libalpm and treat it all as one piece of information. Makepkg is the only
script that knows about epoch as a distinct value; from there on out we will
parse out the components as necessary.

This makes the code a lot simpler as far as epoch handling goes. The
downside here is that we are tossing some compatibility to the wind;
packages using force will have to be rebuilt with an incremented epoch to
keep their special status.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 19:30:45 -06:00
Dan McGee a88cb03a58 makepkg: perform all sanity checks before erroring out
It is pretty annoying to get one, fix it, and then get another. We should be
able to continue on through most of the sanity checks in one go so the user
gets all the error messages at once.

Also ensure $pkgbase is defined by the time we call this function;
previously we printed nothing where a package name should have been due to
this oversight.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-14 00:25:16 -06:00
Allan McRae d288240426 Update copyright years for 2011
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 18:47:37 -06:00
Allan McRae 2052f29cdb makepkg: add option to clear buildflags
Add the "buildflags" option, which is useful in its negative form
for disabling CFLAGS, CXXFLAGS and LDFLAGS when building a package.
This is useful when determining of one of these flags is causing
an issue with a package.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:28:33 -06:00
Allan McRae 0c29eb431a makepkg: Add check() function for running test suites
A PKGBUILD can have an option check() function for running test suites
between the build() and package() stages.  This function is run by
default but can be disabled globally in with "!check" in BUILDENV in
makepkg.conf. This setting can be controlled on an individual package
basis using makepkg's --check and --nocheck flags. Addition dependencies
needed for running the test suite can be specified in the checkdepends
array and are only checked when running the check() function.

Original-work-by: Jeff C <jeff@kcaccess.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:28:00 -06:00
Dave Reisner bd98b93a6e makepkg: escape closing bash array paren for awk
The closing parenthesis of bash arrays needs to be escaped in the ending
address of awk expressions in order to play nicely with implementations
of awk other than gawk. This change provides compatibility with gawk,
nawk and mawk.

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-12-29 18:44:46 -06:00
Allan McRae eb93955477 makepkg: allow pkgname usage in split package functions
Currently, using $pkgname in a split package package_*() function
always returns the first value in the pkgname array rather than the
name of tha package being packaged.  Fix this so $pkgname gives the
expected value.

Fixes FS#22174

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 18:44:32 -06:00
Allan McRae 5776090055 makepkg: remove last inappropriate PKGBUILD usage
We should always use $BUILDSCRIPT instead of PKGBUILD.  The only
remaining uses of PKGBUILD in makekg are in comments.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 18:03:01 -06:00
Allan McRae ef977865a1 makepkg: perform sanity checks on variables in package functions
Check the over-ridden entries for provides, backup, optdepends and
options for illegal entries.  Partially fixes FS#16004.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-12-12 20:32:13 -06:00
Andres P 889c260cbf makepkg: remove dead code from handle_deps
The error message that has been removed never gets to print because, given the
same condition, handle_deps throws the same error and then immediately exits
makepkg.

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-12-12 20:25:09 -06:00
Andres P 579533d1a0 makepkg: do not ignore errors from pacman when checking deps
As check_deps is run in a subshell, exit had the same meaning as return.
Since the intention is to halt makepkg when pacman throws an error other than
127, the enclosing function has to handle error control instead.

Fixes FS#19840

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-12-12 20:24:59 -06:00
Carlos Diaz 330951200c makepkg: use portable escape sequence for terminal escapes
The escape string isn't necesarily \033; it's determined by what the
particular termcap/info entry for that terminal contains.

Bash uses ncurses functions to expand \e to the _correct_ terminal
escape.

Signed-off-by: Carlos Diaz <839273@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:24:46 -06:00
Dan McGee 93718046d7 Add epoch verification to makepkg
If defined, it must be an integer.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:27 -05:00
Dan McGee 6f37ba61ed Make repo-add and makepkg epoch-aware
Allow it to be a variable in the PKGBUILD as well as propagating it through
to the built package and the package database. We leave some backward
compatibility in place by placing the '%FORCE%' option in the database if
the package contains an epoch; this will be used by older versions of pacman
and more or less ignored by versions that use epoch.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:26 -05:00
Dan McGee 6eedf06fcc Fix bash shell location check
BASH is defined when you are actually using bash during configure, which
sucks because it ends up being '/bin/sh', messing up all of our scripts.
Change the name of the variable we use in configure, and also ensure we get
a full path to the executable by using AC_PATH_PROGS rather than
AC_CHECK_PROGS. Finally, change the variable name everywhere we use it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 17:50:54 -05:00
Nezmer 05f0a28932 Use sysconfdir, localstatedir, BASH instead of hardcoded values
This applies to contrib/ files, our scripts, and the documentation.

Dan: fix 'make clean' in contrib/ directory.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:29:22 -05:00
Nezmer fb79d58109 makepkg: Use mkfifo instead of GNU-only 'mknod <file> p'
'mknod <file> p' is apparently GNU-only. Looking at coreutils' source
code, It just calls mkfifo.

This one line patch should fix makepkg logging in non-GNU systems.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 17:01:55 -05:00
Allan McRae c0f58ea9a2 makepkg: canonicalize paths from environmental variables
This prevents circular symlinks and weird final package locations
when using commands like  'PKGDEST="." makepkg'.

Fixes FS#20922.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 11:03:28 -05:00
Allan McRae 960c2cdcf7 makepkg: compare paths using bash test
Compare paths using bash's "-ef" rather than by string tests as this
takes symlinks into account.  This will prevent issues similar to those
in FS#20922 if (e.g.) $PKGDEST is a symlink to $startdir.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 11:03:06 -05:00
Allan McRae f2296aab89 makepkg: improve srcdir check and add pkgdir
The checking of the package for $srcdir references was overly
sensitive and gave a lot of what appear to be false positives with
binary files (in particular with debugging symbols kept).

Restrict the search for $srcdir to non-binary files as this should
still catch the majority of configuration issues the check was
initially designed to catch. Also, add a similar check for $pkgdir.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 10:58:21 -05:00
Allan McRae 022ec3dbb7 makepkg: remove STRIP_DIRS
For binary packages, the majority of the time used in the debugs symbol
stripping process is the actual stripping of the binaries/libraries and
not the testing of which files to strip.  This allows more complete
stripping of packages that install to "non-standard" paths that would
not be generally included in makepkg.conf.

Any performance hit that may be apparent for (_large_) "arch=('any')"
packages can readily be avoided by disabling stripping in the PKGBUILD
options array.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 10:58:05 -05:00
Dan McGee 31aed1243e Remove quotes in remaining bash regexes
After a8dcfeccfc, Allan noted that one more regular exprssion inside makepkg
also contained quotes; these should not be there for the same reason as that
commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-07 08:27:25 -05:00
Jürgen Hötzel 38a60f49bd Use pipe to create compressed package instead of an intermediate tar file
A pipe between tar and compression command is used. This improves
performance by running tar and the compression command simultaneously.

Using a pipe also reduces IO by not writing an intermediate tar file
to disk.

Signed-off-by: Juergen Hoetzel <juergen@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 13:07:57 -05:00
Dan McGee a8dcfeccfc makepkg: remove trailing quote mark in regex
Regular expressions in bash should not be quoted. Glad this was in the
documentation and I didn't have to go to #bash to ask...

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 11:04:21 -05:00
Dan McGee 8d88f0c897 Merge branch 'maint' 2010-08-23 21:53:06 -05:00
Allan McRae a28868eeae makepkg: error out on empty optdepends entries
If optdepends was defined with empty members, then makepkg would
abort late in the package building process.  Detect such cases
in the check_sanity() function.

Fix-provided-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:51:45 -05:00
Allan McRae 08e1d4764c makepkg: use less local variables in check_sanity
Instead of declaring a new local variable for each loop in the
check_sanity() function, just reuse $i.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:51:12 -05:00
Allan McRae f04530eb61 makepkg: remove unnecessary variable presence check
It is unnecessary to check for a variables existence before
looping over it.

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

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:50:57 -05:00
Allan McRae 68d8bfa0b5 makepkg: clarify invalid backup entry errors
"Invalid backup entry" was not a particular helpful error message,
especially when it was due to the file not being in the final package.
Clarify these two messages.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:50:46 -05:00
Andres P f27fed14b1 makepkg: less code duplication in create_package
Combine changelog and install file creation in create_package().

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:49:55 -05:00
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
Allan McRae 5908992e47 makepkg: add file to the list of needed utilities
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-18 13:11:55 -05:00
Allan McRae b02bda75f1 makepkg: check tput support before using
Prevent makepkg aborting whe colors are enabled and the terminal
does not support setting colors by tput.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-18 13:10:03 -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
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