Skip to content

Instantly share code, notes, and snippets.

@nuclearsandwich
Created September 13, 2018 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuclearsandwich/3d64b29edd5c9918262cb57886bc69f7 to your computer and use it in GitHub Desktop.
Save nuclearsandwich/3d64b29edd5c9918262cb57886bc69f7 to your computer and use it in GitHub Desktop.
Read in an apt .changes file with a compound Distribution: stanza and create copies for each distribution.
expand_changes_files() {
# This function works around https://github.com/aptly-dev/aptly/issues/757
# by expanding each changes file into one changes file per Distribution.
repo=$1
incoming="$HOME/${repo}/incoming"
for changes_file in $(ls $incoming/*.changes); do
changes_basename=$(basename $changes_file)
distributions="$(grep '^Distribution: ' $changes_file | cut -d':' -f2-)"
for dist in $distributions; do
dist_changes_file=$incoming/${dist}_${changes_basename}
sed -e "s/^Distribution: .*$/Distribution: $dist/" $changes_file > $dist_changes_file
done
rm $changes_file
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment