You are not logged in.

#1 2019-06-01 20:02:22

Ashark
Member
Registered: 2017-06-01
Posts: 31

Policy for defining pkgver in split packages

Hi, I think I have found a bug in makepkg, but I am not sure, so I wanted to ask if I am right.
I was developing a generator for huge pkgbuild (for amdgpu-pro), and because most of the packages have the same version, I wanted to specify a pkgver for only base package and for packages that have different version. But I got unexpected behavior of makepkg.
See this PKGBUILD-example1:

pkgbase=example1
pkgver=100

package_foo {
}
package_bar {
    pkgver=200
}
package_buz {
}

I expect to get foo-100, bar-200, buz-100, but instead I get foo-100, bar-200, buz-200

So the question is: is this normal? Why pkgver variable is not local for package function?

And still there is an issue with makepkg even when I explicitly specify pkgver for all packages.
See this PKGBUILD-example2:

pkgbase=example2
pkgver=100

package_foo {
    pkgver=100
}
package_bar {
    pkgver=200
}
package_buz {
    pkgver=100
}

When I run makepkg -fi, it builds all packages normally, but fails to install them. It says that it cannot find bar-100 package. I suspect it wants all split packages to be the same version. Why?
makepkg (pacman) 5.1.3

Offline

#2 2019-06-01 20:44:41

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: Policy for defining pkgver in split packages

Post commands you type and the results they give in the terminal.

Offline

#3 2019-06-01 20:51:51

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Policy for defining pkgver in split packages

It is odd, and should probably be cleaned up a bit, but I'm not sure it counts as a bug as you are in unsupported territory.

man PKGBUILD wrote:

All options and directives for the split packages default to the global values given in the PKGBUILD. Nevertheless, the following ones can be overridden within each split package’s packaging function: pkgdesc, arch, url, license, groups, depends, optdepends, provides, conflicts, replaces, backup, options, install, and changelog.

Note that pkgver is not in that list.

Nor should it be.  How could different products of the same source files have different versions?

Last edited by Trilby (2019-06-01 20:52:33)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2019-06-01 21:13:21

Ashark
Member
Registered: 2017-06-01
Posts: 31

Re: Policy for defining pkgver in split packages

Trilby, in reality, it could be different versions in one pkgbuild smile. The project I am working on is a mix of open and proprietary software, so I was stucked with several unusual situations already.
Ok, lets see a real example. Here is a prepared (non-final) version of generated pkgbuild:

# Author: Janusz Lewandowski <lew21@xtreeme.org>
# Contributor: David McFarland <corngood@gmail.com>
# Autogenerated from AMD's Packages file

major=19.10
minor=785425

pkgbase=amdgpu-pro-installer
pkgname=(
amdgpu-core-meta
amdgpu-pro-core-meta
clinfo-amdgpu-pro
libdrm-amdgpu-amdgpu1
libdrm-amdgpu-common
libdrm2-amdgpu
libopencl1-amdgpu-pro
opencl-orca-amdgpu-pro-icd
)
pkgver=${major}_${minor}
pkgrel=1
arch=('x86_64')
url='https://www.amd.com/en/support/kb/release-notes/rn-rad-lin-19-10-unified'
license=('custom')
makedepends=('wget')

DLAGENTS='https::/usr/bin/wget --referer https://www.amd.com/en/support/kb/release-notes/rn-rad-lin-19-10-unified -N %u'

source=(https://drivers.amd.com/drivers/linux/amdgpu-pro-${major}-${minor}-ubuntu-18.04.tar.xz
	0001-disable-firmware-copy.patch
	0003-add-archlinux-as-build-option.patch)
sha256sums=(a0bd71417d0c0ddd404be8c86653135c4e0190a54bb8dc62eef231d5275f37bd
	85359c89d7f1317cf5176bc9c489314aba2db20d962b120a43fc532575466345
	2bf8eac2afac3bce0d17f840c15009838b578a72412ff66df6e8caa6c00fade7)

PKGEXT=".pkg.tar"


