diff options
author | TizenOpenSource <tizenopensrc@samsung.com> | 2023-12-28 18:16:16 +0900 |
---|---|---|
committer | TizenOpenSource <tizenopensrc@samsung.com> | 2023-12-28 18:16:16 +0900 |
commit | e8e269e1ab3b778ed96c10e0d845ac0e78db2c12 (patch) | |
tree | 91c7259d3838bcf31f043a19159681eda7b7f8af | |
parent | 7b0ff2310d0710cd369647029d53e87df954e796 (diff) | |
download | sgml-skel-tizen_base.tar.gz sgml-skel-tizen_base.tar.bz2 sgml-skel-tizen_base.zip |
Bump to 0.7.2accepted/tizen/base/toolchain/20240124.003945accepted/tizen/base/riscv/20240104.212129accepted/tizen/base/asan/20240422.015234accepted/tizen/base/20240104.133029tizen_basesandbox/sgml-skel_0.7.2accepted/tizen_base_toolchainaccepted/tizen_base_riscvaccepted/tizen_base_asanaccepted/tizen_base
Signed-off-by: TizenOpenSource <tizenopensrc@samsung.com>
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | packaging/edit-xml-catalog.sh | 127 | ||||
-rw-r--r-- | packaging/install-catalog.in | 163 | ||||
-rw-r--r-- | packaging/sgml-skel.manifest | 5 | ||||
-rw-r--r-- | packaging/sgml-skel.spec | 72 |
5 files changed, 367 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore deleted file mode 100644 index eb10e94..0000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -autom4te.cache/ -config.log -config.status diff --git a/packaging/edit-xml-catalog.sh b/packaging/edit-xml-catalog.sh new file mode 100644 index 0000000..38ca715 --- /dev/null +++ b/packaging/edit-xml-catalog.sh @@ -0,0 +1,127 @@ +#!/bin/bash + +# $0 $for_root_catalog add|del +export LC_ALL=C + +usage="\ +$0 [-a|-d] [--add|--del] [-c|--catalog /etc/xml/CATALOG] CATALOG_FRAGMENT_FILE" +# TEMP=$(getopt -o ac:dghv \ +# --long add,cat:,catalog:,del,delete,group,help,verbose \ +# -n "$0" -- "$@") +# # Note the quotes around `$TEMP': they are essential! +# eval set -- "$TEMP" + +ROOTCATALOG=/etc/xml/catalog +mode=add +echo=true +while test $# -gt 0; do +# while true ; do + case "$1" in + -h|--help) echo "$usage"; exit 0 ;; + -a|--add) mode=add; shift ;; + -c|--cat*) if test $# -gt 1; then ROOTCATALOG="$2"; shift 2; + else echo "$usage"; exit 1; fi ;; + -d|--del*) mode=del; shift ;; + -g|--group) marker=group; shift ;; + -v|--verbose) verbose="-v"; echo=echo; shift ;; + --) shift ; break ;; + *) break ;; + # *) echo "Internal error!" ; exit 1 ;; + esac +done +FOR_ROOT_CAT=$1 + +[ -z "$FOR_ROOT_CAT" ] && { echo $usage; exit 1; } + +xmlcat=/usr/bin/xmlcatalog +xmllint=/usr/bin/xmllint + +for b in $xmlcat $xmllint; do + [ -x $b ] || { echo "error: $b does not exist" ; exit 1; } +done + +prep_catalog () { + local cat=$1 + [ -s $cat ] || rm -f $cat + if [ -r $cat ]; then + if grep -q '"urn:oasis:names:tc:entity:xmlns:xml:catalog"/>' $cat; then + rm -f $cat + fi + fi + if [ ! -r $cat ] ; then + $xmlcat --create | sed 's:/>:>\ +</catalog>:' >$cat + # echo Failed creating XML Catalog root $1 + fi +} + +# Check /etc/xml/catalog +prep_catalog /etc/xml/catalog + +if [ "$ROOTCATALOG" != /etc/xml/catalog ]; then + root=${ROOTCATALOG#/etc/xml/} + if ! grep -q "nextCatalog.*catalog=\"${root}\"" /etc/xml/catalog; then + sed -i "/<\/catalog>/i\\ +<nextCatalog catalog=\"${root}\"/>" /etc/xml/catalog + fi + prep_catalog "$ROOTCATALOG" +fi + +add_entry () { + { + sed '/<\/catalog>/d' $ROOTCATALOG + $xmllint --nocatalogs --format ${FOR_ROOT_CAT} \ + | awk '\ +/<\/catalog>/{next} +s == 1 {print} +/<catalog/{s=1} +END{print "</catalog>"}' + } >$ROOTCATALOG.tmp + if [ -x /usr/bin/chmod ]; then + /usr/bin/chmod --reference=$ROOTCATALOG $ROOTCATALOG.tmp + fi + $xmllint --nocatalogs --noout $ROOTCATALOG.tmp \ + && mv $ROOTCATALOG.tmp $ROOTCATALOG +} + +del_entry () { + pattern=$FOR_ROOT_CAT + $echo $pattern + if [ -r $ROOTCATALOG ]; then + # Either delete <group>...</group> + # or <!-- pac_start: ... -->...<!-- pac_end: ... --> + if [ "$marker" = "group" ]; then + $xmllint --nocatalogs --format $ROOTCATALOG \ + | awk "\ +/<\/group>/ && s == 1 {s=0;next} +s == 1 {next} +/<group id=\"$pattern\">/{s=1;next} +{print}" > $ROOTCATALOG.tmp + else + $xmllint --nocatalogs --format $ROOTCATALOG \ + | awk "\ +/<!-- pac_end: $pattern do not remove! -->/{s=0;next} +s == 1 {next} +/<!-- pac_start: $pattern do not remove! -->/{s=1;next} +{print}" > $ROOTCATALOG.tmp + fi + if [ -x /usr/bin/chmod ]; then + /usr/bin/chmod --reference=$ROOTCATALOG $ROOTCATALOG.tmp + fi + $xmllint --nocatalogs --noout $ROOTCATALOG.tmp \ + && mv $ROOTCATALOG.tmp $ROOTCATALOG + fi +} + +case "$mode" in + del) + del_entry + ;; + add) + [ -r ${FOR_ROOT_CAT} ] || { echo \"$FOR_ROOT_CAT\" does not exist; exit 1; } + add_entry + ;; + *) +esac + +exit diff --git a/packaging/install-catalog.in b/packaging/install-catalog.in new file mode 100644 index 0000000..358a48e --- /dev/null +++ b/packaging/install-catalog.in @@ -0,0 +1,163 @@ +#!/bin/sh +# Script to install a catalog in the centralized SGML catalog +# Send any comments to Eric Bischoff <eric@caldera.de> +# This program is under GPL license. See LICENSE file for details. + +# Set help message +SGML_HELP_MESSAGE="Usage: `basename $0` [<option>] <action>\n\ +where <option> is:\n\ +\040 -d|--delegate: \t\t\t Use DELEGATE instead of CATALOG\n\ +and where <action> is:\n\ +\040 -a|--add <centralized> <ordinary>: \t Declare ordinary catalog in the centralized catalog\n\ +\040 -r|--remove <centralized> <ordinary>:\t Remove ordinary catalog from the centralized catalog\n\ +\040 -h, --help: \t\t\t\t Print this help message and exit\n\ +\040 -v, --version: \t\t\t Print the version number and exit\n" + +# Set version message +SGML_VERSION_MESSAGE="sgml-common version @VERSION@ (install-catalog version 1.0)" + +# Set type of pointer +SGML_POINTER="CATALOG" + +# Set action to be performed +SGML_ACTION="" + +# Set catalogs +SGML_CENTRALIZED="" +SGML_ORDINARY="" + +# Process options +case $1 in + -d|--delegate) SGML_POINTER="DELEGATE" + shift 1 + ;; +esac + +# Process actions +case $1 in + -a|--add) SGML_ACTION="addition" + SGML_CENTRALIZED=$2 + SGML_ORDINARY=$3 + ;; + -r|--remove) if [ -z "$3" -o "$3" = "--version" ] + then + echo "install-catalog: Old syntax; doing nothing" + exit 0 + fi + SGML_ACTION="removal" + SGML_CENTRALIZED=$2 + SGML_ORDINARY=$3 + ;; + -h|--help) echo -e $SGML_HELP_MESSAGE + exit 0 + ;; + -v|--version) echo -e $SGML_VERSION_MESSAGE + exit 0 + ;; + --install) echo "install-catalog: Old syntax; doing nothing" + exit 0 + ;; + *) echo -e $SGML_HELP_MESSAGE >&2 + exit 1 + ;; +esac + +# Check that the super catalog can be created and changed and deleted +if [ ! -w /etc/sgml ] +then + echo "`basename $0`: unable to write in /etc/sgml." >&2 + exit 2 +fi +case $SGML_ACTION in + addition) + if [ -e /etc/sgml/catalog -a ! -w /etc/sgml/catalog ] + then + echo "`basename $0`: can not modify \"/etc/sgml/catalog\"." >&2 + exit 2 + fi + ;; + removal) + if [ ! -w /etc/sgml/catalog ] + then + echo "`basename $0`: can not modify \"/etc/sgml/catalog\"." >&2 + exit 2 + fi + ;; +esac + +# Check that the centralized catalog can be created, changed and deleted +if [ -z "$SGML_CENTRALIZED" ] +then + echo -e $SGML_HELP_MESSAGE >&2 + exit 1 +fi +case $SGML_ACTION in + addition) + if [ -e $SGML_CENTRALIZED -a ! -w $SGML_CENTRALIZED ] + then + echo "`basename $0`: can not modify \"$SGML_CENTRALIZED\"." >&2 + exit 2 + fi + ;; + removal) + if [ ! -w $SGML_CENTRALIZED ] + then + echo "`basename $0`: can not modify \"$SGML_CENTRALIZED\"." >&2 + exit 2 + fi + ;; +esac + +# Check that we have at least one ordinary package to process +if [ -z "$SGML_ORDINARY" ] +then + echo -e $SGML_HELP_MESSAGE >&2 + exit 1 +fi +case $SGML_ACTION in + addition) + if [ ! -s $SGML_ORDINARY ] + then + echo "`basename $0`: \"$SGML_ORDINARY\" does not exist or is empty." >&2 + exit 2 + fi + ;; +esac + +# Installation or removal of pointers +case $SGML_ACTION in + addition) + echo "`basename $0`: addition of $SGML_ORDINARY in $SGML_CENTRALIZED" + if grep -q $SGML_ORDINARY $SGML_CENTRALIZED 2>/dev/null + then + echo "Warning: $SGML_ORDINARY is already installed in the centralized catalog $SGML_CENTRALIZED" >&2 + else + echo "$SGML_POINTER $SGML_ORDINARY" >> $SGML_CENTRALIZED + fi + grep -q $SGML_CENTRALIZED /etc/sgml/catalog 2>/dev/null + if [ $? -ne 0 ] + then + echo "`basename $0`: addition of $SGML_CENTRALIZED in /etc/sgml/catalog" + echo "$SGML_POINTER $SGML_CENTRALIZED" >> /etc/sgml/catalog + fi + ;; + removal) + echo "`basename $0`: removal of $SGML_ORDINARY from $SGML_CENTRALIZED" + if grep -q $SGML_ORDINARY $SGML_CENTRALIZED 2>/dev/null + then + sed -e "\:$SGML_POINTER $SGML_ORDINARY:d" < $SGML_CENTRALIZED > ${SGML_CENTRALIZED}.new + mv ${SGML_CENTRALIZED}.new $SGML_CENTRALIZED + else + echo "Warning: $SGML_ORDINARY was not found in the centralized catalog $SGML_CENTRALIZED" >&2 + fi + if [ ! -s $SGML_CENTRALIZED ] + then + rm $SGML_CENTRALIZED + echo "`basename $0`: removal of $SGML_CENTRALIZED from /etc/sgml/catalog" + sed -e "\:$SGML_POINTER $SGML_CENTRALIZED:d" < /etc/sgml/catalog > /etc/sgml/catalog.new + mv /etc/sgml/catalog.new /etc/sgml/catalog + fi + ;; +esac + +exit 0 diff --git a/packaging/sgml-skel.manifest b/packaging/sgml-skel.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/sgml-skel.manifest @@ -0,0 +1,5 @@ +<manifest> + <request> + <domain name="_"/> + </request> +</manifest> diff --git a/packaging/sgml-skel.spec b/packaging/sgml-skel.spec new file mode 100644 index 0000000..69a0652 --- /dev/null +++ b/packaging/sgml-skel.spec @@ -0,0 +1,72 @@ +Name: sgml-skel +Version: 0.7.2 +Release: 0 +License: GPL-2.0+ +Summary: Helper Scripts for the SGML System +Group: Productivity/Publishing/SGML +# URL: +Source0: http://www.suse.de/~ke/%{name}/%{name}-%{version}.tar.bz2 +# :pserver:anoncvs@sources.redhat.com:/cvs/docbook-tools +Source1: docbook-tools/sgml-common/bin/install-catalog.in +Source2: edit-xml-catalog.sh +Source1001: sgml-skel.manifest +BuildRequires: automake +BuildRequires: libxml2-tools +Requires(pre): /usr/bin/awk +Requires(pre): /usr/bin/chmod +Requires(pre): /usr/bin/mv +Requires: libxml2-tools +BuildArch: noarch + +%description +These scripts will help prepare and maintain parts of an SGML system. + +%define sgmldir %{_datadir}/sgml +%define INSTALL install -m755 -s +%define INSTALL_SCRIPT install -m755 +%define INSTALL_DIR install -d -m755 +%define INSTALL_DATA install -m644 + +%prep +%setup -q +cp %{SOURCE1001} . +cp %{SOURCE1} . +cp %{SOURCE2} . + +%build +# CFLAGS="%{optflags}" +autoreconf -i -f +./configure --prefix=%{_prefix} --infodir=%{_infodir} \ + --datadir=%{_datadir} --mandir=%{_mandir} \ + --build $RPM_ARCH-%vendor-linux + +%install +%make_install +%{INSTALL_SCRIPT} install-catalog.in %{buildroot}%{_bindir}/install-catalog +%{INSTALL_SCRIPT} edit-xml-catalog.sh \ + %{buildroot}%{_bindir}/edit-xml-catalog +ln -sf sgml2xmlcat.sh %{buildroot}%{_bindir}/sgmlcat2x.sh +ln -sf install-catalog %{buildroot}%{_bindir}/install-catalog.sh +%{INSTALL_DIR} %{buildroot}%{sgmldir} +%{INSTALL_DIR} %{buildroot}%{_sysconfdir}/{sgml,xml} +%{INSTALL_DIR} %{buildroot}%{_localstatedir}/lib/sgml +touch %{buildroot}%{_sysconfdir}/sgml/catalog +xmlcatalog --noout --create %{buildroot}%{_sysconfdir}/xml/tizen-catalog.xml +xmlcatalog --noout --create %{buildroot}%{_sysconfdir}/xml/catalog +xmlcatalog --noout --add "nextCatalog" "tizen-catalog.xml" "tizen-catalog.xml" \ + %{buildroot}%{_sysconfdir}/xml/catalog +%remove_docs + +%files +%manifest %{name}.manifest +%defattr(-, root, root) +%license COPYING +%ghost %{_sysconfdir}/sgml/catalog +%ghost %{_sysconfdir}/xml/tizen-catalog.xml +%config %verify(not md5 size mtime) %{_sysconfdir}/xml/catalog +%dir %{_sysconfdir}/sgml +%dir %{_sysconfdir}/xml +%{_bindir}/* +%dir %{_localstatedir}/lib/sgml + +%changelog |