Commit Graph

125 Commits

Author SHA1 Message Date
Allan McRae 08034ceb17 makepkg: add optional package function
This patch allows us to split the building and packaging stages of
a PKGBUILD and minimize fakeroot usage. This can be done with less
code duplication (run_build and run_package look quite similiar) but
the run_package function will be where the package splitting logic
is implemented in the future.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-01-16 22:20:05 +10:00
Dan McGee 7a3a718c7a makepkg: fix my own stupid mistake
We don't want to bail if a certain integrity check wasn't even provided.
Whoops.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-13 20:13:31 -06:00
Aaron Schaefer e3a06961f6 makepkg: use INTEGRITY_CHECK only for generation of checksums
Signed-off-by: Aaron Schaefer <aaron@elasticdog.com>
[Dan: fail if checksum array is incorrectly sized]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-13 19:50:38 -06:00
Xavier Chantry 4ec846f5ac makepkg : fix a lot of breakages caused by Allan
This patch started as a simple typo fix (pugre instead of purge in two
places), as well as a fix of a test which was using PURGE_TARGETS instead of
$PURGE_TARGETS.

It evolved in a slight handling change of the OPTIONS which have a variable
affecting their behavior (strip STRIP_DIRS, docs DOC_DIRS, zipman MAN_DIRS
and purge PURGE_TARGETS), as well as a clarification in makepkg.conf. Now
when a variable is undefined or empty, the corresponding option will have no
effect. It looked weird to have a fallback when a option is defined but
empty, it seems more natural to not have any fallbacks.

Also re-enable docs by default. It seems arbitrary to delete files from
packages by default, and it would be more vanilla and distro agnostic to
keep them. docs was also the only negated option.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 22:28:10 -06:00
Allan McRae 1cc8ad6112 makepkg: Add support for specifying LDFLAGS
Provide support for specifying LDFLAGS within makepkg.conf but leaves
this undefined by default. Fixes FS#12542.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:17:15 -06:00
Allan McRae 8f26bb9052 makepkg: move BUILDSCRIPT from makepkg.conf
Commit 4b183bf9 moved makepkg.conf sourcing to after the parsing
of options, breaking the -p option and --help output.  The solution
is to move BUILDSCRIPT out of makepkg.conf.  This patch moves the
definition BUILDSCRIPT back to makepkg itself and adds configure
option to allow easy changing of this value during build time.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:13:54 -06:00
Allan McRae 9a7f68317a makepkg: Introduce purge option
The purge option, combined with the PURGE_TARGETS variable,
allows makepkg to automatically remove commonly confliting or
removed files (e.g. /usr/share/info/dir, *.pod).

Original work: Tim Yang
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:11:51 -06:00
Allan McRae 774c252753 makepkg: Add used options to PKGINFO file
Adds defined options to the PKGINFO file in the form of "makepkgopt =".
It may be useful to be able to add these to the pacman DB at some point
as that would allow (e.g.) checking which packages have had their docs
striped (FS#7092).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:11:48 -06:00
Allan McRae 1b7ff7a636 makepkg: add fallback for when MAN_DIRS is unset
This prevents makepkg compressing every file when MAN_DIRS is not
supplied in makepkg.conf

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:08:42 -06:00
Allan McRae bb9b19a6c4 makepkg: provide MAN_DIRS configuration variable
Provides a MAN_DIRS variable in makepkg.conf which can be used
to specify folders to look for manual (man and info) pages to be
compressed.  Useful for packages that install to /opt.  Also
clarifies that "zipman" means "zip manuals" and covers both man
and info pages.

Original work by: Tiago Pierezan Camargo <tcamargo at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:06:51 -06:00
Dan McGee f8b689d48e Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
	po/it.po
	scripts/makepkg.sh.in
2009-01-02 22:48:52 -06:00
Allan McRae 2f59996c54 makepkg: detect incorrect usage of provides array
Using > or < in the provides array is wrong so make it cause an error.
Fixes FS#12540.

Also, use bash substitution rather than spawning new processes where
possible in the error checking.  Move split package detection to a
better position.

Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: backport to maint]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 22:46:47 -06:00
Allan McRae f4651c49af makepkg: tidy version package tests
The use if "! -z" to check if a string is not null is not good practice
so replace with the "-n" option. Also use the AND comparison within one
test rather than on two separate tests.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 22:46:47 -06:00
Allan McRae 751d37e749 makepkg: quote all uses of BUILDSCRIPT
Allows specifying alternative build script with spaces in name

Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: backport some of the fixes to maint]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 22:46:37 -06:00
Allan McRae 08980fb4bc makepkg: Replace getopt with internal function
This will allow makepkg to work on systems like Mac OS X where the
default getopt is too old to properly handle long options.

