Browse code

Remove some unused depenedences in packges. Add RPM Url input option ostree-server installation. Added default link to bintray repo. Updated make-docker-image script to use local repo.

Touseef Liaqat authored on 2015/08/04 11:25:07
Showing 9 changed files
... ...
@@ -202,10 +202,10 @@ docker-image:
202 202
 		--net=host \
203 203
 		-v `pwd`:/workspace \
204 204
 		toliaqat/photon-dev \
205
-		./support/dockerfiles/photon/make-docker-image.sh /workspace
205
+		./support/dockerfiles/photon/make-docker-image.sh tdnf
206 206
 
207 207
 install-docker-image: docker-image
208
-	sudo docker build -t photon:base .
208
+	sudo docker build -t photon:tdnf .
209 209
 
210 210
 clean: clean-install clean-chroot
211 211
 	@echo "Deleting Photon ISO..."
... ...
@@ -26,7 +26,7 @@ BuildRequires:	python2
26 26
 BuildRequires:	python2-libs
27 27
 BuildRequires:	gobject-introspection-devel
28 28
 BuildRequires:	gobject-introspection-python
29
-Requires:	glib-devel
29
+Requires:	glib
30 30
 Requires:	libffi
31 31
 Requires:	pcre
32 32
 %description
... ...
@@ -31,15 +31,13 @@ BuildRequires: 	python2-libs
31 31
 BuildRequires:	python2
32 32
 BuildRequires: 	gobject-introspection-python
33 33
 
34
-Requires:      yum
35 34
 BuildRequires:	which
36 35
 BuildRequires:	popt-devel
37 36
 Requires:	libcap
38
-Requires:	librepo-devel
37
+Requires:	librepo
39 38
 Requires:	hawkey
40
-Requires:	rpm
41
-Requires:	libhif-devel
42
-Requires:	openssl-devel
39
+Requires:	libhif
40
+Requires:	openssl
43 41
 Requires:	ostree
44 42
 Requires:	json-glib
45 43
 
