aboutsummaryrefslogtreecommitdiff
path: root/Functions/Arch
blob: f4c50d543bb0072d1335ac76f739b00724533fa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash (source)

# ThirdPartyInstallers Arch backend

function get_pkginfo_field() {
    local file="$1"
    local field="$2"
    tar --to-stdout -xf "$file" .PKGINFO | grep '^'"$field"'' | awk -F' = ' '{print $2}' | sed -e 's/\([^><]\)=.*/\1/g'
}

function thirdparty_backend() {
    echo "Arch"
}

function thirdparty_arch() {
    local file="$1"
    local arch=$(get_pkginfo_field "$file" arch)
    if [ "$arch" = "all" ]
    then echo "noarch"
    else echo "$arch"
    fi
}

function thirdparty_distribution() {
    # This isn't given by .PKGINFO. Closest we get is the packager field
    echo "Unknown"
}

function thirdparty_distribution_name() {
    # This isn't given by .PKGINFO
    echo "Unknown"
}

function thirdparty_distribution_code() {
    # This isn't given by .PKGINFO
    echo "Unknown"
}

function thirdparty_dependencies() {
    local file="$1"
    local deps=$(get_pkginfo_field "$file" depend)

    # The Depends fields contains a comma-separated list of dependencies. The range with the required
    # versions, when available, is output between parenthesis. To make the Dependencies output match the
    # format used by GoboLinux, we use a newline separator and remove all parenthesis characters found.

    echo "$deps" | sed 's/, /\n/g' | tr -d "()"
}

function thirdparty_description() {
    local file="$1"
    get_pkginfo_field "$file" pkgdesc
}

function thirdparty_filenames() {
    local file="$1"
    local contents=$(tar -tf "$file" | grep -Ev '^(\.MTREE|\.BUILDINFO|\.PKGINFO)' 2>/dev/null)

    echo "$contents"
}

function thirdparty_license() {
    local file="$1"
    get_pkginfo_field "$file" license
}

function thirdparty_name() {
    local file="$1"
    get_pkginfo_field "$file" pkgname
}

function thirdparty_version() {
    local file="$1"
    local version=$(get_pkginfo_field "$file" pkgver)
    # The format is: [epoch:]upstream_version[-arch_revision]
    # We want to output the [epoch:]upstream_version part
    echo "$version" | cut -d: -f1-2 | rev | cut -d- -f2- | rev
}

function thirdparty_release() {
    local file="$1"
    local version=$(get_pkginfo_field "$file" pkgver)
    # The format is: [epoch:]upstream_version[-arch_revision]
    # We want to output the [-debian_revision] part
    # Let's make the absence of a arch_revision is equivalent to a arch_revision of 0.
    if echo "$version" | grep -q -- "-"
    then echo "$version" | rev | cut -d- -f1 | rev
    else echo "0"
    fi
}

function thirdparty_summary() {
    local file="$1"
    get_pkginfo_field "$file" pkgdesc
}

function thirdparty_url() {
    local file="$1"
    get_pkginfo_field "$file" url
}

function thirdparty_search_remotedb() {
    local path="$1"
    local arch="$2"
    local distro="$3"
    false
}

function thirdparty_uncompress() {
    local file="$1"
    Log_Normal "Extracting Arch payload from $file."
    tar -x --exclude={.MTREE,.BUILDINFO,.PKGINFO} -f "$file" 2>/dev/null
}