1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-14 13:25:09 -05:00
Commit Graph

6043 Commits

Author SHA1 Message Date
Allan McRae
15b6cecdd5 libmakepkg: extract more utility functions
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-19 23:43:00 +10:00
Allan McRae
8ab106eb9b libmakepkg: extract get_full_version and get_pkg_arch
These functions group in with other functions that extract PKGBUILD
information.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
61dd7e03be Simplify libmakepkg .gitignore 2015-05-16 14:10:42 +10:00
Allan McRae
dbbe76b83d makepkg: put further restrictions on pkgbase
pkgbase should be subject to the same restrictions as pkgname

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
9302593cfb makepkg: merge validate_pkgver into check_pkgver
The check that pkgver is non-empty done in check_pkgver should also be
performed after running the pkgver() function.  Merge validate_pkgver
into check_pkgver and run check_pkgver after updating pkgver.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
c9a7b7e0bf libmakepkg: extract PKGBUILD linting functions
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
Allan McRae
d38c098787 libmakepkg: extract in_array 2015-05-16 14:10:42 +10:00
Allan McRae
83b734a103 libmakepkg: move functions for extracting pkgbuild attributes
Also rename some functions for clarity:
funcgrep -> grep_function
extract_global_var -> extract_global_variable
extract_function_var -> extract_function_variable
pkgbuild_get_attribute -> get_pkgbuild_attribute

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-16 14:10:42 +10:00
David Macek
d5536d3eb3 libalpm: Do a sanity check before manipulating final DB URL
The change in commit 9d96bed9d6 causes download errors for the .db.sig file
in case the final URL for the .db file contains query strings or other
unexpected stuff. This commit isn't intended to be a total solution, but it
should eliminate the problem in the most obvious cases.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:55 +10:00
David Macek
d568a4335b Fix comment in alpm_db_update
Fix comment to better explain the magic constant used when allocating a buffer
for ".db.sig" URL.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:55 +10:00
Allan McRae
99c7b1b088 libmakepkg: fix test bracket style
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:55 +10:00
Andrew Gregory
9a9e0203de alpm_logaction: implement documented return value
"return 0 on success, -1 on error (pm_errno is set accordingly)"

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:55 +10:00
Andrew Gregory
1545a04253 alpm_logaction: allow falling back to syslog
Even if opening the log file fails, if a user has enabled syslog we may
still be able to log to that.  Set the error return value and continue
instead of bailing out.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Andrew Gregory
e4af5e3c97 alpm_logaction: check logfile before opening
valgrind does not like calling open(NULL, ...).  This also makes the
return value 0 if logfile has not been set.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Andrew Gregory
ae7067440c merge _alpm_logaction into alpm_logaction
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
David Macek
f9423cfa5d makepkg: Empty/create only $pkgdir's relevant to current PKGBUILD
Currently makepkg clears the whole $pkgbasedir which is needless. Moreover,
in the obscure case of multiple makepkg runs (with different $pkgname) that
share a $pkgdirbase, only $pkgdir's from the last run will remain. Since
I consider the contents of $pkgdir an important artifact, this commit restricts
the deletion to individual $pkgdir's.

When CLEANUP is set, the behavior is unchanged.

Discussed in:
https://lists.archlinux.org/pipermail/pacman-dev/2015-February/019939.html

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Charles Duffy
1040ad4e71 Fix compilation if libarchive headers are not in standard location
With commit 097d5a478b, including alpm.h also drags in archive.h.
Ensure the tools we build that depend on ALPM also include the necessary
flags to find libarchive headers if they are not installed in a standard
location.

