makepkg: Implement pkgtype in .PKGINFO
This implements pkgtype into .PKGINFO. This is useful to ensure tools parsing packages do not miss important context on the creation of the package. For instance discovering if a given .pkg.tar is a debug package, one would have to do heuristics on the pkgdesc and "${pkgbase}-debug". However both of these values are controlled by the packager. Similarly, the heuristic for discovering split packages is if pkgbase and pkgname differ, which can happen in any package as both values are packager controlled. This should ensure we don't need to rely on heuristics and instead include the context of how the package was created. Signed-off-by: Morten Linderud <morten@linderud.pw> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
ae2f506ddf
commit
241c29f0cc
2 changed files with 11 additions and 0 deletions
|
@ -244,6 +244,8 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
|
|||
CALLOC(backup, 1, sizeof(alpm_backup_t), return -1);
|
||||
STRDUP(backup->name, ptr, FREE(backup); return -1);
|
||||
newpkg->backup = alpm_list_add(newpkg->backup, backup);
|
||||
} else if(strcmp(key, "pkgtype") == 0) {
|
||||
/* not used atm */
|
||||
} else {
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: unknown key '%s' in description file line %d\n",
|
||||
newpkg->name ? newpkg->name : "error", key, linenum);
|
||||
|
|
|
@ -487,6 +487,7 @@ write_pkginfo() {
|
|||
|
||||
write_kv_pair "pkgname" "$pkgname"
|
||||
write_kv_pair "pkgbase" "$pkgbase"
|
||||
write_kv_pair "pkgtype" "$pkgtype"
|
||||
|
||||
local fullver=$(get_full_version)
|
||||
write_kv_pair "pkgver" "$fullver"
|
||||
|
@ -564,6 +565,8 @@ list_package_files() {
|
|||
create_package() {
|
||||
(( NOARCHIVE )) && return 0
|
||||
|
||||
pkgtype=${pkgtype:-pkg}
|
||||
|
||||
if [[ ! -d $pkgdir ]]; then
|
||||
error "$(gettext "Missing %s directory.")" "\$pkgdir/"
|
||||
plainerr "$(gettext "Aborting...")"
|
||||
|
@ -648,6 +651,7 @@ create_debug_package() {
|
|||
|
||||
pkgdesc="Detached debugging symbols for $pkgbase"
|
||||
pkgname=$pkgbase-@DEBUGSUFFIX@
|
||||
pkgtype=debug
|
||||
|
||||
create_package
|
||||
}
|
||||
|
@ -658,6 +662,8 @@ create_srcpackage() {
|
|||
local srclinks="$(mktemp -d "$startdir"/srclinks.XXXXXXXXX)"
|
||||
mkdir "${srclinks}"/${pkgbase}
|
||||
|
||||
pkgtype=src
|
||||
|
||||
msg2 "$(gettext "Adding %s...")" "$BUILDSCRIPT"
|
||||
ln -s "${BUILDFILE}" "${srclinks}/${pkgbase}/${BUILDSCRIPT}"
|
||||
|
||||
|
@ -833,6 +839,9 @@ run_single_packaging() {
|
|||
|
||||
run_split_packaging() {
|
||||
local pkgname_backup=("${pkgname[@]}")
|
||||
# We might run this function when we only have package_pkgname
|
||||
# and we don't want that marked as a split package
|
||||
(( ${#pkgname[@]} > 1 )) && pkgtype=split
|
||||
backup_package_variables
|
||||
for pkgname in ${pkgname_backup[@]}; do
|
||||
run_single_packaging $pkgname
|
||||
|
|
Loading…
Add table
Reference in a new issue