Commit Graph

570 Commits

Author SHA1 Message Date
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
Allan McRae 9d9c12e4e2 makepkg: fix package arch detection
get_pkg_arch checked for the arch variable being overridden in the
package_$1() function when used with a package as a parameter.
However, when there was no override, it did not fall back to the
global value.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-30 20:48:59 -05:00
Dave Reisner 9dd42dc0da makepkg: remove subshelling from check_option and friends
Instead of creating a subshell for each of these checks (of which there
are many), pass in an expected value and make the check_* function do
the comparison for us, returning 0 (match), 1, (mismatch), or 127 (not
found).

For a measureable benefit, I tested this on a fairly simple package,
perl-term-readkey, and counted the number of clone(2) syscalls to try
and isolate those generated by makepkg itself, rather than the user
defined functions. Results as shown below:

  336 before
  180 after

So, roughly a 50% reduction, which makes sense given that a single
check_option() call could be up to 3 subprocesses in total.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-29 20:26:27 -05:00
Dave Reisner 8a9c666a8c makepkg: null terminate filenames to strip
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-29 20:26:11 -05:00
Allan McRae 242411a1b4 makepkg: Be more consistent with missing program message
Also prevent "sudo" and "su" from being translated.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24 08:54:59 -05:00
Allan McRae 22050f18f4 makepkg: treat list of packages to be installed as an array
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24 08:54:54 -05:00
Allan McRae d38a1c02db makepkg: deal with overriden package arch properly
This fixes a lot of checks done by makepkg (e.g. to see if a package
is already built and choosing which package to install).  Previously,
if a package had both "i686" and "any" versions, the "i686" one
always took precidence regardless of the value of "arch" in the
PKGBUILD for that package.  Fixes FS#27204.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-24 08:54:49 -05:00
Dan McGee ca4f8687f7 Merge branch 'maint'
Conflicts:
	scripts/repo-add.sh.in
2012-04-24 08:44:11 -05:00
Dave Reisner 62dbf7ec43 scripts: avoid dumping usage on parser fail
Avoid letting the error message from parseopts get lost in the usage
output from pacman-key and makepkg (which is already verbose).
2012-04-24 08:38:36 -05:00
Dave Reisner 3f9cf8471f makepkg: allow specifying --pkg multiple times
Make this option additive, so that the following two operations are
equivalent:

  makepkg --pkg foo --pkg bar
  makepkg --pkg foo,bar
2012-04-24 08:38:36 -05:00
Dave Reisner d85c71865e makepkg: adopt parseopts for option parsing
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-24 08:38:36 -05:00
Dave Reisner 5f71570ec4 makepkg: restrict allowed characters in pkgname
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-20 18:14:45 -05:00
Allan McRae 31091963ed makepkg: save and restore shopts when sourcing /etc/profile
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-08 21:52:42 -05:00
Dave Reisner 468270ce4f makepkg: complain when the buildfile isn't writeable
If the PKGBUILD isn't writeable for devel_update, throw a warning
instead of silently ignoring it. Some logical reordering is present in
this patch to reduce the number of nested if's.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 21:52:32 -05:00
Dave Reisner 8fe6791928 makepkg: catch errors sourcing files
create source_safe() function which temporarily disables extglob and
exits on error.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 21:52:26 -05:00
Dave Reisner dca10b062f makepkg: restrict usage of errexit to user functions
It's expected that this will lead to unwanted behavior, and needs
widespread testing. It's desirable to commit this for a few reasons:

- there's no reason we can't do our own error checking for code that we
  write.
