Accepting request 403804 from home:favogt:branches:Publishing

Improve specfile
Version 0.7:
- Move to GitHub
- Integrate:
  -  sgml-skel-edit-cat.diff
  -  sgml-skel-regcat.diff
  -  sgml-skel-regcat2.diff
  -  edit-xml-catalog.sh
  -  install-catalog.in

OBS-URL: https://build.opensuse.org/request/show/403804
OBS-URL: https://build.opensuse.org/package/show/Publishing/sgml-skel?expand=0&rev=13
This commit is contained in:
Karl Eichwalder 2016-06-21 10:25:00 +00:00 committed by Git OBS Bridge
parent 867be225f0
commit 14e6293309
10 changed files with 61 additions and 433 deletions

3
_service Normal file
View File

@ -0,0 +1,3 @@
<services>
<service name="download_files" mode="disabled" />
</services>

View File

@ -1,123 +0,0 @@
#!/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
cp /etc/xml/catalog /etc/xml/catalog.tmp
sed "/<\/catalog>/i\\
<nextCatalog catalog=\"${root}\"/>" \
/etc/xml/catalog.tmp >/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
$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
$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

View File

@ -1,165 +0,0 @@
#!/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>
where <option> is:
-d|--delegate: Use DELEGATE instead of CATALOG
and where <action> is:
-a|--add <centralized> <ordinary>: Declare ordinary catalog in the centralized catalog
-r|--remove <centralized> <ordinary>: Remove ordinary catalog from the centralized catalog
-h, --help: Print this help message and exit
-v, --version: Print the version number and exit
"
# 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 $SGML_HELP_MESSAGE
exit 0
;;
-v|--version) echo $SGML_VERSION_MESSAGE
exit 0
;;
--install) echo "install-catalog: Old syntax; doing nothing"
exit 0
;;
*) echo $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 $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 $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

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a87e468648d1d2c2f629cca1ee712b00fe0ea162620e826efdc720de04d2d4e8
size 63662

View File

@ -1,35 +0,0 @@
--- edit-xml-catalog.sh 2008-05-14 13:28:16.000000000 +0200
+++ edit-xml-catalog.sh 2008-05-14 13:54:11.000000000 +0200
@@ -61,10 +61,8 @@
if [ "$ROOTCATALOG" != /etc/xml/catalog ]; then
root=${ROOTCATALOG#/etc/xml/}
if ! grep -q "nextCatalog.*catalog=\"${root}\"" /etc/xml/catalog; then
- cp /etc/xml/catalog /etc/xml/catalog.tmp
- sed "/<\/catalog>/i\\
-<nextCatalog catalog=\"${root}\"/>" \
- /etc/xml/catalog.tmp >/etc/xml/catalog
+ sed -i "/<\/catalog>/i\\
+<nextCatalog catalog=\"${root}\"/>" /etc/xml/catalog
fi
prep_catalog "$ROOTCATALOG"
fi
@@ -79,6 +77,9 @@
/<catalog/{s=1}
END{print "</catalog>"}'
} >$ROOTCATALOG.tmp
+ if [ -x /bin/chmod ]; then
+ /bin/chmod --reference=$ROOTCATALOG $ROOTCATALOG.tmp
+ fi
$xmllint --nocatalogs --noout $ROOTCATALOG.tmp \
&& mv $ROOTCATALOG.tmp $ROOTCATALOG
}
@@ -104,6 +105,9 @@
/<!-- pac_start: $pattern do not remove! -->/{s=1;next}
{print}" > $ROOTCATALOG.tmp
fi
+ if [ -x /bin/chmod ]; then
+ /bin/chmod --reference=$ROOTCATALOG $ROOTCATALOG.tmp
+ fi
$xmllint --nocatalogs --noout $ROOTCATALOG.tmp \
&& mv $ROOTCATALOG.tmp $ROOTCATALOG
fi

View File

