Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dbp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
packages
dbp
Commits
59239e15
Commit
59239e15
authored
Apr 21, 2016
by
Steven Arnow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate desktop entry
parent
0ab3f369
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
dbp-validate-extracted/validate.c
dbp-validate-extracted/validate.c
+14
-6
dbpd/Makefile
dbpd/Makefile
+1
-1
No files found.
dbp-validate-extracted/validate.c
View file @
59239e15
...
...
@@ -39,7 +39,7 @@ struct CheckList {
struct
StringBufferContainer
notice
,
warning
,
error
;
struct
CheckList
*
icons_avail
,
*
icons_used
,
*
launchers_to_skip
,
*
execs_used
;
struct
CheckList
*
icons_avail
,
*
icons_used
,
*
launchers_to_skip
,
*
execs_used
,
*
desktop_files_to_scan
;
char
*
rootfs_path
=
NULL
,
*
meta_path
=
NULL
;
bool
directorylist_to_checklist
(
char
*
path
,
struct
CheckList
**
list
,
char
*
prefix
,
char
*
suffix
);
...
...
@@ -81,7 +81,7 @@ char *add_string_message(struct StringBufferContainer *cont, char *string) {
void
usage
()
{
fprintf
(
stdout
,
_
(
"Validates ingoing files before a DBP is created
\n
"
));
fprintf
(
stdout
,
_
(
"By Steven Arnow, 2015, version %s
\n
"
),
dbp_config_version_get
());
fprintf
(
stdout
,
_
(
"By Steven Arnow, 2015
-2016
, version %s
\n
"
),
dbp_config_version_get
());
fprintf
(
stdout
,
"
\n
"
);
fprintf
(
stdout
,
_
(
"Usage:
\n
"
));
fprintf
(
stdout
,
_
(
"dbp-validate-extracted <path to meta directory> [path to rootfs directory]
\n
"
));
...
...
@@ -195,12 +195,15 @@ bool validate_desktop_file(const char *path) {
}
else
LOG_FREE
((
asprintf
(
&
tmp
,
"Desktop file %s have an invalid type '%s' in its desktop entry"
,
path
,
tmp
),
tmp
),
error
),
valid
=
false
;
/* TODO: Check that all present keys are known */
if
(
!
(
tmp
=
dbp_desktop_lookup
(
df
,
"Name"
,
NULL
,
"Desktop Entry"
))
||
!
strlen
(
tmp
))
LOG_FREE
((
asprintf
(
&
tmp
,
"Desktop file %s does not have a name set in its desktop entry"
,
path
),
tmp
),
error
),
valid
=
false
;
if
(
!
(
tmp
=
dbp_desktop_lookup
(
df
,
"Icon"
,
NULL
,
"Desktop Entry"
))
||
!
strlen
(
tmp
))
LOG_FREE
((
asprintf
(
&
tmp
,
"Desktop file %s is missing an icon in its desktop entry"
,
path
),
tmp
),
warning
);
if
(
!
(
tmp
=
dbp_desktop_lookup
(
df
,
"Comment"
,
NULL
,
"Desktop Entry"
))
||
strlen
(
tmp
))
LOG_FREE
((
asprintf
(
&
tmp
,
"Desktop file %s is missing a comment in its desktop entry"
,
path
),
tmp
),
warning
);
if
(
!
(
tmp
=
dbp_desktop_lookup
(
df
,
"Icon"
,
NULL
,
"Desktop Entry"
))
||
!
strlen
(
tmp
))
LOG_FREE
((
asprintf
(
&
tmp
,
"Desktop file %s is missing an icon in its desktop entry"
,
path
),
tmp
),
warning
);
else
{
checklist_add
(
tmp
,
&
icons_used
);
if
(
!
checklist_find
(
tmp
,
icons_avail
))
...
...
@@ -261,16 +264,17 @@ bool validate_package_data(struct DBPDesktopFile *def) {
else
if
(
!
_conforms_strict_name_type
(
tmp
))
LOG
(
"default.desktop has an appdata directory specified, but it contains illegal characters"
,
error
);
/* Check package ID etc. etc. */
if
(
dbp_desktop_lookup_section
(
def
,
"Desktop Entry"
)
<
0
)
LOG
(
"default.desktop is lacking a [Desktop Entry], this package will not have a default launch action"
,
warning
);
asprintf
(
&
path
,
"%s/icons"
,
meta_path
);
if
(
!
directorylist_to_checklist
(
path
,
&
icons_avail
,
NULL
,
".png"
))
LOG_FREE
((
asprintf
(
&
tmp
,
"Icon directory '%s' is missing"
,
path
),
tmp
),
warning
);
directorylist_to_checklist
(
path
,
&
desktop_files_to_scan
,
NULL
,
".desktop"
);
if
(
!
icons_avail
)
LOG
(
"No icons found, this is probably not what you want"
,
warning
);
if
(
!
desktop_files_to_scan
)
LOG
(
"No desktop files found"
,
warning
);
return
true
;
}
...
...
@@ -300,6 +304,7 @@ bool directorylist_to_checklist(char *path, struct CheckList **list, char *prefi
int
main
(
int
argc
,
char
**
argv
)
{
struct
CheckList
*
next
;
struct
DBPDesktopFile
*
default_desk
;
if
(
argc
<
2
)
...
...
@@ -321,6 +326,9 @@ int main(int argc, char **argv) {
validate_package_data
(
default_desk
);
for
(
next
=
desktop_files_to_scan
;
next
;
next
=
next
->
next
)
validate_desktop_file
(
next
->
name
);
fatal:
print_messages
();
...
...
dbpd/Makefile
View file @
59239e15
...
...
@@ -9,7 +9,7 @@ LDFLAGS += `pkg-config glib-2.0 --libs gio-unix-2.0` -ldbpbase
all
:
$(OBJFILES) $(DEPENDS)
@
echo
" [ LD ]
$(DAEMONBIN)
"
@
$(CC)
-o
$(DAEMONBIN)
$(OBJFILES)
-ldbpbase
$(LDPATH)
$(LDFLAGS)
@
$(CC)
-o
$(DAEMONBIN)
$(OBJFILES)
$(LDPATH)
-ldbpbase
$(LDFLAGS)
@
echo
"Done."
@
echo
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment