Gentoo Archives: gentoo-commits

From: Jason Zaman <perfinion@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-refpolicy:next commit in: gentoo/
Date: Sun, 10 Sep 2017 14:04:09
Message-Id: 1505051610.2f8d83089694fbacd3e546db5bdf599e8721dd88.perfinion@gentoo
1 commit: 2f8d83089694fbacd3e546db5bdf599e8721dd88
2 Author: Jason Zaman <jason <AT> perfinion <DOT> com>
3 AuthorDate: Wed Jul 12 04:41:00 2017 +0000
4 Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 10 13:53:30 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=2f8d8308
7
8 Start of script to handle userspace releases
9
10 gentoo/release-userspace.sh | 134 ++++++++++++++++++++++++++++++++++++++++++++
11 1 file changed, 134 insertions(+)
12
13 diff --git a/gentoo/release-userspace.sh b/gentoo/release-userspace.sh
14 new file mode 100644
15 index 00000000..0841f77c
16 --- /dev/null
17 +++ b/gentoo/release-userspace.sh
18 @@ -0,0 +1,134 @@
19 +#!/bin/sh
20 +
21 +# Copyright 2013,2014 Sven Vermeulen <swift@g.o>
22 +# Copyright 2017 Jason Zaman <perfinion@g.o>
23 +# Licensed under the GPL-3 license
24 +
25 +RELEASEDATE="${1}";
26 +NEWVERSION="${2}";
27 +
28 +PACKAGES="
29 +sys-libs/libsepol
30 +sys-libs/libselinux
31 +sys-libs/libsemanage
32 +sys-apps/checkpolicy
33 +sys-apps/policycoreutils
34 +sys-apps/selinux-python
35 +sys-apps/semodule-utils
36 +sys-apps/secilc
37 +sys-apps/mcstrans
38 +sys-apps/restorecond
39 +"
40 +# app-admin/setools not released together
41 +# dev-python/sepolgen became selinux-python in 2.7 release
42 +
43 +usage() {
44 + echo "Usage: $0 <release date> <newversion>";
45 + echo "";
46 + echo "Example: $0 20170101 2.7_rc1"
47 + echo "";
48 + echo "The script will copy the live ebuilds towards the";
49 + echo "<newversion>."
50 + echo "";
51 + echo "The following environment variables must be declared correctly for the script";
52 + echo "to function properly:";
53 + echo " - GENTOOX86 should point to the gentoo-x86 checkout";
54 + echo " E.g. export GENTOOX86=\"/home/user/dev/gentoo-x86/\"";
55 + echo " - HARDENEDREFPOL should point to the hardened-refpolicy.git checkout";
56 + echo " E.g. export HARDENEDREFPOL=\"/home/user/dev/hardened-refpolicy/\"";
57 + echo " - REFPOLRELEASE should point to the current latest /release/ of the reference"
58 + echo " policy (so NOT to a checkout), extracted somewhere on the file system."
59 + echo " E.g. export REFPOLRELEASE=\"/home/user/local/refpolicy-20130424/\"";
60 +}
61 +
62 +assertDirEnvVar() {
63 + VARNAME="${1}";
64 + eval VARVALUE='$'${VARNAME};
65 + if [ -z "${VARVALUE}" ] || [ ! -d "${VARVALUE}" ];
66 + then
67 + echo "Variable ${VARNAME} (value \"${VARVALUE}\") does not point to a valid directory.";
68 + exit 1;
69 + fi
70 +}
71 +
72 +# cleanTmp - Clean up TMPDIR
73 +cleanTmp() {
74 + if [ -z "${NOCLEAN}" ];
75 + then
76 + echo "Not cleaning TMPDIR (${TMPDIR}) upon request.";
77 + else
78 + [ -d "${TMPDIR}" ] && [ -f "${TMPDIR}/.istempdir" ] && rm -rf "${TMPDIR}"
79 + fi
80 +}
81 +
82 +die() {
83 + printf "\n";
84 + echo "!!! $*";
85 + cleanTmp;
86 + exit 2;
87 +};
88 +
89 +# set the release date in the live ebuilds so it will be correct when copying to the new version
90 +setLiveReleaseDate() {
91 + local PKG
92 + local PN
93 + cd ${GENTOOX86}
94 + echo "Setting release date var in live ebuilds... "
95 +
96 + for PKG in $PACKAGES;
97 + do
98 + cd "${GENTOOX86}/${PKG}"
99 + PN="${PKG#*/}"
100 + [[ -f "${PN}-9999.ebuild" ]] || continue;
101 + sed -i "/^MY_RELEASEDATE=/s/.*/MY_RELEASEDATE=\"${RELEASEDATE}\"/" "${PN}-9999.ebuild"
102 + git add .
103 + git --no-pager diff --cached
104 + repoman full && repoman commit -m "$PKG: update live ebuild"
105 + done
106 + echo -e "\ndone"
107 +}
108 +
109 +# Create (or modify) the new ebuilds
110 +createEbuilds() {
111 + local PKG
112 + local PN
113 + cd ${GENTOOX86}
114 + echo "Creating new ebuilds based on 9999 version... "
115 +
116 + for PKG in $PACKAGES;
117 + do
118 + cd "${GENTOOX86}/${PKG}"
119 + PN="${PKG#*/}"
120 + [[ -f "${PN}-9999.ebuild" ]] || continue
121 + [[ -f "Manifest" ]] || continue
122 + sed -i -e "/${PN}-${NEWVERSION//_/-}/d" Manifest || die
123 + cp ${PN}-9999.ebuild ${PN}-${NEWVERSION}.ebuild || die
124 + repoman manifest
125 + git add .
126 + #git --no-pager diff --cached
127 + repoman full
128 + repoman commit -m "$PKG: bump to ${NEWVERSION}"
129 + done
130 + echo -e "\ndone"
131 +}
132 +
133 +if [ $# -ne 2 ];
134 +then
135 + usage;
136 + exit 3;
137 +fi
138 +
139 +# Assert that all needed information is available
140 +assertDirEnvVar GENTOOX86;
141 +assertDirEnvVar HARDENEDREFPOL;
142 +assertDirEnvVar REFPOLRELEASE;
143 +
144 +TMPDIR=$(mktemp -d);
145 +touch ${TMPDIR}/.istempdir;
146 +
147 +setLiveReleaseDate
148 +
149 +# Create ebuilds
150 +createEbuilds;
151 +
152 +cleanTmp;