The new parse_options function should replicate getopt's behaviour
completely.

Original work: Yun Zheng Hu <yunzheng.hu@gmail.com>
[Allan: Rewrite and bug fixes]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 22:17:24 -06:00
Dan McGee bd628274cc Merge branch 'maint' 2008-12-07 22:12:17 -06:00
Dan McGee 818fae320f makepkg: ensure PKGBUILD does not contain CRLF characters
Do a simple check before sourcing the file to ensure we are a valid bash
script.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-12-07 22:11:37 -06:00
Allan McRae 69be73f68c makepkg: several small bits of tidying
1. Do not warn people about missing arch if they are using --ignorearch.

2. Remove unneed reference to bug report about using fakeroot as little
   as possible.  We want to do that, bug report of not.

3. Removes superfluous warning given when building as root. The user
   has already used the "--asroot" flag.

4. Move comment about skipping warning message to above where it occurs

5. Do not warn about skipping source retreval, integrety checks and
   extraction when using --repackage

6. Do not warn about skipping build when using --repackage

7. Move comment about fakeroot usage to above test condition

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-12-07 22:11:29 -06:00
Dan McGee 59776ef306 makepkg: save and restore shell options before and after build()
Fix the issue uncovered by FS#12344. In this instance, the dotglob shopt was
being set in the build() function but never cleared, causing issues in the
remaining parts of the makepkg script.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-12-07 22:09:24 -06:00
Dan McGee 61c6552862 Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
2008-12-02 22:15:02 -06:00
Dan McGee 346139298b Simplify mercurial revision command
Not only does this require less sed-magic, it also fixes FS#12286 where
fetching the revision number fails if mercurial is in compact mode.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-11-30 16:07:06 -06:00
Dan McGee 9394f229a0 Merge branch 'maint' 2008-10-31 19:55:50 -05:00
Allan McRae c4b9991258 makepkg: actually fix passing PKGBUILD from pipe
If PKGBUILD (BUILDSCRIPT) is not found, test for information from a
pipe and use that.  Fixes FS#9187.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-31 19:46:13 -05:00
Dan McGee 2890114600 makepkg: fix bash substitution to work under older versions
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-31 18:59:19 -05:00
Allan McRae 8d33dcb81c makepkg: enable passing PKGBUILD from pipe
Do not attemp to update pkgver/pkgrel when reading a SCM based PKGBUILD
from a pipe.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-28 22:33:58 -05:00
Dan McGee cd51abf0c8 Merge branch 'maint' 2008-10-28 22:20:09 -05:00
Allan McRae 1e656c0a6a makepkg: fix updating PKGBUILD when building SCM packages
Fixes a bug and resets pkgrel to 1 when bumping pkgver

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-28 21:46:40 -05:00
Dan McGee 91a013a879 makepkg: allow compression type to be autodetected
Inspired by commit 7e8f1469c4, use our given
PKGEXT or SRCEXT to determine what method of compression to use on the
package we create. If the extension is invalid, this should fall back to
creating a non-compressed tar file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-12 21:36:40 -05:00
Dan McGee 1c47500ea6 Merge branch 'maint' 2008-08-26 20:11:25 -05:00
Xavier Chantry d6f62ba22d makepkg : allow to specify a download filename
A source entry can now have the following form, to specify a different
filename :
"filename::http://path/to/file"

Of course, the old syntax is still supported :
"http://path/to/file"

And as before, in the second case, the filename used is simply "file".

This fixes FS#11292, because handling multiple source files with the same
name is now possible (just choose a different filename).

But it will also allow to deal much more nicely with funny url like this by
using a sane filename (and unfortunately, there are quite a few) :
http://www.vim.org/scripts/download_script.php?src_id=6992

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-25 18:23:05 -05:00
Xavier Chantry 4b183bf9a9 makepkg : add --config option for an alternate config file.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 17:46:56 -05:00
Dan McGee 496b687c3d makepkg: check all integrity sums found in the PKGBUILD
Currently we use the INTEGRITY_CHECK array from makepkg.conf to limit both
the integrity sums generated and checked. It doesn't make a whole lot of
sense to ignore integrity sums that are present in a PKGBUILD, so this patch
will enable checking any that are available, but will only print a warning
about missing sums for those types found in INTEGRITY_CHECK.

