123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #!/bin/bash
-
- . <(ffoom init)
- FFOO_INI_PATH="__FFOO_INI_PATH__"
-
- ffoo import core
- ffoo import ini
- ffoo import yummy
-
- usage() {
- usage_is "[-d] [-f] NVRLIST" \
- "[-d] -n NVR -t DEST"
- }
-
- while true; do case $1 in
- -b|--brewroot) brewroot=$2; shift 2; ;;
- -f|--file) nvrlist=$2; shift 2; break; ;;
- -n|--nvr) nvr=$2; shift 2; ;;
- -t|--to) dest=$2; shift 2; ;;
- -d|--debug) FFOO_DEBUG=true; shift; ;;
- *) nvrlist=$1; shift; break ;;
- esac done
-
- test -n "$brewroot" || brewroot=$(iniread -p get.brewroot)
- test -n "$brewroot" || die "specify '-b /path/to/brewroot or get.brewroot in get.ini"
- test -d "$brewroot" || die "cannot access brewroot: $brewroot"
-
- get_nvr() {
- local nvr=$1
- local dest=$2
-
- local arch="$(nvc_parse arch $nvr)"
- local release="$(nvc_parse release $nvr)"
- local version="$(nvc_parse version $nvr)"
- local name="$(nvc_parse name $nvr)"
-
- debug -v nvr arch release version name dest
-
- rm -rf $dest
- mkdir -p $dest
- local pkgroot="$brewroot/packages/$name/$version/$release"
- rsync -u "$pkgroot/$arch/"* "$dest"
- test -f "$pkgroot/noarch/"* && rsync -u "$pkgroot/noarch/"* "$dest"
- $FFOO_VERBOSE && find $dest -type f
-
- }
-
- if test -n "$nvrlist"; # NVR list provided; make up DESTs and call self
- then
- dirname="rpms.$(basename $nvrlist)"
- rm -f rpms
- archs=$(iniread -k arch - < $nvrlist | paste -sd,)
- if test -z "$archs";
- then
- warn "archs not specified, using $(which arch)"
- archs=$(arch)
- fi
- for arch in $(tr "," " " <<<"$archs");
- do
- get_nvr $(iniread -k old - < $nvrlist).$arch "$dirname/old/$arch"
- get_nvr $(iniread -k new - < $nvrlist).$arch "$dirname/new/$arch"
- done
- ln -s $dirname rpms
-
- elif test -n "$nvr" -a -n "$dest"; # NVR and DEST provided -- do your job
- then
- get_nvr "$nvr" "$dest"
- else
- usage
- fi
-
- # tigervnc-1.2.80/0.23.20130314svn5065.el7$
- # |||||
- # vvvvv
- # /brewroot/packages/tigervnc/1.2.80/0.23.20130314svn5065.el7$
|