nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 20.03 116 lines 4.4 kB view raw
1<?xml version="1.0"?> 2 3<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 4 xmlns:common="http://schemas.android.com/repository/android/common/01" 5 xmlns:generic="http://schemas.android.com/repository/android/generic/01" 6 xmlns:sdk="http://schemas.android.com/sdk/android/repo/repository2/01" 7 xmlns:sdk-common="http://schemas.android.com/sdk/android/repo/common/01" 8 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 9 10 <xsl:output omit-xml-declaration="yes" indent="no" /> 11 12 <!-- Template that puts a google HTTP prefix in front of relative URLs --> 13 <xsl:template name="repository-url"> 14 <xsl:variable name="raw-url" select="complete/url"/> 15 <xsl:choose> 16 <xsl:when test="starts-with($raw-url, 'http')"> 17 <xsl:value-of select="$raw-url"/> 18 </xsl:when> 19 <xsl:otherwise> 20 <xsl:text>https://dl.google.com/android/repository/</xsl:text> 21 <xsl:value-of select="$raw-url"/> 22 </xsl:otherwise> 23 </xsl:choose> 24 </xsl:template> 25 26 <xsl:template match="/sdk:sdk-repository"> 27{fetchurl}: 28 29{ 30 <!-- Convert all remote packages --> 31 <xsl:for-each select="remotePackage"><xsl:sort select="@path" /> 32 33 <!-- Extract the package name from the path --> 34 <xsl:variable name="name"> 35 <xsl:choose> 36 <xsl:when test="contains(@path, ';')"> 37 <xsl:value-of select="substring-before(@path, ';')" /> 38 </xsl:when> 39 <xsl:otherwise> 40 <xsl:value-of select="@path" /> 41 </xsl:otherwise> 42 </xsl:choose> 43 </xsl:variable> 44 45 <!-- Compose version string from version attributes --> 46 <xsl:variable name="revision"> 47 <xsl:choose> 48 <!-- Compose revision for a generic package from the revision attributes --> 49 <xsl:when test="type-details/@xsi:type='generic:genericDetailsType'"> 50 <xsl:choose> 51 <xsl:when test="revision/major"> 52 <xsl:value-of select="revision/major" /> 53 </xsl:when> 54 </xsl:choose> 55 <xsl:choose> 56 <xsl:when test="revision/minor">.<xsl:value-of select="revision/minor" /> 57 </xsl:when> 58 </xsl:choose> 59 <xsl:choose> 60 <xsl:when test="revision/micro">.<xsl:value-of select="revision/micro" /> 61 </xsl:when> 62 </xsl:choose> 63 <xsl:choose> 64 <xsl:when test="revision/preview">-rc<xsl:value-of select="revision/preview" /> 65 </xsl:when> 66 </xsl:choose> 67 </xsl:when> 68 <!-- Compose revision of a platform SDK from the API-level or codename if the latter exists --> 69 <xsl:when test="type-details/@xsi:type='sdk:platformDetailsType'"> 70 <xsl:choose> 71 <xsl:when test="not(type-details/codename='')"> 72 <xsl:value-of select="type-details/codename" /> 73 </xsl:when> 74 <xsl:otherwise> 75 <xsl:value-of select="type-details/api-level" /> 76 </xsl:otherwise> 77 </xsl:choose> 78 </xsl:when> 79 <!-- Compose revision of a source SDK from the API-level --> 80 <xsl:when test="type-details/@xsi:type='sdk:sourceDetailsType'"> 81 <xsl:value-of select="type-details/api-level" /> 82 </xsl:when> 83 </xsl:choose> 84 </xsl:variable> 85 86 <xsl:choose> 87 <xsl:when test="@path='emulator'"> <!-- An emulator package provides one archive per operating system but the same versions --> 88 "<xsl:value-of select="$name" />"."<xsl:value-of select="$revision" />".<xsl:value-of select="archives/archive/host-os" /> = { 89 </xsl:when> 90 <xsl:otherwise> 91 "<xsl:value-of select="$name" />"."<xsl:value-of select="$revision" />" = { 92 </xsl:otherwise> 93 </xsl:choose> 94 name = "<xsl:value-of select="$name" />"; 95 path = "<xsl:value-of select="translate(@path, ';', '/')" />"; 96 revision = "<xsl:value-of select="$revision" />"; 97 displayName = "<xsl:value-of select="display-name" />"; 98 archives = { 99 <xsl:for-each select="archives/archive[not(host-os)]"> 100 all = fetchurl { 101 url = <xsl:call-template name="repository-url"/>; 102 sha1 = "<xsl:value-of select="complete/checksum" />"; 103 }; 104 </xsl:for-each> 105 <xsl:for-each select="archives/archive[host-os and not(host-os = 'windows')]"> 106 <xsl:value-of select="host-os" /> = fetchurl { 107 url = <xsl:call-template name="repository-url"/>; 108 sha1 = "<xsl:value-of select="complete/checksum" />"; 109 }; 110 </xsl:for-each> 111 }; 112 }; 113 </xsl:for-each> 114} 115 </xsl:template> 116</xsl:stylesheet>