1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-10-31 15:45:03 -04:00
Commit Graph

48 Commits

Author SHA1 Message Date
Allan McRae
577701250d Use coreutils binaries for checking/generating checksums
If pacman is build against a crypto library other than openssl, it makes no
sense to require makepkg to use it.

The only currently considered alternative to openssl is nettle, which has no
binary for base64 encode/decode. This means that we could replace the hashing
cacluations with nettle-hash, but would require base64 from coreutils.

Given makepkg already relies heavily on coreutils, we might as well use all
the coreutils hashing binaries too.

This patch also improves the checking of required binaries for hashing
operations.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:55 +10:00
Alad Wenter
1f8f0bd9ac makepkg: Move parseopts from library to libmakepkg
parseopts is used in makepkg and other scripts such as pacman-key as a
getopt replacement.

Instead of including it in those scripts via a macro, move it to
libmakepkg/util/parseopts.sh and have scripts source this file where
appropriate.

To keep the parseopts test, a new variable was introduced:
PM_LIBMAKEPKG_DIR

Signed-off-by: Alad Wenter <alad@archlinux.info>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:54 +10:00
Alad Wenter
aca153bfa6 libmakepkg: generate all scripts
In order for the scripts to be used in testsuites, it is easiest to generate
all of them so they are found in the build directory (which may be different
to the source directory).

Signed-off-by: Alad Wenter <alad@archlinux.info>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:28 +10:00
Christian Hesse
e2b4e220bc lint_pkgbuild/pkgname: pkgname is not allowed to be empty
We checked for empty array elements, but did not catch empty array. Add
a check for that case as well.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-10 10:38:05 +10:00
Jack O'Connor
56de155296 libmakepkg: look for architecture-specific hashes in get_integlist
`makepkg -g` looks for existing checksums in the PKGBUILD file, so that
it can generate new sums of the same type. Previously it only checked
variables of the form "sha256sums", and not "sha256sums_x86_64". That
meant it would always fall back to MD5 for packages with only
architecture-specific sources. This change makes it look at
architecture-specific checksums too to determine the type.

Signed-off-by: Jack O'Connor <oconnor663@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Ashley Whetter
4f114f3817 libmakepkg: extract functions for integrity checking
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:56 +10:00
Ashley Whetter
4cad2423a3 libmakepkg: extract functions for writing .SRCINFO files
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-28 16:26:12 +10:00
Allan McRae
baf1ff64e6 libmakepkg: ensure emptydir find command acts on individual directories
Using "-exec command {} +" systax exits on any error.  Such errors occur when
running rmdir on a non-empty directory.  Switch to "{} ;" syntax instead which
avoids exiting before the find command is completed.

Fixes FS#48515.

Note, we can not use "-empty" in the find command because it is not supported
by Busybox find, and the "--ignore-fail-on-non-empty" flag for rmdir is not
available on BSD rmdir variants.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-21 13:14:56 +10:00
Allan McRae
1a29744d0d makepkg: Remove upx and optipng support
These options were added before libmakepkg allowed passes like this to be
dropped in.  I prefer only real core packaging tasks to be included in
makepkg and additional things like this to be dropped in by a user or
distribution that wants to support them.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
d4f499f563 libmakepkg: fix is_array function
This happened to work for the majority of cases because the only calling
function used a variable named "i" that was related to the variable being
passed to the function.

Fixes FS#48340.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
3cb1669e07 libmakepkg: increase robustness of the detection of array variables
Extract array detection into its own utility function that ensures
extglob is enabled.

Suggested-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:53 +10:00
Zuyi Hu
765e29b67c Fix testing of arrays status for arch specific variables
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-25 12:36:50 +10:00
Allan McRae
4742f5929d Update copyright years for 2016
make update-copyright OLD=2015 NEW=2016

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04 13:27:08 +10:00
Florian Pritz
a671fa497c makepkg: Output full URL in case of download failure
Most entries in $sources contain variables so finding out why a URL
fails to download is hard because one has to manually replace the
variables when looking at the PKGBUILD. Simply output the full URL here
so that it can be easily seen what is wrong.

Old:
==> ERROR: Failure while downloading example-1.2.4.tar.gz

New:
==> ERROR: Failure while downloading http://example.org/releases/1.1/example-1.2.4.tar.gz

With the new format it is much more obvious that the directory name is
the culprint (1.1 vs 1.2) while the old one would not display that
information.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15 20:34:30 +10:00
Allan McRae
23f128ad5e lint_pkgbuild/variable: increase robustness
Approach the detection of variables of the wrong type using an approach
similar to that used for construction of .SRCINFO files. While doing silly
things in bash could still result in false negatives, this approach should
be very robust to generatinf false positives results.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23 16:03:33 +10:00
Allan McRae
c26e5b81e5 lint_pkgbuild: explicitly return value
Set the return value to be local and always explictly returns it.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23 11:13:39 +10:00
Aaron Campbell
bf0e8e6b43 Refactor lint_source to work with earlier versions of Bash
Negative subscripts to indexed arrays are not supported before 4.2.  However,
since substring expansion works on arrays, we can specify an offset of -1 to
be taken relative to one greater than the maximum index of the specified
array (see Parameter Expansion section of the bash man page).  This works with
both Bash 4.1 and 4.2, and 4.1 is already the oldest supported by pacman.

