How to validate metadata.xml against .dtd in gentoo? - metadata

I am trying to validate metadata.xml against www.gentoo.org/dtd/metadata.dtd with xmllint from =dev-libs/libxml2-2.9.3 ebuild.
I tried the commands (some from here):
$ xmllint --noout --valid metadata.xml
error : Unknown IO error
metadata.xml:2: warning: failed to load external entity "http://www.gentoo.org/dtd/metadata.dtd"
the same for xmllint metadata.xml --dtdvalid metadata.dtd
and xmllint --loaddtd http://www.gentoo.org/dtd/metadata.dtd
$ xmllint --valid metadata.xml --schema metadata.dtd
metadata.dtd:1: parser error : StartTag: invalid element name
I need xmllint and not mono-xmltool (from C#/CLI) because xmllint is used in repoman -d command. And repoman is used for gentoo overlay validation in travis-ci
How to validate xml with xmllint properly?
UPD:
site returns "HTTP/1.1 301 Moved Permanently" and that is why load fails
part of strace:
recvfrom(3, "HTTP/1.1 301 Moved Permanently\r\n"..., 4096, 0, NULL, NULL) = 446
recvfrom(3, "", 4096, 0, NULL, NULL) = 0
close(3) = 0
write(2, "error : ", 8error : ) = 8
write(2, "Unknown IO error\n", 17Unknown IO error
probably libxml2 doesn't do https
USE="icu ipv6 python readline -debug -examples -lzma -static-libs {-test}"
libxml2 uses nanoHTTP, nanoHTTP can work with HTTPS

Your assumption was right, the problem is HTTPS. To work around this and to save some BW and time, repoman validates against a local file, which it prefetches if not found. The default location is either REPO_ROOT/metadata/dtd/metadata.dtd or DISTDIR/metadata.dtd. To get the exact arguments repoman uses for xmllint you have to have a look at its source code - here. As you can see, it's
xmllint --nonet --noout --dtdvalid <metadata.dtd> metadata.xml
This command still outputs:
metadata.xml:2: warning: failed to load external entity "https://www.gentoo.org/dtd/metadata.dtd"
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
or in case of HTTP:
I/O error : Attempt to load network entity http://www.gentoo.org/dtd/metadata.dtd
metadata.xml:2: warning: failed to load external entity "http://www.gentoo.org/dtd/metadata.dtd"
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
But only as a warning, so the command exits with 0.

Related

So i‘m trying to deploy a function on openfaas based on arm architecture,but i failed.Can someone tell me how to solve it?

my kubernetes is based on arm,with kubernetes1.22.4
my faas-cli command:
faas-cli build -f ./add.yml
the response code :
[0] > Building add.
Clearing temporary build folder: ./build/add/
Preparing: ./add/ build/add/function
Building: myw/add:latest with python template. Please wait..
Sending build context to Docker daemon 8.192kB
Step 1/31 : FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.2.0 as watchdog
---> 6f97aa96da81
Step 2/31 : FROM --platform=${TARGETPLATFORM:-linux/amd64} python:2.7-alpine
---> 8579e446340f
Step 3/31 : ARG TARGETPLATFORM
---> Using cache
---> a75f5a062540
Step 4/31 : ARG BUILDPLATFORM
---> Using cache
---> c90a8309e851
Step 5/31 : ARG ADDITIONAL_PACKAGE
---> Using cache
---> 4ee3e6fab2a3
Step 6/31 : COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
---> Using cache
---> 33d972637c65
Step 7/31 : RUN chmod +x /usr/bin/fwatchdog
---> Running in 6204e8546454
standard_init_linux.go:219: exec user process caused: exec format error
The command '/bin/sh -c chmod +x /usr/bin/fwatchdog' returned a non-zero code: 1
[0] < Building add done in 0.54s.
[0] Worker done.
Total build time: 0.54s
Errors received during build:
- [add] received non-zero exit code from build, error: The command '/bin/sh -c chmod +x /usr/bin/fwatchdog' returned a non-zero code: 1
then can someone tell me the currect way to build a function with arm in openfaas,and why this happened,did i do someting wrong?

"cpanm PHP" fails

What should I change in order to install the module? php is 5.3.3 withyum install php-devel in place.
PHP.c: In function ‘PHP_set_php_input’:
PHP.c:818: warning: passing argument 2 of ‘Perl_sv_2pv_flags’ from incompatible pointer type
/home/mpapec/.plenv/versions/5.20.0/lib/perl5/5.20.0/x86_64-linux/CORE/proto.h:3931: note: expected ‘STRLEN * const’ but argument is of type ‘int *’
cc -c -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -Wall -O2 -DVERSION=\"0.15\" -DXS_VERSION=\"0.15\" -fPIC "-I/home/mpapec/.plenv/versions/5.20.0/lib/perl5/5.20.0/x86_64-linux/CORE" array.c
In file included from /usr/include/php/main/php.h:33,
from /usr/include/php/sapi/embed/php_embed.h:23,
from PHP.h:14,
from array.c:9:
/usr/include/php/main/php_config.h:2417:1: warning: "_GNU_SOURCE" redefined
In file included from /home/mpapec/.plenv/versions/5.20.0/lib/perl5/5.20.0/x86_64-linux/CORE/perl.h:28,
from PHP.h:9,
from array.c:9:
/home/mpapec/.plenv/versions/5.20.0/lib/perl5/5.20.0/x86_64-linux/CORE/config.h:1825:1: warning: this is the location of the previous definition
rm -f blib/arch/auto/PHP/PHP.so
cc -shared -O2 -L/usr/local/lib -fstack-protector PHP.o array.o -o blib/arch/auto/PHP/PHP.so \
\
chmod 755 blib/arch/auto/PHP/PHP.so
"/home/mpapec/.plenv/versions/5.20.0/bin/perl5.20.0" -MExtUtils::Command::MM -e 'cp_nonempty' -- PHP.bs blib/arch/auto/PHP/PHP.bs 644
Manifying 1 pod document
Running Mkbootstrap for PHP ()
chmod 644 "PHP.bs"
PERL_DL_NONLAZY=1 "/home/mpapec/.plenv/versions/5.20.0/bin/perl5.20.0" "-Iblib/lib" "-Iblib/arch" test.pl
1..79
not ok 1 - use_ok PHP
# Failed test 'use_ok PHP'
# at test.pl line 11.
not ok 2 - require PHP;
# Failed test 'require PHP;'
# at test.pl line 18.
# Tried to require 'PHP'.
# Error: Attempt to reload PHP.pm aborted.
# Compilation failed in require at (eval 6) line 2.
not ok 3 - eval
# Failed test 'eval'
# at test.pl line 49.
Module PHP failed to load at blib/lib/PHP.pm line 80.
Module PHP failed to load at blib/lib/PHP.pm line 80.
END failed--call queue aborted at test.pl line 50.
# Looks like you planned 79 tests but ran 3.
# Looks like you failed 3 tests of 3 run.
# Looks like your test exited with 22 just after 3.
make: *** [test_dynamic] Error 22
-> FAIL Installing PHP failed. See /home/mpapec/.cpanm/work/1440522239.12833/build.log for details. Retry with --force to force install it.
(
PHP is kind of fragile. It probably won't work out of the box with your system php installation, and may have trouble with 64-bit or multi-threaded versions of perl.
I have only ever gotten it to work on Linux. The latest version I have tried to use is 5.3.8 (back in 2013), though I remember things going smoothly from 5.2.x to 5.3.8.
I always build php from source, with this configuration:
./configure --enable-embed --with-zlib --with-openssl --with-mysql \
--with-libdir=lib/i386-linux-gnu
--enable-embed is absolutely required, as the pod mentions, to build a PHP interpreter with the SAPI extension, and which then allows perl to manipulate the PHP interpreter through XS code. The other extensions were for other requirements of my project; they may be optional, but I haven't experimented with building the PHP interpreter or the PHP module with any other configuration. The pod also says to never use the --with-apxs argument, which I was never tempted to do anyway.
The build process of the PHP module will look for and require a program called php-config. You may need to hack your $PATH, if only during the build process, so that the PHP module runs the correct php-config. After that the module will know where to look for the rest of your php installation.
I had fun working with this module for a while (writing a Catalyst and then a Mojolicious wrapper around WordPress), but it has fallen into disrepair and disrepute. Share whatever you learn trying to build it and we'll put it in the docs, making this module that much easier to use.

Convert matlab make from linux version to windows version

I have this linux makefile from public code and now I'm trying to use it on Windows
http://pastebin.com/gSqRFUvQ
This is what I have so far.
http://pastebin.com/iHugE5Z6
But I get an error on line 80.
echo "#include \"../src/gconv.cu\"" > "matlab/mex/gconv.cpp"
"/cygdrive/C/Program Files/Matlab2014b/bin/win64/mex" -lmwblas -largeArrayDims "matlab/mex/gconv.cpp" matlab/src/bits/im2col.obj matlab/src/bits/pooling.obj matlab/src/bits/normalize.obj -o "matlab/mex/gconv.mexw64" 2> >(sed 's/^\(.*\)(\([0-9][0-9]*\)): \([ew].*\)/\1:\2: \3/g' >&2)
Unknown MEX argument '-o'.
Makefile:79: recipe for target 'matlab/mex/gconv.mexw64' failed
make: *** [matlab/mex/gconv.mexw64] Error 127
Basically the argument -o doesn't exist. I'm sure what the author wanted by that parameter. But I think it should be -output since it will produce .mew64 file. If I change that into "-output", it gets error in the middle.
echo "#include \"../src/gconv.cu\"" > "matlab/mex/gconv.cpp"
"/cygdrive/C/Program Files/Matlab2014b/bin/win64/mex" -lmwblas -largeArrayDims "matlab/mex/gconv.cpp" matlab/src/bits/im2col.obj matlab/src/bits/pooling.obj matlab/src/bits/normalize.obj -output "matlab/mex/gconv.mexw64" 2> >(sed 's/^\(.*\)(\([0-9][0-9]*\)): \([ew].*\)/\1:\2: \3/g' >&2)
Building with 'Microsoft Visual C++ 2012'.
gconv.cpp
c:\cygwin64\home\denny\jaderberg-eccv2014_textspotting-dbe823e3c642\matconvnet\matlab\src\bits/mexutils.h(132) : error C3861: 'snprintf': identifier not found
c:\cygwin64\home\denny\jaderberg-eccv2014_textspotting-dbe823e3c642\matconvnet\matlab\src\bits/mexutils.h(147) : error C3861: 'snprintf': identifier not found
c:\cygwin64\home\denny\jaderberg-eccv2014_textspotting-dbe823e3c642\matconvnet\matlab\mex\../src/gconv.cu(228) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
c:\cygwin64\home\denny\jaderberg-eccv2014_textspotting-dbe823e3c642\matconvnet\matlab\mex\../src/gconv.cu(381) : warning C4267: 'argument' : conversion from 'size_t' to 'const int', possible loss of data
c:\cygwin64\home\denny\jaderberg-eccv2014_textspotting-dbe823e3c642\matconvnet\matlab\mex\../src/gconv.cu(459) : warning C4267: 'argument' : conversion from 'size_t' to 'const int', possible loss of data
c:\cygwin64\home\denny\jaderberg-eccv2014_textspotting-dbe823e3c642\matconvnet\matlab\mex\../src/gconv.cu(481) : warning C4267: 'argument' : conversion from 'size_t' to 'const int', possible loss of data
Makefile:79: recipe for target 'matlab/mex/gconv.mexw64' failed
make: *** [matlab/mex/gconv.mexw64] Error 127
Is it not possible to use this on windows? Could anyone shed some light?
You should be now able to use the same networks in newer MatConvNet versions as a Windows support was added (even though there are still some glitches in some configurations...).
Also the bugs which you are reporting here were fixed as well (at that time the code was not fixed for the MSC compiler).

Error in PHP code, Line // Col Non-existent?

WHen I try to run indexer for sphinx.
/usr/bin/indexer --rotate --all
I get this error...
using config file '/etc/sphinx/sphinx.conf'...
ERROR: invalid section type 'Strict' in /etc/sphinx/sphinx.conf line 1617 col 8.
ERROR: invalid section type 'Strict' in /etc/sphinx/sphinx.conf line 1617 col 1.
FATAL: failed to parse config file '/etc/sphinx/sphinx.conf'
When I check sphinx.conf there is no line 1617. The last line of code is 1373. Could someone tell this newb what I'm doing wrong and how do I debug a line that doesn't exist?
Thanks!
It sounds like you have a dynamic config file? ie contains embedded PHP code?
If so try running the config file on its own, and then inspecting that.
php /etc/sphinx/sphinx.conf > /tmp/sphinx.conf
cat -n /tmp/sphinx.conf | grep 1617 -C10
ie sphinx is finding the error in the generated output, not the raw code.

Perl not running

I have experience with setting up multiple Perl program with mac before, but come to a strange situation today.
I delete one of my existing Perl folder and download it from GitHub, when I try to run again, it shows this error: [an error occurred while processing this directive].
So, what I do to debug is:
1) I create test.shtml (some problem displaying the arrow sign in here)
#exec cgi="/Users/lion/htdocs/app/cgi-bin/test.pl"-->
2) I create test.pl
#!/usr/bin/perl
print "content-type: text/html \n\n";
print "test";
3) I create a new htaccess
AddType text/html .shtml
AddHandler server-parsed .shtml
4) I set the test.pl permission to 777
5) I tested with http://app.local/test.shtml
-> come out error [an error occurred while processing this directive].
6) If I manually run from console, it is working fine.
Here's my apache config as well.
<VirtualHost *:80>
DocumentRoot "/Users/lion/htdocs/app"
ServerName app.local
ScriptAlias /cgi-bin/ "/Users/lion/htdocs/app/cgi-bin/"
</VirtualHost>
My apache error log show this:
[Wed Nov 09 16:45:25 2011] [error] [client 127.0.0.1] invalid CGI ref "/Users/lion/htdocs/app/cgi-bin/test.pl" in /Users/lion/htdocs/app/test.shtml
Not sure what I missed out, my other Perl program is running just fine. Run out of ideas what cause the problem.
exec cgi expects a URL-path, not a file system path as an argument.
Try
#exec cgi="/cgi-bin/test.pl"
or just
#exec cgi="test.pl"
Well, after spending sometime for debugging, found out the cause is a .htaccess with authentication in cgi-bin, it blocks the redirection.