Skip to content

Commit

Permalink
gen-upgrade-sets: Add a --suffix option
Browse files Browse the repository at this point in the history
This allows adding a user defined string on the end of the generated
set names if they find it useful.

changelog: Add a --suffix option to gen-upgrade-sets
  • Loading branch information
kentfredric committed Jun 5, 2017
1 parent ac66c20 commit f6902f8
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
0.2.2 2017-02-11/13
0.2.2 2017-06-05/14
- Add a --suffix option to gen-upgrade-sets

0.2.1 2017-02-09/14
- omit blacklisted packages and other cleaned packages from upgrade set
Expand Down
30 changes: 22 additions & 8 deletions libexec/gen-upgrade-sets
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@

source "${LIBDIR}/core-functions.sh" || exit 1;

set_suffix=""

while [[ $# -gt 0 ]]; do
case "$1" in
"--quiet")
export GENTOO_PERL_HELPERS_QUIETNESS=10
shift
;;
"--suffix")
shift;
set_suffix="$1";
shift;
;;
"--suffix="*)
set_suffix="${1##--suffix=}"
shift;
;;
*)
[[ -z "${1}" || "${1:0:1}" == "-" ]] && die "Unknown argument ${1}"
if [[ -z "${subslot}" ]]; then
Expand All @@ -30,8 +41,8 @@ done
set -euo pipefail

sets="${ETC_PORTAGE_SETS:-${ETC_PORTAGE:-/etc/portage}/sets}"
cleanup="${sets}/perl-cleanup"
upgrade="${sets}/perl-upgrade"
cleanup="${sets}/perl-cleanup${set_suffix}"
upgrade="${sets}/perl-upgrade${set_suffix}"
perl_target="$(dorun print-matching-abi "${destsubslot}")"

mkdir -p "${sets}" || die "Cannot ensure ${sets} directory exists"
Expand All @@ -55,19 +66,19 @@ einfo "Generating ${upgrade}"

einfo "... Done ${upgrade}"

einfo "Created set @perl-cleanup in ${cleanup}"
einfo "Created set @perl-upgrade in ${upgrade}"
einfo "Created set @perl-cleanup${set_suffix} in ${cleanup}"
einfo "Created set @perl-upgrade${set_suffix} in ${upgrade}"
einfo
einfo "Assuming both of those were in /etc/portage/sets you can now do"
einfo " emerge -va1 -k n @perl-upgrade"
einfo " emerge -va1 -k n @perl-upgrade${set_suffix}"
einfo "And if this exhibits confusing blockers that only refer to perl-core"
einfo " emerge -C -va @perl-cleanup"
einfo " emerge -C -va @perl-cleanup${set_suffix}"
einfo "Should help pave the way forward"
einfo
einfo "If portage crashes mid-way through an upgrade, after any relevant issues"
einfo "Re-run this tool to regenerate the sets before proceeding"

# help: gen-upgrade-sets --opts [previous perl version] [wanted perl version]
# help: gen-upgrade-sets <--opts> [previous perl version] [wanted perl version]
# help:
# help: example:
# help: gen-upgrade-sets 5.22 5.24
Expand All @@ -84,7 +95,10 @@ einfo "Re-run this tool to regenerate the sets before proceeding"
# help: sets with fewer upgrades to install, which is probably what you want.
# help:
# help: OPTIONS:
# help: --quiet - Suppresses all info/warnings except for fatal ones.
# help: --quiet - Suppresses all info/warnings except for fatal ones.
# help:
# help: --suffix=[name] - Append a user specified suffix string onto generated set
# help: --suffix [name] names.
# help:
# help: ENVIRONMENT
# help: By default, this tool writes to /etc/portage/sets, and the following variables
Expand Down
10 changes: 10 additions & 0 deletions t/cmd/gen-upgrade-sets.t.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ echo "==== [ bin/gentoo-perl gen-upgrade-sets --quiet 5.18 5.20 ] ===="
ETC_PORTAGE="${tempdir}/5.20-quiet" bash bin/gentoo-perl gen-upgrade-sets --quiet 5.18 5.20
echo

