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
No known key found for this signature in database
GPG key ID: 22CBF5249D4B4D59
13 changed files with 25 additions and 96 deletions

View file

@ -1,9 +1,18 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils findutils gnused nix wget
SRCS=
if [ -d "$1" ]; then
SRCS="$(pwd)/$1/srcs.nix"
. "$1/fetch.sh"
else
SRCS="$(pwd)/$(dirname $1)/srcs.nix"
. "$1"
fi
tmp=$(mktemp -d)
pushd $tmp >/dev/null
wget -nH -r -c --no-parent "$@" >/dev/null
wget -nH -r -c --no-parent "${WGET_ARGS[@]}" >/dev/null
csv=$(mktemp)
find . -type f | while read src; do
@ -15,8 +24,8 @@ find . -type f | while read src; do
echo "$name,$version,$src,$filename" >>$csv
done
cat <<EOF
# DO NOT EDIT! This file is generated automatically by fetchsrcs.sh
cat >"$SRCS" <<EOF
# DO NOT EDIT! This file is generated automatically by fetch-kde-qt.sh
{ fetchurl, mirror }:
{
@ -29,7 +38,7 @@ gawk -F , "{ print \$1 }" $csv | sort | uniq | while read name; do
filename=$(gawk -F , "/^$name,$latestVersion,/ { print \$4 }" $csv)
url="${src:2}"
sha256=$(nix-hash --type sha256 --base32 --flat "$src")
cat <<EOF
cat >>"$SRCS" <<EOF
$name = {
version = "$latestVersion";
src = fetchurl {
@ -41,7 +50,7 @@ gawk -F , "{ print \$1 }" $csv | sort | uniq | while read name; do
EOF
done
echo "}"
echo "}" >>"$SRCS"
popd >/dev/null
rm -fr $tmp >/dev/null

View file

@ -1,5 +0,0 @@
#!/bin/sh
./maintainers/scripts/fetch-kde-qt.sh \
http://download.kde.org/stable/applications/16.08.0/ -A '*.tar.xz' \
>pkgs/desktops/kde-5/applications/srcs.nix

View file

@ -1,5 +0,0 @@
#!/bin/sh
./maintainers/scripts/fetch-kde-qt.sh \
http://download.kde.org/stable/frameworks/5.24/ -A '*.tar.xz' \
>pkgs/desktops/kde-5/frameworks/srcs.nix

View file

@ -1,5 +0,0 @@
#!/bin/sh
./maintainers/scripts/fetch-kde-qt.sh \
http://download.kde.org/stable/plasma/5.7.3/ -A '*.tar.xz' \
>pkgs/desktops/kde-5/plasma/srcs.nix

View file

@ -1,6 +0,0 @@
#!/bin/sh
./maintainers/scripts/fetch-kde-qt.sh \
http://download.qt.io/official_releases/qt/5.7/5.7.0/submodules/ \
-A '*.tar.xz' \
>pkgs/development/libraries/qt-5/5.7/srcs.nix

View file

@ -0,0 +1 @@
WGET_ARGS=( http://download.kde.org/stable/applications/16.08.0/ -A '*.tar.xz' )

View file

@ -0,0 +1 @@
WGET_ARGS=( http://download.kde.org/stable/plasma/5.7.4/ -A '*.tar.xz' )

View file

@ -1,16 +0,0 @@
{ plasmaPackage, ecm, baloo, kactivities, kconfig
, kcoreaddons, kdeclarative, kguiaddons, ki18n, kio, kservice
, kfilemetadata, plasma-framework, qtdeclarative, qtmultimedia
, taglib
}:
plasmaPackage rec {
name = "plasma-mediacenter";
nativeBuildInputs = [
ecm
];
propagatedBuildInputs = [
baloo kactivities kdeclarative kfilemetadata ki18n kio plasma-framework
kconfig kcoreaddons kguiaddons kservice qtdeclarative qtmultimedia taglib
];
}

View file

@ -0,0 +1 @@
WGET_ARGS=( http://download.kde.org/stable/frameworks/5.24/ -A '*.tar.xz' )

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' )