Commit Graph

553 Commits

Author SHA1 Message Date
Allan McRae 3531533c2f makepkg: save path to PACMAN and test availability
After we install dependencies, we source /etc/profile so that new
elements get added to the path. As this can override any local setting
of PATH, we store the full path of the PACMAN variable passed to makepkg.

Also, add a check for PACMAN availability if it is needed to deal with any
dependency operations.

Reported-by: Martin Panter <vadmium à gmail·com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Martin Panter 86233476b0 Remove last traces of handling command arguments in $PACMAN
This resolves an inconsistency with how the $PACMAN variable was interpreted.
Previously “makepkg” would extract the first word from the $PACMAN variable
and check that it existed as a command. This appears to have been happening
ever since the variable was implemented in revision 66c6d28 (makepkg: allow
to specify an alternative pacman command). Thus it looks like command
arguments were originally allowed in the variable.

However the run_pacman() function now quotes $PACMAN, so the whole variable
has to be just the command name. This quoting was introduced more recently,
perhaps in revision 622326b (makepkg: fix sudo/su calling of pacman).

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Christian Hesse 0285c678ab makepkg: fix signing built package
Fixes issue introduced in 9dd42dc0

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae 3232c975c6 makepkg: deprecate PKGBUILDs without a package() function
The package() function has been around since pacman-3.3 and has
significant advantages including limited fakeroot usage and correct
repackaging.  The ability to use PKGBUILDs without a package function
will be removed in a future release.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae 93148d0879 makepkg: print "SKIP" for signature checksums
There are valid reasons for a source files PGP signature to be changed
(expired key, expired signature, additional person signing...). Thus
providing a checksum for signature files can potentially cause a
PKGBUILD to require unnecessary updating.

Avoid this issue by using "SKIP" for the signature checksum.
Fixes FS#31590.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae fbf96203ab makepkg: use last match in BUILDENV/OPTIONS array
Using the last match in the BUILDENV and OPTIONS arrays allows the
user to easily override these values without specifying the entire
array. For example add "BUILDENV+=(sign)" in ~/.makepkg.conf.

Fixes FS#26701.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae 2abe1f1646 makepkg: fix incorrect bracket usage
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:41:46 -05:00
Gary van der Merwe 3b02f80dcb makepkg: Add Bazaar VCS support
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:41:35 -05:00
Allan McRae ea452d0277 makepkg: fix order of --help output
Small alphabeticalization issue in options passable to pacman.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:41:23 -05:00
Allan McRae 8b9cb8e03d makepkg: allow fragment to contain a "#" character
The frament element of a vcs url may contain the "#" charcter in the
(e.g) branch or tag name.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:41:02 -05:00
Allan McRae 306c274239 makepkg: always check makepkg.conf for match to download protocol
The list of which download protocol should look in makepkg.conf for the
download agent was hard coded into makepkg.  Instead, fallback to checking
the the download agents array for any non-local or (implemented) vcs
source.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:40:44 -05:00
Allan McRae 7a4f76c2af makepkg: do not embed timestamps in compressed manpages
This will make the checksum of man pages match across architectures
despite different build times.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:40:17 -05:00
Allan McRae 2d347132ba makepkg: check if hg and svn directories are non-empty before updating
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:40:08 -05:00
Allan McRae 800799ea63 makepkg: do not create hg working directory on checkout
Creating the working directory can waste a lot of space.
Fixes FS#31221.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:39:52 -05:00
Gary van der Merwe 03ea8ca6a9 makepkg: Improvements to get_filename:
* For any vcs other that git, the fall through resulted in being handled by the
  code for std url, hence fragments were being left on.
* Handle vcs urls than end in a slash correctly, eg http://example.com/project/

Signed-off-by: Gary van der Merwe <garyvdm@gmail.com>
2012-09-18 08:39:37 -05:00
Mohammad Alsaleh c926c39b04 makepkg: check if $dir is a local clone of the right git repo
Before this patch, makepkg does not check if $dir is a local clone of
the right repo.

For example, git fetch would be run even if $dir is not a local
bare clone of a git repo in present in source(), but a subdir of
a checked-out one. That means makepkg can potentially fetch from
a completely unrelated remote and update completely unrelated
dirs/files.

