3 # shellcheck disable=SC2029
12 USAGE
="Usage: $(basename "$0") SRC DST"
14 [ $# -eq 2 ] || error
"$USAGE"
22 [ -n "$suite" ] ||
return 1
23 ssh reprepro@incoming.deb.tails.boum.org reprepro list
"$suite" \
24 |
sed -r 's,^([^|]+\|){2},,' \
25 |
sort --stable --key=1,1 --key=2,2
28 ### Save the list of packages currently present in the APT suite we
29 ### want to merge into
31 packages_in_suite
"$DST" > "$WORKDIR/$DST.orig.list"
33 ### Make sure we are not going to overwrite newer packages with older
36 echo "I: Diff between the $SRC and $DST custom APT suites:"
38 ssh reprepro@incoming.deb.tails.boum.org \
39 tails-diff-suites
"$SRC" "$DST"
41 echo "Check if the above diff makes sense!" \
42 "For instance, if any package in ${DST} has a higher version you" \
43 "should investigate if you want to proceed with the merge or " \
44 "if you need a more careful approach cherry-picking specific " \
45 "packages from ${SRC}"
47 echo -n "Proceed with the merge? (y/n) "
49 [ "$answer" = 'y' ] ||
exit 1
51 echo "I: merging the $SRC Git branch into $DST"
52 echo "I: If you have to resolve a merge conflict in debian/changelog,"
53 echo "I: ensure only the latest UNRELEASED entry is present,"
54 echo "and remove older versions that were never released."
56 git merge
"origin/$DST"
59 echo "I: merging the $SRC APT suite into $DST"
60 ssh reprepro@incoming.deb.tails.boum.org \
61 tails-merge-suite
"$SRC" "$DST"
63 echo "I: Restoring config/base_branch on $DST if needed"
64 echo "${DST}" > config
/base_branch
65 git commit config
/base_branch
-m "Restore ${DST}'s base branch." ||
:
67 echo "I: Pushing the $DST Git branch"
68 git push origin
"${DST}:${DST}"
70 packages_in_suite
"$DST" > "$WORKDIR/$DST.new.list"
72 echo "I: Diff between the $DST APT suite before and after merging:"
74 diff -Naur "$WORKDIR/$DST.orig.list" "$WORKDIR/$DST.new.list"
79 # diff did its job just fine
84 error
"diff(1) failed."
87 # undocumented diff exit code
88 error
"diff(1) returned $? -- I don't know what it means."
91 echo "Verify that the merge did not re-add to $DST any package that was"
92 echo "removed from it on purpose earlier."
93 echo "If there are any, remove them manually."