Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
73c4d073
Commit
73c4d073
authored
3 years ago
by
Aurélien Gounon
Browse files
Options
Downloads
Patches
Plain Diff
add cta-versionlock helper script
parent
740e3847
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ReleaseNotes.md
+1
-0
1 addition, 0 deletions
ReleaseNotes.md
cta-release/CMakeLists.txt
+2
-1
2 additions, 1 deletion
cta-release/CMakeLists.txt
cta-release/cta-versionlock
+170
-0
170 additions, 0 deletions
cta-release/cta-versionlock
cta.spec.in
+11
-11
11 additions, 11 deletions
cta.spec.in
with
184 additions
and
12 deletions
ReleaseNotes.md
+
1
−
0
View file @
73c4d073
...
...
@@ -3,6 +3,7 @@
## Summary
### Features
-
cta/CTA#983 Add cta-versionlock helper script to cta-release package
### Bug fixes
-
cta/CTA#1029 Fix segmentatin fault in frontend when list repacks of a tape that has been deleted in the catalogue
...
...
This diff is collapsed.
Click to expand it.
cta-release/CMakeLists.txt
+
2
−
1
View file @
73c4d073
...
...
@@ -73,4 +73,5 @@ install (FILES ${KEY_FILES}
install
(
FILES ../continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list
DESTINATION
${
CMAKE_INSTALL_SYSCONFDIR
}
/yum/pluginconf.d
RENAME versionlock.cta
)
install
(
FILES
${
CMAKE_CURRENT_SOURCE_DIR
}
/cta-versionlock
DESTINATION usr/
${
CMAKE_INSTALL_BINDIR
}
)
This diff is collapsed.
Click to expand it.
cta-release/cta-versionlock
0 → 100755
+
170
−
0
View file @
73c4d073
#!/usr/bin/python
import
os.path
import
sys
import
re
from
rpmUtils.miscutils
import
splitFilename
from
collections
import
defaultdict
vfiles
=
{
'
cta
'
:
'
/etc/yum/pluginconf.d/versionlock.cta
'
,
'
yum
'
:
'
/etc/yum/pluginconf.d/versionlock.list
'
}
versions
=
defaultdict
(
dict
)
summary
=
defaultdict
(
list
)
actions
=
(
'
check
'
,
'
apply
'
,
'
forceupdate
'
,
'
clear
'
)
retcode
=
0
try
:
FileNotFoundError
except
NameError
:
FileNotFoundError
=
IOError
def
usage
():
print
(
"
\n
%s: command line tool to manage cta packages versionlock
\n
\
\n
\
usage: %s check|apply|forceupdate|clear
\n
\
check: show cta versionlock status
\n
\
apply: add cta versions to versionlock file
\n
\
forceupdate: add cta versions to versionlock file and overwrite already defined versions
\n
\
clear: remove all cta versions from versionlock file
\n
\
"
%
(
sys
.
argv
[
0
],
sys
.
argv
[
0
]))
exit
(
1
)
# Compare versions in both version lists
def
matchPkg
(
pkglist
):
for
p
,
version
in
pkglist
.
items
():
try
:
versions
[
'
yum
'
][
p
]
except
:
summary
[
'
missing
'
].
append
(
p
)
continue
else
:
if
versions
[
'
yum
'
][
p
][:
-
1
]
==
version
[:
-
1
]:
summary
[
'
present
'
].
append
(
p
)
else
:
summary
[
'
wrong_version
'
].
append
(
p
)
# add cta versions to yum versionlock file
def
addtoVfile
(
pkglist
):
with
open
(
vfiles
[
'
yum
'
],
'
a
'
)
as
f
:
for
p
in
pkglist
:
(
e
,
v
,
r
,
a
)
=
versions
[
'
cta
'
][
p
][:]
package
=
(
"
%s:%s-%s-%s.%s
"
%
(
e
,
p
,
v
,
r
,
a
))
f
.
write
(
package
+
'
\n
'
)
# force update existing versions in yum versionlock with cta one
def
updateVfile
(
pkglist
):
with
open
(
vfiles
[
'
yum
'
],
'
r+
'
)
as
f
:
content
=
f
.
read
()
for
p
in
pkglist
:
ver
=
{}
for
t
in
'
yum
'
,
'
cta
'
:
(
e
,
v
,
r
,
a
)
=
versions
[
t
][
p
][:]
ver
[
t
]
=
(
"
%s:%s-%s-%s.%s
"
%
(
e
,
p
,
v
,
r
,
a
))
content
=
re
.
sub
(
ver
[
'
yum
'
],
ver
[
'
cta
'
],
content
)
f
.
seek
(
0
)
f
.
write
(
content
)
f
.
truncate
()
# clear cta versions from yum versionlock
def
clearPkgs
(
pkglist
):
with
open
(
vfiles
[
'
yum
'
],
'
r+
'
)
as
f
:
content
=
f
.
read
()
for
p
in
pkglist
:
(
e
,
v
,
r
,
a
)
=
versions
[
'
cta
'
][
p
][:]
line
=
(
"
%s:%s-%s-%s.%s
\n
"
%
(
e
,
p
,
v
,
r
,
a
))
content
=
re
.
sub
(
line
,
''
,
content
)
f
.
seek
(
0
)
f
.
write
(
content
)
f
.
truncate
()
# check arguments
if
len
(
sys
.
argv
)
!=
2
:
usage
()
action
=
sys
.
argv
[
1
]
if
action
not
in
actions
:
print
(
"
Error: option %s is not valid
"
%
sys
.
argv
[
1
])
usage
()
# read version files
for
fname
,
vfile
in
vfiles
.
items
():
if
not
os
.
path
.
isfile
(
vfile
):
raise
FileNotFoundError
(
"
file %s not found
"
%
vfile
)
with
open
(
vfile
)
as
f
:
plist
=
f
.
read
().
splitlines
()
for
p
in
plist
:
if
p
==
""
or
p
.
startswith
(
'
#
'
):
continue
(
n
,
v
,
r
,
e
,
a
)
=
splitFilename
(
p
)
versions
[
fname
][
n
]
=
[
e
,
v
,
r
,
a
]
# check if packages versions exist in yum versionlock file (ignore arch)
matchPkg
(
versions
[
'
cta
'
])
# return summary
if
(
action
==
'
check
'
):
for
status
,
content
in
summary
.
items
():
print
(
"
\n
=> %s: (%s/%s)
"
%
(
status
,
len
(
content
),
len
(
versions
[
'
cta
'
])))
print
(
"
\n
"
.
join
(
content
))
if
(
"
missing
"
in
summary
or
"
wrong_version
"
in
summary
):
retcode
=
2
# add cta packages to versionlock file
elif
(
action
==
'
apply
'
):
if
"
missing
"
in
summary
:
print
(
"
\n
Adding %s packages to version lock file:
"
%
len
(
summary
[
'
missing
'
]))
print
(
"
\n
"
.
join
(
summary
[
'
missing
'
]))
addtoVfile
(
summary
[
'
missing
'
])
else
:
print
(
"
\n
Nothing to do
"
)
if
"
wrong_version
"
in
summary
:
print
(
"
\n
WARNING: the following packages have a different version specified in versionlock file:
"
)
print
(
'
\n
'
.
join
(
summary
[
'
wrong_version
'
]))
print
(
"
\n
They will not be changed unless you run %s with the
'
forceupdate
'
option
"
%
sys
.
argv
[
0
])
retcode
=
2
# overwrite existing versions in versionlock file
elif
(
action
==
'
forceupdate
'
):
if
"
wrong_version
"
in
summary
:
print
(
"
\n
Updating %s packages version in versionlock file:
"
%
len
(
summary
[
'
wrong_version
'
]))
for
p
in
summary
[
'
wrong_version
'
]:
print
(
"
%s: previous %s, new %s
"
%
(
p
,
'
:
'
.
join
(
versions
[
'
yum
'
][
p
]),
'
:
'
.
join
(
versions
[
'
cta
'
][
p
])))
updateVfile
(
summary
[
'
wrong_version
'
])
if
"
missing
"
in
summary
:
print
(
"
\n
Adding %s packages to version lock file:
"
%
len
(
summary
[
'
missing
'
]))
print
(
"
\n
"
.
join
(
summary
[
'
missing
'
]))
addtoVfile
(
summary
[
'
missing
'
])
if
(
not
summary
[
'
missing
'
]
and
not
summary
[
'
wrong_version
'
]):
print
(
"
\n
Nothing to do
"
)
# remove cta versions from versionlock file
elif
(
action
==
'
clear
'
):
if
versions
[
'
cta
'
]:
clearPkgs
(
versions
[
'
cta
'
])
print
(
"
\n
Removing %s packages from versionlock file:
"
%
len
(
versions
[
'
cta
'
]))
print
(
"
\n
"
.
join
(
versions
[
'
cta
'
]))
else
:
print
(
"
\n
Nothing to do
"
)
print
(
'
\n
'
)
exit
(
retcode
)
This diff is collapsed.
Click to expand it.
cta.spec.in
+
11
−
11
View file @
73c4d073
...
...
@@ -513,20 +513,20 @@ Group: Application/CTA
Requires: yum-plugin-versionlock
%description -n cta-release
Repository configuration for CTA dependencies
This package contains .repo files, gpg keys and yum-versionlock configuration f
r
o CTA
This package contains .repo files, gpg keys and yum-versionlock configuration fo
r
CTA
%files -n cta-release
%defattr(0644,root,root)
%config(noreplace) %{_sysconfdir}/yum.repos.d/*
%{_sysconfdir}/pki/rpm-gpg/*
%{_sysconfdir}/yum/pluginconf.d/versionlock.cta
%defattr(-,root,root)
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/yum.repos.d/*
%attr(0644,root,root) %{_sysconfdir}/pki/rpm-gpg/*
%attr(0644,root,root) %{_sysconfdir}/yum/pluginconf.d/versionlock.cta
%attr(0755,root,root) %{_bindir}/cta-versionlock
%post -n cta-release
cat << EOF
------
CTA versionlock file installed as "%{_sysconfdir}/yum/pluginconf.d/versionlock.cta"
Remember to add its content to "%{_sysconfdir}/yum/pluginconf.d/versionlock.list" to enable it.
------
EOF
/usr/bin/cta-versionlock apply
%preun -n cta-release
/usr/bin/cta-versionlock clear
%changelog
* Wed Aug 18 2021 volodymyr.yurchenko (at) cern.ch - 4.1-1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment