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

This commit is contained in:
Thomas Tuegel
2016-08-25 10:06:23 -05:00
parent b71d71c576
commit f4bb247bd6
13 changed files with 25 additions and 96 deletions

View File

@@ -0,0 +1,3 @@
WGET_ARGS=( http://download.qt.io/official_releases/qt/5.5/5.5.1/submodules/ \
http://download.qt.io/community_releases/5.5/5.5.1/ \
-A '*.tar.xz' )

View File

@@ -1,54 +0,0 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils findutils gnused nix wget
set -x
MAJOR_VERSION="5.5"
VERSION="${MAJOR_VERSION}.1"
# The trailing slash at the end is necessary!
RELEASE_URLS=(
"http://download.qt.io/official_releases/qt/$MAJOR_VERSION/$VERSION/submodules/"
"http://download.qt.io/community_releases/$MAJOR_VERSION/$VERSION/"
)
EXTRA_WGET_ARGS='-A *.tar.xz'
mkdir tmp; cd tmp
for url in "${RELEASE_URLS[@]}"; do
wget -nH -r -c --no-parent $url $EXTRA_WGET_ARGS
done
cat >../srcs.nix <<EOF
# DO NOT EDIT! This file is generated automatically by fetchsrcs.sh
{ fetchurl, mirror }:
{
EOF
workdir=$(pwd)
find . | sort | while read src; do
if [[ -f "${src}" ]]; then
url="${src:2}"
# Sanitize file name
filename=$(basename "$src" | tr '@' '_')
nameversion="${filename%.tar.*}"
name=$(echo "$nameversion" | sed -e 's,-[[:digit:]].*,,' | sed -e 's,-opensource-src$,,')
version=$(echo "$nameversion" | sed -e 's,^\([[:alpha:]][[:alnum:]]*-\)\+,,')
sha256=$(nix-hash --type sha256 --base32 --flat "$src")
cat >>../srcs.nix <<EOF
$name = {
version = "$version";
src = fetchurl {
url = "\${mirror}/$url";
sha256 = "$sha256";
name = "$filename";
};
};
EOF
fi
done
echo "}" >>../srcs.nix
cd ..

View File

@@ -0,0 +1,3 @@
WGET_ARGS=( http://download.qt.io/official_releases/qt/5.6/5.6.1-1/submodules/ \
http://download.qt.io/community_releases/5.6/5.6.1/ \
-A '*.tar.xz' )

View File

@@ -0,0 +1,2 @@
WGET_ARGS=( http://download.qt.io/official_releases/qt/5.7/5.7.0/submodules/ \
-A '*.tar.xz' )