echo "==== [ bin/gentoo-perl gen-upgrade-sets --suffix -v5.20 5.18 5.20 ] ===="
ETC_PORTAGE="${tempdir}/5.20-suffix" bash bin/gentoo-perl gen-upgrade-sets --suffix "-v5.20" 5.18 5.20
ls "${tempdir}/5.20-suffix/sets"
echo

echo "==== [ bin/gentoo-perl gen-upgrade-sets --suffix=-v5.20 5.18 5.20 ] ===="
ETC_PORTAGE="${tempdir}/5.20-suffix=" bash bin/gentoo-perl gen-upgrade-sets --suffix="-v5.20" 5.18 5.20
ls "${tempdir}/5.20-suffix=/sets"
echo

echo "==== [ bin/gentoo-perl gen-upgrade-sets 5.20 5.21 ] ===="
ETC_PORTAGE="${tempdir}/5.21" bash bin/gentoo-perl gen-upgrade-sets 5.20 5.21 && die "FAIL: Expected INVALID ABI Fails"
echo
146 changes: 146 additions & 0 deletions t/runtest-volatile.expected
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,152 @@ x11-terms/rxvt-unicode:0
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository

==== [ bin/gentoo-perl gen-upgrade-sets --suffix -v5.20 5.18 5.20 ] ====
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Generating TEMPDIR/5.20-suffix/sets/perl-cleanup-v5.20
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-CGI
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-Module-Build
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-Module-Pluggable
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-Version-Requirements
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-Class-ISA
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-Filter
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-Switch
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-net-ping
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-locale-maketext
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-i18n-langtags
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-digest-base
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-PodParser
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] ... Done TEMPDIR/5.20-suffix/sets/perl-cleanup-v5.20
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Generating TEMPDIR/5.20-suffix/sets/perl-upgrade-v5.20
 * [...perl-subslot-rebuild > installed-deps-atom] revdep DEPEND scanning for dev-lang/perl:0/5.26=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in DEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep RDEPEND scanning for dev-lang/perl:0/5.26=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in RDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep PDEPEND scanning for dev-lang/perl:0/5.26=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in PDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep DEPEND scanning for dev-lang/perl:0/5.24=
 * [...perl-subslot-rebuild > installed-deps-atom] revdep RDEPEND scanning for dev-lang/perl:0/5.24=
 * [...perl-subslot-rebuild > installed-deps-atom] revdep PDEPEND scanning for dev-lang/perl:0/5.24=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in PDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep DEPEND scanning for dev-lang/perl:0/5.22=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in DEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep RDEPEND scanning for dev-lang/perl:0/5.22=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in RDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep PDEPEND scanning for dev-lang/perl:0/5.22=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in PDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep DEPEND scanning for dev-lang/perl:0/5.18=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in DEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep RDEPEND scanning for dev-lang/perl:0/5.18=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in RDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep PDEPEND scanning for dev-lang/perl:0/5.18=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in PDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep DEPEND scanning for dev-lang/perl:0/5.16=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in DEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep RDEPEND scanning for dev-lang/perl:0/5.16=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in RDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep PDEPEND scanning for dev-lang/perl:0/5.16=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in PDEPEND
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] ... Done TEMPDIR/5.20-suffix/sets/perl-upgrade-v5.20
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Created set @perl-cleanup-v5.20 in TEMPDIR/5.20-suffix/sets/perl-cleanup-v5.20
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Created set @perl-upgrade-v5.20 in TEMPDIR/5.20-suffix/sets/perl-upgrade-v5.20
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] 
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Assuming both of those were in /etc/portage/sets you can now do
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets]  emerge -va1 -k n @perl-upgrade-v5.20
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] And if this exhibits confusing blockers that only refer to perl-core
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets]  emerge -C -va @perl-cleanup-v5.20
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Should help pave the way forward
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] 
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] If portage crashes mid-way through an upgrade, after any relevant issues
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Re-run this tool to regenerate the sets before proceeding
perl-cleanup-v5.20
perl-upgrade-v5.20

