diff options
author | Swift Geek | 2014-07-30 23:00:30 +0200 |
---|---|---|
committer | Swift Geek | 2014-07-30 23:00:30 +0200 |
commit | e69002b02c1691d0521810f834d3b8214d5aedf5 (patch) | |
tree | 12859b3a000cb71381467bec192a13379c950ba0 /PKGBUILD | |
parent | 7a086a84c8f90916fdc7c5a3df1821b9571faf21 (diff) | |
download | aur-e69002b02c1691d0521810f834d3b8214d5aedf5.tar.gz |
Reworked PKGBUILD of kicad-pretty-git
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 67 |
1 files changed, 39 insertions, 28 deletions
@@ -1,7 +1,21 @@ # Maintainer: Nick Østergaard <oe.nick at gmail dot com> +# Contributor: Swift Geek <swift geek ɐt gmɐil dot com > + +# pre-parse + # Fetching the pretty repos. This should possibly be a bit more + # intelligent, such that it will remove orphaned repos. + +if [ -x /usr/bin/curl ]; then + PRETTY_REPOS=(`curl -s https://api.github.com/orgs/KiCad/repos?per_page=2000 2> /dev/null \ + | grep full_name | grep pretty \ + | sed -r 's:.+ "KiCad/(.+)",:\1:'`) + PRETTY_SRC=(${PRETTY_REPOS[@]/%/.git}) + PRETTY_SRC=(${PRETTY_SRC[@]/#/git+https://github.com/KiCad/}) +fi + pkgname=kicad-pretty-git -pkgver=1 -pkgrel=3 +pkgver=a # 0 > a and git revision can start from letter +pkgrel=1 pkgdesc="KiCad .pretty repos. Theese are the new footprint library." arch=('any') url="https://github.com/KiCad" @@ -10,40 +24,37 @@ makedepends=('git' 'curl') options=('!strip') install='kicad.install' source=('https://raw.githubusercontent.com/KiCad/kicad-library/master/template/fp-lib-table.for-pretty') +source+=(${PRETTY_SRC[@]}) + md5sums=('SKIP') +for (( i=0; i<${#PRETTY_REPOS[@]}; i++ )); do + md5sums+=('SKIP') +done +unset PRETTY_SRC +pkgver() { + # TODO: use API for getting current revision in master branch + PKGVER="$(curl -s "https://api.github.com/repos/KiCad/kicad-library/commits/master" 2> /dev/null | grep -m1 sha)" + PKGVER="${PKGVER%\"*}" + PKGVER="${PKGVER##*\"}" + echo "${PKGVER:0:7}" +} package() { cd "$srcdir" - msg "Fetching list of available pretty repos..." - PRETTY_REPOS=`curl https://api.github.com/orgs/KiCad/repos?per_page=2000 2> /dev/null \ - | grep full_name | grep pretty \ - | sed -r 's:.+ "KiCad/(.+)",:\1:'` - echo $PRETTY_REPOS - - # Fetching the pretty repos. This should possibly be a bit more - # intelligent, such that it will remove orphaned repos. - for repo in $PRETTY_REPOS; do - if [ ! -e "$srcdir/$repo" ]; then - msg "Cloning $repo" - git clone "https://github.com/KiCad/$repo" "$srcdir/$repo" - else - msg "Updating $repo" - cd "$srcdir/$repo" - git pull - fi - done - - mkdir -p "$pkgdir/usr/share/kicad/footprints" - - for repo in $PRETTY_REPOS; do - cp -r "$srcdir/$repo" "$pkgdir/usr/share/kicad/footprints" + #echo "${PRETTY_REPOS[@]}" + + install -d "$pkgdir/usr/share/kicad/footprints" + + for repo in ${PRETTY_REPOS[@]}; do + install -d "$pkgdir/usr/share/kicad/footprints/$repo/" + cp -r "$srcdir/$repo/"* "$pkgdir/usr/share/kicad/footprints/$repo/" # change to install? done - - mv $srcdir/fp-lib-table.for-pretty "$pkgdir/usr/share/kicad/footprints/fp-lib-table" - mkdir -p "$pkgdir/etc/profile.d" + mv $(readlink -f "${srcdir}/fp-lib-table.for-pretty") "$pkgdir/usr/share/kicad/footprints/fp-lib-table" # Check chmods, change to install? + + install -d "$pkgdir/etc/profile.d" echo "export KISYSMOD=/usr/share/kicad/footprints" > "$pkgdir/etc/profile.d/kicad-pretty-git.sh" } |