You are not logged in.

#1 2010-03-29 18:38:09

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

absent, an ABS handler

absent is a simple bash script to ease the tedious task of rebuilding repo packages - locating the PKGBUILD, copying it somewhere, cd-ing there and running makepkg.
Its interface is similar to clyde/packer/yaourt.
For further info, install it (AUR: absent) and read the help message.

Last edited by JohannesSM64 (2011-07-12 14:29:53)

Offline

#2 2010-03-29 21:27:13

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: absent, an ABS handler

If nobody is going to say it; I will. I think this is great. Relieves the headache of building everything manually. Thanks much for this; it's almost exactly what I'm trying to accomplish with mine as well. Yours is a lot cleaner though and at just over 175 lines runs faster too. Bonus there. I think I need to trim down on the PKGBUILD parsing/version checking, etc, and focus less on dependency handling as well (talk about a headache). Sad for me to say, but I like yours better. haha (right now anyway wink) Nifty arithmetic, too. Well done. I think I'll be using this for a while.

Offline

#3 2010-03-29 21:28:56

flamelab
Member
From: Athens, Hellas (Greece)
Registered: 2007-12-26
Posts: 2,160

Re: absent, an ABS handler

Haven't tried it yet.... It's portage (emerge) like ?

Offline

#4 2010-03-29 22:16:15

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: absent, an ABS handler

flamelab wrote:

Haven't tried it yet.... It's portage (emerge) like ?

What I was thinking..it seems to sort of take the ports-like part and add a thin layer of (convenient) abstraction.
Can't wait to try it.

Offline

#5 2010-03-30 00:17:41

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: absent, an ABS handler

milomouse wrote:

If nobody is going to say it; I will. I think this is great. Relieves the headache of building everything manually. Thanks much for this; it's almost exactly what I'm trying to accomplish with mine as well. Yours is a lot cleaner though and at just over 175 lines runs faster too. Bonus there. I think I need to trim down on the PKGBUILD parsing/version checking, etc, and focus less on dependency handling as well (talk about a headache). Sad for me to say, but I like yours better. haha (right now anyway wink) Nifty arithmetic, too. Well done. I think I'll be using this for a while.

Thanks. Good luck with yours, competition would be nice smile

Offline

#6 2010-03-30 00:35:33

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: absent, an ABS handler

very nice script!  i've had a very similar abuild script slowly taking shape for quite some time.  prompts all the way or pass -f to just buildit.  i'll check your script out thoroughly soon, always like to see how different ppl approach the same problems.

smile.

Offline

#7 2010-03-30 01:09:20

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: absent, an ABS handler

Haha. For some reason I felt great and nostalgic when I saw '$EDITOR not defined or invalid, enter your editor of choice". Reminded me of playing MUDs or somesuch.

Offline

#8 2010-03-30 18:34:42

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: absent, an ABS handler

JohannesSM64 wrote:

Thanks. Good luck with yours, competition would be nice smile

Thanks, I'll do my best. I hadn't worked on it in a while but picked it up again last night and actually figured a lot out. It's funny when things come to a standstill and you put it down and come back later and suddenly everything makes sense. Haha. The only problem with mine is it's 500+ lines of zsh that I tried to convert to bash but can't figure it out, so the user will have to have zsh until I can change it. Regardless, it's basically done now, I just have to clean up the dependency handling (or drop it because it's kindy goofy, but I do like having the script handle fetching the extra packages as well). I keep thinking yours could do that too if only by having the script call it's main function again but just with the dependencies for the value, though you'd either have to parse the build or catch it from makepkg if everything is strictly local (no remote fetching of information), which I prefer anyway. Or something else, who knows. I really like yours the way it is though, I'm just rambling because code and coding possibilities are exciting to me, and from the look of the responses it looks like I'm not your only competition. smile

Offline

#9 2010-03-30 19:02:09

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: absent, an ABS handler

Just to clarify, there is already dependency handling (just put -s in the makepkg flags), but that only fetches binary packages. If you want to build the dependencies too, that should indeed not be hard, I already source the PKGBUILD (since it's the most reliable way of getting $install), so just use the $depends array.

And also makedepends. Also, the PKGBUILD is currently only sourced after editing the PKGBUILD before editing $install (since it's only then it's needed), so it's never sourced in non-interactive mode. Sorry for all the post editing tongue

Last edited by JohannesSM64 (2010-03-30 19:15:48)

Offline

#10 2010-03-30 19:03:46

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: absent, an ABS handler

That's what I meant, sorry. Building them. Anyway, was just brainstorming

EDIT: Ah, ok. smile

Last edited by milomouse (2010-03-30 19:06:41)

Offline

#11 2010-04-01 21:09:40

Vintendo
Member
From: Netherlands
Registered: 2008-04-21
Posts: 375
Website

Re: absent, an ABS handler

This is a very nice piece of software. I have a small feature request, when you enter makepkg flags you have to put in "-fsci" for example. It would be nice if you could just do fsci, without the dash. That is it. Thanks for this program!

Offline

#12 2010-04-01 21:15:33

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: absent, an ABS handler

It would be a cool feature if it would generate a diff -u vs abs and your copy, then preserve the diff so that a subsequent run on the same package applies the diff. This could be helpful to keep things in sync smile

Offline

#13 2010-04-01 21:25:30

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: absent, an ABS handler

@ Vintendo: Nah, the string you enter is passed directly to makepkg. If dashes were to be avoided completely, you would have to be able to type something like "csi source" and have absent parse it and transform it into "-csi --source". It's too clunky to implement. There is one simple solution (that is, however, far from perfect, and I won't use it) but you can if you want: replace all occourances of "makepkg $MPKGF" with "makepkg -$MPKGF" in the script.
@ Daenyth: I'll look into it later.

Last edited by JohannesSM64 (2010-04-01 21:30:15)

Offline

#14 2010-04-05 14:57:58

PUE
Member
From: Earth/Europe/Austria
Registered: 2009-05-09
Posts: 51

Re: absent, an ABS handler

Daenyth, the diff idea is nice. I'm waiting pretty much since I use Arch for something that will help me re-build ABS packages the way I want. Somehow I guess it's not easy to get right, but it would be nice.

Offline

#15 2010-04-08 01:43:32

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: absent, an ABS handler

For the "sci" vs "-sci", you could just apply this to the first character and do something like this when reading the user's response:

if [[ $(echo $MPKGF|cut -c1) != "-" ]]; then
  MPKGF=$(echo "-"$MPKGF)
fi

.. or something. Usually it's just the first character people leave out, like "sci" instead of "-sci", but with --source (as with other long options) is something you consciously think about when typing and so always use "--". I would think so anyway.

And I'm not entirely sure I understand the diff'ing suggestion. You mean apply differences from your PKGBUILD <into> the ABS PKGBUILD or vise versa or something entirely different? hmm If so, wouldn't that add your old pkgver, depends, etc into the new one, or vise versa, and if so also removing compilation options? Again, I may be totally missing the meaning behind this suggestion, and apologize if I am and will probably feel pretty stupid after someone explains it.

Offline

#16 2010-04-08 02:42:55

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: absent, an ABS handler

There's no need for cut there, use bash's substring function.

Offline

#17 2010-04-08 05:47:20

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: absent, an ABS handler

I too didn't fully understand the diff idea.

On another note, I swapped "Enter makepkg flags" for the more inituitive "Enter arguments to pass to makepkg" and swapped $MPKGF for the more initituive $MAKEPKGARGS, so $MPKGF doesn't work anymore.

Offline

#18 2010-04-08 19:59:04

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,000
Website

Re: absent, an ABS handler

JohannesSM64 wrote:

I too didn't fully understand the diff idea.

explanation (at least, how I see it. not necessarily how daenyth meant it):
the reason you build custom packages from ABS is usually because you want to make one or a few small changes in the PKGBUILD.
so, just getting the latest pkgbuild from abs and rebuilding the package is not enough. there should be a way to automatically re-apply the changes you did on the older pkgbuild, on top of the new one.

not sure if diff is the right approach for that.  actually i think it's not.
git is really good in that aspect. it can merge changesets into changed/rearranged code and even when there are conflicts, it helps you to solve them. 
I already proposed to keep our package sources (and hence "abs") into a git repo, but there were some problems with that (see http://mailman.archlinux.org/pipermail/ … 1769.html)
what *could* work is this: everytime you sync abs, you do a new git commit. and you keep all official abs stuff in a certain git branch. and you have your own branch with your own changes, that should make it easy to merge in upstream changes. there's the cost that you store abs multiple times (once in /var/abs, and once in ~/mypackages-or-whatever) but i think the benefits outweigh that.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#19 2010-04-10 00:01:11

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: absent, an ABS handler

@Daenyth: I'm not familiar (at least not by name?) with bash's sub-string, could you give me an example? Currently I have quite a large script and only two accounts of "cut" but it would still be nice to remove them if I can. I'm using zsh but I'm sure the same should apply. Also, is Dieter's explaination what you meant about the diff suggestion? I'm curious to know because I'm trying to find a way to do something similar.

@Johannes: Allright, I updated from git and see what you mean. Thanks. By the way, I'm trying to make it where errorneous makepkg flags aren't passed and are intercepted and prompted again. I currently have:

until ( $(cd $newpath;makepkg $answer 1>/dev/null) ); do
  _sub
done

_sub is a function that includes my prompt. Anyway, it works, like it will show "makepkg: invalid option -- 'z'" and call _sub again but if it's a correct makepkg flag it will continue but only show makepkg output and not the compiling output. Do you (or anyone else, for that matter) have any ideas as a way around this? I can't really say "accept all but *X*" because there could be some user variables such as the -p .. command. Just curious since we're both working on similar projects (not trying to hijack the thread). smile

Offline

#20 2010-04-10 00:35:05

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: absent, an ABS handler

Yes, that's what I meant by diff. smile

As for substrings; If you want from variable foo X characters starting from position Y, ${foo:Y:X}. So for first char starting at beginning, ${foo:0:1}. It's much faster because bash does the operation itself instead of calling exec() and letting cut process it.

Offline

#21 2011-07-12 07:40:00

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: absent, an ABS handler

Reviving this.. I did a huge code cleanup (see) and trimmed absent from 181 to 111 lines. It was mostly replacing spaghetti code. The main difference you will notice is that it now uses .absentrc instead of env vars, mainly so searchdirs can be an array (so dir names with spaces are supported - you kind of need to in 2011).

Should I add absent to AUR so you can install it without digging up a forum post and copying from it?

Offline

#22 2011-07-12 07:51:39

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: absent, an ABS handler

JohannesSM64 wrote:

Should I add absent to AUR so you can install it without digging up a forum post and copying from it?

Please do. This is exceptionally handy.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#23 2011-07-12 11:25:20

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: absent, an ABS handler

Done

Offline

#24 2011-07-12 13:25:14

metre
Member
Registered: 2011-03-13
Posts: 130

Re: absent, an ABS handler

Very handful tool.
You could add a link in the first post

Offline

#25 2011-07-12 18:05:33

barzam
Member
From: Sweden
Registered: 2009-01-27
Posts: 277

Re: absent, an ABS handler

Just a quick FYI, public domain isn't a valid legal term outside of the US and similar (and judging by your last name you are Norwegian?).

#!/bin/bash
# Tool for Arch Linux to quickly search a tree of PKGBUILDs and build packages.
# Written by Johannes Langøy, 2010-2011. Public domain.

I'd recommend giving it a valid license, such as the WTFPL or something similar (see http://en.wikipedia.org/wiki/WTFPL)

Very useful tool by the way, thanks for writing it and providing it. Now maybe I'll give the ABS a go!

Offline

Board footer

Powered by FluxBB