File: packagecloud.sh

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (50 lines) | stat: -rwxr-xr-x 1,659 bytes parent folder | download
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
#!/bin/sh
# Based on an (one file at a time) upload script here:
#https://github.com/danielmundi/upload-packagecloud/blob/main/push.sh

echo "Install dependencies"
sudo gem install package_cloud

user=performancecopilot
repo=pcp
here=`pwd`

# Iterate each of the builds
for build in artifacts/build-*
do
    [ $build = "artifacts/build-*" ] && continue

    # some examples...
    #	artifacts/build-fedora31-container
    #	artifacts/build-centos-stream9-container
    #	artifacts/build-debian11-container
    #	artifacts/build-ubuntu2204-container

    dist=`echo $build | sed -e 's/^.*build-//' -e 's/-container.*$//' | awk '
BEGIN {
    # map to any code names packagecloud expects
    dist["debian10"] = "debian/buster";
    dist["debian11"] = "debian/bullseye";
    dist["debian12"] = "debian/bookworm";
    dist["debian13"] = "debian/trixie";
    dist["debian14"] = "debian/forky";
    dist["ubuntu1804"] = "ubuntu/bionic";
    dist["ubuntu2004"] = "ubuntu/focal";
    dist["ubuntu2204"] = "ubuntu/jammy";
    dist["ubuntu2404"] = "ubuntu/noble";
}
$1 ~ /^debian/ || /^ubuntu/ { print dist[$1] }
$1 ~ /^fedora/ { match($1, /fedora([1-9][0-9]*$)/, m); printf "fedora/%s\n", m[1] }
$1 ~ /^centos/ { match($1, /cent.*([1-9][0-9]*$)/, m); printf "el/%s\n", m[1] }
$1 ~ /^amazonlinux/ { match($1, /amazonlinux([1-9][0-9]*).*$/, m); printf "amazon/%s\n", m[1] }
'`
    [ -z "$dist" ] && continue

    echo "Upload $dist packages"
    cd $here/$build
    for file in `find . -name \*.rpm -o -name \*.deb | grep -Ev 'debug|tests|\.src\.'`
    do
	echo package_cloud push $user/$repo/$dist/pcp $file
	package_cloud push $user/$repo/$dist/pcp $file
    done
done