FS#7982 - patch to makepkg to allow PKGBUILDs building more than one package

Attached to Project: Pacman
Opened by Johannes Schriewer (dunkelstern) - Sunday, 09 September 2007, 17:10 GMT
Last edited by Dan McGee (toofishes) - Saturday, 17 January 2009, 17:07 GMT
Task Type Feature Request
Category makepkg
Status Closed
Assigned To Aaron Griffin (phrakture)
Dan McGee (toofishes)
Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version 3.0.5
Due in Version 3.3.0
Due Date Undecided
Percent Complete 100%
Votes 6
Private No

Details

Hi there!

I've done a small modification to makepkg to allow for building more than one package from one source tree.
It could be used for packages that have one big tar.gz for building multiple applications (like kde has) to split those applications into more than one pacman package.

For this to be possible you provide one simple build() function like always and multiple install functions to create the packages then.

I introduced a new variable for this named "splitinstall" which lists all install functions.
The install functions then simply install the corresponding part of the package and call "pack()" at the end to create the package. All other variables like "pkgrel" and "pkgname" have to be overridden in the install functions to create distinct packages.

Of course all "old" PKGBUILDs work as expected. If you don't supply a "splitinstall" entry all is like it was before.

I have attached the patch and an example PKGBUILD (kdetoys from KDEmod).
Please comment on it.
This task depends upon

Closed by  Dan McGee (toofishes)
Saturday, 17 January 2009, 17:07 GMT
Reason for closing:  Implemented
Additional comments about closing:  See commit 3d49d88009341
Comment by Jan M. (funkyou) - Sunday, 09 September 2007, 19:07 GMT
Just tested it and it works properly.

I have attached a PKGBUILD for KDEmod's kdepim which is a little bit more complex, but it also shows the flexibility of this solution. With normal makepkg we had to do a lot of tweaking and deleting in the package itself and not to forget the evil DO_NOT_COMPILE variable. With the patched makepkg we can forget all this and do it in a much cleaner fashion, although the PKGBUILDs get a little bit more crowded :-)
Comment by Johannes Schriewer (dunkelstern) - Sunday, 16 September 2007, 12:49 GMT
Updated the patch and removed some bugs :)
Comment by Aaron Griffin (phrakture) - Tuesday, 18 September 2007, 19:34 GMT
I think I might like this one slightly more than the previous one.

Though, renaming the _install functions to _build would make it clearer. I thought they were related to post_install/pre_install for a second.

Hmm, this is a tough topic as we have free reign to do this here, but want a sane and non-kludgey syntax for it.

Opinions?
Comment by Jan M. (funkyou) - Saturday, 27 October 2007, 03:51 GMT
You can give the _install functions any name you want (they are defined in the splitinstall array), but i think having it standardized is a good idea...
Comment by Jan M. (funkyou) - Monday, 14 January 2008, 22:35 GMT
Here is the last working version, as patch and already patched makepkg...
Notice that this is for makepkg provided by pacman 3.0.6 as we didnt had the time yet to port it to the new makepkg in pacman 3.1...

Please conside adding this, as we could stop hacking makepkg and have more time providing packages :)

Thanks

Jan
Comment by eS.eF. (Dimorph) - Friday, 06 June 2008, 20:46 GMT
I have reworked the Patch for git-SHA1: 470b193a2bee1af2438c1393643e02e65bdece95.

Please review this patch!
Comment by eS.eF. (Dimorph) - Friday, 06 June 2008, 20:47 GMT
Sorry, the git-sha1 is 5ae02e6ae72b7648318e319eba9ab02f489d858a.
Comment by Marc - A. Dahlhaus (wraiden) - Thursday, 12 June 2008, 16:26 GMT
I like the cleanup and it's choice to flush the ${startdir}/pkg directory for every
new sub-package. We need such a functionality here to split packages for hardening
purposes or to separate things that are not needed by every system...

Is there any chance for an upstream inclusion of that work? I mean this is a really
long standing feature request and i think this should go in sometime.
Comment by Xavier (shining) - Thursday, 12 June 2008, 16:42 GMT
Who is we and where is here?
And can you confirm that the last patch posted here is functional and works fine?
If you want to help its upstream inclusion, review and test it very carefully and improve it if needed.
Comment by Marc - A. Dahlhaus (wraiden) - Thursday, 12 June 2008, 20:03 GMT
Xavier > Who is we and where is here?

We use pacman since early 2007 for our in house custom ha-cluster Linux distribution.
We used Makefiles an tar before that point and had no uninstall or dependency tracking...
We got central software distribution with pacman and had a nice an clean migration via
perl-scripts so it was "the richt thing" to adopt pacman for our distribution.

Xavier > And can you confirm that the last patch posted here is functional and works fine?

I can confirm that. To test that we Splittet our php5 package to a base package with
cli api and one for the other APIs (cgi and mod_php). Working well and we spend only
about the half of the build time we used before splitinstall adoption.
(the patch works fine on pacman 3.1.4 also)

Xavier > If you want to help its upstream inclusion, review and test it very carefully and improve it if needed.

I would reorder the saving of the variable-content to the same order as the restore.
I is flexible and simple enough for our use cases as far as i can tell at the moment.
If we encounter any problems along the path to migrate our PKGBUILD files to include
splitinstalls where appropriate, we will contribute patches.

Marc
Comment by Xavier (shining) - Thursday, 12 June 2008, 20:29 GMT
I see, that is interesting.

Well, you could already do something useful, if that is alright with you :
get the above patch from Dimorph, make your reordering cleanup, and submit the new patch to pacman-dev ML inline, so that it can be reviewed there :)

You will need to learn git if you don't know it already, but it will be required for your future patch contribution anyway.
This should help getting you started :
http://code.toofishes.net/git-guide.txt

Otherwise, maybe Dimorph can do that himself.
Comment by Marc - A. Dahlhaus (wraiden) - Thursday, 12 June 2008, 21:07 GMT
I've already spotted a problem. It lacks support for -L (logfile) for
the splitinstall functions. It should append a comment with the name of
the function started and the logs from it to the logfile of the original
build function. I'll post a patch to the list and here until Sunday.

Marc
Comment by eS.eF. (Dimorph) - Friday, 13 June 2008, 18:03 GMT
hi freaks,
0001 is the same patch as above. (git-sha1: 7313c8546ae0a2c38768d665b3f314ee0cf959c4)
0002 have to be applied 0001. This patch fix the logging.

Please review 0002!

Bye DiM
Comment by Jan M. (funkyou) - Friday, 13 June 2008, 18:29 GMT
Guys, you are awesome! :)

I am currently testing the new patches and they are working properly so far.
You even ported the stuff to latest makepkg, so i really have to say thanks for that, as we havent had the time yet to do that...

Just some remarks from our "daily usage experience" with KDEmod:

- This method of splitting is nice and clean. We can create/update splitted stuff for KDEmod in almost no time (no self-praise, but a result of experience)
- The installation of packages with -i does not work with splitted packages for far, as we didnt needed that and thus it wasnt implemented.
- The split stuff only works if the software provides proper Makefiles. This is not always the case, but i think 99,99% of all software will work just dandy :) (the others need to fix their makefiles :P)
- In the latest KDEmod version of makepkg, we have renamed the splitted PKGBUILDs to "SPLITBUILD", to distinguish them better from the standard ones. What do you think about that? (that was the only change in the last months we did, so i guess you need no patch(es) for that, easy stuff)

As we are currently developing some new automated buildscripts for KDEmod, it would be nice to have the -i option working too. I will try to come up with a patch for that after the weekend, but it could take some time...

Again, many thanks for the initiative guys, you rock!



Comment by eS.eF. (Dimorph) - Friday, 13 June 2008, 18:46 GMT
hi freaks,
0001 is the same patch as above. (git-sha1: 7313c8546ae0a2c38768d665b3f314ee0cf959c4)
0002 have to be applied 0001. This patch fix the logging.

Please review 0002!

Bye DiM
Comment by eS.eF. (Dimorph) - Friday, 13 June 2008, 18:47 GMT
sorry for the last posting, it was a mistake!

DiM
Comment by Marc - A. Dahlhaus (wraiden) - Friday, 13 June 2008, 20:38 GMT
> Please review 0002!
Works, and we have logging :)
Many thanks for that.
Can you bring this up on pacman-dev?
Comment by Marc - A. Dahlhaus (wraiden) - Friday, 13 June 2008, 21:38 GMT
You could change the comment appending into a single line of the
following form which would be cleaner in my opinion.

echo -e "\n\n--- Logging for $it ------------" >> "$BUILDLOG"
Comment by Xavier (shining) - Saturday, 14 June 2008, 08:15 GMT
Dimorph, patches are splitted logically, not temporally.
When the second patch is just bugfix/improvement of the first one, you just merge both, you don't keep them separated :)

So if you could write a new patch, with the last suggestion from wraiden if you like it,
and post it inline to pacman-dev ML, it would be great.
You should probably have a look at git-send-email for doing that :
http://git.or.cz/gitwiki/GitTips#head-a015948617d9becbdc9836776f96ad244ba87cb8
Comment by eS.eF. (Dimorph) - Monday, 16 June 2008, 20:06 GMT
After the distaster on the maillinglist, here the right patch.
This is version2 of the patch.

* it builds the packages in different directories
* repackaging works now

To activate this feature you only need a hook-variable "splitinstall" with all
function-names in it.
After performing of build(), it runs all functions in succession.

Loading...