summaryrefslogtreecommitdiffstats
path: root/checkout-all-packages.sh
blob: 3bc4b685e8ed2b7ead10a8b1a82202540b194ff0 (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
#!/bin/bash

# checks out nspr, nss-util, nss-softokn, nss, and client pacakges
# creates their srpms and copies them where build-nss.py expects them
# Usage: prepare-all-srpms [-b branch], defaults to master
#
# TODO: Pass the package names as arguments

checkout_pkgs() {
  if [ -n "$2" ] ; then
    OPT_BRANCH="--branch $2"
  else
    OPT_BRANCH=""
  fi
  for p in $1; do
    fedpkg clone $p ${OPT_BRANCH} -a
  done
}

remove_pkgs() {
  for p in $1; do
    rm -fr $p
  done
}

#----------------------------------------------------------
nssPkgs="nspr nss-util nss-softokn nss"
clientPkgs=""

# default
branch=master
while getopts b:s: opt
do
  case $opt in
  b) export branch="$OPTARG";;
  ?) printf "Usage: %s: [-b branch]\n defaults to master"  $0
     exit 2;;
  esac
done

echo "branch = ${branch}"

remove_pkgs "${nssPkgs}"
remove_pkgs "${clientPkgs}"
checkout_pkgs "${nssPkgs}" "${branch}"
checkout_pkgs "${clientPkgs}" "${branch}"