- it avoids the need for ||true hacks scattered about in the code.
- it makes us immune to upstream changes in exit codes (FS#28248)

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-08 21:52:16 -05:00
Dave Reisner 569876f930 makepkg: treat lib{provides,depends} returns as proper arrays
Make these functions more whitespace space by treating newlines as the
element delimiter rather than every form of whitespace.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 17:42:47 -05:00
Dave Reisner ecd6eddf13 makepkg: use proper array addition in libdeps
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 17:42:37 -05:00
Dave Reisner 87c4fb51a4 makepkg: add missing newline from libprovides output
This was a small oversight from 1917c845 which causes makepkg to write
provides entries to the .PKGINFO file improperly, e.g.

  provides = systemdlibsystemdudev=999

Add a newline in the printf format to ensure that these are spaced
appropriately.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-08 17:41:02 -05:00
Allan McRae 923214497f makepkg: safely change directories
In preparation for the removal of the global error trap we need a
way to ensure changing directories succeeds.  Add a "cd_safe"
wrapper that performs the necessary check.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:27:39 -05:00
Allan McRae 1917c845f7 makepkg: use printf rather than echo to output variable
Also make sure the strings passed to %s in printf are always quoted.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:27:23 -05:00
Allan McRae d11192c73a makepkg: the rhs in string comparisons should be quoted
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:27:08 -05:00
Matthew Monaco bb71d254e2 makepkg: devel_check(): cleanup for hg version
Use pushd/popd, quote args, handle some more errors
2012-04-07 11:26:44 -05:00
Matthew Monaco 0fd477238f makepkg: devel_check(): set newpkgver (cleanup)
The case structure allows the syntax to focus on what's actually being
done here.
2012-04-07 11:26:31 -05:00
Matthew Monaco 0666b13669 makepkg: devel_check(): consolidate common code 2012-04-07 11:26:16 -05:00
Matthew Monaco 80a811ec96 makepkg: devel_check(): determine vcs
Rather than prioritizing an arbitrary VCS, collect all development
directives. If there is more than one, give a warning and abort.
2012-04-07 11:26:00 -05:00
Matthew Monaco 6310bb5fbe makepkg: remove unused variable
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 11:25:34 -05:00
Dan McGee 4ca6590af5 Merge branch 'maint'
Conflicts:
	lib/libalpm/signing.c
	lib/libalpm/sync.c
2012-04-07 11:23:55 -05:00
Dan McGee 3f1ea8b62f Revert "makepkg: calculate exact total file size"
This reverts commit b264fb9e9d.
With our "fix" of sleeping for BTRFS, we can go back to using `du` to
calculate total installed size.
2012-04-07 11:20:08 -05:00
Dave Reisner 3c5d5a19b3 Revert "parseopts: normalize options into an array"
This was really only half a fix for FS#28445, as it still doesn't
correctly handle the case of filenames with spaces. In the short term,
there is no obvious fix for this. In the long term, I believe the
correct decision is to rewrite the options parser to be more in line
with GNU getopt_long.

This reverts commits:
  ca41427141.
  969dcddbdf.
2012-04-07 11:03:48 -05:00
Dave Reisner 7f258619c6 makepkg: avoid reporting bogus install size on btrfs
delayed allocation hoses us here and causes erroenous install sizes to
be reported. Add a short sleep to allow the transaction to be committed
to the filesystem and the stat buffers to be updated.

This is apparently a "feature", as per to some of the denizens of #btrfs
on freenode.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-28 09:56:11 -05:00
Dan McGee e6f72c61a0 Merge branch 'maint'
Conflicts:
	lib/libalpm/sync.c
2012-03-16 12:08:10 -05:00
Allan McRae f988aa6b32 makepkg: quote removed filename as it can have spaces
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 12:01:52 -05:00
Allan McRae 573bd80f14 makepkg: abort when failing to create BUILDDIR
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 12:01:26 -05:00
Allan McRae 44de3183ff makepkg: prevent issues with files starting with a hyphen
Most places in makepkg deal with full file paths, but a few use the
file name only.  Protect from potential issues when a file name
starts with a hyphen.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 12:01:15 -05:00
Allan McRae 03465ad6b6 makepkg: append pkgbase to BUILDDIR if specified
This means multiple packages can be build using the same BUILDDIR
without their source files all ending up extracted in the same
directory.  Fixes FS#28417.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-16 12:00:42 -05:00
Dan McGee 8de0631edb Merge branch 'maint'
Conflicts:
	lib/libalpm/be_package.c
2012-03-08 18:08:15 -06:00
Dave Reisner 1a8c3e52d7 makepkg: exit via default signal handler in trap_exit
Similar to how we manage receipt of SIGINT in pacman's internal
downloader, catch the signal and invoke our own trap handler before
unsetting it and calling the default. This requires a slight
modification to the arguments passed to trap_exit so we can pass the
raised signal to trap_exit (note that we substitue USR1 for ERR since
the latter is unique to bash).

Fixes FS#28491.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-08 18:01:53 -06:00
Dave Reisner bc311a24ce makepkg: use array instead of string
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-08 17:30:25 -06:00
Dave Reisner 8d26df5ee5 makepkg: avoid use of eval in run_pacman
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-08 17:30:15 -06:00
Dave Reisner 708a227578 makepkg: enforce decimal format for pkgrel
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-08 17:29:27 -06:00
Christian Hesse 09a93b2e0e makepkg: allow specifying compression options
Adds the ability to override the commands used to compressing
compiled and source packages.  This is useful for those wanting
to use alternative implementations of the compression tools or
non-default compression options.

Allan: documented options in man page

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-03-08 17:28:36 -06:00
Florian Pritz ea7fc8962a makepkg: fix false error with multiple libdeps
With multiple items in $libdepends this check only worked for the first
one, everything after this returned an error. This was probably an issue
with \s being treated wrong.

Fix-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2012-03-05 11:44:34 -06:00
Florian Pritz fbfcd86650 makepkg: fix extraction of soname in find_libdepends
libperl.so results in soname="libperl.so.so" which is wrong.

This returns the correct string: "libperl.so"

Fix-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2012-03-05 11:44:34 -06:00
Dan McGee 3849c3aec1 Merge branch 'maint'
Conflicts:
	contrib/pacsysclean.in
	src/pacman/conf.h
2012-02-20 17:00:26 -06:00
Allan McRae 5bbe342932 makepkg: rework libprovides
This reworks the implmentation of libprovides for the following
benefits:
 - Moves functionality from write_pkginfo() to find_libprovides()
 - Only calculates the version for libraries specifically requested
   and not all libraries. This has the disadvantage of running find
   over the $pkgdir for as many libraries as needed, but is unlikely
   to be an issue due to caching.
 - The order of the provides array in the PKGBUILD is kept in the
   package
 - There are more warning messages when things fail and those that
   were there are no longer errors (as I do not think failure of
   libprovides should result in complete packaging failure)
 - It is now modular so can be easy extended to other library types
   other than ELF *.so.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20 16:54:19 -06:00
Dave Reisner ca41427141 parseopts: normalize options into an array
Modify parse_options logic to fill an array instead of printing parsed
options. Avoid eval like the plague. Because it is the plague.

Fixes bugs such as FS#28445.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-16 17:31:16 -06:00
Christoph Vigano edd81f3e8b makepkg: fix syntax error in remove_deps
This fixes a problem that occurs if you tell makepkg to remove installed
dependencies (just to be sure) but there are none. As the $ was missing
in front of deplist, the check never happened and 'pacman -Rn' was
called which obviously failed.

Dan: later reported as FS#28448.

Signed-off-by: Christoph Vigano <mail@cvigano.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-15 15:12:59 -06:00
Dan McGee 13a1d5883c scripts: unset CDPATH if cd is used
This wonderful/awful little bash shell variable wrecks havoc on `cd`
calls in shell scripts. Unset CDPATH in makepkg where we use `cd` quite
heavily. In pacman-optimize, we can move the change directory logic into
the bsdtar call so we are left with no usages of `cd` in the script.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-14 10:11:43 -06:00
Dan McGee c7321a7b80 Merge branch 'maint'
Conflicts:
	lib/libalpm/sync.c
	src/util/pactree.c
2012-02-13 10:14:06 -06:00
Allan McRae 31432edcbe makepkg: disable extglob when sourcing BUILDSCRIPT
PKGBUILDs are advertised as being pure bash so it would be expected
that the default bash options are in effect when sourcing it.

This inadvertantly "fixes" FS#27780 where enabling extglob causes
the bash parser to error on non-valid bash function names like
package_libxml++(). Note that these function names are unsupported
in bash and could break again even with this "fix" in future bash
releases.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-11 14:53:33 -06:00
Allan McRae 9b1ab3d767 makepkg: deal with mercurial exit codes
From mercurial-2.1, "hg pull" returns 1 when there are no updates.
Catch the return code and either pull the update or return an
error as appropriate.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-11 14:52:54 -06:00
Dan McGee f55be48977 Merge branch 'maint'
Conflicts:
	lib/libalpm/alpm_list.c
2012-02-06 05:50:48 -06:00
Andrew Gregory b7c06d6d67 makepkg.sh.in - if both -r and -i are provided, only remove makedeps
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 05:50:27 -06:00
Andrew Gregory 0fdf0b19ce makepkg.sh.in - fix remove_deps test for deps to be removed
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 05:34:55 -06:00
Mantas Mikulėnas 17e71fc908 makepkg: add forgotten newline in help output
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06 05:34:46 -06:00
Allan McRae 47313acee4 makepkg: Fix non-writable SRCPKGDEST error message
Provide a helpful error message for when creating a source tarball
and SRCPKGDEST is not writable.

Fixes FS#28197.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-31 11:22:50 -06:00
Dan McGee 4f54bde439 Merge branch 'maint'
Conflicts:
	scripts/makepkg.sh.in
2012-01-30 22:00:26 -06:00
Dave Reisner 9e9835f464 scripts: always use printf with embedded gettext
This addresses two problems:

1) echo's behavior is inconsistent when dealing with flags, and can
potentially be problematic.

  $ echo -n
  $ echo -- -n
  -- -n

