Commit Graph

780 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
Levente Polyak 3190b87b65 fix --printsrcinfo unify arch and non-arch specific variables
This fixes the issue with --printsrcinfo that all arch specific variants
of a variable get merged into their non arch specific variant.

The .SRCINFO file ends up having $depends containing $depends_x86_64
and omitting the latter.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-10 10:38:04 +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
Alastair Hughes 87082e3f44 makepkg: ignore the architecture for --printsrcinfo
Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:55 +10:00
Allan McRae 02a0bf550a makepkg: move build enviroment set-up to function
This is a requirement to split the preparation of the build environment
into libmakepkg, which will allow dropping in extensions (e.g. to allow PGO).

After this patch, disabling buildflags or makeflags and enabling debug
CFLAGS will only effect the build(), check() and package() functions.  The
relevant variables are no longer exported for the prepare() function.  This
should have zero impact for the prepare() function of a properly written
PKGBUILD, as no building/linking is done there...

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:07 +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
Xyne 8ff03868a3 makepkg: Turn PACMAN_OPTS into an array
Avoid potential word expansion with future inclusions

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +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
Evangelos Foutras c034a3322b makepkg: do not run prepare() with --noextract
This is partial revert of 8454daa7fe (makepkg: run pkgver() and
prepare() with --noextract).

Reasoning for the reversion (copied from FS#43498):

    Running prepare() when --noextract is used no longer allows running
    'makepkg -o && makepkg -e' with any PKGBUILD that applies patches in
    prepare(). [1]

    Sure there's --noprepare which restores the old behavior, but that's
    a lot of extra typing for what I believe is a much more common use
    of --noextract.

    For OP's use case of doing git bisects, you can specify the commit
    in the source array and thus skip --noextract since makepkg will
    checkout the correct commit each time.

    [1] I often extract the sources using 'makepkg -o', manually edit
    some source files, and then use 'makepkg -e' to package it (while
    possibly repeating the edit/package steps).

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 12:50:04 +10:00
Dominik Fischer f63854fa96 only include .SRCINFO comments in source tarball
This avoids introducing unnecessary changes to the time stamp into
package repositories that regularly use --printsrcinfo to update the
.SRCINFO file.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-21 17:10:11 +10:00
Allan McRae 169287e494 makepkg: remove pkg from OPT_LONG array
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:53 +10:00
Allan McRae 7624101e18 Revert "makepkg: Empty/create only $pkgdir's relevant to current PKGBUILD"
This reverts commit f9423cfa5d.

This created issue when building packages with debug info multiple times.
It could be fixed, but it confirmed my initial opinion that keeping other
directories in $pkgdirbase was wrong. Use different BUILDDIRs if you want
to build different things from a single PKGBUILD.
2016-02-20 14:01:53 +10:00
Alastair Hughes c72ca3d539 Make "makepkg -g" ignore the current architecture.
Commit 663c74150a
(makepkg: merge arch dependent variables after PKGBUILD linting) broke
"makepkg -g" on a PKGBUILD which did not include the current architecture, by
moving the lint_pkgbuild call before GENINTEG was processed.
Fix that by setting IGNOREARCH for the "-g" option.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20 14:01:53 +10:00
Allan McRae 47ea63ff3b makepkg: do not run prepare() and pkgver() with --repackage
Bug introduced with commit 8454daa7.

Reported-by: Zuyi Hu <hzy068808@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-25 15:23:16 +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
Allan McRae 8454daa7fe makepkg: run pkgver() and prepare() with --noextract
Modifications made to the source before running with --noextract may alter
the version string returned by pkgver(). Always run this function if present
and check build status before proceeding.  Fixes FS#46800.

Also run prepare() when --noextract is used (unless --noprepare is specified).

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15 20:28:48 +10:00
Allan McRae 137ea39fa1 makepkg: record build information in .BUILDINFO
This information can be used to reproduce build conditions, which can then be
used to determine if a package builds reproducibly.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-06 10:20:53 +10:00
Luke 9cdfd18739 makepkg: add whirlpool to the list of hashing algorithms
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-06 10:11:33 +10:00
Allan McRae 663c74150a makepkg: merge arch dependent variables after PKGBUILD linting
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23 16:02:32 +10:00
Allan McRae ef1fb0ef81 makepkg: remove obsolete comment
Behaviour changed in commit dce82f9d.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23 11:13:39 +10:00
Benjamin Yates 1142a32c7f makepkg: fix $pkgname element duplication
run_split_packaging did not preserve the $pkgname array correctly, and
would create duplicate entries in the list during restore.

After restoring the backup (a b c) would become (a b c b c).

This probably went unnoticed because during --install, pacman would
reconcile the duplicates.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-28 13:26:25 +10:00
Mohammad Alsaleh 9809102237 makepkg: Fix hard-coded debug suffix
Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-22 09:40:37 +10:00
Jan Alexander Steffens (heftig) 2c72c8b822 makepkg: Set CCACHE_BASEDIR to make paths in $srcdir relative
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 14:33:30 +10:00
Jan Alexander Steffens (heftig) 2627b423ff makepkg: Correctly layer distcc and ccache
ccache expects further compiler wrappers to be specified via
CCACHE_PREFIX. Otherwise, ccache will hash the wrapper executable
instead of the real one.

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 14:33:17 +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 5d4a3f101c makepkg: separate "sourcefile" into two words
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-19 14:25:35 +10:00
Allan McRae e8deba3b87 makepkg: remove ability to build individual packages
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-23 01:02:23 +10:00
Allan McRae be503c6eac makepkg: remove FORCE_VER variable
This variable is no longer in VCS building.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-22 14:54:03 +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
Dave Reisner 445aa3b52c dont remove x bit when marking pkgdir RO
f170a94c13 potentially causes $pkgdirbase/$pkg to be undeleteable
with -R or -C if a previous build was interrupted. We simply can't
traverse to this directory, and rm blows up.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-20 12:50:25 +10:00
Johannes Löthberg aa9aa343cb makepkg: Add flag for printing SRCINFO to stdout
This commit adds a makepkg option to generate and print the SRCINFO file
for a PKGBUILD, required by the new AUR, to stdout.

AUR 4.0 will use Git instead of source tarballs for uploading packages,
so making makepkg capable of printing the SRCINFO would simplify package
management, instead of having to extract it from a source tarball.

It is also useful for scripting other things, so that instead of having
to parse PKGBUILDs, one can make makepkg generate the SRCINFO and then
you can parse that instead, which is much simpler and less error-prone.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-06-20 17:32:57 +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 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 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
David Macek f9423cfa5d makepkg: Empty/create only $pkgdir's relevant to current PKGBUILD
Currently makepkg clears the whole $pkgbasedir which is needless. Moreover,
in the obscure case of multiple makepkg runs (with different $pkgname) that
share a $pkgdirbase, only $pkgdir's from the last run will remain. Since
I consider the contents of $pkgdir an important artifact, this commit restricts
the deletion to individual $pkgdir's.

When CLEANUP is set, the behavior is unchanged.

Discussed in:
https://lists.archlinux.org/pipermail/pacman-dev/2015-February/019939.html

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Ivy Foster bf3aec8c32 Add makepkg option --packagelist
makepkg --packagelist prints the name of each package that would
normally be produced, minus $PKGEXT, and exits.

Implements FS#42150

Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:44:10 +10:00
Allan McRae 2408d46c1b makepkg: write validpgpkeys to .SRCINFO
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae e7e0c13762 Merge branch 'maint' 2015-03-26 14:43:13 +10:00
Ivy Foster b543c055b9 Make get_pkg_arch treat arch as an array
We use the get_pkg_arch function with the package name parameter in two places:
1) checking if the package is already built
2) installing build packages