It also adds a slight optimization of checking for openssl- we only need to
check once now because we use the same program for all checks.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 10:19:17 -05:00
Allan McRae 7865fb9af4 Treat info pages like man pages
As far a package building is concerned, info pages need to be treated
in the same fashion as man pages in that they both can be compressed.
This separates them from other forms of documentation and so it makes
sense to make that distinction within makepkg.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 09:20:51 -05:00
Xavier Chantry 56f0cf9d15 makepkg : localize the Y/n part of the question.
pacman already localizes the yesno stuff, so doing the same in makepkg is
more consistent.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 08:38:31 -05:00
Xavier Chantry 901e4aa5c2 makepkg: do insensitive comparisons of checksums.
This fixes FS#11283 , which was originally reported on the forums :
http://bbs.archlinux.org/viewtopic.php?id=53794

Insensitive comparisons were implicitly made before since md5sum --status was
used for checking. Now that we use openssl and compare checksums manually in
bash, we lost that feature.
This can be easily reintroduced using tr '[A-F]' '[a-f]'

What convinced me to fix it is that the md5 command line tool generates md5sums
in upper case by default :
http://www.fourmilab.ch/md5/

And finally, A-F and a-f are the same in hex and both are used.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 08:37:19 -05:00
Allan McRae a23fc08758 Fix error when sourcing profile script
With the "set -e" property set, a failure when sourcing /etc/profile
can cause makepkg to exit without error message.  The bash-completion
package activates this bug.  Fixes FS#11179.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-13 21:09:38 -05:00
Allan McRae 57bd8974c7 Fix creation of source package with local source files
Fixes FS#11149.

Signed-off-by: Allan McRae <allan@archlinux.org>
2008-08-09 07:23:37 -05:00
Xavier Chantry 9bc799ec7b makepkg: fix download functions with weird urls.
This fixes FS#11076.

1) quote the url in get_downloadclient
2) only enable nullglob where it is needed
You can see in 7fc306cd41 that nullglob was only enabled for one part, and
that it already caused other problems, which were fixed in 7ff5a917fd.
Thanks to Henning Garus for pointing out that nullglob was problematic with
urls containing expansion char like '?'.
3) change get_downloadcmd which displayed the download command line to
download_file which actually executes the download. It seems nicer that way.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-04 13:11:18 -05:00
Dan McGee 692ea72822 makepkg: Clarify usage instructions for --allsource/--source
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-04 13:02:58 -05:00
Xavier Chantry 6ede1a5af0 makepkg: Fix STRIP_DIRS test.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-29 21:57:17 -05:00
Xavier Chantry 0e0a846135 makepkg : use /etc/profile
This fixes FS#9486.
source /etc/profile instead of all individual files in /etc/profile.d/*
(which is done by /etc/profile anyway).

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-29 21:48:20 -05:00
Allan McRae 67f388c3fc makepkg: add packages to pkgdeps list only after successful install
This fixed FS#9403.  With this you can use "makepkg -sr", install the
dependencies, Ctrl+c during the makedepends installation and have
makepkg remove the installed packages on the exit.  Previously makepkg
tried to also remove the makedepends which were not installed.

The deplist="" line in remove_deps is due to an obscure bug where local
varaibles from the handle_deps function seem stay in scope because we
never formally exited it.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-24 22:16:28 -05:00
Allan McRae ae9e33ed88 Make strip paths configurable
This patch introduces a new STRIP_DIRS makepkg.conf option
to change makepkg's search path when stripping binaries.

Original work by: Thomas Bächler <thomas@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-20 19:06:14 -05:00
Allan McRae a8405847e6 Strip *.a libraries in makepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-19 11:03:10 -05:00
Allan McRae 99be5ab8d1 Use LC_ALL=C everywhere
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-19 11:03:03 -05:00
Nagy Gabor ffa3056010 Use "pacman -S $dep" in makepkg's dependency resolving
This method is equivalent with pacman's resolvedeps.
$dep can be any (versioned) dependency.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-15 19:14:23 -05:00
Dan McGee 0bf66b097f makepkg: speed up svn revision check for large repositories
Using the suggestion from FS#10905, use 'svn info' rather than 'svn log' to
get the current revision number, which is much quicker for large Subversion
repositories. Eventually git will rule the world. :)

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-15 19:09:15 -05:00
Dan McGee b196cc43a5 Merge branch 'maint' 2008-07-07 21:39:42 -05:00
Allan McRae d534488f2d Remove symlinks to libtool files
This prevents dangling symlinks to removed libtool files when
the !libtool option is used.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-27 09:07:39 -05:00
Allan McRae 74eb2f5c61 Additional path quoting and srcdir/pkgdir usage
Removes the remaining $startdir/{src,pkg} usage and adds quoting
around (hopefully) all remaining path variables

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-22 21:12:39 -05:00