summaryrefslogtreecommitdiff
path: root/pcr-testing/scratch-pkg/PKGBUILD
blob: 9b450fe9fba8b82d70e19dc96eb5c19d4ed2b993 (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
# Maintainer: Your Name <your-email@example.net>


# NOTE: This PKGBUILD is for experiments and for testing libretools.
#       Packages built with this PKGBUILD are not intended for distribution.
#       Only the -nonfree source-ball is published, containing two files:
#         $pkgname-$pkgver/non-free $pkgname-$pkgver/buggy


# configuration
_MKSOURCE=true        # excersize the mksource mechanism
_N_MKSOURCES=2        # number of upstream sources to be isolated for mksource
_SIGN=false           # require signature (yours) for libre source-ball
_WANTS_INTERNET=false # build fails if this expectation is not met
_REPO_URL=https://repo.parabola.nu/other


pkgbase=scratch-pkg
pkgname=(scratch-pkg{,-split1,-split2})
pkgver=42
pkgrel=420.3

pkgdesc="PKGBUILD for testing libretools"
arch=(any)
url=
license=(GPL)

depends=()
makedepends=()

source=(${_REPO_URL}/${pkgname}/${pkgname}-${pkgver}-nonfree.tar.gz{,.sig}
        upstream.patch)

sha256sums=(c4a3d2c7dfece8ff1e5f982f7d79d74960271476f6401c7ae5e8adac58bad957
            SKIP
            82126a2be0589ab9b313186d954d5d90183f7b083d986b16d5d7c3587826c7c1)
validpgpkeys=()

# parabola mksource over-rides
if   $_MKSOURCE
then mksource=(       ${source[*]:0:${_N_MKSOURCES}}     )
     mksha256sums=(   ${sha256sums[*]:0:${_N_MKSOURCES}} )
     mkvalidpgpkeys=( ${validpgpkeys[*]}                 )
     source=(${_REPO_URL}/${pkgname}/${pkgname}-${pkgver}-parabola.tar.gz
             ${source[*]:${_N_MKSOURCES}})
     sha256sums=(SKIP # the libre source-ball does not exist, intentionally
                 ${sha256sums[*]:${_N_MKSOURCES}})
     if   $_SIGN
     then source+=(${_REPO_URL}/${pkgname}-libre/${pkgname}-${pkgver}-parabola.tar.gz.sig)
          sha256sums+=(SKIP) # the libre source-ball signature (yours)
          validpgpkeys=( 'YOUR GPG KEY' )
     fi
fi


mksource()
{
  cd $pkgname-$pkgver

  rm non-free
}

prepare()
{
  cd $pkgname-$pkgver

  # technical patching
  patch < "$srcdir"/upstream.patch

  # network check
  local net_check_url=https://repo.parabola.nu/check_network_status.txt
  local online_msg="ERROR: the build chroot has internet access"
  local offline_msg="ERROR: the build chroot does not have internet access"
  local wants_internet=$($_WANTS_INTERNET                 ; echo $(( ! $? )) ;)
  local has_internet=$(curl ${net_check_url} &> /dev/null ; echo $(( ! $? )) ;)
  if   (( wants_internet != has_internet ))
  then $_WANTS_INTERNET && echo "${offline_msg}" || echo "${online_msg}"
       return 1
  fi
}

build()
{
  cd $pkgname-$pkgver
}

check()
{
  cd $pkgname-$pkgver

  local wants_clean=$($_MKSOURCE       ; echo $(( ! $? )) ;)
  local is_clean=$([[ ! -e non-free ]] ; echo $(( ! $? )) ;)
  (( wants_clean == is_clean ))

  grep -q '^buggy - patched$' buggy
}

package_scratch-pkg()
{
  cd $pkgname-$pkgver

  install=${pkgname}.install

  cp buggy "$pkgdir"/
}
package_scratch-pkg-split1() { echo "package_scratch-pkg-split1()" ; }
package_scratch-pkg-split2() { echo "package_scratch-pkg-split2()" ; }