forked from DMTF/python-redfish-utility
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Makefile2
188 lines (168 loc) · 9 KB
/
Makefile2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
TOPDIR:=$(shell pwd)/topdir
BUILD_DIR := $(shell pwd)/.blddir
SRCROOT := $(shell pwd)
CHROOT_LOCAL_DIR:= $(shell pwd)
NAME:=ilorest
VERSION:=2.4.0
RELEASE:=1
CREATE_CHROOT := $(CHROOT_LOCAL_DIR)/chrootbuilder/create_chroot.sh
CHROOT := $(CHROOT_LOCAL_DIR)/chrootbuilder/tools/muchroot
ifdef MTX_PRODUCT_VERSION
VERSION:=$(MTX_PRODUCT_VERSION)
endif
ifdef MTX_BUILD_NUMBER
RELEASE:=$(MTX_BUILD_NUMBER)
endif
tbz:
rm -rf "$(NAME)-$(VERSION)"
rm -f "$(NAME)-$(VERSION).tar.bz2"
mkdir -p "$(NAME)-$(VERSION)"
tar --exclude=$(NAME)-$(VERSION) \
--exclude=.svn --exclude=*.pyc --exclude=rdmc-pyinstaller*.spec --exclude=./Makefile -cf - * |\
( tar -C $(NAME)-$(VERSION) -xf -)
sed -e "s/\%VERSION\%/$(VERSION)/g" -e "s/\%RELEASE\%/$(RELEASE)/g"\
rdmc.spec10.in > "$(NAME)-$(VERSION)/rdmc.spec"
cp -r $(MTX_STAGING_PATH)/externals "$(NAME)-$(VERSION)"
tar cfj "$(NAME)-$(VERSION).tar.bz2" "$(NAME)-$(VERSION)"
rm -rf "$(NAME)-$(VERSION)"
rpmprep:
rm -rf $(TOPDIR)
mkdir -p $(TOPDIR)
cd $(TOPDIR) && mkdir -p BUILD RPMS SOURCES SPECS SRPMS
rdmc.spec: rdmc.spec10.in
sed -e "s/\%VERSION\%/$(VERSION)/g" -e "s/\%RELEASE\%/$(RELEASE)/g" \
$< > $(TOPDIR)/SPECS/$@
rpm: rpmprep tbz rdmc.spec
cp "$(NAME)-$(VERSION).tar.bz2" $(TOPDIR)/SOURCES/
rpmbuild -ba --define '_topdir $(TOPDIR)' $(TOPDIR)/SPECS/rdmc.spec
clean:
rm -f "$(NAME)-$(VERSION).tar.bz2"
rm -rf topdir .blddir
DEBCHROOTD := $(BUILD_DIR)/chroots/squeeze
rpm-freeze: freeze-src tbz rpms
rpms:
$(call freeze-chroot,$(MX_ARCH))
rm -rf /home/monkey/*.tar.bz2
rm -rf /home/monkey/c.sh
cp "$(NAME)-$(VERSION).tar.bz2" /home/monkey
rm -Rf /home/monkey/build
bash -c 'su - monkey -c "mkdir -p ~/build && cd ~/build && mkdir -p BUILD RPMS SOURCES SPECS SRPMS"'
rm -rf /home/monkey/build/RPMS/*.rpm
echo "%_binary_filedigest_algorithm 8" > /home/monkey/.rpmmacros
echo "%_source_filedigest_algorithm 8" >> /home/monkey/.rpmmacros
echo "%__gpg_sign_cmd %{__gpg} gpg --batch --verbose --no-armor --passphrase-fd 3 --no-secmem-warning -u %{_gpg_name} -sbo %{__signature_filename} --digest-algo sha256 %{__plaintext_filename}" >> /home/monkey/.rpmmacros
echo "rpmbuild -ta --define '_topdir /home/monkey/build/' /home/monkey/$(NAME)-$(VERSION).tar.bz2" >> /home/monkey/c.sh
bash -c 'chmod a+x /home/monkey/c.sh'
bash -c 'su - monkey -c "/home/monkey/c.sh"'
cp -r /home/monkey/build/RPMS/ .
#cp -r /root/backup/libssl* /lib64
#cp -r /root/backup/libcrypt* /lib64
#cp -R /root/backup/ossl-modules /lib64
#rm -Rf -v /root/backup
-find ./RPMS -type f -name '*-debuginfo-*.rpm' -exec rm -f {} \;
-find ./RPMS -type d -empty -exec rmdir {} \;
ifdef MTX_COLLECTION_PATH
cp -r ./RPMS $(MTX_COLLECTION_PATH)/
# hpesign will error out if signing not successful
hpesign --project "SDR_RPM_2048" --signonly `find /opt/mxdk/buildagent/work/MTX_COLLECTION_PATH -type f -name '*.rpm'`
endif
freeze-src:
#rm -rf hp
#git clone git@github.hpe.com:ess-morpheus/chrootbuilder.git $(CHROOT_LOCAL_DIR)/chrootbuilder
-bash -c 'useradd monkey'
-mkdir -p /home/monkey > /dev/null
#grep -i "monkey:" /etc/passwd > /dev/null
#if [ $? -eq 0 ]; then \
# echo "yes the user exists"; \
#else \
# bash -c 'useradd monkey'; \
# echo "No, the user does not exist, creating"; \
#fi
#if [! -d /home/monkey]; then \
# mkdir -p /home/monkey > /dev/null; \
#fi
define freeze-chroot
#bash -c 'yum group install -y "Development Tools"'
#bash -c 'yum install -y perl-Text-Template perl-IPC-Cmd perl-Test-Harness perl-Pod-Html perl-Digest-SHA cpan'
#bash -c 'yum install -y gcc zlib-devel bzip2 libxml2-devel libxslt-devel ncurses-devel expat-devel sqlite sqlite-devel openssl-devel readline-devel bzip2-devel xz-devel tk-devel libffi-devel'
# SUSE
bash -c 'zypper --non-interactive install libgcrypt-devel glib2-devel xz-devel tk-devel zlib-devel libxml2-devel libxslt-devel ncurses-devel sqlite3-devel readline-devel libffi-devel'
#bash -c 'zypper --non-interactive install perl-Text-Template perl-IPC-Cmd perl-Test-Harness perl-Pod-Html perl-Digest-SHA'
#mkdir -p /root/backup
#cp -r /lib64/libssl* /root/backup
#cp -r /lib64/libcrypt* /root/backup
#cp -R /lib64/ossl-modules /root/backup/
tar -xvf $(SRCROOT)/packaging/python3/openssl-3.0.12.tar.gz -C .
bash -c 'cd openssl-3.0.12 && ./Configure --prefix=/usr/local/openssl3.0 --openssldir=/usr/local/openssl3.0 enable-tls1_3 enable-fips && make && make install'
echo "/usr/local/openssl3.0/lib64" > /etc/ld.so.conf.d/openssl3.0.conf
bash -c 'ldconfig'
/usr/local/openssl3.0/bin/openssl version
tar xf $(SRCROOT)/packaging/python3/Python-3.10.4.tgz -C .
bash -c 'cd Python-3.10.4 && export LDFLAGS=-L/usr/local/openssl3.0/lib64 && export LD_LIBRARY_PATH=/usr/local/openssl3.0/lib64 && ./configure --prefix=/usr/local/python3.10 --enable-shared --with-openssl=/usr/local/openssl3.0/ --with-openssl-rpath=/usr/local/openssl3.0/lib64'
#bash -c 'cd Python-3.10.4 && ./configure --prefix=/usr/local/python3.10 --enable-shared --with-openssl=/usr/local/openssl3.0/'
make -C Python-3.10.4
make -C Python-3.10.4 altinstall
echo "/usr/local/python3.10/lib" > /etc/ld.so.conf.d/python3.10.conf
bash -c 'ldconfig'
bash -c '/usr/local/python3.10/bin/python3.10 --version'
#Added external packages
bash -c '/usr/local/python3.10/bin/python3.10 -m ensurepip --upgrade'
tar xfz $(SRCROOT)/packaging/ext/setuptools-58.1.0.tar.gz -C .
bash -c 'cd setuptools-58.1.0 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/pyinstaller-hooks-contrib-2022.3.tar.gz -C .
bash -c 'cd pyinstaller-hooks-contrib-2022.3 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/altgraph-0.17.2.tar.gz -C .
bash -c 'cd altgraph-0.17.2 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/wheel-0.37.1.tar.gz -C .
bash -c 'cd wheel-0.37.1 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/jsonpointer-2.2.tar.gz -C .
bash -c 'cd jsonpointer-2.2 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/six-1.16.0.tar.gz -C .
bash -c 'cd six-1.16.0 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/ply-3.11.tar.gz -C .
bash -c 'cd ply-3.11 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/decorator-5.1.1.tar.gz -C .
bash -c 'cd decorator-5.1.1 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/jsonpatch-1.32.tar.gz -C .
bash -c 'cd jsonpatch-1.32 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/jsonpath-rw-1.4.0.tar.gz -C .
bash -c 'cd jsonpath-rw-1.4.0 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/pyudev-0.23.2.tar.gz -C .
bash -c 'cd pyudev-0.23.2 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/jsondiff-1.3.1.tar.gz -C .
bash -c 'cd jsondiff-1.3.1 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/pyaes-1.6.1.tar.gz -C .
bash -c 'cd pyaes-1.6.1 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/urllib3-1.26.9.tar.gz -C .
bash -c 'cd urllib3-1.26.9 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/colorama-0.4.4.tar.gz -C .
bash -c 'export LC_ALL=en_US.UTF-8 && cd colorama-0.4.4 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/tabulate-0.8.9.tar.gz -C .
bash -c 'cd tabulate-0.8.9 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/wcwidth-0.2.5.tar.gz -C .
bash -c 'cd wcwidth-0.2.5 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/prompt_toolkit-3.0.29.tar.gz -C .
bash -c 'cd prompt_toolkit-3.0.29 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/certifi-2021.10.8.tar.gz -C .
bash -c 'cd certifi-2021.10.8 && /usr/local/python3.10/bin/python3.10 setup.py install'
tar xfz $(SRCROOT)/packaging/ext/pyinstaller-5.1.tar.gz -C .
bash -c 'cd pyinstaller-5.1/bootloader && /usr/local/python3.10/bin/python3.10 ./waf distclean all && cd .. && /usr/local/python3.10/bin/python3.10 setup.py install'
cp -r $(MTX_STAGING_PATH)/externals/*.zip packaging/ext
unzip packaging/ext/python-ilorest-library-$(MX_ILOREST_LIB_VERSION).zip -d .
bash -c 'cd python-ilorest-library-$(MX_ILOREST_LIB_VERSION) && /usr/local/python3.10/bin/python3.10 setup.py install'
bash -c '/usr/local/python3.10/bin/pip3.10 list'
endef
deb:
sudo apt-get -y install alien
sudo alien $(MTX_STAGING_PATH)/rpmlocation/RPMS/x86_64/*.rpm
mkdir temp
dpkg-deb -R *.deb temp
mv temp/usr/lib64 temp/usr/lib
mkdir temp/usr/lib/x86_64-linux-gnu
cp temp/usr/lib/ilorest_chif.so temp/usr/lib/x86_64-linux-gnu/
rm temp/usr/lib/ilorest_chif.so
dpkg-deb -b temp new.deb
rm ilorest*.deb
mv new.deb $(NAME)-$(VERSION)-$(RELEASE)_amd64.deb
mkdir -p DEB && cp *.deb DEB
cp -r DEB $(MTX_COLLECTION_PATH)/