Skip to content
Snippets Groups Projects
Commit c009fca0 authored by intrigeri's avatar intrigeri
Browse files

Move tails-diff-suites functions to its functions.sh library.

parent 435a2668
Branches
No related tags found
No related merge requests found
...@@ -8,3 +8,31 @@ ref_name_to_suite() { ...@@ -8,3 +8,31 @@ ref_name_to_suite() {
echo "$ref" | sed -e 's,[^a-z0-9.-],-,ig' | tr '[A-Z]' '[a-z]' 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"
}
...@@ -29,38 +29,6 @@ TAG_RE='^[0-9][0-9.]*(?:-(?:alpha|beta|rc)\d*)?$' ...@@ -29,38 +29,6 @@ TAG_RE='^[0-9][0-9.]*(?:-(?:alpha|beta|rc)\d*)?$'
. /usr/local/share/tails-reprepro/functions.sh . /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() { packages_in_suite() {
local suite="$1" local suite="$1"
[ -n "$suite" ] || return 1 [ -n "$suite" ] || return 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment