You are not logged in.

#1 2010-01-01 02:54:01

Xemertix
Member
Registered: 2009-04-09
Posts: 66

[SOLVED] Script to automatically update source

Hello,i need a script to use in a pkgbuild that can
1)check this website http://fsinapsi.altervista.org/code/tre … 091228.zip for new version of the archive.
2)change the pkgver if a new version is found
3)download the archive

Maybe it's something like this (taken from the chromium pkgbuild),but i don't know how i can modify it sad.. thank you.

_bldname=chrome-linux.zip
_bldroot=http://build.chromium.org/buildbot/snapshots/${_bldarch}

source=('LICENSE.txt' 'chrome-wrapper.patch' "${_realname}.1.gz" "${_realname}.default"
    "${_realname}.desktop" "${_realname}.sh")
noextract=(${_realname}.1.gz)

# trick re-determining the build revision and, or entertain the hidden
# makepkg option --forcever, huh
if [ -z "$FORCE_VER" ]; then
    msg "Determining latest build revision..."
    newpkgver="$(wget -qO - ${_bldroot}/LATEST)"
    if [ -n "$newpkgver" -a "$newpkgver" != "$pkgver" ]; then
    msg2 "Version found: %s" "$newpkgver"
    FORCE_VER="$newpkgver"
    else
    FORCE_VER="$pkgver"
    fi
fi
if [ "$FORCE_VER" = "LATEST" -a "$SOURCEONLY" -eq 0 ]; then
    error "Plz omit '--forcever LATEST'; I'll auto-detect the LATEST ;)"
    exit 1
elif [ "$FORCE_VER" != "$pkgver" ]; then
    rm -f "$SRCDEST/${_bldname}"
    devel_update
fi

}

build() {
    if [ ! -r "$srcdir/${_bldname}" ]; then
    msg2 "Downloading the latest '$CARCH/$pkgver/${_bldname}'..."
    wget --no-cache -c "${_bldroot}/$pkgver/${_bldname}" \
        -O "$SRCDEST/${_bldname}" || return $?
    ln -fs "$SRCDEST/${_bldname}" "$srcdir/${_bldname}" || return $?
    fi

Last edited by Xemertix (2010-01-01 18:30:04)

Offline

#2 2010-01-01 03:46:15

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] Script to automatically update source

This is PKGBUILD abuse IMO. Look at any PKGBUILD from an Arch dev - you won't see anything like this going on.

Write a PKGBUILD for the current version. Make some completely separate arrangement to check for upstream updates. When an update is announced, update the PKGBUILD.

Up to you, of course - I know what I'd do though.

Offline

#3 2010-01-01 10:28:51

Xemertix
Member
Registered: 2009-04-09
Posts: 66

Re: [SOLVED] Script to automatically update source

tomk wrote:

This is PKGBUILD abuse IMO.

Yes i know,but this archive is updated frequently and generally there aren't major changes in the new versions,so a pkgbuild with a similar script may work well for some time...

Offline

#4 2010-01-01 10:48:10

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

Re: [SOLVED] Script to automatically update source

Xemertix wrote:
tomk wrote:

This is PKGBUILD abuse IMO.

Yes i know,but this archive is updated frequently and generally there aren't major changes in the new versions,so a pkgbuild with a similar script may work well for some time...

So would an external script which automatically updates the PKGBUILD on your machine and then uploads it to the AUR? Simplest I can think of would involve bash, wget/curl, and a bit of sed.

You could even run every X hours if you feel like it.


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

#5 2010-01-01 11:03:53

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: [SOLVED] Script to automatically update source

I don't see a problem here. All you need to do is determine the package version dynamically. (Just like the dev packages.)

pkgver=$(wget http://fsinapsi.altervista.org/code/treep/ -q -O - | sed '/.*trp-\([0-9]\{8\}\)\.zip.*/!d;s//\1/')
sources=(http://fsinapsi.altervista.org/code/treep/trp-${pkgver}.zip)

This silver ladybug at line 28...

Offline

#6 2010-01-01 18:28:54

Xemertix
Member
Registered: 2009-04-09
Posts: 66

Re: [SOLVED] Script to automatically update source

lolilolicon wrote:

I don't see a problem here. All you need to do is determine the package version dynamically. (Just like the dev packages.)

pkgver=$(wget http://fsinapsi.altervista.org/code/treep/ -q -O - | sed '/.*trp-\([0-9]\{8\}\)\.zip.*/!d;s//\1/')
sources=(http://fsinapsi.altervista.org/code/treep/trp-${pkgver}.zip)

Thank you,it worked!

Offline

Board footer

Powered by FluxBB