# extracts a debian package
# $1: deb file to extract
extract_deb() {
    local tmpdir="$(basename "${1%.deb}")"
    rm -Rf "$tmpdir"
    mkdir "$tmpdir"
    cd "$tmpdir"
    ar x "$1"
    tar -C "${pkgdir}" -xf data.tar.xz
}
# move ubuntu specific /usr/lib/x86_64-linux-gnu to /usr/lib
# $1: debian package library dir (goes from opt/amdgpu or opt/amdgpu-pro and from x86_64 or i386)
# $2: arch package library dir (goes to usr/lib or usr/lib32)
move_libdir() {
    local deb_libdir="$1"
    local arch_libdir="$2"

    if [ -d "${pkgdir}/${deb_libdir}" ]; then
        if [ ! -d "${pkgdir}/${arch_libdir}" ]; then
            mkdir -p "${pkgdir}/${arch_libdir}"
        fi
        mv -t "${pkgdir}/${arch_libdir}/" "${pkgdir}/${deb_libdir}"/*
        find ${pkgdir} -type d -empty -delete
    fi
}
# move copyright file to proper place and remove debian changelog
# move_copyright() {
#     pkgname_deb=${pkgname//-meta}; pkgname_deb=${pkgname_deb/lib32-/};
#     rm "${pkgdir}/usr/share/doc/${pkgname_deb}/changelog.Debian.gz"
#     mkdir -p ${pkgdir}/usr/share/licenses/${pkgname}
#     mv ${pkgdir}/usr/share/doc/${pkgname_deb}/copyright ${pkgdir}/usr/share/licenses/${pkgname}
#     find ${pkgdir}/usr/share/doc -type d -empty -delete
# }
# remove copyright file and remove debian changelog - only while debugging, not for release
remove_copyright() {
    pkgname_deb=${pkgname//-meta}; pkgname_deb=${pkgname_deb/lib32-/};
    rm "${pkgdir}/usr/share/doc/${pkgname_deb}/changelog.Debian.gz"
    rm "${pkgdir}/usr/share/doc/${pkgname_deb}/copyright" # only while debugging, not for release
    find ${pkgdir}/usr -type d -empty -delete
}

package_amdgpu-core-meta () {
    pkgdesc="Core meta package for unified amdgpu driver."
    pkgver=${major}_${minor}
    license=('MIT')
    install=amdgpu-core-meta.install
    arch=('any')

    extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}-ubuntu-18.04/amdgpu-core_${major}-${minor}_all.deb
    remove_copyright
}

package_amdgpu-pro-core-meta () {
    pkgdesc="Core meta package for Pro components of the unified amdgpu driver."
    pkgver=${major}_${minor}
    license=('custom:AMD GPU-PRO')
    install=amdgpu-pro-core-meta.install
    arch=('any')
    depends=("amdgpu-core-meta")

    extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}-ubuntu-18.04/amdgpu-pro-core_${major}-${minor}_all.deb
    remove_copyright
}

package_clinfo-amdgpu-pro () {
    pkgdesc="AMD OpenCL info utility"
    pkgver=${major}_${minor}
    license=('custom:AMD GPU-PRO')
    arch=('x86_64')
    depends=("aarch64-linux-gnu-glibc" "libopencl1-amdgpu-pro=${major}_${minor}-${pkgrel}")

    extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}-ubuntu-18.04/clinfo-amdgpu-pro_${major}-${minor}_amd64.deb
    move_libdir "opt/amdgpu-pro/lib/x86_64-linux-gnu" "usr/lib"
    remove_copyright
}

package_libdrm-amdgpu-amdgpu1 () {
    pkgdesc="Userspace interface to amdgpu-specific kernel DRM services -- runtime"
    pkgver=2.4.97_${minor}
    license=('MIT')
    arch=('x86_64')
    depends=("aarch64-linux-gnu-glibc" "libdrm-amdgpu-common" "libdrm2-amdgpu=2.4.97_${minor}-${pkgrel}")

    extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}-ubuntu-18.04/libdrm-amdgpu-amdgpu1_2.4.97-${minor}_amd64.deb
    move_libdir "opt/amdgpu/lib/x86_64-linux-gnu" "usr/lib"
    remove_copyright
}

package_libdrm-amdgpu-common () {
    pkgdesc="List of AMD/ATI cards' device IDs, revision IDs and marketing names"
    pkgver=1.0.0_${minor}
    license=('MIT')
    arch=('any')
    depends=("amdgpu-core-meta")

    extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}-ubuntu-18.04/libdrm-amdgpu-common_1.0.0-${minor}_all.deb
    move_libdir "opt/amdgpu/lib/x86_64-linux-gnu" "usr/lib"
    remove_copyright
}

package_libdrm2-amdgpu () {
    pkgdesc="Userspace interface to kernel DRM services -- runtime"
    pkgver=2.4.97_${minor}
    license=('MIT')
    arch=('x86_64')
    depends=("aarch64-linux-gnu-glibc" "amdgpu-core-meta")

    extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}-ubuntu-18.04/libdrm2-amdgpu_2.4.97-${minor}_amd64.deb
    move_libdir "opt/amdgpu/lib/x86_64-linux-gnu" "usr/lib"
    remove_copyright

    # extra_commands:
    mv ${pkgdir}/lib/* ${pkgdir}/usr/lib
    rmdir ${pkgdir}/lib
}

package_libopencl1-amdgpu-pro () {
    pkgdesc="AMD OpenCL ICD Loader library"
    pkgver=${major}_${minor}
    license=('custom:AMD GPU-PRO')
    arch=('x86_64')
    depends=("aarch64-linux-gnu-glibc" "amdgpu-pro-core-meta" "libdrm-amdgpu-amdgpu1")

    extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}-ubuntu-18.04/libopencl1-amdgpu-pro_${major}-${minor}_amd64.deb
    move_libdir "opt/amdgpu-pro/lib/x86_64-linux-gnu" "usr/lib"
    remove_copyright
}

package_opencl-orca-amdgpu-pro-icd () {
    pkgdesc="non-free AMD OpenCL ICD Loaders"
    pkgver=${major}_${minor}
    license=('custom:AMD GPU-PRO')
    arch=('x86_64')
    depends=("aarch64-linux-gnu-glibc" "amdgpu-pro-core-meta")
    backup=(etc/OpenCL/vendors/amdocl-orca64.icd)

    extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}-ubuntu-18.04/opencl-orca-amdgpu-pro-icd_${major}-${minor}_amd64.deb
    move_libdir "opt/amdgpu-pro/lib/x86_64-linux-gnu" "usr/lib"
    remove_copyright
}

All pkgvers are specified. But makepkg -fi fails with:

==> Installing amdgpu-pro-installer package group with pacman -U...
[sudo] password for andrew: 
loading packages...
warning: amdgpu-core-meta-19.10_785425-1 is up to date -- reinstalling
warning: amdgpu-pro-core-meta-19.10_785425-1 is up to date -- reinstalling
error: '/home/andrew/Development/amdgpu-19.10/archlinux-amdgpu/libdrm-amdgpu-amdgpu1-19.10_785425-1-x86_64.pkg.tar': could not find or read package
error: '/home/andrew/Development/amdgpu-19.10/archlinux-amdgpu/libdrm-amdgpu-common-19.10_785425-1-any.pkg.tar': could not find or read package
error: '/home/andrew/Development/amdgpu-19.10/archlinux-amdgpu/libdrm2-amdgpu-19.10_785425-1-x86_64.pkg.tar': could not find or read package
warning: opencl-orca-amdgpu-pro-icd-19.10_785425-1 is up to date -- reinstalling
==> WARNING: Failed to install built package(s).

Offline

#5 2019-06-01 21:37:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Policy for defining pkgver in split packages

You have one source downloaded with a filename of ${major}_${minor}.  Why would anything you build from that source have a different version number?

In any case, even if there is a reason to do this (I still doubt it) then you're still in unsupported territory.  Perhaps you could write/submit a patch for makepkg to handle this, but based on the documentation, this isn't expected to work.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2019-06-01 21:44:01

Ashark
Member
Registered: 2017-06-01
Posts: 31

Re: Policy for defining pkgver in split packages

A different versions are used there because actually it is a set of different software. And the source is actually not source code, but a set of debian packages. So I am repacking it for arch linux. I think I should keep versions used in debian packages.
So, as I suspected, this is a bug. I will file a bug report then.

Offline

#7 2019-06-01 21:50:06

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Policy for defining pkgver in split packages

Support for overridding pkgver was removed from makepkg.  Next version (when I get around to releasing...)  will fail to build if you attempt to set pkgver within a package() function.

Offline

#8 2019-06-01 21:57:26

Ashark
Member
Registered: 2017-06-01
Posts: 31

Re: Policy for defining pkgver in split packages

In other words, you will not be allowed to set different pkgvers in one pkgbuild at all? Why?
Perhaps because of this case is rather rare I guess.
Should I report a bug of this topic?

Last edited by Ashark (2019-06-01 21:58:28)

Offline

#9 2019-06-01 23:37:44

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: Policy for defining pkgver in split packages

A different versions are used there because actually it is a set of different software.

Then you should write many different PKGBUILDs depending on each other. One software, one PKGBUILD.

Offline

#10 2019-06-02 11:31:14

pb
Member
From: Krakow, PL
Registered: 2014-12-26
Posts: 336
Website

Re: Policy for defining pkgver in split packages

@Ashark - I'm maintainer of 4k*-ffmpeg packages (i.e. for 4kvideodownloader and makepkg generating proper version of 2 packages in pkgbase, but it's not possible to install them using makepkg -i, only.

Offline

#11 2019-06-02 12:26:46

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Policy for defining pkgver in split packages

Ashark wrote:

In other words, you will not be allowed to set different pkgvers in one pkgbuild at all? Why?

Because having different version numbers implies different software and should be multiple PKGBUILDs.

Ashark wrote:

Should I report a bug of this topic?

Nope.  I have seen it here and my opinion is not changed.

Offline

#12 2019-06-02 13:17:19

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Policy for defining pkgver in split packages

Ashark wrote:

Perhaps because of this case is rather rare I guess.

The fact that cases like these are rare is true, but not relevant.  They are rare because most archers are pretty good at following directions and learning to do things properly.  If you don't follow directions and do not do things properly, you cannot expect makepkg to work the way you want.  So it's not that attempts like yours are rare, it is that they are wrong.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#13 2019-06-02 14:22:05

Ashark
Member
Registered: 2017-06-01
Posts: 31

Re: Policy for defining pkgver in split packages

Trilby wrote:

They are rare because most archers are pretty good at following directions and learning to do things properly.  If you don't follow directions and do not do things properly, you cannot expect makepkg to work the way you want.  So it's not that attempts like yours are rare, it is that they are wrong.

Please tell me clearly what I am doing wrong? The workaround I think about is just removing pkgvers of different values, so it will become a value of base package. But I think this is ugly.
Probably those packages (libdrm*) could be omitted from that installer, but I am not sure for now, so I was trying to make it right until I realize it.

Offline

#14 2019-06-02 14:26:42

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Policy for defining pkgver in split packages

Ashark wrote:

Please tell me clearly what I am doing wrong?

Ah ... not reading any posts in this thread apparently.  That and having multiple different bits of software in one PKGBUILD - but you've been told this several times, quite directly twice.  If you refuse to listen, there's nothing more that can be said here.

Last edited by Trilby (2019-06-02 14:28:07)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#15 2019-06-02 14:35:49

Ashark
Member
Registered: 2017-06-01
Posts: 31

Re: Policy for defining pkgver in split packages

I have read this. The problem is that I am repacking several Debian packages bundled with driver. Making several pkgbuilds for this task is stupid.

Last edited by Ashark (2019-06-02 19:24:00)

Offline

#16 2019-06-02 15:05:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Policy for defining pkgver in split packages

Ashark wrote:

Making several pkgbuilds for this task is stupid.

Thinking the right way is "stupid" doesn't make the wrong way acceptable.  But I'm done here, you are not here seeking input, you are here to insist that makepkg conform to your desires.  Good luck with that.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#17 2019-06-02 15:18:50

Ashark
Member
Registered: 2017-06-01
Posts: 31

Re: Policy for defining pkgver in split packages

Trilby, please don't be so angry. But thanks for your answers.
I also explained my case several times. But I don't want to quarrel here.

you are here to insist that makepkg conform to your desires

No, I am not.
I understand the point of makepkg developers.

Thanks everybody for answers.

Offline

#18 2022-12-31 12:45:13

tallero
Member
Registered: 2018-09-14
Posts: 9

Re: Policy for defining pkgver in split packages

I've been giving pkgver of pkgbase to all split packages, regardless of their internal version.

Last edited by tallero (2022-12-31 12:49:22)

Offline

#19 2022-12-31 13:38:53

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,783
Website

Re: Policy for defining pkgver in split packages


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB