Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
installsystems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Seblu
installsystems
Commits
880c528c
Commit
880c528c
authored
13 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
Adding script is now done one by one and not recursively
parent
9e30b8a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
installsystems/image.py
+29
-13
29 additions, 13 deletions
installsystems/image.py
with
29 additions
and
13 deletions
installsystems/image.py
+
29
−
13
View file @
880c528c
...
...
@@ -162,12 +162,9 @@ class SourceImage(Image):
arrow
(
"
Add format
"
)
tarball
.
add_str
(
"
format
"
,
self
.
format
,
tarfile
.
REGTYPE
,
0444
)
# add parser scripts
arrow
(
"
Add parser scripts
"
)
tarball
.
add
(
self
.
parser_path
,
arcname
=
"
parser
"
,
recursive
=
True
,
filter
=
self
.
_tar_scripts_filter
)
self
.
_add_scripts
(
tarball
,
self
.
parser_path
)
# add setup scripts
tarball
.
add
(
self
.
setup_path
,
arcname
=
"
setup
"
,
recursive
=
True
,
filter
=
self
.
_tar_scripts_filter
)
self
.
_add_scripts
(
tarball
,
self
.
setup_path
)
# closing tarball file
tarball
.
close
()
arrowlevel
(
-
1
)
...
...
@@ -245,16 +242,35 @@ class SourceImage(Image):
fsource
.
close
()
fdest
.
close
()
def
_
tar
_scripts
_filter
(
self
,
t
info
):
def
_
add
_scripts
(
self
,
t
arball
,
directory
):
'''
Filter files which can be included in scripts
tarball
Add scripts inside a directory into a
tarball
'''
if
not
re
.
match
(
"
(parser|setup)(/\d+-.*\.py)?$
"
,
tinfo
.
name
):
return
None
tinfo
.
mode
=
0755
tinfo
.
uid
=
tinfo
.
gid
=
0
tinfo
.
uname
=
tinfo
.
gname
=
"
root
"
return
tinfo
basedirectory
=
os
.
path
.
basename
(
directory
)
arrow
(
"
Add %s scripts
"
%
basedirectory
)
arrowlevel
(
1
)
# adding base directory
ti
=
tarball
.
gettarinfo
(
directory
,
arcname
=
basedirectory
)
ti
.
mode
=
0755
ti
.
uid
=
ti
.
gid
=
0
ti
.
uname
=
ti
.
gname
=
"
root
"
tarball
.
addfile
(
ti
)
# adding each file
for
fi
in
os
.
listdir
(
directory
):
# check name
if
not
re
.
match
(
"
\d+-.*\.py$
"
,
fi
):
debug
(
"
name %s skipped: invalid name
"
%
fi
)
continue
# adding file
ti
=
tarball
.
gettarinfo
(
os
.
path
.
join
(
directory
,
fi
),
arcname
=
os
.
path
.
join
(
basedirectory
,
os
.
path
.
basename
(
fi
)))
ti
.
mode
=
0755
ti
.
uid
=
ti
.
gid
=
0
ti
.
uname
=
ti
.
gname
=
"
root
"
tarball
.
addfile
(
ti
)
arrow
(
"
%s added
"
%
fi
)
arrowlevel
(
-
1
)
def
generate_json_description
(
self
,
payloads
):
'''
...
...
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