[Dan: Add commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Dominik Fischer
b0ae59724e makepkg-template: support multiple --template-dirs
Especially when maintaining local templates in addition to the ones
stored in /usr/share/makepkg-template, it can be useful to include
templates stored in multiple different locations into one PKGBUILD. This
patch makes this possible by allowing --template-dir to be specified
multiple times.

This also introduces a dedicated error message when a template cannot be
found, in contrast to the already existing "Couldn't detect version for
template '%s'".

If a template of the same name is present in more than one of the given
directories, the last one always takes precedence.

Neither the default behaviour without the option given, nor the handling
of a single template dir is changed.

Signed-off-by: Dominik Fischer <d.f.fischer@web.de>
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Andrew Gregory
d4e5de4bf6 pacsort: fix warning about signed overflow potential during comparison.
Some crazy person assumed we would have fewer than INT_MAX columns.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Allan McRae
54067c390f Silence warning from clang
clang is wrong - dbfile is always used initialized in that function.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Allan McRae
4dbac804a3 Pluralize callback string
In English, this string only has it plural form. However, we need to use the
pluralized translation as some languages can have multiple plural formats.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Allan McRae
4e6848dbea Update source URL
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Andrew Gregory
e374e6829c close stdin before running install scripts
libalpm does not guarantee that script output will be presented to the
user or that stdin will be connected to a terminal.  Close stdin so that
scripts do not attempt to use it for user interaction.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:44:14 +10:00
Andrew Gregory
721b785e73 be_package: fallback to standard filelist loading
In order to work properly, loading the filelist from an mtree file
requires a libarchive patch that has not yet been included in an
official release.[1]  Under certain circumstances, an unpatched
libarchive may refuse to read the mtree file due to inconsistencies
between it and the user's file system.  In order to allow alpm to
recover in this situation, read the mtree data into a temporary filelist
that is only copied over to the package if the entire read is
successful.

[1] 661684170b

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:44:13 +10:00
Andrew Gregory
edeafcc988 add_entry_to_files_list: pass filelist directly
Allows entries to be added to arbitrary filelists not connected to
a package.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:44:13 +10:00
Ivy Foster
bf3aec8c32 Add makepkg option --packagelist
makepkg --packagelist prints the name of each package that would
normally be produced, minus $PKGEXT, and exits.

Implements FS#42150

Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:44:10 +10:00
Allan McRae
b520c6312f repo-add: merge desc and depends files
There is little point in these two files being separated as the whole sync db
is parsed at once.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
2408d46c1b makepkg: write validpgpkeys to .SRCINFO
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
eb5da52c0e PKGBUILD.5: have epoch directly following pkgver/pkgrel
These three fields should be grouped together.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
b630f455d2 update repo-add documentation for removal of -f flag
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
cb0f2bd038 Always create files database
Both the "db" and "files" databases are created in one call to repo-add.
Only the "foo.db.tar.xz" name is passed to repo-add.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
30c9dbcdeb repo-add: remove duplication finding old package details
The information needed to create a delta entry and remove the old package from
the filesystem are the same.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
6aef45ee1a repo-add: check early for xdelta if it is needed
The check for xdelta3 was done as needed (and not in all cases).  Do this
check early so that repo-add does not abort part way through.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
81d233b793 repo-add: only update database if entire command succeeded
It is not hard to think of situations where the repo database should not
be updated unless the whole operation succeeds.  Error out before a partial
database update occurs.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
d2cb52de12 repo-add: move database creation into its own function
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
f3fc9af2b7 repo-add: move database rotation into its own function
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:43:37 +10:00
Allan McRae
e7e0c13762 Merge branch 'maint' 2015-03-26 14:43:13 +10:00
Ivy Foster
b543c055b9 Make get_pkg_arch treat arch as an array
We use the get_pkg_arch function with the package name parameter in two places:
1) checking if the package is already built
2) installing build packages

Currently this failed when a package override for "arch" was an array, despite
all our documentation stating that it is indeed an array.  This change makes
these two places fail if there is package override for arch that is not an
array - i.e. of the form arch='i686'.

Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:42:22 +10:00
Allan McRae
b8f2d713e0 Update PKGBUILD-split.proto allowed overrides
Commit 8a02abcf19 disallowed overridding pkgver/pkgrel/epoch.  Update the
split package prototype to refelct this change.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:42:10 +10:00
Christian Hesse
eb21e9eb93 fix source package signing with SRCPKGDIR set
Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:41:26 +10:00
Charles Pigott
f34e48a988 Actually return the error value of check_db_local
Signed-off-by: Charles Pigott <charlespigott@googlemail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-15 15:32:58 +10:00
Allan McRae
f9cb4f3b9c libmakepkg: move helper functions into tidy/strip
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-15 15:32:58 +10:00
Johannes Löthberg
22a5128985 PKGBUILD.5.txt: Clarify note about variables available
Reported-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-15 15:32:58 +10:00
Johannes Löthberg
0aded7487f PKGBUILD.5.txt: Add note about functions starting in $srcdir
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-15 15:32:58 +10:00
Andrew Gregory
156d41a186 remove: use strcmp for files in skip_remove
Paths from noupgrade, the transaction skip_remove, and package backup
lists were combined into a single list matched using fnmatch causing
paths with glob characters to match unrelated files.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Andrew Gregory
ba532bda6b sync_prepare: exclude removals from resolvedeps
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
David Macek
ff8de12151 Allow UPX compression for DOS/Win executables
Hi. This change allows makepkg to UPX-compress executables on Windows, but will probably affect some Linux packages as well (I'm guessing gdbserver, wine, mingw-w64).

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Will Miles
965539adbf common: Avoid errors on systems that define strnlen but not strndup
Add a configure test for a system library supplied strnlen, and disable
the embedded version in common if one is found.

Signed-off-by: Will Miles <wmiles@sgl.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Will Miles
bb94729c09 util: Use util-common for strndup in pacsort and pactree
This small refactor reduces the number of replications of the local
imeplementation of strndup.

Signed-off-by: Will Miles <wmiles@sgl.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae
8f92fe47a7 calculate_removed_size: ensure llstat succeeds
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00