You are not logged in.

#1 2012-08-16 19:31:17

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

[SOLVED] Is it appropriate to call "$EDITOR <file>" from PKGBUILD

I have a PKGBUILD in the AUR for my recent creation ttwm.

Installing from the AUR is a nice convenience (over a git pull, and manual build), but this hinders customization through the config.h which must be modified prior to recompiling.

I have come up with two ideas that may allow the best of both options.

1) Include a command in the PKGBUILD such as

    $EDITOR config.h

which will allow the user to edit the config file right before the make command.  I know this will work, but I don't know if would be appropriate.  Are PKGBUILD expected to run 'uninterupted' or is expecting user input like this acceptable?

2) Include a command to copy a file from the user's home director (perhaps a ~/.ttwm.conf) to config.h - eg

    [[ -f ~/.ttwm.conf ]] && cp ~/.ttwm.conf ./config.h

I'm not yet sure if this would even work: can makepkg access something outside the fakeroot environment like this?  And would this be acceptable, or is reading from the user's home dir inappropriate?

Any feedback would be appreciated.  I want to make building the package as easy as possible, but I also want to ensure the PKGBUILD doesn't violate any standards of expected behavior.

Last edited by Trilby (2012-08-16 21:28:00)


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

Offline

#2 2012-08-16 20:48:11

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: [SOLVED] Is it appropriate to call "$EDITOR <file>" from PKGBUILD

AFAIK no, PKGBUILDs should be non-interactive.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#3 2012-08-16 21:12:54

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [SOLVED] Is it appropriate to call "$EDITOR <file>" from PKGBUILD

.:B:. wrote:

PKGBUILDs should be non-interactive.

In addition, a single PKGBUILD file should produce the same package independent of which computer it's compiled on.

Offline

#4 2012-08-16 21:27:48

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

Re: [SOLVED] Is it appropriate to call "$EDITOR <file>" from PKGBUILD

Sounds good, thanks.

I'll just stick with two installation guidelines: AUR for simple "previewing" and manual building to allow configuration.


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

Offline

#5 2012-08-16 21:43:15

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: [SOLVED] Is it appropriate to call "$EDITOR <file>" from PKGBUILD

I think you could allow a custom config file or opening the editor depending on an environment variable. If it is not present then the package is built with the default settings. I think this is appropriate when the application is configured at compile time.

It is not too important, though since it is very easy to add a breakpoint to the PKGBUILD with read or just add the editor or copy command manually.
Edit: I like the idea of a console message in build() and/or post_install that reminds the user of modifying config.h just like in the package for tabbed.

Last edited by progandy (2012-08-16 21:48:58)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#6 2012-08-17 00:33:50

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

Re: [SOLVED] Is it appropriate to call "$EDITOR <file>" from PKGBUILD

Yep, for now I'm just modifying the PKGBUILD every time I use it.

Whenever I push a change on github I want to make sure it builds properly from the AUR, but I don't want to loose my own settings.  So I just build as is once to ensure it works, then I change the PKGBUILD to copy in my config.h and rebuild.  Of course I could build but not install the update - but then I wouldn't benefit from the changes I made.

I have already been violating drcouzelis's advice though as the PKGBUILD uses "$USER" in the build process - so the package built on one machine will not be exactly the same as that built on another.


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

Offline

#7 2012-08-17 00:51:05

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: [SOLVED] Is it appropriate to call "$EDITOR <file>" from PKGBUILD

Trilby wrote:

I have already been violating drcouzelis's advice though as the PKGBUILD uses "$USER" in the build process - so the package built on one machine will not be exactly the same as that built on another.

That has already lead to an error in the default config:

#define AUD_FILE "/home/jmcclure/.audio_volume"

| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#8 2012-08-17 01:03:34

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

Re: [SOLVED] Is it appropriate to call "$EDITOR <file>" from PKGBUILD

Oops.  No, that was just me being to quick on pushing an update from a version I had been modifying.  That mistake would have been there either way.  That one is fixed now.

Last edited by Trilby (2012-08-17 01:03:46)


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

Offline

#9 2012-08-17 05:51:11

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: [SOLVED] Is it appropriate to call "$EDITOR <file>" from PKGBUILD

My linux-ice and linux-rt-ice PKGBUILDs use environment variables and user-conf files (if selected). For me the most important thing is that a 'general' install works non-interactively. If the user wants something different, they'd have to edit the PKGBUILD themselves (or just let them set an env variable).


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

Board footer

Powered by FluxBB