fetch-kde-qt.sh: modularize script allowing multiple versions

+25 -96
+14 -5
maintainers/scripts/fetch-kde-qt.sh
··· 1 1 #! /usr/bin/env nix-shell 2 2 #! nix-shell -i bash -p coreutils findutils gnused nix wget 3 3 4 + SRCS= 5 + if [ -d "$1" ]; then 6 + SRCS="$(pwd)/$1/srcs.nix" 7 + . "$1/fetch.sh" 8 + else 9 + SRCS="$(pwd)/$(dirname $1)/srcs.nix" 10 + . "$1" 11 + fi 12 + 4 13 tmp=$(mktemp -d) 5 14 pushd $tmp >/dev/null 6 - wget -nH -r -c --no-parent "$@" >/dev/null 15 + wget -nH -r -c --no-parent "${WGET_ARGS[@]}" >/dev/null 7 16 8 17 csv=$(mktemp) 9 18 find . -type f | while read src; do ··· 15 24 echo "$name,$version,$src,$filename" >>$csv 16 25 done 17 26 18 - cat <<EOF 19 - # DO NOT EDIT! This file is generated automatically by fetchsrcs.sh 27 + cat >"$SRCS" <<EOF 28 + # DO NOT EDIT! This file is generated automatically by fetch-kde-qt.sh 20 29 { fetchurl, mirror }: 21 30 22 31 { ··· 29 38 filename=$(gawk -F , "/^$name,$latestVersion,/ { print \$4 }" $csv) 30 39 url="${src:2}" 31 40 sha256=$(nix-hash --type sha256 --base32 --flat "$src") 32 - cat <<EOF 41 + cat >>"$SRCS" <<EOF 33 42 $name = { 34 43 version = "$latestVersion"; 35 44 src = fetchurl { ··· 41 50 EOF 42 51 done 43 52 44 - echo "}" 53 + echo "}" >>"$SRCS" 45 54 46 55 popd >/dev/null 47 56 rm -fr $tmp >/dev/null
-5
maintainers/scripts/generate-kde-applications.sh
··· 1 - #!/bin/sh 2 - 3 - ./maintainers/scripts/fetch-kde-qt.sh \ 4 - http://download.kde.org/stable/applications/16.08.0/ -A '*.tar.xz' \ 5 - >pkgs/desktops/kde-5/applications/srcs.nix
-5
maintainers/scripts/generate-kde-frameworks.sh
··· 1 - #!/bin/sh 2 - 3 - ./maintainers/scripts/fetch-kde-qt.sh \ 4 - http://download.kde.org/stable/frameworks/5.24/ -A '*.tar.xz' \ 5 - >pkgs/desktops/kde-5/frameworks/srcs.nix
-5
maintainers/scripts/generate-kde-plasma.sh
··· 1 - #!/bin/sh 2 - 3 - ./maintainers/scripts/fetch-kde-qt.sh \ 4 - http://download.kde.org/stable/plasma/5.7.3/ -A '*.tar.xz' \ 5 - >pkgs/desktops/kde-5/plasma/srcs.nix
-6
maintainers/scripts/generate-qt.sh
··· 1 - #!/bin/sh 2 - 3 - ./maintainers/scripts/fetch-kde-qt.sh \ 4 - http://download.qt.io/official_releases/qt/5.7/5.7.0/submodules/ \ 5 - -A '*.tar.xz' \ 6 - >pkgs/development/libraries/qt-5/5.7/srcs.nix
+1
pkgs/desktops/kde-5/applications/fetch.sh
··· 1 + WGET_ARGS=( http://download.kde.org/stable/applications/16.08.0/ -A '*.tar.xz' )
+1
pkgs/desktops/kde-5/plasma/fetch.sh
··· 1 + WGET_ARGS=( http://download.kde.org/stable/plasma/5.7.4/ -A '*.tar.xz' )
-16
pkgs/desktops/kde-5/plasma/plasma-mediacenter.nix
··· 1 - { plasmaPackage, ecm, baloo, kactivities, kconfig 2 - , kcoreaddons, kdeclarative, kguiaddons, ki18n, kio, kservice 3 - , kfilemetadata, plasma-framework, qtdeclarative, qtmultimedia 4 - , taglib 5 - }: 6 - 7 - plasmaPackage rec { 8 - name = "plasma-mediacenter"; 9 - nativeBuildInputs = [ 10 - ecm 11 - ]; 12 - propagatedBuildInputs = [ 13 - baloo kactivities kdeclarative kfilemetadata ki18n kio plasma-framework 14 - kconfig kcoreaddons kguiaddons kservice qtdeclarative qtmultimedia taglib 15 - ]; 16 - }
+1
pkgs/development/libraries/kde-frameworks/fetch.sh
··· 1 + WGET_ARGS=( http://download.kde.org/stable/frameworks/5.24/ -A '*.tar.xz' )
+3
pkgs/development/libraries/qt-5/5.5/fetch.sh
··· 1 + WGET_ARGS=( http://download.qt.io/official_releases/qt/5.5/5.5.1/submodules/ \ 2 + http://download.qt.io/community_releases/5.5/5.5.1/ \ 3 + -A '*.tar.xz' )
-54
pkgs/development/libraries/qt-5/5.5/fetchsrcs.sh
··· 1 - #! /usr/bin/env nix-shell 2 - #! nix-shell -i bash -p coreutils findutils gnused nix wget 3 - 4 - set -x 5 - 6 - MAJOR_VERSION="5.5" 7 - VERSION="${MAJOR_VERSION}.1" 8 - # The trailing slash at the end is necessary! 9 - RELEASE_URLS=( 10 - "http://download.qt.io/official_releases/qt/$MAJOR_VERSION/$VERSION/submodules/" 11 - "http://download.qt.io/community_releases/$MAJOR_VERSION/$VERSION/" 12 - ) 13 - EXTRA_WGET_ARGS='-A *.tar.xz' 14 - 15 - mkdir tmp; cd tmp 16 - 17 - for url in "${RELEASE_URLS[@]}"; do 18 - wget -nH -r -c --no-parent $url $EXTRA_WGET_ARGS 19 - done 20 - 21 - cat >../srcs.nix <<EOF 22 - # DO NOT EDIT! This file is generated automatically by fetchsrcs.sh 23 - { fetchurl, mirror }: 24 - 25 - { 26 - EOF 27 - 28 - workdir=$(pwd) 29 - 30 - find . | sort | while read src; do 31 - if [[ -f "${src}" ]]; then 32 - url="${src:2}" 33 - # Sanitize file name 34 - filename=$(basename "$src" | tr '@' '_') 35 - nameversion="${filename%.tar.*}" 36 - name=$(echo "$nameversion" | sed -e 's,-[[:digit:]].*,,' | sed -e 's,-opensource-src$,,') 37 - version=$(echo "$nameversion" | sed -e 's,^\([[:alpha:]][[:alnum:]]*-\)\+,,') 38 - sha256=$(nix-hash --type sha256 --base32 --flat "$src") 39 - cat >>../srcs.nix <<EOF 40 - $name = { 41 - version = "$version"; 42 - src = fetchurl { 43 - url = "\${mirror}/$url"; 44 - sha256 = "$sha256"; 45 - name = "$filename"; 46 - }; 47 - }; 48 - EOF 49 - fi 50 - done 51 - 52 - echo "}" >>../srcs.nix 53 - 54 - cd ..
+3
pkgs/development/libraries/qt-5/5.6/fetch.sh
··· 1 + WGET_ARGS=( http://download.qt.io/official_releases/qt/5.6/5.6.1-1/submodules/ \ 2 + http://download.qt.io/community_releases/5.6/5.6.1/ \ 3 + -A '*.tar.xz' )
+2
pkgs/development/libraries/qt-5/5.7/fetch.sh
··· 1 + WGET_ARGS=( http://download.qt.io/official_releases/qt/5.7/5.7.0/submodules/ \ 2 + -A '*.tar.xz' )