diff --git a/files/reprepro/functions.sh b/files/reprepro/functions.sh index fe6a13865a8ed03efede277101c8ad3e6c9cc9ed..3ec9e874a68f8966d0cb88ad7fc802b7405cf16d 100644 --- a/files/reprepro/functions.sh +++ b/files/reprepro/functions.sh @@ -8,3 +8,31 @@ ref_name_to_suite() { echo "$ref" | sed -e 's,[^a-z0-9.-],-,ig' | tr '[A-Z]' '[a-z]' } + +assert_is_branch_name() { + local branch="$1" + + if ! echo "$branch" | grep -q -E "$BRANCH_RE" ; then + error "Invalid branch name: '$branch'" + fi +} + +assert_is_apt_suite() { + local suite="$1" + + if ! echo "$suite" | grep -q -E "$APT_SUITE_RE" ; then + error "Invalid APT suite name: '$suite'" + fi +} + +assert_is_list_of_apt_suites() { + for suite in "$@" ; do + assert_is_apt_suite "$suite" + done +} + +is_tag() { + local rev="$1" + + echo "$rev" | grep -q -E "$TAG_RE" +} diff --git a/files/reprepro/tails-diff-suites b/files/reprepro/tails-diff-suites index 055d3fd0d1fa7889fe807132aa5ef0ffa9d36879..ed0bbfa4061a992761969a4153a03cb54d961256 100755 --- a/files/reprepro/tails-diff-suites +++ b/files/reprepro/tails-diff-suites @@ -29,38 +29,6 @@ TAG_RE='^[0-9][0-9.]*(?:-(?:alpha|beta|rc)\d*)?$' . /usr/local/share/tails-reprepro/functions.sh -# -------------------- XXX: move to functions.sh --------------------- - -assert_is_branch_name() { - local branch="$1" - - if ! echo "$branch" | grep -q -E "$BRANCH_RE" ; then - error "Invalid branch name: '$branch'" - fi -} - -assert_is_apt_suite() { - local suite="$1" - - if ! echo "$suite" | grep -q -E "$APT_SUITE_RE" ; then - error "Invalid APT suite name: '$suite'" - fi -} - -assert_is_list_of_apt_suites() { - for suite in "$@" ; do - assert_is_apt_suite "$suite" - done -} - -is_tag() { - local rev="$1" - - echo "$rev" | grep -q -E "$TAG_RE" -} - -# -------------------- XXX ------------------------------------------- - packages_in_suite() { local suite="$1" [ -n "$suite" ] || return 1