diff options
author | Jason Zaman <perfinion@gentoo.org> | 2021-01-10 12:19:19 -0800 |
---|---|---|
committer | Jason Zaman <perfinion@gentoo.org> | 2021-01-10 12:19:19 -0800 |
commit | 3d94919dde6b42b619289f49b05b1e5a00ee9a54 (patch) | |
tree | 507111de99088f05bcde59a11fbfeee3b86d711f /gentoo/release-userspace.sh | |
parent | Update gentoo release-prepare script (diff) | |
download | hardened-refpolicy-3d94919dde6b42b619289f49b05b1e5a00ee9a54.tar.gz hardened-refpolicy-3d94919dde6b42b619289f49b05b1e5a00ee9a54.tar.bz2 hardened-refpolicy-3d94919dde6b42b619289f49b05b1e5a00ee9a54.zip |
gentoo: Update release scripts
Signed-off-by: Jason Zaman <perfinion@gentoo.org>
Diffstat (limited to 'gentoo/release-userspace.sh')
-rw-r--r-- | gentoo/release-userspace.sh | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/gentoo/release-userspace.sh b/gentoo/release-userspace.sh index f94732607..f1db4d38a 100644 --- a/gentoo/release-userspace.sh +++ b/gentoo/release-userspace.sh @@ -1,11 +1,11 @@ #!/bin/sh # Copyright 2013,2014 Sven Vermeulen <swift@gentoo.org> -# Copyright 2017-2018 Jason Zaman <perfinion@gentoo.org> +# Copyright 2017-2021 Jason Zaman <perfinion@gentoo.org> # Licensed under the GPL-3 license -RELEASEDATE="${1}"; -NEWVERSION="${2}"; +RELEASEDATE="${1}" +NEWVERSION="${2}" PACKAGES=" sys-libs/libsepol @@ -23,34 +23,34 @@ sys-apps/restorecond # dev-python/sepolgen became selinux-python in 2.7 release usage() { - echo "Usage: $0 <release date> <newversion>"; - echo ""; + echo "Usage: $0 <release date> <newversion>" + echo "" echo "Example: $0 20170101 2.7_rc1" - echo ""; - echo "The script will update the live ebuilds then copy towards the"; + echo "" + echo "The script will update the live ebuilds then copy towards the" echo "<newversion>." - echo ""; - echo "The following environment variables must be declared correctly for the script"; - echo "to function properly:"; - echo " - GENTOOX86 should point to the gentoo-x86 checkout"; - echo " E.g. export GENTOOX86=\"/usr/portage/\""; + echo "" + echo "The following environment variables must be declared correctly for the script" + echo "to function properly:" + echo " - GENTOOX86 should point to the gentoo-x86 checkout" + echo " E.g. export GENTOOX86=\"/usr/portage\"" } assertDirEnvVar() { - VARNAME="${1}"; - eval VARVALUE='$'${VARNAME}; - if [ -z "${VARVALUE}" ] || [ ! -d "${VARVALUE}" ]; + VARNAME="${1}" + eval VARVALUE='$'${VARNAME} + if [ -z "${VARVALUE}" ] || [ ! -d "${VARVALUE}" ] then - echo "Variable ${VARNAME} (value \"${VARVALUE}\") does not point to a valid directory."; - exit 1; + echo "Variable ${VARNAME} (value \"${VARVALUE}\") does not point to a valid directory." + exit 1 fi } die() { - printf "\n"; - echo "!!! Error: $*"; - exit 2; -}; + printf "\n" + echo "!!! Error: $*" + exit 2 +} # set the release date in the live ebuilds so it will be correct when copying to the new version setLiveReleaseDate() { @@ -59,18 +59,18 @@ setLiveReleaseDate() { cd ${GENTOOX86} echo "Setting release date var in live ebuilds... " - for PKG in $PACKAGES; + for PKG in $PACKAGES do cd "${GENTOOX86}/${PKG}" PN="${PKG#*/}" - [[ -f "${PN}-9999.ebuild" ]] || continue; + [[ -f "${PN}-9999.ebuild" ]] || continue # make sure the tree is clean so we dont commit anything else by mistake [[ -z "$(git status --porcelain -- .)" ]] || die git diff --cached --exit-code >/dev/null 2>&1 || die "Uncommitted changes" # update header and release date - sed -i "s@Copyright 1999-201. Gentoo .*@Copyright 1999-$(date '+%Y') Gentoo Authors@" "${PN}-9999.ebuild" + sed -i "s@Copyright 1999-20.. Gentoo .*@Copyright 1999-$(date '+%Y') Gentoo Authors@" "${PN}-9999.ebuild" sed -i "/^MY_RELEASEDATE=/s/.*/MY_RELEASEDATE=\"${RELEASEDATE}\"/" "${PN}-9999.ebuild" sed -i "/SRC_URI/s@raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases@github.com/SELinuxProject/selinux/releases/download@" "${PN}-9999.ebuild" @@ -81,7 +81,8 @@ setLiveReleaseDate() { git add "${PN}-9999.ebuild" git --no-pager diff --cached repoman -q full - if [[ $? -eq 0 ]]; then + if [[ $? -eq 0 ]] + then repoman -q commit -m "$PKG: update live ebuild" else git reset -- . @@ -94,48 +95,49 @@ setLiveReleaseDate() { createEbuilds() { local PKG local PN - cd ${GENTOOX86} + cd ${GENTOOX86} || die echo "Creating new ebuilds based on 9999 version... " - for PKG in $PACKAGES; + for PKG in $PACKAGES do - cd "${GENTOOX86}/${PKG}" + cd "${GENTOOX86}/${PKG}" || die PN="${PKG#*/}" [[ -f "${PN}-9999.ebuild" ]] || continue [[ -f "Manifest" ]] || continue # make sure the tree is clean so we dont commit anything else by mistake - [[ -z "$(git status --porcelain -- .)" ]] || die + [[ -z "$(git status --porcelain -- .)" ]] || die "Uncommitted changes" git diff --cached --exit-code >/dev/null 2>&1 || die "Uncommitted changes" sed -i -e "/${PN}-${NEWVERSION//_/-}/d" Manifest || die cp ${PN}-9999.ebuild ${PN}-${NEWVERSION}.ebuild || die - repoman -q manifest - git add Manifest ${PN}-${NEWVERSION}.ebuild + repoman -q manifest || die + git add Manifest ${PN}-${NEWVERSION}.ebuild || die #git --no-pager diff --cached repoman -q full - if [[ $? -eq 0 ]]; then - repoman -q commit -m "$PKG: bump to ${NEWVERSION}" + if [[ $? -eq 0 ]] + then + repoman -q commit -m "$PKG: bump to ${NEWVERSION}" || die else - git reset -- . + git reset -- . || die fi done echo -e "\ndone ${PN}\n" } -if [ $# -ne 2 ]; +if [ $# -ne 2 ] then - usage; - exit 3; + usage + exit 3 fi # Assert that all needed information is available -assertDirEnvVar GENTOOX86; +assertDirEnvVar GENTOOX86 setLiveReleaseDate # Create ebuilds -createEbuilds; +createEbuilds |