summaryrefslogtreecommitdiffstats
path: root/scripts/makepkg.sh.in
AgeCommit message (Collapse)AuthorFilesLines
2012-05-21makepkg: use mapfile where plausibleDave Reisner1-6/+5
With bash4 as a requirement, we can use mapfile when reading command output into an array. mapfile has the advantage of using block buffered I/O rather than line buffered I/O, making it slightly faster for most jobs. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-01makepkg: fix package arch detectionAllan McRae1-0/+1
get_pkg_arch checked for the arch variable being overridden in the package_$1() function when used with a package as a parameter. However, when there was no override, it did not fall back to the global value. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-30makepkg: remove subshelling from check_option and friendsDave Reisner1-58/+79
Instead of creating a subshell for each of these checks (of which there are many), pass in an expected value and make the check_* function do the comparison for us, returning 0 (match), 1, (mismatch), or 127 (not found). For a measureable benefit, I tested this on a fairly simple package, perl-term-readkey, and counted the number of clone(2) syscalls to try and isolate those generated by makepkg itself, rather than the user defined functions. Results as shown below: 336 before 180 after So, roughly a 50% reduction, which makes sense given that a single check_option() call could be up to 3 subprocesses in total. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-30makepkg: null terminate filenames to stripDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24makepkg: Be more consistent with missing program messageAllan McRae1-1/+1
Also prevent "sudo" and "su" from being translated. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24makepkg: treat list of packages to be installed as an arrayAllan McRae1-2/+2
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24makepkg: deal with overriden package arch properlyAllan McRae1-18/+33
This fixes a lot of checks done by makepkg (e.g. to see if a package is already built and choosing which package to install). Previously, if a package had both "i686" and "any" versions, the "i686" one always took precidence regardless of the value of "arch" in the PKGBUILD for that package. Fixes FS#27204. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24Merge branch 'maint'Dan McGee1-0/+5
Conflicts: scripts/repo-add.sh.in
2012-04-24scripts: avoid dumping usage on parser failDave Reisner1-1/+1
Avoid letting the error message from parseopts get lost in the usage output from pacman-key and makepkg (which is already verbose).
2012-04-24makepkg: allow specifying --pkg multiple timesDave Reisner1-1/+1
Make this option additive, so that the following two operations are equivalent: makepkg --pkg foo --pkg bar makepkg --pkg foo,bar
2012-04-24makepkg: adopt parseopts for option parsingDave Reisner1-13/+13
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-21makepkg: restrict allowed characters in pkgnameDave Reisner1-0/+5
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-09makepkg: save and restore shopts when sourcing /etc/profileAllan McRae1-0/+4
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-09makepkg: complain when the buildfile isn't writeableDave Reisner1-7/+7
If the PKGBUILD isn't writeable for devel_update, throw a warning instead of silently ignoring it. Some logical reordering is present in this patch to reduce the number of nested if's. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-09makepkg: catch errors sourcing filesDave Reisner1-9/+14
create source_safe() function which temporarily disables extglob and exits on error. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-09makepkg: restrict usage of errexit to user functionsDave Reisner1-23/+23
It's expected that this will lead to unwanted behavior, and needs widespread testing. It's desirable to commit this for a few reasons: - there's no reason we can't do our own error checking for code that we write. - it avoids the need for ||true hacks scattered about in the code. - it makes us immune to upstream changes in exit codes (FS#28248) Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-09makepkg: treat lib{provides,depends} returns as proper arraysDave Reisner1-6/+6
Make these functions more whitespace space by treating newlines as the element delimiter rather than every form of whitespace. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-09makepkg: use proper array addition in libdepsDave Reisner1-7/+7
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-09makepkg: add missing newline from libprovides outputDave Reisner1-1/+1
This was a small oversight from 1917c845 which causes makepkg to write provides entries to the .PKGINFO file improperly, e.g. provides = systemdlibsystemdudev=999 Add a newline in the printf format to ensure that these are spaced appropriately. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07makepkg: safely change directoriesAllan McRae1-13/+21
In preparation for the removal of the global error trap we need a way to ensure changing directories succeeds. Add a "cd_safe" wrapper that performs the necessary check. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07makepkg: use printf rather than echo to output variableAllan McRae1-31/+31
Also make sure the strings passed to %s in printf are always quoted. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07makepkg: the rhs in string comparisons should be quotedAllan McRae1-12/+12
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07makepkg: devel_check(): cleanup for hg versionMatthew Monaco1-5/+7
Use pushd/popd, quote args, handle some more errors
2012-04-07makepkg: devel_check(): set newpkgver (cleanup)Matthew Monaco1-27/+34
The case structure allows the syntax to focus on what's actually being done here.
2012-04-07makepkg: devel_check(): consolidate common codeMatthew Monaco1-30/+7
2012-04-07makepkg: devel_check(): determine vcsMatthew Monaco1-0/+16
Rather than prioritizing an arbitrary VCS, collect all development directives. If there is more than one, give a warning and abort.
2012-04-07makepkg: remove unused variableMatthew Monaco1-1/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07Merge branch 'maint'Dan McGee1-3/+9
Conflicts: lib/libalpm/signing.c lib/libalpm/sync.c
2012-04-07Revert "makepkg: calculate exact total file size"Dan McGee1-1/+2
This reverts commit b264fb9e9ddcc31dc8782390309421965e507383. With our "fix" of sleeping for BTRFS, we can go back to using `du` to calculate total installed size.
2012-04-07Revert "parseopts: normalize options into an array"Dave Reisner1-3/+3
This was really only half a fix for FS#28445, as it still doesn't correctly handle the case of filenames with spaces. In the short term, there is no obvious fix for this. In the long term, I believe the correct decision is to rewrite the options parser to be more in line with GNU getopt_long. This reverts commits: ca4142714137b16feabac09c4cda86b0a75036f8. 969dcddbdf9d5dbd91aa414cdd193f3fb26b644b.
2012-03-28makepkg: avoid reporting bogus install size on btrfsDave Reisner1-0/+6
delayed allocation hoses us here and causes erroenous install sizes to be reported. Add a short sleep to allow the transaction to be committed to the filesystem and the stat buffers to be updated. This is apparently a "feature", as per to some of the denizens of #btrfs on freenode. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16Merge branch 'maint'Dan McGee1-1/+1
Conflicts: lib/libalpm/sync.c
2012-03-16makepkg: quote removed filename as it can have spacesAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16makepkg: abort when failing to create BUILDDIRAllan McRae1-2/+5
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16makepkg: prevent issues with files starting with a hyphenAllan McRae1-3/+3
Most places in makepkg deal with full file paths, but a few use the file name only. Protect from potential issues when a file name starts with a hyphen. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16makepkg: append pkgbase to BUILDDIR if specifiedAllan McRae1-2/+8
This means multiple packages can be build using the same BUILDDIR without their source files all ending up extracted in the same directory. Fixes FS#28417. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-09Merge branch 'maint'Dan McGee1-6/+12
Conflicts: lib/libalpm/be_package.c
2012-03-09makepkg: exit via default signal handler in trap_exitDave Reisner1-4/+9
Similar to how we manage receipt of SIGINT in pacman's internal downloader, catch the signal and invoke our own trap handler before unsetting it and calling the default. This requires a slight modification to the arguments passed to trap_exit so we can pass the raised signal to trap_exit (note that we substitue USR1 for ERR since the latter is unique to bash). Fixes FS#28491. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-09makepkg: use array instead of stringDave Reisner1-3/+3
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-09makepkg: avoid use of eval in run_pacmanDave Reisner1-5/+5
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-09makepkg: enforce decimal format for pkgrelDave Reisner1-2/+2
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-09makepkg: allow specifying compression optionsChristian Hesse1-4/+4
Adds the ability to override the commands used to compressing compiled and source packages. This is useful for those wanting to use alternative implementations of the compression tools or non-default compression options. Allan: documented options in man page Signed-off-by: Allan McRae <allan@archlinux.org>
2012-03-05makepkg: fix false error with multiple libdepsFlorian Pritz1-1/+2
With multiple items in $libdepends this check only worked for the first one, everything after this returned an error. This was probably an issue with \s being treated wrong. Fix-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Florian Pritz <bluewind@xinu.at>
2012-03-05makepkg: fix extraction of soname in find_libdependsFlorian Pritz1-1/+1
libperl.so results in soname="libperl.so.so" which is wrong. This returns the correct string: "libperl.so" Fix-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Florian Pritz <bluewind@xinu.at>
2012-02-21Merge branch 'maint'Dan McGee1-4/+6
Conflicts: contrib/pacsysclean.in src/pacman/conf.h
2012-02-20makepkg: rework libprovidesAllan McRae1-39/+50
This reworks the implmentation of libprovides for the following benefits: - Moves functionality from write_pkginfo() to find_libprovides() - Only calculates the version for libraries specifically requested and not all libraries. This has the disadvantage of running find over the $pkgdir for as many libraries as needed, but is unlikely to be an issue due to caching. - The order of the provides array in the PKGBUILD is kept in the package - There are more warning messages when things fail and those that were there are no longer errors (as I do not think failure of libprovides should result in complete packaging failure) - It is now modular so can be easy extended to other library types other than ELF *.so. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-17parseopts: normalize options into an arrayDave Reisner1-3/+3
Modify parse_options logic to fill an array instead of printing parsed options. Avoid eval like the plague. Because it is the plague. Fixes bugs such as FS#28445. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-15makepkg: fix syntax error in remove_depsChristoph Vigano1-1/+1
This fixes a problem that occurs if you tell makepkg to remove installed dependencies (just to be sure) but there are none. As the $ was missing in front of deplist, the check never happened and 'pacman -Rn' was called which obviously failed. Dan: later reported as FS#28448. Signed-off-by: Christoph Vigano <mail@cvigano.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-14scripts: unset CDPATH if cd is usedDan McGee1-0/+2
This wonderful/awful little bash shell variable wrecks havoc on `cd` calls in shell scripts. Unset CDPATH in makepkg where we use `cd` quite heavily. In pacman-optimize, we can move the change directory logic into the bsdtar call so we are left with no usages of `cd` in the script. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13Merge branch 'maint'Dan McGee1-2/+11
Conflicts: lib/libalpm/sync.c src/util/pactree.c