2) Always using the end of options markers prevents translated strings
from throwing errors, as shown in FS#28069.

The remaining "inconsistencies" are because printf is being used in a
guaranteed safe manner, e.g.

  printf '%s\n' "$(gettext "--this can never break")"

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-30 21:31:38 -06:00
Allan McRae 7ff1b945f6 makepkg: workaround for zipman issues
This "fixes" two issues:

1) MAN_DIRS contains a glob by default so should not be quoted.  It is
not quoted anywhere else so this should not cause breakage...

2) the find statement returns 1 when some of MAN_DIRS are missing. This
appears to only be exposed when running makepkg as root (which it appears
some wrappers do...).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-30 21:18:28 -06:00
Dave Reisner 41db62b77a makepkg: check for license when creating srcpackage
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-23 13:34:28 -05:00
Dave Reisner 225ee71cae makepkg: abstract license check into separate function
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-23 13:34:28 -05:00
Dan McGee e50c4a8837 Merge branch 'maint'
Conflicts:
	lib/libalpm/diskspace.c
	src/pacman/util.h
2012-01-23 12:20:52 -06:00
Allan McRae edd4276bbf makepkg: restrict usage of flags passed to pacman
With pacman-4.0, using --noconfirm or --noprogressbar with -Q or -T
results in pacman reporting an "invalid option" error. Restrict the
passing of these options to pacman. Fixes FS#28012.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-23 09:23:21 -06:00
Allan McRae df47136bcf makepkg: fix error on unnecessary -r
The grep statement used to check for a difference between the
installed package list before and after resolving dependencies
returns 1 if there is no difference.  This sets of the error
trap when "-r" is used "unnecessarily".

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-23 09:23:15 -06:00
Dan McGee 562109c0e8 Update copyright on changed files since beginning of year
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18 22:25:27 -06:00
Dan McGee 4f02b98338 Merge branch 'maint'
Conflicts:
	lib/libalpm/signing.c

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-08 12:14:04 -06:00
Allan McRae 73d0d743bd makepkg: abort on missing download agent
makepkg would not abort on a missing download agent due to the
output variable being declared local on the same line as the
function call in the assignment. That would result in strange output
such as:

