You are not logged in.

#1 2010-06-30 06:32:31

JackH79
Member
From: Australia
Registered: 2009-06-18
Posts: 663
Website

[SOLVED] How to automate updating local AUR repo?

Just been fiddeling around with pacman and came across this: http://wiki.archlinux.org/index.php/Cus … repository, which I find quite brilliant. So I put up a local repo on my computer where I can put all those AUR pkg's to install with pacman -S.
Works brilliantly. However, I would quite like to automate this. I.e. one command that:

1: goes through my build folder and when I makepkg a new AUR package, copies the newly created foo.pkg.tar.xz from folder foo to folder local-repo
2: run

repo-add /path/to/local-repo.db ~/build/local-repo/foo.pkg.tar.xz

Does anyone have any idea as to how to implement this? Because it's dealing with a changing folder structure and variable file names, it's completely beyond my programming skills.
Or is there maybe a script out there that can do this already? I did search but couldn't find anything.

Thanks very much in advance for any form of help.

Last edited by JackH79 (2010-06-30 07:56:53)

Offline

#2 2010-06-30 06:48:21

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: [SOLVED] How to automate updating local AUR repo?

`makerepo` from Xyne perhaps...? I don't have a link handy, sorry...

Offline

#3 2010-06-30 06:49:41

Ari'osika
Member
From: Your computer, okay?
Registered: 2010-06-22
Posts: 175

Re: [SOLVED] How to automate updating local AUR repo?

The first part would be easy, IMHO.

The second? I don't know, not until now I've never even thought it was possible to add a localized 'repo'...

*Puts on thinking cap*


If you're reading this; you're awesome.

Offline

#4 2010-06-30 06:51:02

pressh
Developer/TU
From: Netherlands
Registered: 2005-08-14
Posts: 1,719

Re: [SOLVED] How to automate updating local AUR repo?

something like this if I understand you correctly, it copies the latest pkg.tar.xz file in the makepkg directory into your local repo. You could put in a check to see if makepkg completed succesfully before you do all the copying part of course.

#!/bin/bash

makepkg
cp $( ls -t *pkg.tar.xz | sed -n 1p ) /path/to/local/repo
pushd /path/to/local/repo
rm -f local-repo.db
repo-add local-repo.db *.pkg.tar.xz
popd

Last edited by pressh (2010-06-30 06:51:35)

Offline

#5 2010-06-30 07:37:46

JackH79
Member
From: Australia
Registered: 2009-06-18
Posts: 663
Website

Re: [SOLVED] How to automate updating local AUR repo?

@fukawi2: thanks for the tip, but it's not quite what I was looking for.

@pressh: Thanks a bunch! Pretty much exactly what I was looking for. Works like a charm. big_smile
One minor thing though: is there a way to add makepkg switches (eg. -s) when giving the command (called it updaur), so that I could just type in like

updaur -s

?

Offline

#6 2010-06-30 07:51:43

pressh
Developer/TU
From: Netherlands
Registered: 2005-08-14
Posts: 1,719

Re: [SOLVED] How to automate updating local AUR repo?

sure, change

makepkg

to

makepkg $*

this will add all arguments you give to the script to makepkg

[edit]
changed the script to only add the package and not to recreate the whole db, let me know if I made a typo cool

#!/bin/bash

makepkg $*
newfile=$( ls -t *pkg.tar.xz | sed -n 1p )
install -m644 ${newfile} /path/to/local/repo/${newfile}
repo-add /path/to/local/repo/local-repo.db /path/to/local/repo/${newfile}

Last edited by pressh (2010-06-30 07:57:23)

Offline

#7 2010-06-30 07:56:36

JackH79
Member
From: Australia
Registered: 2009-06-18
Posts: 663
Website

Re: [SOLVED] How to automate updating local AUR repo?

Legend!!!

Thanks so much.

EDIT:

pressh wrote:

[edit]
changed the script to only add the package and not to recreate the whole db, let me know if I made a typo cool

#!/bin/bash

makepkg $*
newfile=$( ls -t *pkg.tar.xz | sed -n 1p )
install -m644 ${newfile} /path/to/local/repo/${newfile}
repo-add /path/to/local/repo/local-repo.db /path/to/local/repo/${newfile}

Sweet! Now it's perfect. What do you want? Tacos? Beer? A hug?

Last edited by JackH79 (2010-06-30 08:23:53)

Offline

#8 2010-06-30 13:14:28

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] How to automate updating local AUR repo?

Suggestion: use makepkg's PKGDEST variable to move the built package to the local repo, rather than doing it manually. You can either set it in /etc/makepkg.conf or just set it at runtime:

PKGDEST=/path/to/local/repo makepkg "$@"

This has the added bonus of not (re)adding a random package to the repo when makepkg fails.

Also, "$@" is preferred over $*, as it will correctly handle any quoted arguments.

Last edited by falconindy (2010-06-30 13:16:28)

Offline

#9 2010-06-30 13:34:55

JackH79
Member
From: Australia
Registered: 2009-06-18
Posts: 663
Website

Re: [SOLVED] How to automate updating local AUR repo?

Nifty.

Thanks for the input, falconindy.

Implemented successfully.

Offline

Board footer

Powered by FluxBB