Browse code

Upgrade motd to python3 and remove python2 from packages_minimal.json.

Change-Id: I048b4e9b33c9374ce801f3d016ee4f5f702f0175
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2832
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>

xiaolin-vmware authored on 2017/06/01 07:50:16
Showing 2 changed files
... ...
@@ -1,26 +1,24 @@
1
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
2
-%{!?python_version: %define python_version %(%{__python} -c "import sys ; print sys.version[:3]")}
1
+%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
3 2
 
4 3
 %define commit0 a152954dcf0583a6efd1af31c42f9e27e6a15bea
5 4
 
6
-Summary:	Message of the Day
7
-Name:		motd
8
-Version:	0.1.3
9
-Release:	2%{?dist}
10
-License:	GPLv3
11
-URL:		http://github.com/rtnpro/fedora-motd
12
-Source0:	https://github.com/rtnpro/motdgen/archive/motdgen-a152954.tar.gz
13
-%define sha1 motdgen-a152954.tar.gz=fd0b535df54515ce5f56933e53b0ed73c77d1137
14
-Patch0:		strip-dnf.patch
5
+Summary:        Message of the Day
6
+Name:           motd
7
+Version:        0.1.3
8
+Release:        3%{?dist}
9
+License:        GPLv3
10
+URL:            http://github.com/rtnpro/fedora-motd
11
+Source0:        https://github.com/rtnpro/motdgen/archive/motdgen-a152954.tar.gz
12
+%define sha1    motdgen-a152954.tar.gz=fd0b535df54515ce5f56933e53b0ed73c77d1137
13
+Patch0:         strip-dnf.patch
15 14
 
16 15
 BuildArchitectures: noarch
17 16
 
18
-BuildRequires:	python2-devel
19
-BuildRequires:	python-setuptools
17
+BuildRequires:  python3-devel
20 18
 
21
-Requires:	Linux-PAM
22
-Requires:	systemd
23
-Requires:	python2
19
+Requires:       Linux-PAM
20
+Requires:       systemd
21
+Requires:       python3
24 22
 
25 23
 %description
26 24
 Generates Dynamic MOTD.
... ...
@@ -30,11 +28,11 @@ Generates Dynamic MOTD.
30 30
 %patch0 -p1
31 31
 
32 32
 %build
33
-%{__python} setup.py build
33
+python3 setup.py build
34 34
 
35 35
 %install
36
-%{__python} setup.py install -O1 --skip-build \
37
-	--install-data=%{_datadir} --root %{buildroot}
36
+python3 setup.py install -O1 --skip-build \
37
+    --install-data=%{_datadir} --root %{buildroot}
38 38
 
39 39
 #shadow is providing /etc/pam.d/sshd with (noreplace)
40 40
 
... ...
@@ -42,7 +40,7 @@ Generates Dynamic MOTD.
42 42
 [ $1 -eq 1 ] && [ $2 -eq 1 ] || exit 0
43 43
 echo "detected install of motd/shadow, patching /etc/pam.d/sshd" >&2
44 44
 grep -q '^\s*session\s*include\s*motdgen.*$' %{_sysconfdir}/pam.d/sshd \
45
-	|| echo "session include motdgen" >> %{_sysconfdir}/pam.d/sshd
45
+    || echo "session include motdgen" >> %{_sysconfdir}/pam.d/sshd
46 46
 
47 47
 %triggerun -- shadow
48 48
 [ $1 -eq 0 ] && [ $2 -eq 1 ] || exit 0
... ...
@@ -50,7 +48,7 @@ grep -q '^\s*session\s*include\s*motdgen.*$' %{_sysconfdir}/pam.d/sshd \
50 50
 # 0  1  motd is being uninstalled, shadow is installed
51 51
 echo "detected uninstall of motd/shadow, reverting /etc/pam.d/sshd" >&2
52 52
 sed -i '/^\s*session\s*include\s*motdgen.*$/d' \
53
-	%{_sysconfdir}/pam.d/sshd || exit 0
53
+    %{_sysconfdir}/pam.d/sshd || exit 0
54 54
 
55 55
 %postun
56 56
 [ $1 -eq 0 ] || exit 0
... ...
@@ -59,7 +57,7 @@ rm -rf %{_localstatedir}/run/motdgen
59 59
 %files
60 60
 %doc README.md
61 61
 %defattr(-,root,root)
62
-%{python_sitelib}/motdgen-%{version}-py%{python_version}.egg-info/
62
+%{python3_sitelib}/*
63 63
 %{_sysconfdir}/pam.d/motdgen
64 64
 %{_sysconfdir}/motdgen.d
65 65
 %{_sysconfdir}/profile.d/motdgen.sh
... ...
@@ -67,6 +65,8 @@ rm -rf %{_localstatedir}/run/motdgen
67 67
 %{_sysconfdir}/systemd/system/motdgen.service
68 68
 
69 69
 %changelog
70
+*   Wed May 31 2017 Xiaolin Li <xiaolinl@vmware.com> 0.1.3-3
71
+-   Upgraded to python3.
70 72
 *   Sun Apr 30 2017 Bo Gan <ganb@vmware.com> 0.1.3-2
71 73
 -   Do not write to stdout in triggers
72 74
 *   Mon Apr 17 2017 Bo Gan <ganb@vmware.com> 0.1.3-1
... ...
@@ -3,7 +3,7 @@
3 3
                 "pkg-config", "bash", "bzip2", "shadow", "procps-ng", "iana-etc", "coreutils", "bc", "libtool", "net-tools",
4 4
                 "findutils", "xz", "iproute2", "util-linux", "kmod", "linux", "ca-certificates", "curl", "iptables", "Linux-PAM",
5 5
                 "systemd", "dbus", "file", "e2fsprogs", "rpm",
6
-                "openssh", "gdbm", "python2", "python2-libs", "python-xml", 
6
+                "openssh", "gdbm",
7 7
                 "photon-release", "photon-repos",
8 8
                 "sed", "grep", "cpio", "gzip", "vim", "libdb", "tdnf",
9 9
                 "open-vm-tools",
... ...
@@ -11,5 +11,3 @@
11 11
                 "cloud-init", "tzdata",
12 12
                 "krb5", "which", "initramfs", "motd", "cracklib-dicts"]
13 13
 }
14
-
15
-