==> Retrieving Sources...
==> ERROR: There is no agent set up to handle foo URLs. Check /etc/makepkg.conf.
    Aborting...
  -> Downloading foobaz...
/home/arch/code/pacman/scripts/makepkg: line 401: foo://foobaz: No such file or directory
==> ERROR: Failure while downloading foobaz
    Aborting...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-08 12:13:32 -06:00
Allan McRae 2b38f4eab7 makepkg: fix missing source file detection
Declaring the variable as local on the same line as the assignment
results in result of the assignment being returned rather than the
result of the function on the righthand side of the assignment.

Declaring the variable as local on a separate line means the result
of the function on the r.h.s. is returned and our error function
will be invoked if necessary  (although it is practically impossible
to ever trigger it...).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-08 12:03:56 -06:00
Allan McRae 36413aa856 makepkg: simplify source archive generation
Simplify the source tarball generation by unifying the handling of
local and remote files.  This also allows local files to be found
in $SRCDEST (FS#26580) and makepkg will abort on missing local source
files (only possible to trigger in combination with --skipinteg).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-08 12:03:48 -06:00
Allan McRae b264fb9e9d makepkg: calculate exact total file size
The current calculation of the total file size for a package using "du"
suffers from issues in portability and correctness.  Especially on btrfs,
this can result in clearly wrong package information such as:

Download Size  : 14684.29 KiB
Installed Size : 7628.00 KiB

Use an approach based on "stat" to calculate total file size.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-28 22:32:22 -06:00
Allan McRae 1b46137426 makepkg: Use SKIP in checksum to skip integrity check
Using the value of "SKIP" in the checksum array will cause that
integrity check to be skipped.  This makes building packages that
rely on user configurable sources less painful.

Based-on-patch-by: Dan McGee <dan@archlinux.org>
Based-on-patch-by: David Campbell <davekong@archlinux.us>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-28 22:27:02 -06:00
Dave Reisner 5f0df42303 makepkg: split source elements when looking for sigs
Allows renamed .asc/.sig files to be still discovered by makepkg. This
is needed for a package such as PuTTY, which provides abnormally named
sig files (.DSA and .RSA) which are valid input for gpg --verify.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:47:46 -06:00
Lukas Fleischer 0e4946d559 scripts/*: Declare several constant variables read-only
Be more semantically accurate and avoid accidental overwriting of some
configuration variables that are considered to be constant.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07 10:02:11 -06:00
Dan McGee 1d98c6347c Merge branch 'maint' 2011-11-30 22:34:25 -06:00
Dave Reisner a521cea96f makepkg: avoid using comm for diff'ing package lists
Whereas comm will check inputs to see if they're sorted (and warn when
they aren't), grep doesn't even care about ordering. In this particular
instance -- neither do we. We're only interested that the two lists are
equivalent.

Fixes FS#26580.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee 96b3ba3470 Merge branch 'maint' 2011-11-20 21:40:50 -06:00
Phillip Smith 5ba8b83b8b makepkg: add support for PACKAGER environment var
Add support for overriding configuration in /etc/makepkg.conf and
~/.makepkg.conf by setting the environment variable PACKAGER similar to
how SRCDEST and PKGDEST behave.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-11-20 21:36:30 -06:00
Dave Reisner b8ef22312b makepkg: trim trailing space from whitespace sensitive vars
This applies to pkgver, pkgrel, and epoch and ensures that any trailing
whitespace outside of the context of the variable declaration itself is
properly trimmed. The Bash parser will ignore this, and so should we.

We don't need to worry about leading space because it would force a
syntax error, or fail validation.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:17:43 -06:00
Dave Reisner 42e2f8bfbf makepkg: check for value before using eval'd var
This prevent bsdtar from exploding when install= or changelog= are
present without a value.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-10 09:22:17 -06:00
Allan McRae e7b56f48d7 makepkg: handle pgp signatures with .sign extension
Detached sgnature files with extension .sign are accepted by gnupg.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-07 09:14:09 -06:00
Dan McGee 020bdb4298 makepkg: don't attach traps until after argument parsing
Nothing we do in our traps is necessary this early in the script. This
fixes FS#26196.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14 08:16:06 -05:00
Lukas Fleischer 241946ccea scripts/*.sh.in: Fix signal handler error messages
This includes some fixes to the messages that are displayed when a
signal is caught in makepkg or repo-add:

* Instead of always showing "==> ERROR: TERM signal caught. Exiting...",
  replace "TERM" by whatever signal is actually caught.

* Fix a typo in the SIGERR error message in repo-add ("occurred" instead
  of "occured"). Francois already fixed this for makepkg in 1e51b81c.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 11:20:12 -05:00
Allan McRae 36f31dd133 makepkg: strip comments after pkgver/pkgrel when checking value
Inline comments after pkgver or pkgrel would cause the sanity
checks to fail so remove them before checking the value.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-10 19:05:22 -05:00