You are not logged in.

#1 2015-09-11 20:17:21

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,612

Optional Build Time Packages

I've been upping my game where it comes to Autotools.   I can proudly state that I can now detect the presence (or lack thereof) of things like doxygen and, if it is available at build time, create a suite of documentation for my packages.  If it is not present, then I ignore it and move on.  Nice.

Taking it a step further, I tried a PKGBUILD to deal with one of my packages that has the optional build dependency of doxygen.   I realized there is optional run time dependency support in makepkg, but there is no support for optional build time dependencies that I can see.  This might make sense -- the build won't fail without it, and if present, I think it will use it.  But,  might it not be nice to be able to indicate to the end user that, if a package like doxygen is available, they will get documentation to go along with it?   

Further, if one user built it on a machine without doxygen, and another user used a machine with doxygen, would they not get two different packages that have the same name and revision that had different sizes and contents?  Is this not a bit nondeterministic? Or am I missing some better practice?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#2 2015-09-11 22:17:12

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,693

Re: Optional Build Time Packages

Since PKGBUILDs really should be built in a clean chroot, optional build-time deps don't make a lot of sense. The package is either installed in the chroot or it's not.

Online

#3 2015-09-11 22:45:41

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,612

Re: Optional Build Time Packages

I'm not sure I fully understand here, mostly because  have honestly never build in a clean chroot.  Mostly because I have not needed to or have cared.

So, if I get this right, the contents of a clean chroot are not controlled by the PKGBUILD, but rather one has to install packages into the chroot prior to the build.
So, I would conceivably create the chroot, install the packages I think I need, then do the build in the chroot.  The build won't see things outside the jail.  Can one make any assumptions as to what is in the chroot, like stuff from core?

Most users, I'm sure, have never used a clean chroot.  I imagine most people who have created an AUR package have not either.    So --- If an Autotools configured configure exists that looks for an optional build dependency, and the packager did not include that optional build dependency in their chroot, and someone else, who has the optional package installed uses the PKGBUILD, they could end up with different results then the original packager.

Last edited by ewaller (2015-09-11 22:47:43)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#4 2015-09-11 23:01:55

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,693

Re: Optional Build Time Packages

Creating a clean chroot installs the base-devel group. Building then installs all packages listed in the depends and makedepends arrays before building.

This is the entire problem with building packages on a live system. Too many build systems will try to autodetect something and give you completely different results. Building in a clean chroot is what gives you the consistent environment to be able to predict how the final package will turn out. All package in the binary repos are built in a clean chroot for this reason. Can you imagine how things would be if dependencies were determined by what the packager had installed?

Online

#5 2015-09-11 23:08:57

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,405
Website

Re: Optional Build Time Packages

ewaller wrote:

So, if I get this right, the contents of a clean chroot are not controlled by the PKGBUILD, but rather one has to install packages into the chroot prior to the build.

Not quite. Only base-devel (or multilib-devel if you're building a multilib package) is installed into a clean chroot by default, then anything that the PKGBUILD demands (deps and makedeps). Nothing else.

The main benefit of using a clean chroot is that "greedy" configure scripts don't pull in extra dependencies, so you have full control over what libraries the compiled binaries link against.

So --- If an Autotools configured configure exists that looks for an optional build dependency, and the packager did not include that optional build dependency in their chroot, and someone else, who has the optional package installed uses the PKGBUILD, they could end up with different results then the original packager.

Exactly. This is why everyone should build in clean chroots. It goes a long way in making reproduceable builds. https://bugs.archlinux.org/task/43407

I agree with you that most users do not though. I think running the PKGBUILD through one should be a prerequisite to submitting a package however.

EDIT: Beaten by Scimmia again. I got distracted. sad

Last edited by WorMzy (2015-09-11 23:10:05)


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

#6 2015-09-11 23:15:22

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,693

Re: Optional Build Time Packages

Wow, twice in one day. smile I guess there's an advantage to being a bit terse.

FWIW, I completely agree with you that every AUR maintainer should be doing, at minimum, a test build in a clean chroot. If nothing else, it helps a lot in figuring out dependencies.

Online

#7 2015-09-11 23:46:53

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,612

Re: Optional Build Time Packages

Okay thanks guys.   I'll be going off to play with this for awhile and will come back with more questions after making and resolving  a few mistakes.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#8 2015-09-12 00:12:44

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

Re: Optional Build Time Packages

Optional build time dependencies can be indicated by a comment in the PKGBUILD.  Everyone reads these scripts before running them on their system...   right?

Offline

#9 2015-09-12 18:45:12

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,612

Re: Optional Build Time Packages

Okay, I did it using extra-x86_64-build.   What a brilliant bit of code.   If I required Doxygen, it did what I would have expected -- except carping about my package being mostly documentation  wink -- and If I did not require it, I get no documentation in the package.  I'll the while, Doxygen being installed in the real system.

I'm not finding a lot of data on this aside from the link in post #3.   Any suggested reading?  I have a bunch of artifacts left over in /var/lib/archbuild/extra-x86_64.   There is a root branch and an ewaller branch.  The ewaller branch has more files in it, including the program built by my PKGBUILD.  The root branch seems to be pristine.   I imagine that the root branch is a vanilla installation with that WorMzy described, whereas the ewaller branch has my dependencies that are declared by the PKGBUILD, plus the package files themselves.  Do these take care of themselves?  Next month when I use extra-x86_64-build on a different PKGBUILD does the root branch update by itself?  Using pacman -Syu? or the packages installed in my system?  Is the ewaller branch purged and rebuilt from the root branch and the PKGBUILD? Or is maintained incrementally through pacman?

Last edited by ewaller (2015-09-12 20:12:18)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#10 2015-09-12 20:00:40

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,405
Website

Re: Optional Build Time Packages

Mmm, the devtool scripts are really handy.

To answer your questions: the root copy stays clean, and updates when you next build a package, and the ewaller copy is destroyed and remade from the root copy each time you build a package. If you have /var/lib/archbuild/extra-x86_64 on a btrfs partition, it will automagically use a snapshot of "root" for "ewaller", saving space and time.


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

#11 2015-09-13 22:50:03

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,881

Re: Optional Build Time Packages

devtools / nspawn have 1 big flaw :

they only work when arch is booted with systemd .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#12 2015-09-13 23:45:40

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

Re: Optional Build Time Packages

Lone_Wolf wrote:

devtools / nspawn have 1 big flaw :

they only work when arch is booted with systemd .

Makes sense, given Arch developers only support systemd...

Offline

#13 2015-09-14 07:12:09

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,881

Re: Optional Build Time Packages

I am aware of that,
devtools and netctl are both on my list of projects to try to adjust them so they can work with any init system.
I started looking at netctl, found 20+ files where systemd functionality is used.
I'm trying to split those parts out into bash functions, but sofar with little success.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#14 2015-09-14 07:37:01

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

Re: Optional Build Time Packages

Both devtools and netctl used to be systemd free.  So your best bet is looking at old versions of devtools and netcfg.   Have fun...

Offline

#15 2015-09-14 22:18:33

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Optional Build Time Packages

ewaller wrote:

Okay, I did it using extra-x86_64-build.

Take a look at graysky's clean-chroot-manager


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

Board footer

Powered by FluxBB