Currently this failed when a package override for "arch" was an array, despite
all our documentation stating that it is indeed an array.  This change makes
these two places fail if there is package override for arch that is not an
array - i.e. of the form arch='i686'.

Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:42:22 +10:00
Christian Hesse eb21e9eb93 fix source package signing with SRCPKGDIR set
Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:41:26 +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
Allan McRae 7879a5b3e5 Merge branch 'maint' 2015-02-20 10:36:18 +10:00
Renato Silva 0927206fc4 Fix Bazaar cloning in makepkg.
There was some manual check to know if the local repository was really a clone
of the one specified in PKGBUILD. This check has been removed because it is
buggy and not necessary.

It is buggy because this check needs to be semantic, not a simple string
comparison. For example, I was blocked from building a PKGBUILD because Bazaar
was returning two different strings for the same location (for HTTP one was
url-encoded while the other was not, and for local paths one was absolute while
the other was relative). While this may be a bug in Bazaar, the check is
unreliable since the comparison is not semantic (http://foo.com/%2Bplus and
http://foo.com/+plus obviously refer to the same location for example).

Specially, it is useless because the intention is updating the existing local
clone. However, if the local clone is not a real clone of the repository
specified in PKGBUILD (which was what this buggy check tried to tell), next step
which is a pull operation will fail anyway. This is because bzr pull does not
perform merges, it just makes one branch into a mirror of another.

There was a reason provided when this manual check was added for Git, but no
reason provided for copying such check when Bazaar support was added, see
commits below. In fact, Mercurial lacks such manual check.

* c926c39b04
* 3b02f80dcb

Fixes FS#43448.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-14 11:18:20 +10:00