Commit Graph

461 Commits

Author SHA1 Message Date
Cedric Staniewski c7d8601e12 Fix stderr redirection
When redirecting both stderr and stdout and using the 2>&1 construct,
you have to redirect stdout first. Otherwise stderr will be redirected to
the 'old' stdout and not to the new resource.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 16:34:47 -05:00
Xavier Chantry 35bbc96b99 replace rankmirrors by bash clone
This removes python optdepends in pacman package

This bash clone is a courtesy of
Matthew Bruenig <matthewbruenig@gmail.com>

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-10-11 15:08:06 -05:00
Dan McGee 8e7652f1af Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
2009-09-29 21:08:06 -05:00
Dan McGee 2071286770 repo-add: clean up options parsing
-f/--force has been dead for a while, so kill it off. In addition, the
check for > 2 args is pretty useless when you do something like:
  repo-add -q -q
or a more legit:
  repo-add -q /path/to/mine.db.tar.gz

So instead make repo-add just return 1 when it doesn't do anything with
the database which seems to make more sense.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-23 22:46:38 -05:00
Dan McGee 7f14f185a2 repo-remove: create empty DB when all packages are removed
Rather than creating no database at all, create an empty zipped tar archive
in its place. This keeps the download side of repositories a bit more sane
as a DB will always exist, and pacman handles this empty case just fine.

For this to be fully transparent, we also need to make sure repo-add and
repo-remove accept an empty "DB" as an argument, which in reality is a
completely void of files .tar.{gz,bz2,xz} archive.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-23 21:15:53 -05:00
Allan McRae 5bea2c08a3 makepkg: tidy usage output
Various tidying to the usage output
 - change "--config <config>" to "--config <file>" to prevent wrapping in a 80 character wide terminal
 - re-alphabetise options, including moving all long only opts to the end
 - use same indentation for additional pacman options
 - remove useless comment

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-22 19:01:05 -05:00
Dan McGee 6bfca2fd14 Merge branch 'maint'
Message updates made this one a bit messy, but nothing too bad.

Conflicts:
	lib/libalpm/add.c
	lib/libalpm/remove.c
2009-09-20 12:09:10 -05:00
Xavier Chantry 1df3b91931 String improvements
Add more untranslated strings, improve consistency, etc.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-16 19:36:49 -05:00
Xavier Chantry 0845b2f13c sanity check for optdepends syntax
only allow optdepends like:
pkgname: description

some (real) examples of invalid optdepends:
 'tcl, python and/or ruby: to use corresponding binding'
 'xorg-fonts-75dpi : X bitmap fonts needed for the interface'
 'ruby-htmlentities (AUR): for one provider named Deastore'
 'xpdf - for pdf'

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Allan: rebase off de39a1f6 and adjust man page]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 16:52:47 -05:00
Xavier Chantry b53aa87ea9 makepkg : check for invalid backup entry
This implements FS#13551

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:57:30 -05:00
Xavier Chantry cb07265851 makepkg : refactor run_build and run_package
These two functions were very similar.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:57:14 -05:00
Henning Garus 545eac145d makepkg: exit on error during build() or package()
Set the ERR trap to abort upon encountering an error during the execution
of a build or package function.

Activate set -E, which lets functions inherit the ERR trap.

Signed-off-by: Henning Garus <henning.garus@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:56:58 -05:00
Dan McGee b9dd8ce233 Merge branch 'maint' 2009-09-06 15:54:11 -05:00
Xavier Chantry 65c1f06be5 Allow $arch to be used in Server
similarly to the $repo variable, Server can now contain $arch, which will be
automatically replaced by the appropriate architecture.

This allows us to have one universal mirrorlist file, for both i686 and x86_64,
woohoo!

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:53:54 -05:00
Francois Charette 1e51b81c63 fix typos in makepkg.sh.in
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:36:56 -05:00
Xavier Chantry 7ddb645bd7 makepkg: always keep sources symlinks
Make bunzip2/xz/gunzip decompressing to stdout, because gzip does not offer
something like a -k option.

The selection of the decompression command for gzip/bzip2/xz compressed
files now also depends on the file suffix, since we need to strip the
extensions to get the output filename.

Thanks to Cedric Staniewski <cedric@gmx.ca> for reporting this issue and
contributing patches.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:33:54 -05:00
Xavier Chantry 82522dd8c1 makepkg: new --skipinteg option
Implements FS#15830

This option allows to build a PKGBUILD with no checksums

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:26:32 -05:00
Dan McGee 7bb9c4098b Merge branch 'maint' 2009-08-08 11:23:38 -05:00
Allan McRae 68200676d2 Be consistent with naming of handle_deps function
All other "dep" functions (check_deps, resolve_deps, remove_deps)
have underscores separating words.

Being consistent, convert handledeps to handle_deps.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:13:48 -05:00
Allan McRae ee43e75ed2 Remove builddeps from option parser
Leftover from commit ae5ef3b9

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:12:05 -05:00
Allan McRae 839bb56269 makepkg: change to pkgdir before creating PKGINFO file
Commit 01f9ae63 moved that creation of the PKGINFO file to before changing
to pkgdir.  This causes issues when using the -R option (FS#15851).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:12:05 -05:00
Xavier Chantry f16c7a4343 repo-add: clarify one message
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-03 07:39:20 -05:00
Cedric Staniewski fb97d325a5 Do not allow pkgnames to start with a hyphen
Commandline arguments starting with a hyphen are usually recognized as
options by unix tools. Therefore, allowing hyphens at the beginning of a
package name requires a different handling of pkgnames as suggested by
rm's manpage.
It would be possible to make the scripts 'hyphen-safe', but
hyphen-prefixed packages will cause trouble for pacman users which do
not know these tricks.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
[Dan: remove the repo-add check]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-26 23:29:55 -05:00
Dan McGee 597118ddd7 Revert "makepkg: Exit on failure within build() or package() functions"
As reported in FS#15210, we have some problems with split packages and
variable overrides because of this patch. For now, in prep for a release, it
is best to back it out and see what we can do later.

This reverts commit 621aa26e26.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-26 12:58:02 -05:00
Allan McRae 4b21504ffc makepkg: add pkgbase to .PKGINFO and database for split packages
With split packages, the pkgbase variable provides a useful way to
find out which packages were build from the same PKGBUILD. Add it
to the packages .PKGINFO file and the repo database only when
package splitting is used.

Original-patch-by: Pierre Schmitz <pierre@archlinux.de>
[Allan: restrict to including only with spilt packages
        and include after pkgname]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-22 06:37:33 -05:00
Allan McRae 5dc0b80c26 makepkg: clean up BUILDSCRIPT usage
FS#15448 (which is made worse by the "fix" for FS#14727...), highlighted
some deficiencies in the usage of the BUILDSCRIPT variable. In particular,
only relative paths worked with "-p" and some output was very strange in
combination with the "-p" flag or reading from /dev/stdin. e.g.
"Please add a license line to your /dev/stdin!".

This patch adds a new variable, BUILDFILE, which contains the full path
to the BUILDSCRIPT.  This defaults to $startdir/$BUILDSCRIPT.

Also, fix a missed quoting of $BUILD{SCRIPT->FILE} and remove warning
about missing BUILDSCRIPT definition in makepkg.conf as the default
BUILDSCRIPT value is now specified during configure. Add check that
BUILDFILE is writable before updating VCS PKGBUILDs. When making a source
package, the BUILDSCRIPT always gets given the default name, regardless
of what it was originally called.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-12 17:32:57 +10:00
Allan McRae 104daa16a6 makepkg: allow spaces in source file names
The download command failed with sources that contained spaces.
Remainder of fix for FS#15323.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-12 01:17:25 +10:00
Dan McGee caa0f2205a makepkg: fix breakage with '%' in source filenames
Ensure we don't pass a bare filename to printf that might contain a
lookalike '%' escape sequence. Fixes part of FS#15323.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-12 01:02:25 +10:00
Dan McGee 68c10690ea makepkg: quote filenames when extracting
We currently fall apart on files with spaces in the names.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-12 01:02:21 +10:00
Allan McRae 6092dda177 makepkg: check for package functions when package splitting
Makes sure the required package functions are present when using package
splitting.  Also moves setting of pkgbase variable outside the
check_sanity function to somewhere more appropriate.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:58 +10:00
Allan McRae e72cce352a makepkg: fix pkgdesc restoration with split packaging
A pkgdesc with spaces in it would get restored to an array and thus only
the first word would be restored (FS#15210). Convert that array back to a
string.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:58 +10:00
Allan McRae 621aa26e26 makepkg: Exit on failure within build() or package() functions
Errors in build() functions were only fatal, if "--log" was enabled. Errors in
package() functions were never fatal. Piping these functions through "cat -"
triggers error trapping. This prevents the need for "|| return 1" usage in
PKGBUILDs.

Original-patch-by: Juergen Hoetzel <juergen@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:58 +10:00
Allan McRae b312c820c8 makepkg: fix check for previously built packages with package splitting
Checks if some or all packages are built before overwriting/installing.
Adds some new strings for translation.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:58 +10:00
Allan McRae 617e7d512f makepkg: clean up moving PKGINFO creation to a function
Someone forgot to commit this when pulling in the original patch
to his working branch...

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:57 +10:00
Dan McGee c72b4543b6 Update copyright headers and messages
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01 02:08:33 -05:00
Dan McGee 68813ca986 Merge commit 'allan/working' 2009-06-23 21:52:35 -05:00
Dan McGee 8bbaf045b9 repo-add: use bsdtar optimization for better performance
When unzipping packages and the database archives, we don't need to look
through the entire archive to do what we need to do. For packages, .PKGINFO
should only be found once and should be the first file in the package. For
the database check, we only really need to look for one desc file.

The bsdtar -q option is very similar to the GNU tar --occurrence=1 option.

Example of speedup:

$ time repo-add junkdb.db.tar.gz *.pkg.tar.gz >/dev/null
real	0m16.159s
user	0m14.836s
sys	0m2.277s

$ time ./scripts/repo-add junkdb.db.tar.gz *.pkg.tar.gz >/dev/null
real	0m4.949s
user	0m3.730s
sys	0m2.093s

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-23 21:51:42 -05:00
Loui Chang 01f9ae63e7 makepkg: Move .PKGINFO creation into a function.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-22 17:09:16 +10:00
Loui Chang 02acf65ef3 makepkg: Download sources and check checksums for any source package.
It wouldn't be very nice to ship a PKGBUILD with the wrong checksums.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-21 20:32:17 +10:00
Allan McRae ef500b44ce makepkg: fix variable backup/restore for splitpkg
The backup and restore of variables that can be overridden while
making split packages only dealt with the first element, not the
whole array (FS#15010).  Adjust the bash voodoo to fix it...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-13 09:51:18 -05:00
Allan McRae 04d5c4294a makepkg: fix PKGBUILD sanity check
If PKGBUILD was good, the "insane" variable was not defined and so
the if statement failed.  Simplify and fix this check.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-13 09:50:53 -05:00
Dan McGee e61ab1536f makepkg: refactor sanity checking into a function
No new checks, just move it into a function and return 1 rather than exit
directly. This also allows the use of local variables.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-07 15:07:37 -05:00
Xavier Chantry 30e2496775 repo-add: fail early if repo can not be created
Before this commit, the repo creation could fail after all packages have
been added to the database. Now this will be detected before adding
anything.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-23 12:27:32 -05:00
Pierre Schmitz c301d6aa25 Add support for the xz archive format
This simple patch adds support for the xz archive format to makepkg and repo-
add.
Xz can be used as source, package and package db file type.

Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
[Dan: fixed a few alignment issues]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:16:59 -05:00
Cedric Staniewski 212ea8a9ed repo-add: fix -n tests which are applicable only to strings
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:04:28 -05:00
Allan McRae 250e66e57b makepkg: fix sourcing BUILDSCRIPT and PATH issues
The bash source command looks in the users PATH for the file to source
before the local directory. This causes issues when someone has a
PKGBUILD somewhere in their path (for unknown some reason...).
Fixes FS#14727.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-16 13:48:10 +10:00
Allan McRae 5e32928a42 makepkg: Document package splitting
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-14 16:30:02 +10:00
Allan McRae de44a0f474 makepkg: do not update pkgver when building source package
When making a source package for a SCM PKGBUILD, makepkg should not
update the pkgver/pkgrel.  Noted in FS#14456.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-14 16:30:01 +10:00
Allan McRae f569c4a042 makepkg: several small fixes
1) Do not attempt to strip compressed binaries
Original-work-by: Marc - A. Dahlhaus <mad@wol.de>

2) Add "\" in "GPL\'ed" so quote mark does not break source code highlighting

3) Add local to docdir paths in makepkg.conf for consistency

4) Use full path to sed in MacOSX in case users have GNU sed earlier in
path

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-11 21:23:46 -05:00
Allan McRae c27904661e makepkg: make in-place sed portable
Do a sed replacement in-place is not very portable.  On Mac OSX and
BSDs, the syntax is "sed -i ''" where as with GNU sed the command is
"sed -i''" or just "sed -i".  This patch detects which command should
be used during configure.

Credit to Kevin Barry who researched this issue and provided a patch
to work around this using temporary backup files.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-26 09:22:23 -05:00