FS#42433 - [makepkg] pkgver() is run before prepare()

Attached to Project: Pacman
Opened by Martin Lukeš (meridius) - Saturday, 18 October 2014, 14:08 GMT
Last edited by Allan McRae (Allan) - Tuesday, 29 March 2016, 04:22 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version 5.0.1
Due in Version 5.0.2
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

When running makepkg on any package with implemented pkgver() function:
Because pkgver() is run before prepare() or build() it could not find git directory because it wasn't downloaded yet. Therefore it can't determine the current package version.

Solution:
The pkgver() function should run after prepare() when VCS files were downloaded.
This task depends upon

Closed by  Allan McRae (Allan)
Tuesday, 29 March 2016, 04:22 GMT
Reason for closing:  Fixed
Additional comments about closing:  commits c034a332 and 4960be77
Comment by Dave Reisner (falconindy) - Saturday, 18 October 2014, 14:19 GMT
Why are you downloading things in prepare or build? The contents of the source array will be already present when prepare runs.

Could you post a PKGBUILD that shows the issue you're describing?
Comment by Martin Lukeš (meridius) - Saturday, 18 October 2014, 15:07 GMT
My mistake. I was using old PKGBUILD template.
The pkgver() is working after switching to use source array.

Thank you
Comment by Dominik Fischer (XZS) - Friday, 01 May 2015, 20:18 GMT
  • Field changed: Percent Complete (100% → 0%)
Some packages use unzip, a special invocation of bsdtar or other black magic to extract archive formats not supported by makepkg. As the wiki states <https://wiki.archlinux.org/index.php/PKGBUILD#noextract>, the prepare function should be responsible for this.

See for example extensions for firefox <https://aur.archlinux.org/packages/fi/firefox-extension-stylish/PKGBUILD>, which download xpi archives which are then extracted with unzip manually. The version is then determined from the install.rdf description inside the archive.

The current workaround is to include the optional extraction step in both function. This would not be necessary if prepare would run before pkgver.
Comment by Allan McRae (Allan) - Sunday, 20 March 2016, 11:43 GMT
  • Field changed: Category (Packages: Core → General)
  • Field changed: Reported Version ( → 5.0.1)
  • Field changed: Architecture (All → All)
This was inadvertently fixed in pacman-5.0.1 by commit c034a332
Comment by Allan McRae (Allan) - Sunday, 20 March 2016, 11:43 GMT
Documentation update is still needed.

Loading...