@ -1,23 +0,0 @@
--- sgml-skel-0.6/sgml-register-catalog.in 2002-11-25 09:42:46.000000000 +0100
+++ sgml-skel-0.6/sgml-register-catalog.in 2002-11-25 13:02:47.000000000 +0100
@@ -126,13 +126,12 @@
# else
# echo "Warning: $SGML_ORDINARY was not found in the centralized catalog $SGML_CENTRALIZED" >&2
# fi
- if [ ! -s $SGML_ORDINARY ]; then
+ # set -x
# rm $SGML_ORDINARY
- echo "`basename $0`: removal of $SGML_ORDINARY from /etc/sgml/catalog"
- sed -e "\:$SGML_POINTER \"\?$SGML_ORDINARY\"\?\>:d" /etc/sgml/catalog \
- > /etc/sgml/catalog.new
- mv /etc/sgml/catalog.new /etc/sgml/catalog
- fi
+ echo "`basename $0`: removal of $SGML_ORDINARY from /etc/sgml/catalog"
+ sed -e "\:$SGML_POINTER \+\"\?$SGML_ORDINARY\"\?\>:d" /etc/sgml/catalog \
+ > /etc/sgml/catalog.new
+ mv /etc/sgml/catalog.new /etc/sgml/catalog
;;
esac
Diff finished at Mon Nov 25 13:20:03

View File

