• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

RPM erstellen ohne etwas zu kompiliren

Hallo,

hier mal mein Problem.

In einem Projekt kam die anforderung unsere Software unter Linux zu installieren. Ist so weit kein Problem, wir arbeiten mit Java und es läuft auch alles unter Linux. Nur will unser Kunde nun ein rpm für die installation. Und daran häöngt es gerade. Ich will mit der rpm nichts kompiliren oder so. Der quellcode kommt schon fertig von einem Windows Server wo ein Ant-Script den build übernimmt.

Nun muss aus den fertigen Klassen und den ganzen configs und sonstigen Dateien ein rpm werden.

Kann mir jemand sagen wie ich das am besten mache.

Gibt es evtl. auf dem Windows Rechner auf dem der build läuft eine Möglichkeit das rpm zu erstellen?

Danke schon mal im Voraus und viele Grüße
burbacher :mrgreen:
 

whois

Ultimate Guru
Hi

Lies dich hier mal ein das ist ein ganzer Kapitel zu Paketbau. :wink:
http://www.tu-chemnitz.de/docs/lindocs/RPM/node12.html

Ob das allerdings auf einem Windows Rechner gemacht werden kann?

cu
 

oc2pus

Ultimate Guru
hier ein Beispiel spec für ein Java-Paket.

ggfl musst du bei ANT noch andere Parameter mit -Dxxx einfügen und ggfls die targets direkt aurufen:
z.Bsp: ant -DmyProperty=abc dist

das spec nach /usr/src/packages/SPECS kopieren, alle sourcen nach /usr/src/packages/SOURCES

dann ein rpmbuild -bb /usr/src/packages/SPECS/name-des.spec und der Build startet. Die fertigen RPMs sind dann in /usr/src/package/RPMS/noarch

Code:
# Copyright (c) 2007 oc2pus
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments to oc2pus

# norootforbuild

Name:			jardepend
Version:		0.1
Release:		0.pm.1
Summary:		JarDepend analyzes the interdependencies between jar files
License:		GPL
URL:			http://sourceforge.net/projects/jardepend/
Group:			Development/Languages/Java
Source0:		%{name}-%{version}.tar.bz2
BuildRequires:	ant
BuildRequires:	java-1_5_0-sun-devel >= 1.5
BuildRequires:	jpackage-utils >= 1.5
BuildRequires:	update-alternatives
BuildRequires:	xml-commons-apis
Requires:		java >= 1.5
BuildRoot:		%{_tmppath}/%{name}-%{version}-%{release}-buildroot

%description
JarDepend analyzes the interdependencies between jar (java archive)
files. This is useful to add only the required dependencies in the
CLASSPATH.

Developed originally to get to know all dependencies of the jar file.

Use it with:
jardpend.sh [-options] -jarfile jarfilename -cp classpath

%package javadoc
Summary:	API Documentation for jardepend
Group:		Documentation/HTML

%description javadoc
API Documentation for jardepend.

%prep
%setup -q -n %{name}

%build
%ant \
	-DtargetOS="unix"

%install
# jars
%__install -dm 755 %{buildroot}%{_javadir}
%__install -m 644 dist/%{name}.jar \
	%{buildroot}%{_javadir}/%{name}-%{version}.jar
pushd %{buildroot}%{_javadir}
	for jar in *-%{version}*; do \
		ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`
	done
popd

# javadoc
%__install -dm 755 %{buildroot}%{_javadocdir}/%{name}-%{version}
%__cp -pr dist/javadoc/* \
	%{buildroot}%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name} # ghost symlink

# startscript
%__cat > %{name}.sh << EOF
#!/bin/sh

# source the jpackage helpers
VERBOSE=1
. %{_javadir}-utils/java-functions

# set JAVA_* environment variables
set_javacmd
check_java_env
set_jvm_dirs

CLASSPATH=\`build-classpath %{name}\`
MAIN_CLASS="com.jardepend.JarDepend"

run "\$@"
EOF
%__install -dm 755 %{buildroot}%{_bindir}
%__install -m 755 %{name}.sh \
	%{buildroot}%{_bindir}

%clean
[ -d %{buildroot} -a "%{buildroot}" != "" ] && %__rm -rf %{buildroot}

%post javadoc
%__rm -f %{_javadocdir}/%{name}
ln -s %{name}-%{version} %{_javadocdir}/%{name}

%files
%defattr(-,root,root,-)
%doc README.txt
%{_bindir}/*.sh
%{_javadir}/%{name}*.jar

%files javadoc
%defattr(644,root,root,755)
%doc %{_javadocdir}/%{name}-%{version}
%ghost %doc %{_javadocdir}/%{name}

%changelog
* Thu Jun 28 2007 oc2pus <oc2pus@zuhause.de> - 0.1-0.pm.1
- Initial build 0.1
 
OP
B

burbacher.de

Newbie
Danke schon mal für das file.
Leider bricht es bei mir immer bei folgendem ab:

Code:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.32200
+ umask 022
+ cd /usr/src/packages/BUILD
+ cd /usr/src/packages/BUILD
+ rm -rf Leitstand
+ /usr/bin/gzip -dc /usr/src/packages/SOURCES/Leitstand.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd Leitstand
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chown -Rhf root .
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chgrp -Rhf root .
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ $'\r'
: command not found200: line 33:
error: Bad exit status from /var/tmp/rpm-tmp.32200 (%prep)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.32200 (%prep)

Ne Idee an was das liegen könnte?


und ich brauch auch die ganzen build Befehle nicht, da das ganze ja schaon auf nem anderen Rechner kombiliert wurde.
es muss nur noch aus den ganzen Dateien ein rpm werden.

gruß burbacher
 

oc2pus

Ultimate Guru
ja, du hast das unter windows kopiert ?
dann unter linux mit dos2unix das spec umwandeln.

ansonsten poste dein SPEC-file mal ...

du kannst in der build-Sektion auch schreiben:
jar cf meinJar.jar *.class

du kannst als Source: dein jar angeben,

dann in der prep-Sektion:
ein -c (create) einfügen damit ein "BAU" verzeichnis angelegt wird und statt ant aufzurufen schreibst du einen copy (cp) Befehl hin.

Beispiel; hier wird das jar nur verpackt, nix compiliert etc ..

Code:
...
Source0:		%{name}-%{version}.jar

...
%prep 
%setup -q -T -c %{name}

%build
#nix :)

%install
# jars
%__install -dm 755 %{buildroot}%{_javadir}
%__install -m 644 %{SOURCE0} \
	%{buildroot}%{_javadir}/%{name}.jar
...
 
Oben