Compare commits

..

No commits in common. "c9s" and "c8" have entirely different histories.
c9s ... c8

7 changed files with 69 additions and 107 deletions

13
LICENSE
View File

@ -1,13 +0,0 @@
Copyright (c) 2025 Red Hat Inc.
All rights reserved.
Redistribution and use in source and binary forms are permitted
provided that the above copyright notice and this paragraph are
duplicated in all such forms and that any documentation, advertising
materials, and other materials related to such distribution and use
acknowledge that the software was developed by Red Hat Inc. The name
of Red Hat Inc. may not be used to endorse or promote products derived
from this software without specific prior written permission. THIS
SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

14
SOURCES/LICENSE Normal file
View File

@ -0,0 +1,14 @@
Copyright (c) 2015 Red Hat inc.
All rights reserved.
Redistribution and use in source and binary forms are permitted
provided that the above copyright notice and this paragraph are
duplicated in all such forms and that any documentation,
advertising materials, and other materials related to such
distribution and use acknowledge that the software was developed
by the Red Hat inc. The name of the Red Hat inc. may not be used
to endorse or promote products derived from this software without
specific prior written permission. THIS SOFTWARE IS PROVIDED
``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -53,29 +53,25 @@ local function dirWithParents(path)
s = s .. "/" .. d
local stat2 = posix.stat(s, "type");
if (stat2 == nil) then
debugOneLinePrint(s .. " does not exist. Creating")
debugOneLinePrint(s .. " does not exists, creating")
if (not dry) then
posix.mkdir(s)
end
else
debugOneLinePrint(s .. " exists. Not creating")
debugOneLinePrint(s .. " exists,not creating")
end
end
end
function getVersion()
return ##VERSION##
end
-- main function,
-- formerly main body
-- moved to function resolved
-- formelry main body
-- move to function resolved
-- https://bugzilla.redhat.com/show_bug.cgi?id=1892224
-- for readability not indented, todo, indent once tuned
function M.mainProgram(arg)
debugOneLinePrint("cjc: lua debug on")
debugOneLinePrint("cjc version " .. getVersion())
local caredFiles = { "jre/lib/calendars.properties",
"jre/lib/content-types.properties",
"jre/lib/flavormap.properties",
@ -119,11 +115,6 @@ function M.mainProgram(arg)
end
return 0;
end
if (arg[1] == "--version") then
print(getVersion())
return 0;
end
-- yum install lua-posix
local posix = require "posix"
@ -140,37 +131,28 @@ function M.mainProgram(arg)
for i = 1, #arg, 2 do
if (arg[i] == "--help" or arg[i] == "-h") then
print("cjc version " .. getVersion())
print("")
print("All but jvmDestdir and debug are mandatory")
print("all but jvmDestdir and debug are mandatory")
print(" --currentjvm")
print(" <name>-<version>-<release>.<arch> of currently installed java")
print(" NVRA of currently installed java")
print(" --jvmdir")
print(" Directory where to find this virtual machine. Generally /usr/lib/jvm")
print(" Directory where to find this kind of virtual machine. Generally /usr/lib/jvm")
print(" --origname")
print(" convenient switch to specify full name of the JDK. Generally java-<version>-vendor")
print(" convinient switch to determine jdk. Generally java-1.X.0-vendor")
print(" --origjavaver")
print(" convenient switch to specify the JDK's version. Generally X or 1.X.0")
print(" convinient switch to determine jdk's version. Generally 1.X.0")
print(" --arch")
print(" convenient switch to specify the JDK's architecture")
print(" convinient switch to determine jdk's arch")
print(" --jvmDestdir")
print(" Migration/testing switch. Target mostly the same as jvmdir, but you may want to copy outside it.")
print(" Migration/testing switch. Target Mostly same as jvmdir, but you may wont to copy ouside it.")
print(" --debug or $debug")
print(" Enables printing out what is going on. true/false. False by default")
print(" Enables printing out whats going on. true/false. False by default")
print(" --temp")
print(" optional file to save intermediate result - directory configs were copied from")
print(" --dry")
print(" true/false. If true, then no changes will be written to disk except one tmp file. False by default")
print("")
print("**** Special Parameters ****")
print(" true/fase if true, then no changes will be written to disk except one tmp file. False by default")
print(" **** specil parasm ****")
print(" --list")
print(" if present on cmdline, lists all cared files and exits")
print(" --version")
print(" if present on cmdline, outputs the version and exits")
print("")
print("**** Example ****")
print(" --currentjvm java-1.8.0-openjdk-1.8.0.65-3.b17.fc22.x86_64 --jvmdir /usr/lib/jvm")
print(" --origname java-1.8.0-openjdk --origjavaver 1.8.0 --arch x86_64 --jvmDestdir /home/jvanek/Desktop")
print(" if present on cmdline, list all cared files and exists")
os.exit(0)
end
if (arg[i] == "--currentjvm") then
@ -250,11 +232,11 @@ function M.mainProgram(arg)
if (string.find(p, name .. "%-" .. javaver .. ".*" .. arch) ~= nil) then
debugOneLinePrint("matched: " .. p)
if (currentjvm == p) then
debugOneLinePrint("This jdk is already installed. Exiting lua script")
debugOneLinePrint("this jdk is already installed. exiting lua script")
return
end ;
if (string.match(p, ".*-debug$")) then
print(p .. " matched but seems to be a debug variant. Skipping")
print(p .. " matched but seems to be debug variant. Skipping")
else
table.insert(jvms, p)
end
@ -264,11 +246,11 @@ function M.mainProgram(arg)
end
if (#jvms <= 0) then
debugOneLinePrint("No matching jdk in " .. jvmdir .. " exit")
debugOneLinePrint("no matching jdk in " .. jvmdir .. " exit")
return
end ;
debugOneLinePrint("Matched " .. #jvms .. " jdk in " .. jvmdir)
debugOneLinePrint("matched " .. #jvms .. " jdk in " .. jvmdir)
--full names are like java-1.7.0-openjdk-1.7.0.60-2.4.5.1.fc20.x86_64
table.sort(jvms, function(a, b)
@ -302,7 +284,7 @@ function M.mainProgram(arg)
end)
if (debug) then
print("Sorted list of jvms")
print("sorted lsit of jvms")
for i, file in pairs(jvms) do
print(file)
end
@ -312,7 +294,7 @@ function M.mainProgram(arg)
if (temp ~= nil) then
src = jvmdir .. "/" .. latestjvm
debugOneLinePrint("Temp declared as " .. temp .. ". Saving used dir of " .. src)
debugOneLinePrint("temp declared as " .. temp .. " saving used dir of " .. src)
file = io.open(temp, "w")
file:write(src)
file:close()
@ -340,35 +322,35 @@ function M.mainProgram(arg)
if (not ((link) == (SOURCE))) then
debugOneLinePrint("WARNING link " .. link .. " where file " .. SOURCE .. " expected!")
debugOneLinePrint("Will try to copy link target rather then link itself!")
-- replacing any NVRA by future NVRA (still expecting to have NVRA for any multiple-installable targets)
-- lua stubbornly consider dash as interval. Replacing by dot to match X-Y more correct as X.Y rather then not at all
--replacing any NVRA by future NVRA (still execting to have NVRA for any multiple-installable targets
-- lua stubbornly consider dash as inteval. Replacing by dot to match X-Y more correct as X.Y rather then not at all
local linkDest = string.gsub(link, latestjvm:gsub("-", "."), currentjvm)
debugOneLinePrint("attempting to copy " .. link .. " to " .. linkDest)
if (link == linkDest) then
debugOneLinePrint("These are identical files. Nothing to do.")
debugOneLinePrint("Those are identical files! Nothing to do!")
else
local exe2 = "cp" .. " -ar " .. link .. " " .. linkDest
dirWithParents(linkDest)
debugOneLinePrint("Executing " .. exe2)
debugOneLinePrint("executing " .. exe2)
if (not dry) then
os.execute(exe2)
end
end
else
debugOneLinePrint("Executing " .. exe)
debugOneLinePrint("executing " .. exe)
if (not dry) then
os.execute(exe)
end
end
else
debugOneLinePrint(SOURCE .. " does not exist")
debugOneLinePrint(SOURCE .. " does not exists")
end
end
end --unindented main function
if (arg == nil) then
debugOneLinePrint("arg variable is nil. You have to call mainProgram manually") -- this can actually not be invoked, as the debug is set via arg
debugOneLinePrint("arg variable is nil, you have to call mainProgram manually") -- this can actually not be invoked, as the debug is set via arg
else
M.mainProgram(arg)
end

View File

@ -7,23 +7,23 @@ Name: copy-jdk-configs
# hash relevant to version tag
%global htag 88d3ed89f30d8b0eb4877d860fa8d951f224f156
Version: 4.1
Release: 1%{?dist}
Version: 4.0
Release: 2%{?dist}
Summary: JDKs configuration files copier
License: BSD
URL: https://pagure.io/%{project}
Source0: %{URL}/blob/%{htag}/f/%{file}.in
Source0: %{URL}/blob/%{htag}/f/%{file}
Source1: %{URL}/blob/%{htag}/f/LICENSE
Source2: %{URL}/blob/%{htag}/f/%{fixFile}
# we need to duplicate most of the percents in that script so they survive rpm expansion (even in that sed they have to be duplicated)
%global pretrans_install %(cat %{SOURCE0} | sed s/%%/%%%%/g | sed s/\\^%%%%/^%%/g | sed "s|##VERSION##|%{version}|")
# we need to duplicate msot of the percents in that script so they survive rpm expansion (even in that sed they have to be duplicated)
%global pretrans_install %(cat %{SOURCE0} | sed s/%%/%%%%/g | sed s/\\^%%%%/^%%/g)
BuildArch: noarch
Requires: lua
Requires: lua-posix
#Requires: lua-posix
# rh1965305 - copy-jdk-configs script uses find and xargs but RPM does not depend on them
Requires: findutils
OrderWithRequires: findutils
@ -35,6 +35,7 @@ archiving. With script to fix incorrectly created rpmnew files
%prep
cp -a %{SOURCE1} .
%build
#blob
@ -60,7 +61,8 @@ end
%install
mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}
sed -e "s|##VERSION##|%{version}|" %{SOURCE0} > $RPM_BUILD_ROOT/%{_libexecdir}/%{file}
cp -a %{SOURCE0} $RPM_BUILD_ROOT/%{_libexecdir}/%{file}
chmod 644 $RPM_BUILD_ROOT/%{_libexecdir}/%{file}
cp -a %{SOURCE2} $RPM_BUILD_ROOT/%{_libexecdir}/%{fixFile}
%posttrans
@ -74,44 +76,27 @@ rm "%{rpm_state_dir}/%{file}" 2> /dev/null || :
%license LICENSE
%changelog
* Thu Jan 09 2025 Andrew Hughes <gnu.andrew@redhat.com> - 4.1-1
- Provide programmatic access to the copy-jdk-configs version
- Resolves: RHEL-73278
* Tue Jun 08 2021 Jiri Vanek <jvanek@redhat.com> - 4.0-2
- commented out requires lua-posix, it was always commented out in el8, never in fedora. IDK
- Resolves: rhbz#1953923
* Thu Jan 09 2025 Andrew Hughes <gnu.andrew@redhat.com> - 4.0-4
- Cleanup typos and help output
- Related: RHEL-73278
* Tue Jun 08 2021 Jiri Vanek <jvanek@redhat.com> - 4.0-1
- rebased to 4.0
- Resolves: rhbz#1953923
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 4.0-3
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu Jul 09 2020 Jiri Vanek <jvanek@redhat.com> - 3.7-3
- added link to http://hydra.brq.redhat.com:8080/view/c~j~c/#projectstatus
- removed source check from test.yaml
- added gating.yaml
- Resolves: rhbz#1855374
* Tue Jun 08 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-1
- added requires and orderWithRequires of findutils to provide find and xargs (rh1965305)
* Thu Jul 09 2020 Jiri Vanek <jvanek@redhat.com> - 3.7-3
- added gatnig placeholder
- Resolves: rhbz#1855374
* Thu Apr 29 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-0
- bumped to 4.0 to resolve remvoed rpm 4.17 removing arg from global table
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.7-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.7-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jun 30 2020 Andrew Hughes <gnu.andrew@redhat.com> - 3.7-6
- Rebuilt for lua 5.4.0.
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.7-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.7-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Jul 09 2020 Jiri Vanek <jvanek@redhat.com> - 3.7-2
- added nss.fips.cfg to cared files
- Resolves: rhbz#1855374
* Wed May 02 2018 Jiri Vanek <jvanek@redhat.com> - 3.7-1
- udpated to latst relase
@ -126,6 +111,7 @@ rm "%{rpm_state_dir}/%{file}" 2> /dev/null || :
* Mon Apr 30 2018 Jiri Vanek <jvanek@redhat.com> - 3.3-10
- added javaws.policy and blacklist
- fixed rhbz#1541838
* Tue Apr 03 2018 Jiri Vanek <jvanek@redhat.com> - 3.3-5
- fixed rhbz#1541838

View File

@ -1,7 +0,0 @@
# recipients: java-qa
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}