diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..0a0efeed1c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +* +!stage/photon-rootfs.tar.bz2 + diff --git a/support/dockerfiles/photon/Dockerfile b/Dockerfile similarity index 78% rename from support/dockerfiles/photon/Dockerfile rename to Dockerfile index 0216bdfdb4..865a557dbd 100644 --- a/support/dockerfiles/photon/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ FROM scratch MAINTAINER tliaqat@vmware.com -ADD rootfs.tar.bz2 / +ADD stage/photon-rootfs.tar.bz2 / VOLUME /var/lib/docker diff --git a/Makefile b/Makefile index 739416a0f1..e848860d4f 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ clean-install clean-chroot PARALLEL=False -all: iso micro-iso minimal-iso +all: iso micro-iso minimal-iso docker-image micro: micro-iso @@ -163,6 +163,19 @@ $(PHOTON_STAGE): @echo "Building LOGS folder..." @test -d $(PHOTON_LOGS_DIR) || $(MKDIR) -p $(PHOTON_LOGS_DIR) +docker-image: + sudo docker run \ + -it \ + --rm \ + --privileged \ + --net=host \ + -v `pwd`:/workspace \ + toliaqat/photon-dev \ + ./support/dockerfiles/photon/make-docker-image.sh /workspace + +install-docker-image: docker-image + sudo docker build -t photon:base . + clean: clean-install clean-chroot @echo "Deleting Photon ISO..." @$(RM) -f $(PHOTON_STAGE)/photon.iso diff --git a/SPECS/apr-util/apr-util.spec b/SPECS/apr-util/apr-util.spec index 14a9fc895c..5abfb27ea7 100644 --- a/SPECS/apr-util/apr-util.spec +++ b/SPECS/apr-util/apr-util.spec @@ -24,7 +24,7 @@ The Apache Portable Runtime Utility Library. %setup -q %build %configure --with-apr=%{_prefix} \ - --includedir=%{_includedir}/apr-%{apuver} \ + --includedir=%{_includedir}/apr-%{version} \ --with-ldap --without-gdbm \ --with-sqlite3 --with-pgsql \ --without-sqlite2 \ @@ -47,10 +47,12 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -/usr/lib/* -/usr/bin/* -/usr/include/* +%{_libdir}/* +%{_bindir}/* +%{_includedir}/* %changelog +* Wed Jul 01 2015 Touseef Liaqat 1.5.2-2 +- Fix tags and paths. * Wed May 20 2015 Touseef Liaqat 1.5.2-1 - Initial build. First version diff --git a/SPECS/apr/apr.spec b/SPECS/apr/apr.spec index fd034c6ed1..2e365c31e7 100644 --- a/SPECS/apr/apr.spec +++ b/SPECS/apr/apr.spec @@ -1,7 +1,7 @@ Summary: The Apache Portable Runtime Name: apr Version: 1.5.2 -Release: 1%{?dist} +Release: 2%{?dist} License: Apache License 2.0 URL: https://apr.apache.org/ Group: System Environment/Libraries @@ -15,8 +15,8 @@ The Apache Portable Runtime. %setup -q %build ./configure --prefix=/usr \ - --includedir=%{_includedir}/apr-%{aprver} \ - --with-installbuilddir=%{_libdir}/apr/build-%{aprver} \ + --includedir=%{_includedir}/apr-%{version} \ + --with-installbuilddir=%{_libdir}/apr/build-%{version} \ --with-devrandom=/dev/urandom \ CC=gcc CXX=g++ @@ -29,10 +29,12 @@ make DESTDIR=%{buildroot} install %files %defattr(-,root,root) -/usr/lib/* -/usr/bin/* -/usr/include/* +%{_libdir}/* +%{_bindir}/* +%{_includedir}/* %changelog +* Wed Jul 01 2015 Touseef Liaqat 1.5.2-2 +- Fix tags and paths. * Wed May 20 2015 Touseef Liaqat 1.5.2-1 - Initial build. First version diff --git a/support/dockerfiles/photon/make-docker-image.sh b/support/dockerfiles/photon/make-docker-image.sh index 987f1f082d..410c35baf5 100755 --- a/support/dockerfiles/photon/make-docker-image.sh +++ b/support/dockerfiles/photon/make-docker-image.sh @@ -1,8 +1,8 @@ #!/bin/bash -if [ "$#" -lt 2 ]; then - echo "Script to create new Photon Docker image." - echo "Usage: $0 " +if [ "$#" -lt 1 ]; then + echo "Script to create new photon base docker image." + echo "Usage: $0 " exit -1 fi @@ -10,35 +10,67 @@ set -e set -x PROGRAM=$0 -ROOT=$1 -TYPE=$2 -IN_CONTAINER=$3 - -ROOTFS_TAR_FILENAME=rootfs.tar.bz2 -INSTALLER_DIR=/workspace/photon/installer -PACKAGE_BUILDER_DIR=/workspace/photon/support/package-builder -DOCKERFILES_DIR=/workspace/photon/support/dockerfiles/photon/ - -if [ -z "$IN_CONTAINER" ] -then - rm -f $ROOTFS_TAR_FILENAME - docker run -it --privileged --rm -v $ROOT:/workspace toliaqat/ubuntu-dev bash /workspace/photon/support/dockerfiles/photon/${PROGRAM} $ROOT $TYPE "In Container" && \ - [ -e "$ROOTFS_TAR_FILENAME" ] && docker build -t photon:$TYPE . -else - - cd $INSTALLER_DIR && \ - cp sample_config.json docker_image_config.json && \ - sed -i -e "s/minimal/$TYPE/" docker_image_config.json && \ - ./photonInstaller.py -f -w /mnt/photon-root docker_image_config.json && \ - rm docker_image_config.json - cd $PACKAGE_BUILDER_DIR && \ - ./umount-build-root.sh /mnt/photon-root && \ - cd /mnt/photon-root && \ - rm -rf tools/ - rm -rf usr/src/ - rm -rf boot/ - rm -rf lib/modules/ - tar cpjf /$ROOTFS_TAR_FILENAME . && \ - cp /$ROOTFS_TAR_FILENAME $DOCKERFILES_DIR -fi +WORKSPACE_DIR=$1 +RPMS_DIR=$WORKSPACE_DIR/stage/RPMS +TEMP_CHROOT=$(pwd)/temp_chroot + +ROOTFS_TAR_FILENAME=photon-rootfs.tar.bz2 +STAGE_DIR=$WORKSPACE_DIR/stage + + +sudo createrepo $RPMS_DIR + +cat > yum.conf <<- "EOF" + +[main] +cachedir=$(pwd)/temp_chroot/var/cache/yum +keepcache=1 +debuglevel=2 +logfile=$(pwd)/temp_chroot/var/log/yum.log +exactarch=1 +obsoletes=1 + +[photon] +name=VMware Photon Linux 1.0(x86_64) +baseurl=https://dl.bintray.com/vmware/photon_release_1.0_x86_64 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY +gpgcheck=0 +enabled=1 +skip_if_unavailable=True + +EOF + +rm -rf $TEMP_CHROOT +mkdir $TEMP_CHROOT + +# use host's yum to install in chroot +yum -c yum.conf --installroot=$TEMP_CHROOT install -y filesystem glibc +yum -c yum.conf --installroot=$TEMP_CHROOT install -y bash tdnf coreutils photon-release +yum -c yum.conf clean all +cp /etc/resolv.conf $TEMP_CHROOT/etc/ + +# reinstalling inside to make sure rpmdb is created for tdnf. +# TODO find better solution. +chroot $TEMP_CHROOT bash -c \ + "tdnf install -y filesystem; \ + tdnf install -y glibc ; \ + tdnf install -y bash ; \ + tdnf install -y coreutils ; \ + tdnf install -y tdnf ; \ + tdnf install -y photon-release; \ + rpm -e --nodeps perl" + +cd $TEMP_CHROOT +# cleanup anything not needed inside rootfs +rm -rf usr/src/ +rm -rf home/* +rm -rf var/lib/yum/* +rm -rf /var/log/* +tar cpjf ../$ROOTFS_TAR_FILENAME . +mv ../$ROOTFS_TAR_FILENAME $STAGE_DIR +cd .. + +# cleanup +rm -rf $TEMP_CHROOT +rm yum.conf diff --git a/support/pullsources/pullsources.py b/support/pullsources/pullsources.py index de547841eb..257d9dffcf 100755 --- a/support/pullsources/pullsources.py +++ b/support/pullsources/pullsources.py @@ -46,17 +46,6 @@ def getFileHash(self, filepath): f.close() return sha1.hexdigest() - def downloadExistingFilePrompt(self, filename): - yes = ['yes', 'y'] - no = ['no', 'n'] - while True: - prompt = "Found a different local copy of {0}. Do you want to replace it? [y/n]:".format(filename) - answer = raw_input(prompt).lower() - if answer in yes: - return True - elif answer in no: - return False - def downloadFile(self, filename, file_path): print '%s: Downloading %s...' % (str(datetime.datetime.today()), filename) @@ -112,8 +101,7 @@ def ProcessDownload(self, package_and_source_dir): self.downloadFileHelper(package_name, package_path, package_sha1) elif package_sha1 != self.getFileHash(package_path): - if self.downloadExistingFilePrompt(package_name): - self.downloadFileHelper(package_name, package_path, package_sha1) + self.downloadFileHelper(package_name, package_path, package_sha1) def _pickle(method): if method.im_self is None: