aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas C. Villa Real <lucasvr@gmail.com>2016-12-29 20:31:49 -0200
committerLucas C. Villa Real <lucasvr@gmail.com>2016-12-29 20:31:49 -0200
commitb418221f7ea103f76d7adeb295450ca888419270 (patch)
tree2a917308bbbf5c983d6942367b1670a255419836
parent0e37bc88a4d19144e6c9614cf6ff134cfa26be99 (diff)
downloadThirdPartyInstallers-b418221f7ea103f76d7adeb295450ca888419270.tar.xz
Improve population of Resources:
- Dependencies: if multiple RPM files are merged to a single entry under /Programs, then the deps of all packages are reported on this file; - Architecture: always populated. 'uname -m' is used as fallback; - Revision: always populated. When multiple RPM packages are merged to a single entry under /Programs, only the revision of the last package is stored on this file; - PackageSource: this is a new file. It contains a [File] field with the name of the RPM file installed and a [Distribution] field that tells for which distro the RPM has been packed. When multiple RPM packages are given as input a blank line will separate each [File],[Distribution] pair.
-rwxr-xr-xbin/InstallPackage-RPM105
1 files changed, 60 insertions, 45 deletions
diff --git a/bin/InstallPackage-RPM b/bin/InstallPackage-RPM
index d5af1b8..a977188 100755
--- a/bin/InstallPackage-RPM
+++ b/bin/InstallPackage-RPM
@@ -156,26 +156,84 @@ function flatten_rpm() {
rmdir * 2> /dev/null
}
+function populate_dependencies() {
+ local rpmfile="$1"
+ rpminfo --dependencies "$rpmfile" | while read dependency
+ do
+ if echo "$dependency" | grep -q "^/"
+ then
+ depinfo=$(take_dependency_from_path "$rpmfile" "$dependency" "")
+ if [ "$depinfo" ]
+ then echo "$depinfo"
+ else echo "# Unresolved dependency: $dependency"
+ fi
+ elif echo "$dependency" | grep -q "^lib.*.so*"
+ then
+ libname=$(echo "$dependency" | cut -d'(' -f1)
+ wantedsymbol=$(echo "$dependency" | cut -d'(' -f2 | cut -d')' -f1)
+ depinfo=$(take_dependency_from_path "$rpmfile" "$goboLibraries/$libname" "$wantedsymbol")
+ if [ "$depinfo" ]
+ then echo "$depinfo"
+ else echo "# Unresolved dependency: $dependency"
+ fi
+ elif is_basic_symbol "$dependency"
+ then
+ Log_Verbose "Skipping basic symbol: $dependency"
+ elif is_rpmlib_symbol "$dependency"
+ then
+ Log_Verbose "Skipping internal symbol: $dependency"
+ else
+ depinfo=$(lookup_pkgname "$dependency")
+ if [ "$depinfo" ]
+ then echo "$depinfo"
+ else echo "# Unresolved dependency: $dependency"
+ fi
+ fi
+ done
+}
+
function populate_resources() {
local rpmfile="$1"
local arch=$(rpminfo --arch "$rpmfile")
local description=$(rpminfo --description "$rpmfile")
+ local release=$(rpminfo --release "$rpmfile")
+ local distro=$(rpminfo --distribution "$rpmfile")
Log_Normal "Populating Resources."
mkdir -p Resources
+
if [ "$arch" ]
- then echo "$arch" > Resources/Architecture
+ then echo "$arch" > Resources/Architecture
else echo "$(uname -m)" > Resources/Architecture
fi
+ echo "$release" > Resources/Revision
+
+ # Note that we never truncate neither Resources/PackageSource nor
+ # Resources/Description or Resources/Dependencies. This is to
+ # enable the installation of multiple RPM files under the same
+ # /Programs entry while keeing metadata of all the original files
+ # around.
+
+ [ -e Resources/PackageSource ] && echo >> Resources/PackageSource
+ echo "[File] $(basename $rpmfile)" >> Resources/PackageSource
+ echo "[Distribution] $distro" >> Resources/PackageSource
+
if [ "$description" ]
then
- cat /dev/null > Resources/Description
+ [ -e Resources/Description ] && echo "" >> Resources/Description
echo "[Name] $(rpminfo --name $rpmfile)" >> Resources/Description
echo "[Summary] $(rpminfo --summary $rpmfile)" >> Resources/Description
echo "[License] $(rpminfo --license $rpmfile)" >> Resources/Description
echo "[Description] $(rpminfo --description $rpmfile)" >> Resources/Description
echo "[Homepage] $(rpminfo --url $rpmfile)" >> Resources/Description
fi
+
+ Log_Normal "Processing dependencies."
+ alldeps=$(mktemp InstallPackage-RPM.XXXXXXXXXX)
+ populate_dependencies "$rpmfile" >> Resources/Dependencies
+ cat Resources/Dependencies | sort -n | uniq > "$alldeps"
+ cat "$alldeps" > Resources/Dependencies
+ rm -f -- "$alldeps"
}
function lookup_symbol() {
@@ -311,48 +369,6 @@ function is_rpmlib_symbol() {
return 1
}
-function populate_dependencies_loop() {
- local rpmfile="$1"
- rpminfo --dependencies "$rpmfile" | while read dependency
- do
- if echo "$dependency" | grep -q "^/"
- then
- depinfo=$(take_dependency_from_path "$rpmfile" "$dependency" "")
- if [ "$depinfo" ]
- then echo "$depinfo"
- else echo "# Unresolved dependency: $dependency"
- fi
- elif echo "$dependency" | grep -q "^lib.*.so*"
- then
- libname=$(echo "$dependency" | cut -d'(' -f1)
- wantedsymbol=$(echo "$dependency" | cut -d'(' -f2 | cut -d')' -f1)
- depinfo=$(take_dependency_from_path "$rpmfile" "$goboLibraries/$libname" "$wantedsymbol")
- if [ "$depinfo" ]
- then echo "$depinfo"
- else echo "# Unresolved dependency: $dependency"
- fi
- elif is_basic_symbol "$dependency"
- then
- Log_Verbose "Skipping basic symbol: $dependency"
- elif is_rpmlib_symbol "$dependency"
- then
- Log_Verbose "Skipping internal symbol: $dependency"
- else
- depinfo=$(lookup_pkgname "$dependency")
- if [ "$depinfo" ]
- then echo "$depinfo"
- else echo "# Unresolved dependency: $dependency"
- fi
- fi
- done
-}
-
-function populate_dependencies() {
- local rpmfile="$1"
- Log_Normal "Processing dependencies."
- populate_dependencies_loop "$rpmfile" | sort -n | uniq
-}
-
function deduce_program_name() {
local rpmfile="$1"
local name=$(rpminfo --name "$rpmfile")
@@ -414,7 +430,6 @@ do
uncompress_rpm "$rpmfile"
flatten_rpm "$rpmfile"
populate_resources "$rpmfile"
- populate_dependencies "$rpmfile"
Quiet popd
Is_URL "$entry" && rm -f -- "$rpmfile"