commit d5f80cf13577bb9b3e936c4d3e8721c605c505df
Author: Richard Shaw <hobbes1069(a)gmail.com>
Date: Wed Jun 17 07:11:28 2020 -0500
Add automated bundled provides script proided by Alex Jacocks.
unifi.spec | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
version-scan.sh | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 143 insertions(+), 9 deletions(-)
---
diff --git a/unifi.spec b/unifi.spec
index e251465..1395435 100644
--- a/unifi.spec
+++ b/unifi.spec
@@ -46,16 +46,26 @@ Conflicts: unifi-controller
Provides: bundled(lato-fonts-web)
Provides: bundled(ubnt-fonts)
-# Bundled java ;obraries
-# This needs to be automated!
-
+# Bundled java libraries
+### BEGIN AUTOMATION ###
+Provides: bundled(ace) = 9999
+Provides: bundled(animal-sniffer-annotations) = 1.17
Provides: bundled(annotations) = 3.0.1
+Provides: bundled(api-common) = 1.7.0
+Provides: bundled(apigateway-generic-java-sdk) = 1.3
+Provides: bundled(auto-value) = 1.6.2
+Provides: bundled(aws-iot-device-sdk-java) = 1.2.0
Provides: bundled(aws-java-sdk-cloudwatch) = 1.11.409
Provides: bundled(aws-java-sdk-core) = 1.11.409
Provides: bundled(aws-java-sdk-s3) = 1.11.409
+Provides: bundled(bcpkix-jdk15on) = 1.60
+Provides: bundled(bcprov-jdk15on) = 1.60
+Provides: bundled(checker-qual) = 2.5.7
+Provides: bundled(classmate) = 1.5.0
+Provides: bundled(coloring) = 1.0
Provides: bundled(commons-beanutils) = 1.9.3
Provides: bundled(commons-codec) = 1.11
-Provides: bundled(commons-httpclient) = 3.1-2
+Provides: bundled(commons-httpclient-3.1-atlassian) = 2
Provides: bundled(commons-httpclient-contrib) = 3.1
Provides: bundled(commons-io) = 2.6
Provides: bundled(commons-lang) = 2.6
@@ -67,41 +77,92 @@ Provides: bundled(compiler) = 0.9.5
Provides: bundled(cron4j) = 2.2.5
Provides: bundled(dom4j) = 1.6.1
Provides: bundled(ecj) = 4.6.1
+Provides: bundled(eddsa) = 0.3.0
+Provides: bundled(error_prone_annotations) = 2.3.1
+Provides: bundled(gax) = 1.31.0
+Provides: bundled(google-api-client) = 1.26.0
+Provides: bundled(google-api-services-drive-v3-rev20180830) = 1.26.0
+Provides: bundled(google-api-services-storage-v1-rev20181013) = 1.26.0
+Provides: bundled(google-auth-library-credentials) = 0.11.0
+Provides: bundled(google-auth-library-oauth2-http) = 0.11.0
+Provides: bundled(google-cloud-core) = 1.44.0
+Provides: bundled(google-cloud-core-http) = 1.44.0
+Provides: bundled(google-cloud-storage) = 1.44.0
+Provides: bundled(google-http-client) = 1.26.0
+Provides: bundled(google-http-client-appengine) = 1.26.0
+Provides: bundled(google-http-client-gson) = 1.26.0
+Provides: bundled(google-http-client-jackson) = 1.26.0
+Provides: bundled(google-http-client-jackson2) = 1.26.0
+Provides: bundled(google-http-client-jdo) = 1.26.0
+Provides: bundled(google-oauth-client) = 1.26.0
Provides: bundled(gson) = 2.8.5
-Provides: bundled(guava) = 26.0
+Provides: bundled(guava-26.0) = jre
Provides: bundled(httpclient) = 4.5.6
Provides: bundled(httpcore) = 4.4.10
+Provides: bundled(j2objc-annotations) = 1.3
Provides: bundled(jackson-annotations) = 2.9.7
Provides: bundled(jackson-core) = 2.9.7
Provides: bundled(jackson-databind) = 2.9.7
+Provides: bundled(java-ipv6) = 0.17
+Provides: bundled(java-semver) = 0.9.0
+Provides: bundled(javax.mail) = 1.6.2
Provides: bundled(jedis) = 2.9.0
+Provides: bundled(jenetics) = 4.2.0
Provides: bundled(jmdns) = 3.4.1
Provides: bundled(joda-time) = 2.10.1
Provides: bundled(jorbis) = 0.0.17
+Provides: bundled(json) = 20180813
+Provides: bundled(jsr305) = 3.0.2
Provides: bundled(jstl) = 1.2
Provides: bundled(jstun) = 0.7.4
Provides: bundled(jul-to-slf4j) = 1.7.25
-Provides: bundled(log4j) = 2.11.1
+Provides: bundled(log4j-api) = 2.11.1
+Provides: bundled(log4j-core) = 2.11.1
+Provides: bundled(log4j-slf4j-impl) = 2.11.1
Provides: bundled(mongo-java-driver) = 3.4.3
-Provides: bundled(radclient4)
+Provides: bundled(openssh) = 1.0
+Provides: bundled(org.eclipse.paho.client.mqttv3) = 1.1.0
+Provides: bundled(owasp-java-html-sanitizer) = 20190503.1
+Provides: bundled(protobuf-java) = 3.6.1
+Provides: bundled(protobuf-java-util) = 3.6.1
+Provides: bundled(proto-google-common-protos) = 1.12.0
+Provides: bundled(proto-google-iam-v1) = 0.12.0
+Provides: bundled(radclient4) = 0.12.0
+Provides: bundled(servo-aws) = 0.12.25
Provides: bundled(servo-core) = 0.12.25
Provides: bundled(servo-graphite) = 0.12.25
Provides: bundled(slf4j-api) = 1.7.25
-Provides: bundled(slf4j-log4j12) = 1.7.25
Provides: bundled(snappy-java) = 1.1.7.2
+Provides: bundled(spectator-api) = 0.76.0
+Provides: bundled(spring-aop) = 5.1.2
Provides: bundled(spring-beans) = 5.1.2
Provides: bundled(spring-context) = 5.1.2
Provides: bundled(spring-core) = 5.1.2
Provides: bundled(spring-expression) = 5.1.2
+Provides: bundled(springfox-core) = 2.9.2
+Provides: bundled(springfox-schema) = 2.9.2
+Provides: bundled(springfox-spi) = 2.9.2
+Provides: bundled(springfox-spring-web) = 2.9.2
+Provides: bundled(springfox-swagger2) = 2.9.2
+Provides: bundled(springfox-swagger-common) = 2.9.2
+Provides: bundled(springfox-swagger-ui) = 2.9.2
+Provides: bundled(spring-plugin-core) = 1.2.0
+Provides: bundled(spring-plugin-metadata) = 1.2.0
Provides: bundled(spring-test) = 5.1.2
+Provides: bundled(spring-web) = 5.1.2
+Provides: bundled(spring-webmvc) = 5.1.5
Provides: bundled(sshj) = 0.26.0
+Provides: bundled(swagger-annotations) = 1.5.20
+Provides: bundled(swagger-models) = 1.5.20
Provides: bundled(tomcat-annotations-api) = 8.5.34
-Provides: bundled(tomcat-embed-core) = 8.5.34
+Provides: bundled(tomcat-embed-core) = 8.5.34
Provides: bundled(tomcat-embed-el) = 8.5.34
Provides: bundled(tomcat-embed-jasper) = 8.5.34
Provides: bundled(tomcat-embed-logging-juli) = 8.5.2
Provides: bundled(tomcat-embed-logging-log4j) = 8.5.2
+Provides: bundled(tomcat-embed-websocket) = 8.5.34
Provides: bundled(urlrewritefilter) = 4.0.4
+### END AUTOMATION ###
# So you can prevent automatic updates.
%if 0%{?fedora}
diff --git a/version-scan.sh b/version-scan.sh
new file mode 100755
index 0000000..3600c8d
--- /dev/null
+++ b/version-scan.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+SPECFILE=$(pwd)/unifi.spec
+
+SOURCES=$( spectool -l -s 0 $SPECFILE )
+DLURL=$( echo $SOURCES | egrep '^Source0:\s+' | sed 's/^Source0://' )
+SOURCEFILE=$(pwd)/$( echo $DLURL | sed 's/http.*\///' )
+TEMPDIR=$( mktemp -d -t unifi_XXXXXXXXXX )
+TEMPLIBDIR=$TEMPDIR/UniFi/lib
+VERSION=$( egrep '^Version:\s+' $SPECFILE | sed 's/^Version://' )
+VERSIONFILE=$TEMPDIR/provides.list
+if [ x"$VERSION" = x ]; then
+ echo "Unable to determine the version to scan from $SPECFILE. Exiting!"
+ exit 1
+fi
+
+echo DLURL is $DLURL
+echo SOURCEFILE is $SOURCEFILE
+echo TEMPDIR is $TEMPDIR
+echo TEMPLIBDIR is $TEMPLIBDIR
+echo VERSION is $VERSION
+
+if [ ! -x /usr/bin/unzip ]; then
+ echo "Unzip is required for this script. Exiting!"
+ exit 2
+fi
+
+if [ ! -f $SOURCEFILE ]; then
+ echo "Unable to find the required sourcefiles. Exiting!"
+ exit 3
+fi
+
+echo -n "Extracting $SOURCEFILE to $TEMPDIR..."
+unzip -q $SOURCEFILE -d $TEMPDIR
+if [ $? -ne 0 ]; then
+ echo "Failed to extract $SOURCEFILE to $TEMPDIR. Exiting!"
+ exit 4
+fi
+echo "done!"
+
+for file in `ls $TEMPLIBDIR/*.jar`; do
+
+ # try the file name
+ # get just the version, which is assumed to be -#[.#]+.jar
+ if [ `echo $file | grep -` ]; then
+ version=`echo $file | sed -e 's/\.jar$//' -e 's/.*-//' -e
's/\.RELEASE//'`
+ determination="filename"
+ fi
+
+ # if not, check to see if implementation-version is set, if so, go with it
+ if [ x${version} = x ]; then
+ version=`unzip -p $file META-INF/MANIFEST.MF | grep Implementation-Version | sed -e
's/^Implementation-Version: //' -e 's/\r//'`
+ determination="manifest"
+ fi
+
+ # if not, just give up, and say '9999'
+ if [ x${version} = x ]; then
+ version='9999'
+ determination="fallback"
+ fi
+
+ library=`echo $file | sed -e 's/.*\///' -e 's/\.jar$//' -e
"s/-$version//" -e 's/\.RELEASE//'`
+
+ # create output for RPM packaging
+ echo "Provides: bundled(${library}) = ${version}" >>
$VERSIONFILE
+
+done
+
+echo "Created provides list in $VERSIONFILE."
+
+echo -n "Updating $SPECFILE with jar library versions..."
+sed -i -n -e '1,/^### BEGIN AUTOMATION ###$/p' -e '/^### BEGIN AUTOMATION
###$/r '$VERSIONFILE -e '/^### END AUTOMATION ###$/,$p' $SPECFILE
+echo "done!"