... ...
@@ -77,6 +75,8 @@ find %{buildroot} -name '*.la' -delete
77 77
 %{_libdir}/*.so.1*
78 78
 %{_libdir}/girepository-1.0/*.typelib
79 79
 
80
+
81
+
80 82
 %files devel
81 83
 %{_libdir}/lib*.so
82 84
 %{_includedir}/*
... ...
@@ -42,7 +42,7 @@ class OstreeInstaller(Installer):
42 42
                     "Please provide the URL of OSTree repo",
43 43
                     "OSTree Repo URL:", 2,
44 44
                     self.install_config,
45
-                    "http://192.168.29.166/")
45
+                    "https://dl.bintray.com/vmware/photon/rpms/dev/")
46 46
 
47 47
                 ret = ostree_url_reader.get_user_string(None)
48 48
                 self.ostree_repo_url = ret.result
... ...
@@ -54,7 +54,7 @@ class OstreeInstaller(Installer):
54 54
                 "Please provide the Ref in OSTree repo",
55 55
                 "OSTree Repo Ref:", 2,
56 56
                 self.install_config,
57
-                "tp2/x86_64/minimal")
57
+                "dev/x86_64/minimal")
58 58
 
59 59
             ret = ostree_ref_reader.get_user_string(None)
60 60
             self.ostree_ref = ret.result
... ...
@@ -31,6 +31,19 @@ class OstreeServerInstaller(Installer):
31 31
     def __init__(self, install_config, maxy = 0, maxx = 0, iso_installer = False, rpm_path = "../stage/RPMS", log_path = "../stage/LOGS", ks_config = None):
32 32
         Installer.__init__(self, install_config, maxy, maxx, iso_installer, rpm_path, log_path, ks_config)
33 33
 
34
+    def unsafe_install(self, params):
35
+        rpmrepo_url_reader = WindowStringReader(
36
+            self.maxy, self.maxx, 10, 70,
37
+            "rpm_repo_url", False,
38
+            "Please provide the URL of RPM repo",
39
+            "RPM Repo URL:", 2,
40
+            self.install_config,
41
+            "https://dl.bintray.com/vmware/photon/rpms/dev/")
42
+
43
+        ret = rpmrepo_url_reader.get_user_string(None)
44
+        self.rpm_repo_url = ret.result
45
+        return Installer.unsafe_install(self, params)
46
+
34 47
     def finalize_system(self):
35 48
         Installer.finalize_system(self)
36 49
 
... ...
@@ -39,5 +52,14 @@ class OstreeServerInstaller(Installer):
39 39
         self.run("cp ./mk-ostree-server.sh {}/srv/rpm-ostree/".format(self.photon_root))
40 40
         self.run("cp ./photon-base.json {}/srv/rpm-ostree/".format(self.photon_root))
41 41
         self.run("cp ./photon-ostree.repo {}/srv/rpm-ostree/".format(self.photon_root))
42
+        with open("{}/srv/rpm-ostree/photon-ostree.repo".format(self.photon_root), "a") as myfile:
43
+            myfile.write("baseurl={}".format(self.rpm_repo_url))
44
+
45
+        self.run("mv {}/etc/resolv.conf {}/etc/resolv.conf.bak".format(self.photon_root, self.photon_root))
46
+        self.run("cp /etc/resolv.conf {}/etc/resolv.conf".format(self.photon_root, self.photon_root))
47
+
42 48
         self.run("mount /dev/cdrom {}/mnt/cdrom".format(self.photon_root))
43 49
         self.run("chroot {} bash -c \"cd /srv/rpm-ostree; ./mk-ostree-server.sh /\"".format(self.photon_root))
50
+
51
+        # Restore resolv.conf
52
+        self.run("mv {}/etc/resolv.conf.bak {}/etc/resolv.conf".format(self.photon_root, self.photon_root))
... ...
@@ -1,6 +1,5 @@
1 1
 [photon-ostree]
2
-name=VMware Photon Linux 1.0(x86_64)
3
-baseurl=http://192.168.29.140:8090/
2
+name=VMware Photon OSTree Linux 1.0(x86_64)
4 3
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
5 4
 gpgcheck=0
6 5
 enabled=1
... ...
@@ -81,9 +81,9 @@ class ReadText(Action):
81 81
                     if self.str != self.install_config['password']:
82 82
                         curses.curs_set(0)
83 83
                         conf_message_height = 8
84
-                        conf_message_width = 40
84
+                        conf_message_width = 48
85 85
                         conf_message_button_y = (self.maxy - conf_message_height) / 2 + 5
86
-                        confrim_window = ConfirmWindow(conf_message_height, conf_message_width, self.maxy, self.maxx, conf_message_button_y, "passwords don't match, please try again.", True)
86
+                        confrim_window = ConfirmWindow(conf_message_height, conf_message_width, self.maxy, self.maxx, conf_message_button_y, "Passwords don't match, please try again.", True)
87 87
                         confrim_window.do_action()
88 88
                         return ActionResult(False, {'goBack': True})
89 89
                     self.install_config['password'] = self.generate_password_hash(self.str)
... ...
@@ -10,14 +10,14 @@ set -e
10 10
 set -x
11 11
 
12 12
 PROGRAM=$0
13
-WORKSPACE_DIR=$1
14
-RPMS_DIR=$WORKSPACE_DIR/stage/RPMS
15
-TEMP_CHROOT=$(pwd)/temp_chroot
13
+MAIN_PACKAGE=$1
14
+
16 15
 
16
+TEMP_CHROOT=$(pwd)/temp_chroot
17 17
 ROOTFS_TAR_FILENAME=photon-rootfs.tar.bz2
18
-STAGE_DIR=$WORKSPACE_DIR/stage
18
+STAGE_DIR=$(pwd)/stage
19 19
 
20
-cat > yum.conf <<- "EOF"
20
+cat > yum.conf <<- EOF
21 21
 
22 22
 [main]
23 23
 cachedir=$(pwd)/temp_chroot/var/cache/yum
... ...
@@ -27,9 +27,9 @@ logfile=$(pwd)/temp_chroot/var/log/yum.log
27 27
 exactarch=1
28 28
 obsoletes=1
29 29
 
30
-[photon]
30
+[photon-local]
31 31
 name=VMware Photon Linux 1.0(x86_64)
32
-baseurl=https://dl.bintray.com/vmware/photon_release_1.0_x86_64
32
+baseurl=file://$(pwd)/stage/RPMS
33 33
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
34 34
 gpgcheck=0
35 35
 enabled=1
... ...
@@ -41,34 +41,39 @@ rm -rf $TEMP_CHROOT
41 41
 mkdir $TEMP_CHROOT
42 42
 
43 43
 # use host's yum to install in chroot
44
-yum -c yum.conf --installroot=$TEMP_CHROOT install -y filesystem glibc
45
-yum -c yum.conf --installroot=$TEMP_CHROOT install -y bash tdnf coreutils photon-release
46
-yum -c yum.conf clean all
44
+mkdir -p $TEMP_CHROOT/var/lib/rpm
45
+rpm --root $TEMP_CHROOT/ --initdb
46
+yum -c yum.conf --disablerepo=* --enablerepo=photon-local --installroot=$TEMP_CHROOT install -y filesystem glibc
47
+yum -c yum.conf --disablerepo=* --enablerepo=photon-local --installroot=$TEMP_CHROOT install -y yum bash coreutils photon-release $MAIN_PACKAGE
48
+yum -c yum.conf --disablerepo=* --enablerepo=photon-local --installroot=$TEMP_CHROOT clean all
49
+
47 50
 cp /etc/resolv.conf $TEMP_CHROOT/etc/
48 51
 
49
-# reinstalling inside to make sure rpmdb is created for tdnf.
50
-# TODO find better solution.
51
-chroot $TEMP_CHROOT bash -c \
52
-   "tdnf install -y filesystem; \
53
-    tdnf install -y glibc ; \
54
-    tdnf install -y bash ; \
55
-    tdnf install -y coreutils ; \
56
-    tdnf install -y tdnf ; \
57
-    tdnf install -y photon-release; \
58
-    rpm -e --nodeps perl; \
59
-    rpm -e --nodeps perl-DBD-SQLite; \
60
-    rpm -e --nodeps perl-Module-ScanDeps; \
61
-    rpm -e --nodeps perl-DBIx-Simple; \
62
-    rpm -e --nodeps perl-DBI; \
63
-    rpm -e --nodeps perl-WWW-Curl;"
52
+# # reinstalling inside to make sure rpmdb is created for tdnf.
53
+# # TODO find better solution.
54
+# chroot $TEMP_CHROOT bash -c \
55
+#    "tdnf install -y filesystem; \
56
+#     tdnf install -y glibc ; \
57
+#     tdnf install -y bash ; \
58
+#     tdnf install -y coreutils ; \
59
+#     tdnf install -y rpm-ostree ; \
60
+#     tdnf install -y photon-release; \
61
+#     rpm -e --nodeps perl; \
62
+#     rpm -e --nodeps perl-DBD-SQLite; \
63
+#     rpm -e --nodeps perl-Module-ScanDeps; \
64
+#     rpm -e --nodeps perl-DBIx-Simple; \
65
+#     rpm -e --nodeps perl-DBI; \
66
+#     rpm -e --nodeps perl-WWW-Curl;"
64 67
 
65 68
 cd $TEMP_CHROOT
66 69
 # cleanup anything not needed inside rootfs
67 70
 rm -rf usr/src/
68 71
 rm -rf home/*
69
-rm -rf var/lib/yum/*
72
+# rm -rf var/lib/yum/*
70 73
 rm -rf var/log/*
71
-find var/cache/tdnf/photon/rpms -type f -name "*.rpm" -exec rm {} \;
74
+
75
+#find var/cache/tdnf/photon/rpms -type f -name "*.rpm" -exec rm {} \;
76
+
72 77
 tar cpjf ../$ROOTFS_TAR_FILENAME .
73 78
 mkdir -p $STAGE_DIR
74 79
 mv ../$ROOTFS_TAR_FILENAME $STAGE_DIR/
75 80
new file mode 100755
... ...
@@ -0,0 +1,27 @@
0
+#!/bin/sh
1
+# Script to upload files to bintray. All files in source-path are uploaded to location 
2
+# configured in following parameters.
3
+
4
+ACCOUNT=vmware
5
+REPO=photon
6
+PACKAGE=rpm-ostree
7
+VERSION=dev
8
+
9
+if [ $# -lt 3 ]
10
+then
11
+    echo "Usage : " $0 " <Source Path>  <Username> <APIKEY>"
12
+    exit 1
13
+fi
14
+
15
+SRC_DIR=$1
16
+USER=$2
17
+APIKEY=$3
18
+
19
+(cd $SRC_DIR
20
+
21
+for FILE in `find . -type f`; do
22
+
23
+  echo "Uploading " $FILE
24
+  curl -vvf -T $FILE -u$USER:$APIKEY -H "X-Bintray-Package:$PACKAGE" -H "X-Bintray-Version:$VERSION" https://api.bintray.com/content/$ACCOUNT/$REPO/$PACKAGE/$VERSION/$FILE
25
+
26
+done)