My main motivation was to remove the "sync", which can stall for
minutes on a busy machine (FS#23378). I also cleaned up the redirection.
Signed-off-by: Jan Steffens <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This is a rather simple patch to add signing support to makepkg. Add a
create_signature() to makepkg, add a 'sign' BUILDENV option in makepkg.conf,
and document the changes in the makepkg.conf manpage.
Signed-off-by: Geoffroy Carrier <geoffroy.carrier@koon.fr>
Signed-off-by: Dan McGee <dan@archlinux.org>
Prevents issues where optdepends descriptions contain a bracket.
Also, strip all comments from arrays before joining them.
Fixes FS#23307.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
A lot of these were places that should have used the same message but
didn't, or were very easy to convert to using the same message and
letting some of the burden off of the translators.
Signed-off-by: Dan McGee <dan@archlinux.org>
When generating integrity sums, we could get some weird output before due to
epoch being uninitialized:
/usr/bin/makepkg: line 234: [[: 2.6.37: syntax error: invalid arithmetic operator (error token is ".6.37")
Signed-off-by: Dan McGee <dan@archlinux.org>
Adding the "|| true" to the subshell prevents bash-3.2 setting off the
error_trap but requires changing the if statement.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Fixes bash-3.2 compatibility.
Thanks-to: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
The current behaviour, which is placing source packages in PKGDEST if
SRCPKGDEST is not set, is inconsistent with {SRC,PKG}DEST handling and
there is no real advantage in doing so.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
At least in FreeBSD, find always returns 0 if it finds stuff
(imagine that). It doesn't care about the exit status of whatever is
passed to -exec.
This patch makes the checks compatible with this behaviour.
Using xargs and not using grep directly because packages with too many
files would cause grep to complain about argument list being too long.
This should also fix the false positive in packages with no files.
Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This makes things consistent with everywhere else we are incorporating the
new optional epoch field. Add a helper function that forms the version
string for you and use it in makepkg where I found 'pkgver.*-.*pkgrel'.
This exposes a few shortcomings in a previous "Override pkgver" patch
(2020e629) in the install package and check if built functions.
Signed-off-by: Dan McGee <dan@archlinux.org>
Instead, go the same route we have always taken with version-release in
libalpm and treat it all as one piece of information. Makepkg is the only
script that knows about epoch as a distinct value; from there on out we will
parse out the components as necessary.
This makes the code a lot simpler as far as epoch handling goes. The
downside here is that we are tossing some compatibility to the wind;
packages using force will have to be rebuilt with an incremented epoch to
keep their special status.
Signed-off-by: Dan McGee <dan@archlinux.org>
It is pretty annoying to get one, fix it, and then get another. We should be
able to continue on through most of the sanity checks in one go so the user
gets all the error messages at once.
Also ensure $pkgbase is defined by the time we call this function;
previously we printed nothing where a package name should have been due to
this oversight.
Signed-off-by: Dan McGee <dan@archlinux.org>
Add the "buildflags" option, which is useful in its negative form
for disabling CFLAGS, CXXFLAGS and LDFLAGS when building a package.
This is useful when determining of one of these flags is causing
an issue with a package.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
A PKGBUILD can have an option check() function for running test suites
between the build() and package() stages. This function is run by
default but can be disabled globally in with "!check" in BUILDENV in
makepkg.conf. This setting can be controlled on an individual package
basis using makepkg's --check and --nocheck flags. Addition dependencies
needed for running the test suite can be specified in the checkdepends
array and are only checked when running the check() function.
Original-work-by: Jeff C <jeff@kcaccess.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
The closing parenthesis of bash arrays needs to be escaped in the ending
address of awk expressions in order to play nicely with implementations
of awk other than gawk. This change provides compatibility with gawk,
nawk and mawk.
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Currently, using $pkgname in a split package package_*() function
always returns the first value in the pkgname array rather than the
name of tha package being packaged. Fix this so $pkgname gives the
expected value.
Fixes FS#22174
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
We should always use $BUILDSCRIPT instead of PKGBUILD. The only
remaining uses of PKGBUILD in makekg are in comments.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Check the over-ridden entries for provides, backup, optdepends and
options for illegal entries. Partially fixes FS#16004.
Signed-off-by: Allan McRae <allan@archlinux.org>
The error message that has been removed never gets to print because, given the
same condition, handle_deps throws the same error and then immediately exits
makepkg.
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
As check_deps is run in a subshell, exit had the same meaning as return.
Since the intention is to halt makepkg when pacman throws an error other than
127, the enclosing function has to handle error control instead.
Fixes FS#19840
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
The escape string isn't necesarily \033; it's determined by what the
particular termcap/info entry for that terminal contains.
Bash uses ncurses functions to expand \e to the _correct_ terminal
escape.
Signed-off-by: Carlos Diaz <839273@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Allow it to be a variable in the PKGBUILD as well as propagating it through
to the built package and the package database. We leave some backward
compatibility in place by placing the '%FORCE%' option in the database if
the package contains an epoch; this will be used by older versions of pacman
and more or less ignored by versions that use epoch.
Signed-off-by: Dan McGee <dan@archlinux.org>
BASH is defined when you are actually using bash during configure, which
sucks because it ends up being '/bin/sh', messing up all of our scripts.
Change the name of the variable we use in configure, and also ensure we get
a full path to the executable by using AC_PATH_PROGS rather than
AC_CHECK_PROGS. Finally, change the variable name everywhere we use it.
Signed-off-by: Dan McGee <dan@archlinux.org>
This applies to contrib/ files, our scripts, and the documentation.
Dan: fix 'make clean' in contrib/ directory.
Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
'mknod <file> p' is apparently GNU-only. Looking at coreutils' source
code, It just calls mkfifo.
This one line patch should fix makepkg logging in non-GNU systems.
Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
This prevents circular symlinks and weird final package locations
when using commands like 'PKGDEST="." makepkg'.
Fixes FS#20922.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Compare paths using bash's "-ef" rather than by string tests as this
takes symlinks into account. This will prevent issues similar to those
in FS#20922 if (e.g.) $PKGDEST is a symlink to $startdir.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
The checking of the package for $srcdir references was overly
sensitive and gave a lot of what appear to be false positives with
binary files (in particular with debugging symbols kept).
Restrict the search for $srcdir to non-binary files as this should
still catch the majority of configuration issues the check was
initially designed to catch. Also, add a similar check for $pkgdir.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
For binary packages, the majority of the time used in the debugs symbol
stripping process is the actual stripping of the binaries/libraries and
not the testing of which files to strip. This allows more complete
stripping of packages that install to "non-standard" paths that would
not be generally included in makepkg.conf.
Any performance hit that may be apparent for (_large_) "arch=('any')"
packages can readily be avoided by disabling stripping in the PKGBUILD
options array.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
After a8dcfeccfc, Allan noted that one more regular exprssion inside makepkg
also contained quotes; these should not be there for the same reason as that
commit.
Signed-off-by: Dan McGee <dan@archlinux.org>
A pipe between tar and compression command is used. This improves
performance by running tar and the compression command simultaneously.
Using a pipe also reduces IO by not writing an intermediate tar file
to disk.
Signed-off-by: Juergen Hoetzel <juergen@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Regular expressions in bash should not be quoted. Glad this was in the
documentation and I didn't have to go to #bash to ask...
Signed-off-by: Dan McGee <dan@archlinux.org>
If optdepends was defined with empty members, then makepkg would
abort late in the package building process. Detect such cases
in the check_sanity() function.
Fix-provided-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Instead of declaring a new local variable for each loop in the
check_sanity() function, just reuse $i.
Signed-off-by: Allan McRae <allan@archlinux.org>
It is unnecessary to check for a variables existence before
looping over it.
Extracted from patch supplied by Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
"Invalid backup entry" was not a particular helpful error message,
especially when it was due to the file not being in the final package.
Clarify these two messages.
Signed-off-by: Allan McRae <allan@archlinux.org>
Combine changelog and install file creation in create_package().
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Eases maintanence if we need to add further options in the future.
Extracted from a patch supplied by Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Prevent makepkg aborting whe colors are enabled and the terminal
does not support setting colors by tput.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
When performing local testing, it may be useful to add PKGEXT='.pkg.tar'
to the PKGBUILD to save time, especially with big packages.
Signed-off-by: Dan McGee <dan@archlinux.org>
Fixes repackaging issues when multiple package names are passed to the
--pkg option.
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Variables that are only meaningful within the function they are declared in are
now prefixed by "local".
Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: fix whitespace]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This fixes two issues:
1) using "sudo -l" results in excess password asking under certian
configurations. Revert to the pre 3.4 behaviour of always using
sudo if it is installed.
2) Properly escape the command so that that versioned dependencies,
such as "foo>4", do not get treated as output redirection when using
su. This also unifies the generation of the pacman line and its
privilege escalation.
Based on patches supplied by Andres P <aepd87@gmail.com> with minor
adjustments for suitability for the maint branch.
Original-work-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
When makepkg catches a command failure it currently prints "Aborting..."
and exits. Clarify the reason for aborting from packaging is a failure
during one of the PKGBUILDs functions.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Attempt to find "du" from coreutils in the standard paths and if
not revert to the version in the users PATH. Using the full path
prevents issues such as FS#19932, where a different and incompatible
version of du is put earlier in the users path.
Signed-off-by: Allan McRae <allan@archlinux.org>
The 'grep -R' in the $srcdir check would not only grep regular files,
but also devices, symlinks (that might potentially point outside of
$pkgdir), pipes and so on. Use find to ensure only regular files are
examined.
This should fix https://bugs.archlinux.org/task/19975
Signed-off-by: Allan McRae <allan@archlinux.org>
Commit 13748ca052 inversed the nature of one test wherein the if clause would
throw a fatal error if a legitimate package function was defined in PKGBUILD.
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Running "pacman -T foo" is expected to return a non-zero value when
"foo" is not installed. This sets of the error trap in bash-3.2 but
not bash 4.x. Work around this by disabling the error trap around
this pacman call as we are manually checking the return value anyway.
Signed-off-by: Allan McRae <allan@archlinux.org>
Commit 3d67d9b1 introduced multiple bash4 string manipulations.
Revert those in order retain compatibility with bash-3.2 which
is still widely used.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
pacman -Qq output is sorted according to the users LC_COLLATE
setting as is needed for comm.
Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: adjust commit message]
Signed-off-by: Allan McRae <allan@archlinux.org>
Ease maintainace; the two parts that have been combined into a function were
identical.
Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: rename function]
Signed-off-by: Allan McRae <allan@archlinux.org>
Regression caused by c71fe7db. Was checking for "optdepend" and "conflict"
rather than "optdepends" and "conflicts" when populating .PKGINFO.
Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: adjust commit message]
Signed-off-by: Allan McRae <allan@archlinux.org>
If the library stripping variables are not defined in makepkg.conf,
libraries will be fully stripped and become broken. Fallback to a
sane default stripping level.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
If "file -bizL" does not return a supported type, check if the file is
recognized by bsdtar and if yes extract from it.
Dan: use '-q' option to prevent needing to seek the entire archive.
Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Instead of specifying the output file on every echo, leave it to the
caller of write_pkginfo to specify the target.
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Change all instances of the (test) [ builtin to the [[ keyword.
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Rely on type -p's return value instead of a string check.
And gettext was previously being checked with type -t, which was
inconsistent with the rest of the tests pertaining commands that aren't
expected to be functions nor builtins.
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
If the library stripping variables are not defined in makepkg.conf,
libraries will be fully stripped and become broken. Fallback to a
sane default stripping level.
Signed-off-by: Allan McRae <allan@archlinux.org>
Source packages were getting created with only links to local source
files. Caused by commit 5cddcc90.
Also, fix dangling symlinks to install and changelog files. Caused
by commit fe1e3471.
Thanks to Christopher Rogers <slaxemulator@gmail.com> for pointing
out areas that were failing.
Signed-off-by: Allan McRae <allan@archlinux.org>
Move the absolute filename detection to a new function to reduce code
duplication.
This patch also fixes the --allsource option that did not include remote
source files if they reside in $startdir instead of $SRCDEST.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
The complete file path of a temporary symlink is really useless
information.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
Merges code in two almost identical chunks in create_srcpackage and
check_sanity.
Also discards the space kept by regex in ae73d75660 and earlier, since
the for loop discards it later on.
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
The .INSTALL and .CHANGELOG files in a package retained the permissions
that they had in $startdir. Do a chmod after copying to ensure
that the permissions are sane.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
f569c4a042 wrongly relied on file's output.
The fix is to not decompress files in the first place.
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Extends the use of the --skipinteg option to creating a source
package. Fixes FS#15984.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
With this patch, dependencies will be resolved and not silently ignored
when running:
makepkg --nobuild --syncdeps
makepkg --repackage --syncdeps
Also, a warning is displayed when repackaging and dependencies are not
being resolved.
Thank you Allan for the feedback.
Signed-off-by: Nezmer <git@nezmer.info>
[Allan: Only warn when repackaging with a package function]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
The current --skipinteg is a bit weird. It does not skip integrity
checks, but instead does them and prints a warning. Change this
behaviour to actually skipping the checks.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
The presence of all install and changelog files (multiple files may
be used with package splitting) is checked for in check_sanity().
All install and changelog files are copied to the source location
when using --source. The check for install and changelog file presence
is removed in create_srcpackage() as this is redundant to the checks
performed in check_sanity().
Moved install and changelog handling in create_srcpackage() to after
source array files, as this is more logical and readily allows for the
following.
A check is made when creating a source package that a symlink to an
install file has not already been added. This can occur if the
install file is used multiple times or if it is listed in the source
array.
Fixes FS#18831, FS#18394 and partially fixes FS#16004
Signed-off-by: Allan McRae <allan@archlinux.org>
Compare a list of packages on the system before and after dependency
resolution in order to get a complete list of packages to remove. This
allows makepkg to remove packages installed due to provides.
Bail in cases where packages that were on the system originally have been
removed as there is a risk of breaking the system when removing the new
packages.
Fixes FS#15144.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
File permissions are not guaranteed to stay the same on exit from fakeroot,
so repackaging may result in files with different permissions. This is
avoided when using a package() function (or split packages) as the
packaging step is rerun.
Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: touched up message for translation purposes]
Signed-off-by: Dan McGee <dan@archlinux.org>
When a man page has both symbolic and hard links, any symlink pointing
to other than the alphabetically first hardlink was not "compressed"
and left dangling towards the uncompressed man page. Fixes FS#18569.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
The newly added variables STRIP_BINARIES, STRIP_SHARED and STRIP_STATIC,
that are set in makepkg.conf, specify the strip options used on binaries
and shared and static libraries.
In addition, files are now stripped more aggressively by default.
Implements FS#13592 the way it was suggested by Allan in the comments.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
It was noted in FS#17533 that setgid bits are carried down into any created
subdirectories, and thus could end up being in a built package if the
original package directory was marked g+s. When we create src/ and pkg/,
explicitly chmod them to remove any sticky bits.
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
When PKGDEST pointed to a non-writable location, makepkg would fail
after completing the build process. This patch makes it abort as
soon as PKGDEST is parsed.
Also, move the SRCDEST check to the same point rather than right
before downloading sources (which was after dependency checks).
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Introduce $SRCPKGDEST to define a destination dir for source packages
instead of saving them in $PKGDEST with binary packages.
The simple patch doesn't break old behavior.
Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
When makepkg exits in create_srcpackage(), the (temporary) srclinks
directory is left behind.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Currently, "makepkg -R" creates a package with a wrong updated $pkgver.
Signed-off-by: Nezmer <Nezmer@allurelinux.org>
[Allan: adjusted comment]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This is particularly useful when using pacman wrappers which call sudo
by themselves and therefore should not be run as root.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
If PACMAN environment variable is set, makepkg will try to use this
command to check for installed dependencies and to install or remove
packages. Otherwise, makepkg will fall back to pacman.
Implements FS#13028.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: move envvar section in manpage]
Signed-off-by: Dan McGee <dan@archlinux.org>
Add a check that the package does not contain references to the
folder it was built in.
Fixes FS#14751
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This allows makepkg to only build a specified subset of packages
from a split PKGBUILD. This is very useful in combination with the
-R flag or when bumping the pkgrel of a single package.
Fixes FS#15956.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
When PKGDEST is used, symlinks to the packages will be put in the build
directory. This combines the convenience of a global package cache with
the ease of having a package (i.e. a symlink) in the build directory for
testing and installation purpose.
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
[Allan: add comment documenting clean-up addition]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
For some packages, generally the 'any' arch ones, a build step is not
required and therefore can be skipped. In these cases, a package()
function without a build() one is sufficient.
As a side effect, this commit makes meta packages without any function
at all in the PKGBUILD possible.
Fixes FS#15147.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Since commit fb97d32, which brought in this test, support for split
PKGBUILDs was added, and therefore, all values of pkgname and also
pkgbase have to be checked now.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
makepkg looks for a package() function when building a single package
but package_$pkgname() style package functions when building a split
package. This patch allows the use of a package_$pkgname() function
when building a single package for consistency. This is achieved by
having makepkg consider a non-split package with a package_$pkgname()
function as a split package (creating just the one package).
Fixes FS#16622.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
* FS#16623, second half of makepkg
* Includes stuff like -o to ||, -a to &&, etc.
* if [ $(type ... preserved due to a bash bug with [[ and set -e and ERR traps
Signed-off-by: Isaac Good <pacman@isaac.otherinbox.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
* FS#16623, first half of makepkg
* Includes stuff like -o to ||, -a to &&, etc.
* if [ $(type ... preserved due to a bash bug with [[ and set -e and ERR traps
Signed-off-by: Isaac Good <pacman@isaac.otherinbox.com>
[Dan: made commit message useful]
Signed-off-by: Dan McGee <dan@archlinux.org>
The source command triggers / might trigger the ERR trap which makes
makepkg abort right after a successful installation of missing
dependencies.
Thanks to Xavier Chantry <shiningxc@gmail.com> for finding this
solution.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Fixes FS#16871 and makes the pkgdesc workaround obsolete.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Currently makepkg takes the commandline arguments, assigns them to a
variable and passes that variable to the next makepkg call (within
fakeroot).
Use a comination of quotes and arrays in this process to ensure any
arguments passed within quotes and containing spaces stay as a single
argument during the second makepkg call.
Thanks to Dan for figuring out how to get this working.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
In doing so, it is possible to get rid of all the tests for colored
messages except for one global one.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
pkgbase is used in the following rm calls, and since pkgname can be
present when pkgbase is not, it is safer to check for pkgbase.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Commit c7e4d10d introduced a small error in the testing of whether
a package is already built.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This allows building a mixture of binary and arch=any packages.
Fixes FS#15955.
The value of CARCH is no longer overridden to "any" in when arch=any
is used and the assigning of the "any" arch is delayed to during the
packaging stage. Adjustments were required to fix installing and
checking for pre-built packages of varing arches.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Fixing a single package within a split package requires the overriding
or pkgrel. In very rare (but existing) cases, it is useful to
override pkgver. Partial fix for FS#15955.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This also removes the awk dependency from makepkg and repo-add.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Currently, a changelog is added to a package if a specific file with a
hardcoded name exists in the PKGBUILD's directory. This approach is not
pretty and also inconsistent with the handling of install files, but it
works.
With the introduction of split PKGBUILDs, however, a drawback in this
old behavior has arisen: you only have the possibility to include one
specific changelog file in either every package defined in the PKGBUILD
or in none.
The use of an additional variable, `changelog`, works around this issue
and makes it possible to include a changelog in only some of the
packages, and besides, each package of the PKGBUILD can have its own
changelog file.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
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>
Add more untranslated strings, improve consistency, etc.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
The index in the for loop wasn't being incremented, so
if the first file wasn't found, the second file would be compared to the
first checksum, rather than the second.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
After the splitpkg implementation, the tidy_install function
was not being called in PKGBUILDs with only the build() function.
Signed-off-by: Allan McRae <allan@archlinux.org>
Fixes FS#13417. Do no exit makepkg on a failure to install the
built package(s). This allows clean-up to still occur.
Signed-off-by: Allan McRae <allan@archlinux.org>
The log files now have -build or -package at the end and there
are separate log files for each *_package() function. Alter
clean_up() to deal with this. Also, move glob outside quotes so
this actually works.
Signed-off-by: Allan McRae <allan@archlinux.org>
The pkgbase variable is added to improve informational output and
source package naming when using split packages. Defaults to
${pkgname[0]} if not set.
Also:
- move splitpkg detection to after pkgname presence is verified
- add "cd" line to package_foo() functions in splitpkg proto
Signed-off-by: Allan McRae <allan@archlinux.org>
1) The changes to sync.c look big but there are mostly caused by
the indentation. Fix a bug where download_size == 0 because the packages and
deltas are already in the cache, but we still need to build the deltas list
and apply the deltas to create the final package.
2) Fix the gzip / md5sum issue by switching to xdelta3, disabling external
recompression and using gzip -n in pacman, and disable bsdtar compression
and using gzip -n in makepkg.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
The pkgdelta script can be used instead.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Commit 1e656c0a introduced the changing of pkgrel to 1 when the
pkgver was updated in SCM PKGBUILDs. However, the output in the
"Making package:" was wrong. Attempting to fix that created
another bug (FS#13416). Interestingly, pkgver was only ever
being updated in the fakeroot stage which caused this problem.
Now both pkgver and pkgrel are updated after the first
devel_check and devel_update. Enjoy the really long explaination
for a two line fix...
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
The Linux and BSD versions of strip have the --strip-debug option (as
well as the -S option), however Mac OS X only has -S.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
The goal of this fix was empty string comparisons:
- if [ "$pkgname" != "" ]; then
+ if [ -n "$pkgname" ]; then
Signed-off-by: Dan McGee <dan@archlinux.org>
In a lot of places, we had the following construct:
[ "$foobar" = "0" ]
which is better represented by using the integer tests:
[ $foobar -eq 0 ]
Attempt to unify makepkg to use the latter rather than the former in all
places. From here on out we should ensure anything that is set to 0, 1, etc.
uses the -eq format rather than =.
In addition, fix a few other test anomalies including usage of double
equals.
Signed-off-by: Dan McGee <dan@archlinux.org>
When using the optional package() function or split packages, the
entire packaging step is rerun instead of just final package
creation step.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Generalize run_package to allow the passing of a package name
directing the use of an alternative package function. A similar
adjustment to create_package to prepare split packages.
Signed-off-by: Allan McRae <allan@archlinux.org>
Piping the package function through tee to log the outut also
clears any variables set in the package function. This is a
problem in split packages as package variable overrides are done
in the package function. This is fixed by creating a node which
the output is piped through and duplicated using the tee function.
Signed-off-by: Allan McRae <allan@archlinux.org>
Adds functions for the backup and restoration of package variables
that can be over-ridden during package splitting. Variables which
can be overridden are given in the splitpkg_overrides variable.
Signed-off-by: Allan McRae <allan@archlinux.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
After the "shopt -s nullglob" change, all regular expressions should be
properly quoted.
This commit only fixes the ones I found, there are probably others left, so
this should be kept in mind for easier future fixing.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Now makepkg can handle filenames with whitespaces in the source array.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
md5sum, sha1sum, etc, do not exist on BSD systems by default. Openssl is a
good portable alternative. This also brings in a dependency for openssl.
Closes FS#10530.
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This patch moves the generating of integrity checks to before any
error checking takes place in the PKGBUILD file. This allows integrity
generation to complete when unrelated errors exist in a PKGBUILD file
and allows the removal of multiple checks of the GENINTEG variable that
would otherwise be needed.
In addition a minor fix is made to a comment.
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
On BSD systems, as super user, the 'ls' command displays all dot files by
default, causing these to get included when not intended. If we use the bash
glob operator, we can avoid issues with ls on different platforms; however,
we need to turn the nullglob shell option on first to ensure we don't have
problems in empty directories.
Originally-noticed-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This supplements the --source option and does nearly the same thing, except
downloaded source files are included in the archive as well. The sources are
now packages with a pkgname/ prefix.
Original-work-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
makepkg should not abort with error when a user uses the --nobuild option to
extract sources if a package has already been built.
Signed-off-by: Anton Fiuman <llexiw@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This patch removes the code block in makepkg that checked for depreciated
options in a PKGBUILD and provided a workaround. Unknown and depreciated
options are upgraded to error conditions.
Also, removed TODO regarding including install script if exists and $install
is unset. That should never happen.
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Catches error from when pacman is unable to remove dependencies after
successfully building package and prints warning. Fixes FS#10039.
Signed-off-by: Allan McRae <mcrae_allan at hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
On BSD systems using a dot as a separator is not allowed. On Mac OSX it
is deprecated. A colon should be used instead. BSD systems also use the
"wheel" group instead of "root" to indicate the "super user" group. Both
groups use the id of 0.
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Acked-by: Aaron Griffin <aaronmgriffin@gmail.com>
Acked-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
For some reason `file` on Mac OSX has different arguments than BSD and
Linux; -i no longer prints out the mime strings. With the environment
variable COMMAND_MODE set to "legacy", `file` behaves more like it does
on Linux and BSD, i.e., `file -i` prints the mime type.
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Acked-by: Dan McGee <dan@archlinux.org>
Acked-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
When fakeroot was not in BUILDENV and the user was not root, makepkg still
tried to use fakeroot for building packages.
BUILDENV is now checked to see if fakeroot is enabled. If it is not enabled the
package can still be built, but root will not have ownership of files. This is
useful when users want to make packages for personal use and don't care about
ownership.
Closes FS#10450.
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This fixes FS#10459.
There is apparently no portable ways to get the apparent size of a file,
like du -b does. So the best compromise seems to get the block size in kB,
and then convert that to byte so that we keep compatibility.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
The "-s" argument does not exist on BSD, and neither does
"--remove-destination". This patch replaces the calls to "cp -s
--remove-destination" with the equivalent "rm -f" and "ln -s" calls, in
order to increase portability.
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
I've always found it odd why the package version is shown at the start but
not the end of the package build. Fix it, and while we are at it, add the
$CARCH variable to the display too.
Signed-off-by: Dan McGee <dan@archlinux.org>
Inside tidy_install, change the section which strips libraries to use find |
while read rather than for foo in `find`. This should allow whitespaces in
filenames to still be processed correctly.
This fixes FS#10294.
Signed-off-by: Daenyth Blank <Daenyth+git@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
All other steps in tidy_install function were already controlled by an
option in makepkg.conf, so this patch adds an option for the man page
compression step too.
This will allow to keep man pages uncompressed, which is required for some
special meta man page, like the zshall one (see FS#4580).
Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011472.html
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Download to *.part and remove the suffix if successful, thus md5sums will be
checked only for complete files, and next time makepkg will resume
downloading of partial file instead of complaining about invalid md5sums.
Old DLAGENTS format is still supported.
Late fix: Do not try to download %u first
The output of grep was not suppressed, thus the output of get_downloadcmd
was wrong because of extra line at the beginning that contained an
unsubstituted (with %o and %u) entry from DLAGENTS.
Signed-off-by: Roman Kyrylych <roman@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Address the issue of our scripts not working so great when gettext is not
available. This has come up in multiple bug reports, and is relatively easy
to address by adding a simple check and a stub function if gettext was not
found that simply echos the original message.
Addresses concerns from FS#9214 and FS#9607.
Signed-off-by: Dan McGee <dan@archlinux.org>
This fixes FS#9242 and FS#9362.
Set umask before the sources are extracted, and after the /etc/profile.d/*
files are sourced in handledeps.
This sourcing of profile.d files is why umask was moved to the build
function in the first place, as can be seen in commit ac965ed401.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Fixes FS#9230. Ensure we have the VCS binaries available when doing the
development version number checking.
Signed-off-by: Dan McGee <dan@archlinux.org>
The path selection for stripping binaries was slightly off, so any binaries
in subdirectories of opt/ were missed. Fixes FS#9342.
Signed-off-by: Dan McGee <dan@archlinux.org>
The previous sed command matched every line starting with r.
For example, with mpd-svn package in aur, the svn log output was rather big,
and there were several lines starting with r (the actual revision : r7155,
but also other lines starting with reverting and run), so this broke makepkg:
> makepkg
==> Determining latest svn revision...
-> Version found: 7155
everting
un
sed: -e expression #1, char 27: unterminated `s' command
To make the sed command more bullet proof, I added the -q option of svn log,
which produces a quieter output, without the log.
And I changed the sed command to only match numbers for the revision.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Workaround found in Advanced Bash-Scripting Guide, localization section.
"added a \0 (NULL) at the beginning of the sentence."
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Pacman 3.0 printed the following message if a file could not be found:
ERROR: xxx was not found in the build directory and is not a proper URL.
We lost this logic in 3.1 when moving to the DLAGENT type stuff, so a
not-found file got passed all the way to the download logic where it failed
with a odd error message. Bring back some logic to ensure only files with
URLs get past a certain point, and fail if the file is not available.
Fixes FS#9208.
Signed-off-by: Dan McGee <dan@archlinux.org>
The --asroot option was not passed to recursive calls of makepkg.
In addition, a 'cd' call was done only on the fakeroot branch instead of
both fakeroot and root branches. Move it outside the conditional.
Noticed-by: Karolina Lindqvist <karolina.lindqvist@kramnet.se>
Signed-off-by: Dan McGee <dan@archlinux.org>
The recent upgrade of magic.mime in the file program changed the mime type
output to application/zip instead of application/x-zip as it is a registered
type. Unfortunately we then just skipped zip file extraction becuase of this
change.
Signed-off-by: Dan McGee <dan@archlinux.org>
This is something pacman can do on its own straight from the archive, and we
will reduce the chance of problems occurring becuase of inproper FILELIST
generation as we have had in the past with special characters in filenames.
Once we remove it from makepkg. we can remove any usage of it from all of
our other tools, including pacman, pactest, and contrib/ utilities.
Note that removing it from pacman uncovered a few other bugs anyway, so this
was probably a good move.
Signed-off-by: Dan McGee <dan@archlinux.org>
I thought it was wierd that makepkg didn't do a sanity check for the
$pkgname. This makes for a simple first try at a GIT patch.
Signed-off-by: K. Piche <kevin@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
There is no real reason to make it look like someone that can't bother to
set the packager variable is official in any way, so remove the Arch Linux
reference from makepkg.
Signed-off-by: Dan McGee <dan@archlinux.org>
Update the GPL boilerplate to direct people to the GNU website for a copy of
the license, as well as bump all of Judd's copyrights to 2007.
Signed-off-by: Dan McGee <dan@archlinux.org>
This fixes FS#5392. If hard links are present for a man page, all
other hard linked files are removed, the man page is zipped and the
hard links are updated to the newly compress man page.
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
[Dan: use find -samefile option, don't fail if one of mandirs is
nonexistent]
Signed-off-by: Dan McGee <dan@archlinux.org>
Retrieve SVN/CVS/etc revision number before checking if the
package has already been built. This allows building a newer
version of a developmental package without having to use -f.
Now -f will only be needed if the latest SVN/CVS/etc revision
is the same as the built package.
Signed-off-by: Scott Horowitz <stonecrest@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Some of the find calls did not have a path, which isn't valid in some
versions of the find utility. Add a . for compatibility.
Signed-off-by: Dan McGee <dan@archlinux.org>
If PKGBUILDs use the correct svn/cvs/etc variables, determine the latest
revision number and force this as the pkgver for building.
Signed-off-by: Scott Horowitz <stonecrest@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
In one of the original clean up patches[1] I changed the search path
for stripping binaries and libraries. This resulted in only
usr/{bin,sbin,lib} being searched. This patch reverts that change.
[1] 721ceee1e2
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
This is needed because 'xdelta delta' returns 1 even when the delta
creation succeeds. This was causing makepkg to exit after the command
due to bash's -e option.
Some information from the xdelta man page:
The delta command exits with status 0 to indicate that no differences
were found, with status 1 to indicate that some differences were found,
and with status 2 to indicate an error of some kind.
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
The -A,--ignorearch option was added and given help text, but never actually
listed as valid to the option parser. Fix this.
Signed-off-by: Dan McGee <dan@archlinux.org>
Packages and DBs now support using the UNIX epoch (seconds since Jan 1, 1970)
for use in builddate and installdate. This will only affect newly built
packages. Old existing packages with the text format are still supported, but
this is deprecated.
In the case of removal of text time support, this code will fail gracefully,
returning the start of the epoch for broken packages.
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Add some alpm functions for getting optdepends, have makepkg include them
in the PKGINFO file, and have a pacman -Qi operation display the raw string
as stored by libalpm.
Signed-off-by: Dan McGee <dan@archlinux.org>
repo-add, repo-remove:
'bsdtar -c * | ...' doesn't work (you need '-f -'). Code clean up
eliminated this bug.
Removed the multiple checksum support, pacman now only supports MD5, so
there's no need for the database to contain multiple checksums.
Quote all variables containing file/dir names to prevent paths
containing spaces from causing problems.
Add msg, warning and error functions.
General code clean up.
pacman-optimize:
Use a sub-directory in /tmp for working files to make it easier to clean
up at the end.
Add quotes round $@ in die and die_r, otherwise printf can't display the
message correctly.
makepkg:
Disable colour output if stderr is not a tty.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
makepkg didn't correctly detect the type of the archive
since it didn't dereference symlinks, and so failed
to extract the source tarball.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
- Downloaded files weren't being copied to $srcdir
- Counter wasn't being incremented for checksum checks
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
This replaces the former -D operation that was undocumented and rather
hacky. It can be used with add, upgrade, or sync transactions and will affect
all packages installed. Should close FS #7193.
Also tell makepkg to use this new flag.
Signed-off-by: Dan McGee <dan@archlinux.org>
makepkg: We still need the source files in $srcdir because PKGBUILDS need
access to noextract() files and other file not handled by by
extract_source(). (eg config files)
query.c: Fix some output formating.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Change the behaviour of makepkg so no longer stores a copy of the
source tarball in $srcdir, instead it downloads all sources to $SRCDEST
then extracts them to $srcdir.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
When running as root, we don't care if fakeroot is installed, and the user
certainly isn't "unprivileged". Cut out these warnings.
Signed-off-by: Dan McGee <dan@archlinux.org>
Changed the exit code for missing deps from 1 to 127 because 1 is used
for other errors. makepkg breaks if pacman exits with 1 for any reason
other than a missing dep.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
It is much easier for translators to deal with paragraphs as strings rather
than by lines. Take all usage and version information and convert it to this
format.
Signed-off-by: Dan McGee <dan@archlinux.org>
If we move the scripts from *.in to *.sh.in and *.py.in, gettext can pull the
required strings to translate a whole lot easier. Do this.
Signed-off-by: Dan McGee <dan@archlinux.org>