@ -1,22 +0,0 @@
--- sgml-skel-0.6/sgml-register-catalog.in.~1~ 2002-11-28 16:30:54.000000000 +0100
+++ sgml-skel-0.6/sgml-register-catalog.in 2002-11-28 16:41:59.000000000 +0100
@@ -111,7 +111,7 @@
# else
# echo "$SGML_POINTER $SGML_ORDINARY" >> $SGML_CENTRALIZED
# fi
- grep -q -e "\<$SGML_ORDINARY\>" /etc/sgml/catalog 2>/dev/null
+ grep -q -e "$SGML_ORDINARY\"\?[ ]*$" /etc/sgml/catalog 2>/dev/null
if [ $? -ne 0 ]; then
echo "`basename $0`: addition of $SGML_ORDINARY in /etc/sgml/catalog"
echo "$SGML_POINTER \"$SGML_ORDINARY\"" >> /etc/sgml/catalog
@@ -129,7 +129,7 @@
# set -x
# rm $SGML_ORDINARY
echo "`basename $0`: removal of $SGML_ORDINARY from /etc/sgml/catalog"
- sed -e "\:$SGML_POINTER \+\"\?$SGML_ORDINARY\"\?\>:d" /etc/sgml/catalog \
+ sed -e "\:$SGML_POINTER \+\"\?$SGML_ORDINARY\"\?[ ]*$:d" /etc/sgml/catalog \
> /etc/sgml/catalog.new
mv /etc/sgml/catalog.new /etc/sgml/catalog
;;
Diff finished at Thu Nov 28 16:42:05

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Tue Jun 14 14:50:47 UTC 2016 - fvogt@suse.com
- Improve specfile
- Version 0.7:
- Move to GitHub
- Integrate:
- sgml-skel-edit-cat.diff
- sgml-skel-regcat.diff
- sgml-skel-regcat2.diff
- edit-xml-catalog.sh
- install-catalog.in
-------------------------------------------------------------------
Wed Jul 15 13:08:00 UTC 2015 - ke@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package sgml-skel
#
# Copyright (c) 2015 SUSE Linux GmbH, Nuernberg, Germany.
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,78 +17,54 @@
Name: sgml-skel
BuildRequires: automake
BuildRequires: libxml2
Version: 0.7
Release: 0
Summary: Helper Scripts for the SGML System
License: GPL-2.0+
Group: Productivity/Publishing/SGML
Version: 0.6
Release: 0
Requires: libxml2
Url: https://github.com/openSUSE/sgml-skel
Source0: https://github.com/openSUSE/sgml-skel/archive/v%{version}.tar.gz
BuildRequires: automake
BuildRequires: libxml2
Requires: /bin/awk
Requires: bash
Requires: coreutils
Requires: findutils
Requires: libxml2-tools
Requires: libxslt-tools
Requires(post): /bin/awk
Requires(post): findutils
Requires(post): coreutils
Requires(post): libxml2-tools
PreReq: /bin/awk
PreReq: /bin/mv
PreReq: /bin/chmod
# URL:
Source0: http://www.suse.de/~ke/%{name}/%{name}-%{version}.tar.bz2
Source1: docbook-tools/sgml-common/bin/install-catalog.in
Source2: edit-xml-catalog.sh
Patch: sgml-skel-regcat.diff
Patch1: sgml-skel-regcat2.diff
Patch2: sgml-skel-edit-cat.diff
Requires(post): libxslt-tools
Requires(post): bash
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
These scripts will help prepare and maintain parts of an SGML system.
Authors:
--------
Eric Bischoff <eric@caldera.de>
Karl Eichwalder <ke@suse.de>
%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
%patch -p 1
%patch1 -p 1
# # cp -p $RPM_SOURCE_DIR/%{name}-README.SuSE .
cp %{S:1} .
cp %{S:2} .
%patch2 -p 0
%build
# CFLAGS="$RPM_OPT_FLAGS"
autoreconf -i -f
./configure --prefix=%{_prefix} --infodir=%{_infodir} \
--datadir=%{_datadir} --mandir=%{_mandir} \
--build $RPM_ARCH-suse-linux
autoreconf -fvi
%configure
%install
make install DESTDIR=$RPM_BUILD_ROOT
%{INSTALL_SCRIPT} install-catalog.in $RPM_BUILD_ROOT%{_bindir}/install-catalog
%{INSTALL_SCRIPT} edit-xml-catalog.sh \
$RPM_BUILD_ROOT%{_bindir}/edit-xml-catalog
ln -sf sgml2xmlcat.sh $RPM_BUILD_ROOT%{_bindir}/sgmlcat2x.sh
ln -sf install-catalog $RPM_BUILD_ROOT%{_bindir}/install-catalog.sh
%{INSTALL_DIR} $RPM_BUILD_ROOT%{sgmldir}
%{INSTALL_DIR} $RPM_BUILD_ROOT%{_sysconfdir}/{sgml,xml}
%{INSTALL_DIR} $RPM_BUILD_ROOT/var/lib/sgml
touch $RPM_BUILD_ROOT%{_sysconfdir}/sgml/catalog
xmlcatalog --noout --create $RPM_BUILD_ROOT%{_sysconfdir}/xml/suse-catalog.xml
xmlcatalog --noout --create $RPM_BUILD_ROOT%{_sysconfdir}/xml/catalog
xmlcatalog --noout --add "nextCatalog" "suse-catalog.xml" "suse-catalog.xml" \
$RPM_BUILD_ROOT%{_sysconfdir}/xml/catalog
%clean
rm -fr $RPM_BUILD_ROOT
%make_install
ln -sf sgml2xmlcat.sh %{buildroot}%{_bindir}/sgmlcat2x.sh
ln -sf install-catalog %{buildroot}%{_bindir}/install-catalog.sh
ln -sf edit-xml-catalog %{buildroot}%{_bindir}/edit-xml-catalog.sh
install -d -m755 %{buildroot}%{_datadir}/sgml
install -d -m755 %{buildroot}%{_sysconfdir}/{sgml,xml}
install -d -m755 %{buildroot}%{_localstatedir}/lib/sgml
touch %{buildroot}%{_sysconfdir}/sgml/catalog
xmlcatalog --noout --create %{buildroot}%{_sysconfdir}/xml/suse-catalog.xml
xmlcatalog --noout --create %{buildroot}%{_sysconfdir}/xml/catalog
xmlcatalog --noout --add "nextCatalog" "suse-catalog.xml" "suse-catalog.xml" %{buildroot}%{_sysconfdir}/xml/catalog
xmlcatalog --noout --add "nextCatalog" "catalog-d.xml" "catalog-d.xml" %{buildroot}%{_sysconfdir}/xml/catalog
install -d -m755 %{buildroot}%{_sysconfdir}/xml/catalog.d
%post
# only create suse-catalog.xml at installation time; not in the update case
@ -97,16 +73,20 @@ if [ "$1" = 1 ]; then
|| xmlcatalog --create | sed 's:/>:>\
</catalog>:' >%{_sysconfdir}/xml/suse-catalog.xml
fi
update-xml-catalog
%files
%defattr(-, root, root)
%doc AUTHORS COPYING NEWS README*
%ghost %{_sysconfdir}/sgml/catalog
%ghost %{_sysconfdir}/xml/suse-catalog.xml
%config %verify(not md5 size mtime) %{_sysconfdir}/xml/catalog
%dir %{_sysconfdir}/sgml
%dir %{_sysconfdir}/xml
%dir %{_sysconfdir}/xml/catalog.d
%dir %{_localstatedir}/lib/sgml
%doc AUTHORS COPYING ChangeLog README*
%ghost %{_sysconfdir}/sgml/catalog
%ghost %{_sysconfdir}/xml/suse-catalog.xml
%ghost %{_sysconfdir}/xml/catalog-d.xml
%config %verify(not md5 size mtime) %{_sysconfdir}/xml/catalog
%{_bindir}/*
%dir /var/lib/sgml
%{_mandir}/man1/*
%changelog

3
v0.7.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:936f7a4ae2eb6cd720d67170677c8721e2a70d62405c6f0cb9c7edfcb5a4374c
size 99041