diff --git a/.gitignore b/.gitignore index e69de29..5678398 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +*.idea* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3c2c116 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM baseruntime/baseruntime:latest + +LABEL MAINTAINER Rado Pitonak + +RUN microdnf --nodocs install php && \ + microdnf -y clean all + +CMD bash diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8b6941b --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +IMAGE_NAME = php + +MODULEMDURL=file://php.yaml + +default: run + +build: + docker build --tag=$(IMAGE_NAME) . + +run: build + docker run -d $(IMAGE_NAME) + +debug: build + docker run -it $(IMAGE_NAME) bash + +test: build + cd tests; MODULE=docker MODULEMD=$(MODULEMDURL) URL="docker=$(IMAGE_NAME)" make all diff --git a/README.md b/README.md new file mode 100644 index 0000000..06648e8 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# php module + +[**Package DB** (owner)](https://admin.fedoraproject.org/pkgdb/package/modules/php/) | +[**F26 modulemd** (source)](http://pkgs.fedoraproject.org/cgit/modules/php.git/tree/php.yaml?h=f26) | +[**PDC** (result)](https://pdc.fedoraproject.org/rest_api/v1/unreleasedvariants/?active=True&variant_name=php) + + +PHP is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. + +## Current state + +| State | Description | +|-------|-------------| +| ✓ YES | **Build passes** in the infra (all build deps are ok) | +| ✓ YES | **Installs** on the Base Runtime (all runtime deps are ok) | +| ✗ NO | **No bootstrap** - uses only proper modules | +| ✓ YES | General **tests are in dist-git** | +| ✓ YES | General **tests pass** | +| ✗ NO | Meets the **Fedora Module Packaging Guidelines** | + +### Notes + +See [**PHP s2i image**](https://github.com/container-images/php) on github for more details. diff --git a/php.yaml b/php.yaml new file mode 100644 index 0000000..fc52e89 --- /dev/null +++ b/php.yaml @@ -0,0 +1,97 @@ +document: modulemd +version: 1 +data: + summary: PHP scripting language for creating dynamic web sites + description: PHP is an HTML-embedded scripting language. PHP attempts to make it + easy for developers to write dynamically generated web pages. PHP also + offers built-in database integration for several commercial and + non-commercial database management systems, so writing a + database-enabled webpage with PHP is fairly simple. The most common + use of PHP coding is probably as a replacement for CGI scripts. + The php package contains the module (often referred to as mod_php) + which adds support for the PHP language to Apache HTTP Server. + license: + module: [PHP and Zend and BSD] + dependencies: + buildrequires: +# base-runtime: f26 + bootstrap: f26 + common-build-dependencies: f26 +# shared-userspace: f26 + perl: f26 + postgresql: f26 + nginx: f26 + httpd: f26 + requires: + perl: f26 + shared-userspace: f26 + base-runtime: f26 + httpd: f26 + references: + community: https://docs.pagure.org/modularity/ + documentation: https://github.com/modularity-modules/php + tracker: https://github.com/modularity-modules/php + profiles: + default: + rpms: + - php + api: + rpms: + - php + filter: + rpms: + - php-dba + - php-devel + - php-enchant + - php-gd + - php-imap + - php-interbase + - php-mcrypt + - php-odbc + - php-pdo-dblib + - php-pspell + - php-recode + - php-snmp + - php-tidy + components: + rpms: + php: + rationale: php package. + ref: f26 + buildorder: 10 +# nginx: +# rationale: Provides API for this module. +# ref: f26 +# buildorder: 2 +# gperftools: +# rationale: dependency +# ref: f26 +# buildorder: 1 +# libmnl: +# rationale: dependency +# ref: f26 +# buildorder: 1 +# libnetfilter_conntrack: +# rationale: dependency +# ref: f26 +# buildorder: 1 +# libnfnetlink: +# rationale: dependency +# ref: f26 +# buildorder: 1 +# libunwind: +# rationale: dependency +# ref: f26 +# buildorder: 1 + libxkbcommon: + rationale: dependency + ref: f26 + buildorder: 1 + mailcap: + rationale: dependency + ref: f26 + buildorder: 1 + xkeyboard-config: + rationale: dependency + ref: f26 + buildorder: 1 diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..8fd8ae7 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,6 @@ +MODULE_LINT=/usr/share/moduleframework/tools/modulelint.py +CMD=python -m avocado run --filter-by-tags=-WIP $(MODULE_LINT) *.py + +# +all: + $(CMD) diff --git a/tests/config.yaml b/tests/config.yaml new file mode 100644 index 0000000..a2c06a9 --- /dev/null +++ b/tests/config.yaml @@ -0,0 +1,16 @@ +document: modularity-testing +version: 1 +name: php +modulemd-url: http://pkgs.fedoraproject.org/cgit/modules/php.git/plain/php.yaml?h=f26 +service: + port: 8080 +packages: + rpms: + - php +module: + docker: + start: "docker run -it" + container: php + rpm: + repos: + - http://mirror.vutbr.cz/fedora/releases/26/Everything/x86_64/os/ diff --git a/tests/sanity1.py b/tests/sanity1.py new file mode 100644 index 0000000..4ed53a7 --- /dev/null +++ b/tests/sanity1.py @@ -0,0 +1,60 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# This Modularity Testing Framework helps you to write tests for modules +# Copyright (C) 2017 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# he Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Authors: Rado Pitonak +# + +from avocado import main +from avocado.core import exceptions +from moduleframework import module_framework + + +class SanityCheck(module_framework.AvocadoTest): + """ + :avocado: enable + """ + + def testPhpBinary(self): + """ + Simple sanity test + """ + + self.start() + self.run("ls /bin | grep php") + + def test2PHPVersion(self): + """ + Check if PHP is installed in correct version + """ + version = "7." + self.start() + self.run("php -v | grep {}".format(version)) + + def testScriptExecution(self): + """ + Execute simple PHP script from CLI + """ + output = "Hello world!" + self.start() + self.assertIn(output, self.run("php -r 'echo \"{}\";'".format(output)).stdout) + + +if __name__ == '__main__': + main()