File: koji-build-scratch

package info (click to toggle)
cmake-fedora 2.9.3-0.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 788 kB
  • sloc: sh: 1,369; perl: 87; makefile: 14
file content (85 lines) | stat: -rwxr-xr-x 2,124 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
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
#!/bin/bash -eu

function print_usage(){
    cat <<END
Usage: $0 <srpm> [scope1 [scope2 ....]]
    This command does koji scratch build for given fedora and epel releases.

Parameters:
    srpm: SRPM file to be scratch-built with koji.

    scopes: releases of what to build. Multiple values are allowed.
        Valid values:
            rawhide: Build rawhide.

	    fedora: Build actives fedora releases, including Rawhide.

	    fedora_1: Build the latest supported fedora releases.
	        This is one release eariler than rawhide.

	    fedora_2: Build the second latest supported fedora releases.
	        This is two releases eariler than rawhide.

            f22 f21 ...: Build the specified fedora releases.

	    epel: Build the currently supported EPEL releases.

	    epel_1: Build the latest supported EPEL releases.

	    epel_2: Build the second latest supported EPEL releases.

	    epel7 el6 ... : The EPEL releases to be built.

        If scopes is not specified, then rawhide and active
	fedora and EPEL releases are built,
       	as if "rawhide fedora epel" are specified.
END
}
##=== Finding Library ===
ScriptFile=$(readlink -e "${BASH_SOURCE[0]}" 2>/dev/null || realpath "${BASH_SOURCE[0]}")
export ScriptDir=$(dirname $ScriptFile)
source $ScriptDir/cmake-fedora-functions

##=== Argument Parsing ===
if [ $# = 0 ]; then
    print_usage
    exit $EXIT_FATAL_INVALID_OPTIONS
fi

Srpm=$1
shift

if [[ -z $Srpm ]];then
    print_usage
    exit $EXIT_FATAL_INVALID_OPTIONS
else
    Srpm=`readlink -f $Srpm`
fi

if [[ ! -r "$Srpm" ]];then
    echo "[Fatal] Failed to read $Srpm" > /dev/stderr
    exit $EXIT_FATAL_INVALID_OPTIONS
fi

##=== Dependency Checking ===
cmfd_set_dependencies_programs curl fedpkg

TargetArray=($($ScriptDir/cmake-fedora-koji target "$@" | xargs) )

echo -n "Targets to process:"
(IFS=' ' echo "${TargetArray[@]}")

Failed=

for t in "${TargetArray[@]}";do
    if ! koji build --scratch $t $Srpm; then
	    Failed+=" $t"
    fi
done

if [ -n "$Failed" ]; then
    echo "Failed targets:$Failed" > /dev/stderr
    exit $EXIT_ERROR_FAIL
fi
exit $EXIT_OK
# vim: set ts=4 sw=4 et