Signed-off-by: Aaron Campbell <aaron@monkey.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-05 11:55:17 +10:00
Allan McRae
960b64553d libmakepkg: fix pkgver checking
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27 20:44:57 +10:00
Jan Alexander Steffens (heftig)
70e6875ad9 libmakepkg: Add check_buildoption for distcc and ccache
makepkg used to check OPTIONS too, which could override
BUILDENV. Implement a new function that handles these
options more like OPTIONS.

This also reduces code duplication a bit.

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 14:32:59 +10:00
Allan McRae
5301d3fe8f Remove space before ellipses
Makes all use of ellipses consistent...

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 13:48:56 +10:00
Allan McRae
0adb74b293 libmakepkg: remove declaration of unused local variables
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-22 16:11:32 +10:00
Allan McRae
dd3fe853b3 libmakepkg: return 1 on error in arch array
The return value was being assigned when an error was found in a PKGBUILD's
arch array but it never was returned.

Also remove error message explaining about adding the arch array to a PKGBUILD.
That was added a long time ago when the arch array first became compulsory.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-22 16:06:29 +10:00
Allan McRae
19e61a9e07 libmakepkg: update .gitignore
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-22 15:11:52 +10:00
Allan McRae
486643083c libmakepkg: check if PKGBUILD variables are arrays or not as appropriate
When extracting variables from PKGBUILD (e.g. for .SRCINFO creation) we make
assumptions about whether variables are arrays or not.  This adds a check to
the PKGBUILD linter to ensure variables are arrays or not as appropriate.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-07 11:22:00 +10:00
Allan McRae
1586b23080 libmakepkg: util/pkgbuild.sh needs processing on build
pkgbuild.sh contained @DEBUGSUFFIX@ and so needs to be run through the sed
command on build.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-07 11:21:59 +10:00
Allan McRae
877578762c libmakepkg: move color settings to function
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-20 14:56:12 +10:00
Allan McRae
bbab90836b libmakepkg: lint_package requires cd_safe
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-20 11:43:27 +10:00
Allan McRae
3d4529335c libmakepkg: extract functions for source download and extraction
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-19 23:43:00 +10:00
Allan McRae
1a17249159 libmakepkg: extract functions for handling source URLs
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-19 23:43:00 +10:00
Allan McRae
366adc3bb0 libmakepkg: fix test style
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-19 23:43:00 +10:00
Allan McRae
23e3c48526 libmakepkg: move more functions for extracting information from PKGBIULDs
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-19 23:43:00 +10:00
Allan McRae
15b6cecdd5 libmakepkg: extract more utility functions
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-19 23:43:00 +10:00
Allan McRae
8ab106eb9b libmakepkg: extract get_full_version and get_pkg_arch
These functions group in with other functions that extract PKGBUILD
information.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
61dd7e03be Simplify libmakepkg .gitignore 2015-05-16 14:10:42 +10:00
Allan McRae
dbbe76b83d makepkg: put further restrictions on pkgbase
pkgbase should be subject to the same restrictions as pkgname

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
9302593cfb makepkg: merge validate_pkgver into check_pkgver
The check that pkgver is non-empty done in check_pkgver should also be
performed after running the pkgver() function.  Merge validate_pkgver
into check_pkgver and run check_pkgver after updating pkgver.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
c9a7b7e0bf libmakepkg: extract PKGBUILD linting functions
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
d38c098787 libmakepkg: extract in_array 2015-05-16 14:10:42 +10:00
Allan McRae
83b734a103 libmakepkg: move functions for extracting pkgbuild attributes
Also rename some functions for clarity:
funcgrep -> grep_function
extract_global_var -> extract_global_variable
extract_function_var -> extract_function_variable
pkgbuild_get_attribute -> get_pkgbuild_attribute

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
99c7b1b088 libmakepkg: fix test bracket style
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:55 +10:00
Allan McRae
f9cb4f3b9c libmakepkg: move helper functions into tidy/strip
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-15 15:32:58 +10:00
David Macek
ff8de12151 Allow UPX compression for DOS/Win executables
Hi. This change allows makepkg to UPX-compress executables on Windows, but will probably affect some Linux packages as well (I'm guessing gdbserver, wine, mingw-w64).

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae
adc6ca1f2c libmakepkg: make package checking functions extendable
To add a new package check, drop a file in libmakepkg/lint and add the
function to the "lint_functions" array.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 14:00:57 +10:00
Allan McRae
00da25a5ea libmakepkg: make package tidy functions extendable
To add a new packaging option, drop a file into libmakepkg/tidy that contains
a 'packaging_options+=('<option>') and a function that implements that
option. The function needs added to the 'tidy_remove' array if it removes
files or the 'tidy_modify' array otherwise.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 14:00:57 +10:00
Allan McRae
bfe9b56e1f libmakepkg: move package checking out of tidy_install
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 14:00:55 +10:00
Allan McRae
295a3491ad makepkg: split package tidying into libmakepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:20:08 +10:00
Allan McRae
33466000d6 makepkg: split PKGBUILD/makepkg.conf option checking to libmakepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:20:08 +10:00
Allan McRae
7885931c96 makepkg: split message functions into libmakepkg
This performs all the needed work for libmakepkg to be included in
tarballs, installed into the correct place, and read into makepkg.

Also change the install root for libmakepkg to an architecture independant
location.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:20:08 +10:00