Author: mlandres
Date: Wed Jan 9 11:38:46 2008
New Revision: 8234
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8234&view=rev
Log:
PatchFileReader_test
Added:
branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/PatchFileReader_test.cc
branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/data/patch-fetchmsttfonts.sh-4347.xml
Modified:
branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/CMakeLists.txt
Modified: branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/CMakeLists.txt?rev=8234&r1=8233&r2=8234&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/CMakeLists.txt (original)
+++ branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/CMakeLists.txt Wed Jan 9 11:38:46 2008
@@ -4,5 +4,9 @@
ADD_EXECUTABLE( PatchesFileReader PatchesFileReader_test.cc )
TARGET_LINK_LIBRARIES( PatchesFileReader zypp boost_unit_test_framework )
+ADD_EXECUTABLE( PatchFileReader PatchFileReader_test.cc )
+TARGET_LINK_LIBRARIES( PatchFileReader zypp boost_unit_test_framework )
+
ADD_TEST(RepomdFileReader ${CMAKE_CURRENT_BINARY_DIR}/RepomdFileReader ${CMAKE_CURRENT_SOURCE_DIR}/data )
-ADD_TEST(PatchesFileReader ${CMAKE_CURRENT_BINARY_DIR}/PatchesFileReader ${CMAKE_CURRENT_SOURCE_DIR}/data )
\ No newline at end of file
+ADD_TEST(PatchesFileReader ${CMAKE_CURRENT_BINARY_DIR}/PatchesFileReader ${CMAKE_CURRENT_SOURCE_DIR}/data )
+ADD_TEST(PatchFileReader ${CMAKE_CURRENT_BINARY_DIR}/PatchFileReader ${CMAKE_CURRENT_SOURCE_DIR}/data )
Added: branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/PatchFileReader_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/PatchFileReader_test.cc?rev=8234&view=auto
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/PatchFileReader_test.cc (added)
+++ branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/PatchFileReader_test.cc Wed Jan 9 11:38:46 2008
@@ -0,0 +1,85 @@
+#include
+#include
+#include
+
+#include "zypp/base/Easy.h"
+#include "zypp/Url.h"
+#include "zypp/PathInfo.h"
+#include "zypp/Pathname.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/parser/yum/PatchFileReader.h"
+
+using namespace std;
+using namespace boost::unit_test;
+using namespace zypp;
+using namespace zypp::parser::yum;
+
+struct Check_fetchmsttfonts
+{
+ bool operator()( const data::Patch_Ptr & data_r )
+ {
+ BOOST_CHECK( data_r );
+ if ( data_r )
+ {
+ BOOST_CHECK_EQUAL( data_r->name, "fetchmsttfonts.sh" );
+ BOOST_CHECK_EQUAL( data_r->edition, Edition("4347", "0") );
+ BOOST_CHECK_EQUAL( data_r->arch, Arch_noarch );
+
+ BOOST_CHECK_EQUAL( data_r->summary.text().size(), 41 );
+ BOOST_CHECK_EQUAL( data_r->description.text().size(), 296 );
+ BOOST_CHECK_EQUAL( data_r->licenseToConfirm.text().size(), 4911 );
+
+ BOOST_CHECK_EQUAL( data_r->id, "fetchmsttfonts.sh-4347" );
+ BOOST_CHECK_EQUAL( data_r->timestamp, Date(20070919) );
+ BOOST_CHECK_EQUAL( data_r->category, "optional" );
+
+ BOOST_CHECK_EQUAL( data_r->atoms.size(), 1 );
+ if ( data_r->atoms.size() == 1 )
+ {
+ data::Script_Ptr scr( dynamic_pointer_castdata::Script( *data_r->atoms.begin() ) );
+ if ( scr )
+ {
+ BOOST_CHECK_EQUAL( scr->name, "fetchmsttfonts.sh-4347-patch-fetchmsttfonts.sh-2" );
+ BOOST_CHECK_EQUAL( scr->edition, Edition("4347", "1") );
+ BOOST_CHECK_EQUAL( scr->arch, Arch_noarch );
+
+ BOOST_CHECK_EQUAL( scr->doScript.size(), 3718);
+ BOOST_CHECK_EQUAL( scr->undoScript.size(), 0 );
+ }
+ else
+ {
+ BOOST_CHECK_MESSAGE( false, "Atom is not a Script" );
+ }
+ }
+ }
+ return true;
+ }
+};
+
+void patch_read_test( const Pathname & file_r )
+{
+ cout << "Testing : " << file_r << endl;
+ PatchFileReader( file_r, Check_fetchmsttfonts() );
+}
+
+test_suite * init_unit_test_suite( int argc, char * argv[] )
+{
+ Pathname patchfile;
+ --argc; ++argv;
+ if ( argc )
+ {
+ patchfile = argv[0];
+ if ( PathInfo( patchfile ).isDir() )
+ patchfile /= "patch-fetchmsttfonts.sh-4347.xml";
+ }
+ else
+ {
+ patchfile = TESTS_SRC_DIR;
+ patchfile /= "parser/yum/data/patch-fetchmsttfonts.sh-4347.xml";
+ }
+
+ test_suite * test = BOOST_TEST_SUITE( "PatchFileReader" );
+ test->add( BOOST_PARAM_TEST_CASE( &patch_read_test, &patchfile, &patchfile+1 ) );
+
+ return test;
+}
Added: branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/data/patch-fetchmsttfonts.sh-4347.xml
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/data/patch-fetchmsttfonts.sh-4347.xml?rev=8234&view=auto
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/data/patch-fetchmsttfonts.sh-4347.xml (added)
+++ branches/tmp/ma/jump_sat/libzypp/tests/parser/yum/data/patch-fetchmsttfonts.sh-4347.xml Wed Jan 9 11:38:46 2008
@@ -0,0 +1,296 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--PATCHINFO id="287e34f0d7e54e31ac219b16fd6961cb"!-->
+http://novell.com/package/metadata/suse/patch"
+ xmlns:yum="http://linux.duke.edu/metadata/common"
+ xmlns:rpm="http://linux.duke.edu/metadata/rpm"
+ xmlns:suse="http://novell.com/package/metadata/suse/common"
+ patchid="fetchmsttfonts.sh-4347"
+ timestamp="20070919"
+ engine="1.0">
+ yum:namefetchmsttfonts.sh
+ <summary lang="en">Download Microsoft(r) TrueType Core Fonts</summary>
+ <summary lang="de">Download Microsoft(r) TrueType Core Fonts</summary>
+ <description lang="en">For legal reasons we can't include the Microsoft(r)
+TrueType Core Fonts in our product. This patch downloads
+these fonts and installs them on your system. Please note
+that about 4 MByte data are downloaded therefore. License
+for the fonts will be installed as
+/usr/share/doc/corefonts/EULA.html.
+</description>
+ <description lang="de">Aus rechtlichen Gründen können wir leider die TrueType Core
+Fonts von Microsoft(r) auf unserem Produkt nicht
+mitliefern. Dieser Patch lädt diese Fonts herunter und
+installiert diese auf Ihrem System. Beachten Sie bitte,
+dass dazu in etwa 4 MByte an Daten heruntergeladen werden.
+Die Lizenz für die Fonts wird unter
+/usr/share/doc/corefonts/EULA.html abgelegt.
+
+</description>
+
+ rpm:requires
+
+
+ <category>optional</category>
+ <license-to-confirm>
+END-USER LICENSE AGREEMENT FOR
+MICROSOFT SOFTWARE
+
+IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is
+a legal agreement between you (either an individual or a single entity) and
+Microsoft Corporation for the Microsoft software accompanying this EULA, which
+includes computer software and may include associated media, printed materials,
+and "on-line" or electronic documentation ("SOFTWARE PRODUCT" or "SOFTWARE").
+By exercising your rights to make and use copies of the SOFTWARE PRODUCT, you
+agree to be bound by the terms of this EULA. If you do not agree to the terms
+of this EULA, you may not use the SOFTWARE PRODUCT.
+
+
+SOFTWARE PRODUCT LICENSE
+The SOFTWARE PRODUCT is protected by copyright laws and international copyright
+treaties, as well as other intellectual property laws and treaties. The
+SOFTWARE PRODUCT is licensed, not sold.
+
+
+1. GRANT OF LICENSE. This EULA grants you the following rights:
+
+ * Installation and Use. You may install and use an unlimited number of copies
+ of the SOFTWARE PRODUCT.
+ * Reproduction and Distribution. You may reproduce and distribute an
+ unlimited number of copies of the SOFTWARE PRODUCT; provided that each copy
+ shall be a true and complete copy, including all copyright and trademark
+ notices, and shall be accompanied by a copy of this EULA. Copies of the
+ SOFTWARE PRODUCT may not be distributed for profit either on a standalone
+ basis or included as part of your own product.
+
+
+2. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS.
+
+ * Limitations on Reverse Engineering, Decompilation, and Disassembly. You may
+ not reverse engineer, decompile, or disassemble the SOFTWARE PRODUCT,
+ except and only to the extent that such activity is expressly permitted by
+ applicable law notwithstanding this limitation.
+ * Restrictions on Alteration. You may not rename, edit or create any
+ derivative works from the SOFTWARE PRODUCT, other than subsetting when
+ embedding them in documents.
+ * Software Transfer. You may permanently transfer all of your rights under
+ this EULA, provided the recipient agrees to the terms of this EULA.
+ * Termination. Without prejudice to any other rights, Microsoft may terminate
+ this EULA if you fail to comply with the terms and conditions of this EULA.
+ In such event, you must destroy all copies of the SOFTWARE PRODUCT and all
+ of its component parts.
+
+
+3. COPYRIGHT. All title and copyrights in and to the SOFTWARE PRODUCT
+(including but not limited to any images, text, and "applets" incorporated into
+the SOFTWARE PRODUCT), the accompanying printed materials, and any copies of
+the SOFTWARE PRODUCT are owned by Microsoft or its suppliers. The SOFTWARE
+PRODUCT is protected by copyright laws and international treaty provisions.
+Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted
+material.
+
+
+4. U.S. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE PRODUCT and documentation
+are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the
+Government is subject to restrictions as set forth in subparagraph (c)(1)(ii)
+of the Rights in Technical Data and Computer Software clause at DFARS
+252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer
+Software - Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer
+is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399.
+
+
+LIMITED WARRANTY
+
+NO WARRANTIES. Microsoft expressly disclaims any warranty for the SOFTWARE
+PRODUCT. The SOFTWARE PRODUCT and any related documentation is provided "as is"
+without warranty of any kind, either express or implied, including, without
+limitation, the implied warranties or merchantability, fitness for a particular
+purpose, or noninfringement. The entire risk arising out of use or performance
+of the SOFTWARE PRODUCT remains with you.
+
+NO LIABILITY FOR CONSEQUENTIAL DAMAGES. In no event shall Microsoft or its
+suppliers be liable for any damages whatsoever (including, without limitation,
+damages for loss of business profits, business interruption, loss of business
+information, or any other pecuniary loss) arising out of the use of or
+inability to use this Microsoft product, even if Microsoft has been advised of
+the possibility of such damages. Because some states/jurisdictions do not allow
+the exclusion or limitation of liability for consequential or incidental
+damages, the above limitation may not apply to you.
+
+
+MISCELLANEOUS
+
+If you acquired this product in the United States, this EULA is governed by the
+laws of the State of Washington.
+
+If this product was acquired outside the United States, then local laws may
+apply.
+
+Should you have any questions concerning this EULA, or if you desire to contact
+Microsoft for any reason, please contact the Microsoft subsidiary serving your
+country, or write: Microsoft Sales Information Center/One Microsoft Way/
+Redmond, WA 98052-6399.
+ </license-to-confirm>
+ <atoms>
+ <script>
+ yum:namefetchmsttfonts.sh-4347-patch-fetchmsttfonts.sh-2
+
+ <do>
+#!/bin/sh
+
+EULA="http://corefonts.sourceforge.net/eula.htm"
+
+FONTS=" \
+dl.sourceforge.net/sourceforge/corefonts/andale32.exe \
+dl.sourceforge.net/sourceforge/corefonts/arial32.exe \
+dl.sourceforge.net/sourceforge/corefonts/arialb32.exe \
+dl.sourceforge.net/sourceforge/corefonts/comic32.exe \
+dl.sourceforge.net/sourceforge/corefonts/courie32.exe \
+dl.sourceforge.net/sourceforge/corefonts/georgi32.exe \
+dl.sourceforge.net/sourceforge/corefonts/impact32.exe \
+dl.sourceforge.net/sourceforge/corefonts/times32.exe \
+dl.sourceforge.net/sourceforge/corefonts/trebuc32.exe \
+dl.sourceforge.net/sourceforge/corefonts/verdan32.exe \
+dl.sourceforge.net/sourceforge/corefonts/webdin32.exe \
+"
+
+SERVER=" \
+switch \
+mesh \
+jaist \
+kent \
+nchc \
+heanet \
+easynews \
+optusnet \
+"
+
+CURL_OPTIONS="-s --speed-limit 3500 --speed-time 15"
+
+if [ "`id -u`" != "0" ]; then
+ echo "error: You must be root to use this program!"
+ exit 1
+fi
+
+if [ ! -x /usr/bin/cabextract ]; then
+ echo "error: cabextract missing! Please install package cabextract first."
+ exit 2
+fi
+
+. /etc/sysconfig/proxy
+
+if test "$PROXY_ENABLED" != "no"; then
+ if test -n "$HTTP_PROXY" ; then
+ export http_proxy="$HTTP_PROXY"
+ fi
+fi
+
+if [ -z $http_proxy ]; then
+ echo
+ echo "note: No proxy is used. Please set the environment variable \"http_proxy\""
+ echo "note: to your favorite proxy, if you want to use a proxy for the download."
+ echo "note:"
+ echo "note: bash: export http_proxy=\"http://proxy.example.com:3128/\""
+ echo "note: tcsh: setenv http_proxy \"http://proxy.example.com:3128/\""
+fi
+
+echo "EULA:"
+mkdir -p /usr/share/doc/corefonts
+echo -n " Fetching ... "
+curl $CURL_OPTIONS -o /usr/share/doc/corefonts/EULA.html $EULA || \
+ rm -f /usr/share/doc/corefonts/EULA.html
+echo "done"
+
+tmpname=`basename $0`
+tmpdir=`mktemp -d /tmp/$tmpname.XXXXXX`
+trap "rm -rf $tmpdir" EXIT
+if [ $? -ne 0 ]; then
+ echo "$0: Can't create temp dir, exiting..."
+ exit 4
+fi
+
+pushd $tmpdir &> /dev/null
+
+echo
+echo "Trying to find the fastest server:"
+besttime=1000
+
+for server in $SERVER; do
+ echo -n " $server ... "
+ start=$SECONDS
+ curl $CURL_OPTIONS --connect-timeout 10 -o cabextract.rpm \
+ http://$server.dl.sourceforge.net/sourceforge/corefonts/cabextract-0.5-1.i38...
+ if [ $? -ne 0 ]; then
+ echo "too slow (aborted)"
+ continue
+ fi
+ stop=$SECONDS
+ time=$((stop - start))
+ echo "$time sec"
+ if [ $time -lt $besttime ]; then
+ besttime=$time
+ useserver=$server
+ fi
+done
+
+rm -f cabextract.rpm
+if [ -n "$useserver" ]; then
+ echo "The winner is: >> $useserver <<"
+ echo
+else
+ echo "Connection too slow or no server available. Aborting ... "
+ exit 5
+fi
+
+for font in $FONTS; do
+ for i in $useserver $SERVER; do
+ archive=http://$i.$font
+ file=`echo $archive|awk -F "/" '{print $NF}'`
+ rm -f $file
+ echo "$file ($archive):"
+ echo -n " Fetching ... "
+ curl $CURL_OPTIONS -o $file $archive
+ if [ $? -ne 0 ]; then
+ rm -f $file
+ echo "failed ... deleted!"
+ continue
+ fi
+ echo done
+ echo -n " Extracting ... "
+ cabextract -l $file &> /dev/null
+ if [ $? -ne 0 ]; then
+ rm -f $file
+ echo "failed ... deleted!"
+ else
+ cabextract $file &> /dev/null
+ echo "done"
+ success=true
+ break
+ fi
+ rm -f $file
+ done
+done
+
+if [ "x$success" != "x" ]; then
+ for i in *.[Tt][Tt][CFcf]; do
+ lower=`echo $i|tr [:upper:] [:lower:]`
+ test "$i" != "$lower" && mv $i $lower
+ done
+ chmod 644 *.tt[cf]
+ # impact.ttf already in agfa-fonts package
+ test -s /usr/share/fonts/truetype/impact.ttf && rm impact.ttf
+ mv -f *.tt[cf] /usr/share/fonts/truetype
+ /usr/sbin/fonts-config
+ echo "*** Fonts installed. ***"
+else
+ echo "*** No Fonts installed. ***"
+fi
+
+popd &> /dev/null
+ </do>
+ suse:freshens
+
+
+ </script>
+ </atoms>
+</patch>
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org