Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#25628 - [srcpac] Add support for building packges from Git

Attached to Project: Arch Linux
Opened by Andrej Podzimek (andrej) - Wednesday, 17 August 2011, 20:26 GMT
Last edited by Gerardo Exequiel Pozzi (djgera) - Saturday, 08 February 2014, 00:27 GMT
Task Type Feature Request
Category Arch Projects
Status Assigned
Assigned To Andrea Scarpino (BaSh)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 2
Private No



The attached patch adds experimental (shot-in-the-dark) support for building packages from Git instead of ABS.


* Added a configuration file /etc/srcpac.conf with some important variables.
* Added initial support for building packages from Git.
* The Git repository is first cloned if the appropriate directory is not found.
* If the Git repository directory exists, the tree is first reverted to its initial state (local changes purged) and then updated (pulled) from the remote repository.
* Added the -z or --git option to build from Git instead of ABS. Without this option, srcpac should behave the same way as the original version.
* Fixed a bug when no packages were supplied to pacman and installed after building an entire compound package and selecting the default ("all"/empty) option.
* Removed --asroot completely. It does not seem to serve any reasonable purpose.

Known issues:

* The code branch corresponding to $pkg != $pkgbase in build_packages() never runs. Consequently, *all* packages from compound PKGBUILDs are installed by pacman instead of the required ones only.
*This is a bug inherited from the original srcpac. It is caused by calling the build_packages() function with the resolved 'candidates' (package directories) instead of the actual package names required by the command line arguments.
*This should be sorted out properly by creating a mapping of the candidate directories to sets of required (sub)package names for each candidate.)
* It fails if GITROOT or ABSROOT paths contain spaces. (This is not critical, but it can be certainly fixed somehow. (Dunno how.))
* The differences in directory naming (extra/lsof versus lsof/trunk) caused certain difficulties concerning those prefix/suffix expressions. I may have messed something up.

Other remarks and suggestions:

* Nearly 100% of corner cases (packages replacing other packges, changes in dependency sets from version to version) cause failures. This means that *most* if not all full system upgrades fail.
* The dependency on pacman (and its view of the binary repositories, possibly inconsistent with both ABS and the Git tree) is a problem.
* The code badly needs cleanup...
* This thing is becoming rather complex. Shouldn't it be implemented in a more suitable language (Perl, Python, ...)?
This task depends upon

Comment by Andrej Podzimek (andrej) - Monday, 22 August 2011, 07:44 GMT
Ooops! There's yet another issue. Unfortunately, the Git repo contains only core and extra packages. Supporting community packages would require a separate Git checkout and dealing with two separate trees.
Comment by Andrej Podzimek (andrej) - Monday, 22 August 2011, 09:44 GMT
Two further issues I found during tests:

1) When SUDO_USER is set, srcpac (or perhaps makepkg) attempts to install missing dependencies using pacman under the restricted user role, which (of course) does not work (at least not in an unattended manner).
2) IMO, when the -b flag is set, the missing build-time dependencies should be *built* (rather than downloaded by pacman) and *optionally* removed (rather than removed automatically). Keeping them is preferable since they will be needed on every single future update of the dependent package and rebuilding or reinstalling them each time serves no purpose. Alternatively, there could be more options, such as
-b == "download missing packages with pacman"
-bb == "build missing packages"
-r == "remove temporarily added build dependencies" (*but* no sooner than at the end of the whole update procedure and only if their removal is still possible (they did not become run-time dependencies in the mean time))

Perhaps I could have a look at the second suggestion, but have no idea how the first one could (should) be dealt with.