This patch adds a check to make sure we are fetching from the right
remote.

Signed-off-by: Mohammad Alsaleh <msal@i2pmail.org>
2012-09-18 08:39:18 -05:00
Mohammad Alsaleh 34b52c9a60 makepkg: git clone instead of git fetch if $dir exists but empty
Before this patch, makepkg would only check if $dir exists as an
indication that a local clone exists. And if $dir does exist, makepkg
will run git fetch inside it unconditionally.

After applying this patch, makepkg will check if the existent $dir is
empty. And if it is, it will be used to store a local clone.

Signed-off-by: Mohammad Alsaleh <msal@i2pmail.org>
2012-09-18 08:39:08 -05:00
Allan McRae 8550680924 makepkg: fix warnings with --noextract
Three warnings after someone deliberately typed --noextract is a
tad excessive...   Also, an empty $srcdir is perfectly valid when
the source array is empty, although using --noextact then is
wasteful.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-09-18 08:38:08 -05:00
Dave Reisner aa50df630c makepkg: implement dir_is_empty for dir content checks
Rather than calling upon ls for this, use a proper shell function which
uses globbing to determine the existance of files in a directory.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-18 08:37:46 -05:00
Allan McRae a818766c6e makepkg: delay checking for build package with pkgver()
If a pkgver() function is specified, delay checking the package is
built until the pkgver is updated..

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:39 +10:00
Allan McRae 7e4aa9e524 makepkg: add hg url support
Supported fragments are branch, revision and tag.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:39 +10:00
Allan McRae 4b129d4843 makepkg: check pkgver validity after updating
If a PKGBUILD has a pkgver() function, skip checking the pkgver validity
until it has been updated.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:39 +10:00
Allan McRae b1e75d7dd6 makepkg: only update pkgver when all sources are available
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae 6c8def6ae0 makepkg: add --holdver to control VCS source updating
Do not update VCS sources if --holdver is used. If the VCS checkout
is not present, it will still be downloaded.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae 7fd56118d0 makepkg: do not download VCS sources unless needed
VCS sources are not needed for --geninteg or --source operations.
This also prevents VCS downloads outputting to stdout, which
prevented piping -g output to the PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae b3e82ec59e makepkg: rename myver
myver is a bit generic for an internal variable name.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae 2042b79bcc makepkg: add support for SVN urls
Allow SVN repo sources in the form:

source=("<folder>::<repo>#<fragment>")

where <repo> must start with svn (e.g svn+http://) and a <fragment>
can specify a revision (e.g. revision=22).

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae 888020de90 makepkg: provide mechanism for auto-updating pkgver
Now that VCS repos are provided in the source array, it becomes too
complicated to have automatic updating pkgver as was the case with
the old VCS PKGBUILDs (there can be multiple repos of different types
in the source array, the VCS repo may not be the package primary
source, etc).

Instead provide an optional way for a PKGBUILD to update the pkgver
value through the specifing of a pkgver() function that returns the
new version string.  This is run after all source files are downloaded
so can access the VCS repo if needed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae cca9849fc2 makepkg: modify get_filepath to handle VCS sources
With VCS sources, get_filepath should return the directory of the
checkout. This allows backing up of the VCS checkout when using
--allsource.  Fixes FS#21098.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae aa6fe1160b makepkg: modify get_filename to handle VCS sources
Modify get_filename to return the name of the folder with VCS sources.
This fixes output issues in checksum checking.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae 682c9af846 makepkg: fix checksum generation with VCS sources
VCS sources should have "SKIP" for their checksum value

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae 91d119af1c makepkg: allow using GIT source URLs
Allow specifing GIT sources using the following syntax

source=('<folder>::<repo>#<fragment>')

This will download the git repo <repo> into <folder> (into $SRCDIR
if set, otherwise $startdir). <repo> must start with "git", but
non-git protocols are handled using (e.g.) "git+http://...".

The <fragment> can be used to specify a branch, tag, or commit to
build from. e.g. branch=maint.

Checksum entries for git sources should be "SKIP".

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae 57e06394dd makepkg: skip integrity checking early
If "SKIP" is provided for an integrity check, abort checking as soon
as possible.

Also swap fork to tr for bash4 conversion.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae 1a04e2e11a makepkg: generalize download_sources
In order to treat all VCS sources as URLs, we need to be able to
deal with more protocols. Rewrite download_sources to use a case
statement so additional protocols are easily added.

Also fix the use of scp to not pass the protocol in the URL
(noticed by William J. Bowman <wjb@williamjbowman.com>)

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae a922d18056 makepkg: add function to return download protocol
Extract the download protocol from a source entry.  Returns "local"
for local source files.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae e806414407 makepkg: reorder source handling functions
There is no actual code change here, but these related functions
were all over the place which makes this code difficult to adjust.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Allan McRae d338b3981d makepkg: remove VCS package support
The current VCS packaging support is really, really, really bad.
It is best to strip it out completely before rewriting it.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-08-04 00:16:38 +10:00
Dan McGee 7193ce1ecd Merge branch 'maint' 2012-08-01 09:21:33 -05:00
Enjolras 065b7f863a Add a function prepare() to PKGBUILD
prepare is run after the source extraction, and is not run with
--noextract option.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:17:58 -05:00
Allan McRae b782388f16 makepkg: remove unnecessary formatting
This extra newline leaves a gap that looks strange in of itself,
but is highlighted when piping -g output to a PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:17:42 -05:00
Daniel Wallace 52550a2a0a asdeps flag passed from makepkg to pacman
add the asdeps flag for makepkg so that it does pacman -U --asdeps

[Allan: clean-up whitespace]
Signed-off-by: Daniel Wallace <daniel.wallace12@gmail.com>

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-01 09:17:12 -05:00
Allan McRae e253968b4d repo-add: add checkdepends information
Similar to the case for makedepends, it is useful to be able to
access this information without parsing a PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-06-25 23:08:15 -05:00
Allan McRae 81dd6ddf0c makepkg: install deps with --repackage
I have noticed that quite a number of packages fail with "makepkg -R"
when their (make)dependencies are not installed. Adjust makepkg to
check for dependencies when used with -R.  This can still be avoided
by using --nodeps/-d.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-06-25 23:08:08 -05:00
Jeremy Huntwork d310b6f85c Allow wildcards in PURGE_TARGETS to match any type of file except for directories.
Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com>
2012-06-25 23:07:49 -05:00
Allan McRae 3a24e44206 makepkg: allow url to be overridden in split packages
This is already being used (despite not working...) in packages
in the Arch Linux repos.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-06-25 23:07:03 -05:00
Jeremy Huntwork 19c2347507 Portability fixes for makepkg
Allow makepkg to work correctly when used with find from busybox.
Fix handling of cross directory symlinks.

Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-06-25 23:06:43 -05:00
Allan McRae 9a76a458b8 makepkg: rework libdepends
Rewrite the handling of libdepends. The primary advantage are:
 - Moves functionality from write_pkginfo() to find_libdepends().
 - The order of the depends array in the PKGBUILD is kept in the package.
 - An unneeded libdepends is only a warning and not an error. This allows
   putting a libdepend on a library that is dlopened.
 - It is now modular so can be extended to library types other than
   ELF *.so.
 - Finding the list of libraries a package depends only occurs when a
   libdepend is specified in the depends array.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-05-20 19:04:38 -05:00
Allan McRae 18e0a97209 makepkg: write makedepends into .PKGINFO
Currently there is no way to access the makedepends for a package
apart from parsing its PKGBUILD. Put these into the .PKGINFO file
with the idea of making them available in the repo dbs so that
automated build tools can readily determine build order.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 19:00:42 -05:00
Allan McRae 8abef73ba9 makepkg: Add CPPFLAGS support
Add CPPFLAGS support in addition to the current CFLAGS and CXXFLAGS.
This keeps compiler flags split up in the same logical way done
everywhere else.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 18:58:17 -05:00
Dave Reisner 9d3e59e311 makepkg: use mapfile where plausible
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-20 17:39:21 -05:00