==== [ bin/gentoo-perl gen-upgrade-sets --suffix=-v5.20 5.18 5.20 ] ====
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Generating TEMPDIR/5.20-suffix=/sets/perl-cleanup-v5.20
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-CGI
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-Module-Build
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-Module-Pluggable
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-Version-Requirements
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-Class-ISA
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-Filter
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-Switch
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-net-ping
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-locale-maketext
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-i18n-langtags
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-digest-base
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [...de-sets > installed-match-atom-blacklisted] Looking for cleanups for virtual/perl-PodParser
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] ... Done TEMPDIR/5.20-suffix=/sets/perl-cleanup-v5.20
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Generating TEMPDIR/5.20-suffix=/sets/perl-upgrade-v5.20
 * [...perl-subslot-rebuild > installed-deps-atom] revdep DEPEND scanning for dev-lang/perl:0/5.26=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in DEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep RDEPEND scanning for dev-lang/perl:0/5.26=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in RDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep PDEPEND scanning for dev-lang/perl:0/5.26=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in PDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep DEPEND scanning for dev-lang/perl:0/5.24=
 * [...perl-subslot-rebuild > installed-deps-atom] revdep RDEPEND scanning for dev-lang/perl:0/5.24=
 * [...perl-subslot-rebuild > installed-deps-atom] revdep PDEPEND scanning for dev-lang/perl:0/5.24=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in PDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep DEPEND scanning for dev-lang/perl:0/5.22=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in DEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep RDEPEND scanning for dev-lang/perl:0/5.22=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in RDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep PDEPEND scanning for dev-lang/perl:0/5.22=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in PDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep DEPEND scanning for dev-lang/perl:0/5.18=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in DEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep RDEPEND scanning for dev-lang/perl:0/5.18=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in RDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep PDEPEND scanning for dev-lang/perl:0/5.18=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in PDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep DEPEND scanning for dev-lang/perl:0/5.16=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in DEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep RDEPEND scanning for dev-lang/perl:0/5.16=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in RDEPEND
 * [...perl-subslot-rebuild > installed-deps-atom] revdep PDEPEND scanning for dev-lang/perl:0/5.16=
 * [...perl-subslot-rebuild > installed-deps-atom] No matches in PDEPEND
!!! Section 'perl-experimental-snapshots' in repos.conf has name different from repository name 'perl-experimental' set inside repository
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] ... Done TEMPDIR/5.20-suffix=/sets/perl-upgrade-v5.20
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Created set @perl-cleanup-v5.20 in TEMPDIR/5.20-suffix=/sets/perl-cleanup-v5.20
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Created set @perl-upgrade-v5.20 in TEMPDIR/5.20-suffix=/sets/perl-upgrade-v5.20
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] 
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Assuming both of those were in /etc/portage/sets you can now do
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets]  emerge -va1 -k n @perl-upgrade-v5.20
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] And if this exhibits confusing blockers that only refer to perl-core
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets]  emerge -C -va @perl-cleanup-v5.20
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Should help pave the way forward
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] 
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] If portage crashes mid-way through an upgrade, after any relevant issues
 * [gen-upgrade-sets.t.sh > gen-upgrade-sets] Re-run this tool to regenerate the sets before proceeding
perl-cleanup-v5.20
perl-upgrade-v5.20

==== [ bin/gentoo-perl gen-upgrade-sets 5.20 5.21 ] ====
 * [...sh > gen-upgrade-sets > print-matching-abi] No ABI matched "5.21".

Expand Down

0 comments on commit f6902f8

Please sign in to comment.