Commit graph

64 commits

Author SHA1 Message Date
Daniel Martí
163044648c Allow commonsware and gradle plugin repos 2016-02-17 13:00:05 +00:00
Hans-Christoph Steiner
a28ede2b67 PEP8 fix E225 missing whitespace around operator 2016-02-15 23:06:31 +01:00
Daniel Martí
1ff4f63de3 scanner: Allow clojars.org maven repository
See https://github.com/inorichi/tachiyomi/issues/46.
2016-01-24 18:13:45 +00:00
NeroBurner
af38f151a2 Change print-function to have brackets 2015-12-29 20:06:46 +01:00
Daniel Martí
7a7d36feef scanner: remove jni check
buildjni=no is the default. Moreover, some apps now run ndk-build via
gradle, so this was just in the way.
2015-12-04 19:32:01 +01:00
Daniel Martí
bf8518ee8f Rework build into a class
This simplifies usage, goes from

    build['flag']
to
    build.flag

Also makes static analyzers able to detect invalid attributes as the set
is now limited in the class definition.

As a bonus, setting of the default field values is now done in the
constructor, not separately and manually.

While at it, unify "build", "thisbuild", "info", "thisinfo", etc into
just "build".
2015-12-02 20:03:11 +01:00
Daniel Martí
ab614ab442 Rework app into a class
This simplifies usage, goes from

	app['Foo']
to
	app.Foo

Also makes static analyzers able to detect invalid attributes as the set
is now limited in the class definition.

As a bonus, setting of the default field values is now done in the
constructor, not separately and manually.
2015-11-28 17:11:05 +01:00
Daniel Martí
b84688af7a scanner: don't warn about ignored files 2015-11-12 20:02:40 +01:00
Daniel Martí
af7178f2fe scanner: Ignore certain binary executable files
These were warnings, so the behaviour doesn't really change.
2015-11-10 21:59:54 +01:00
Daniel Martí
c94b0342ad scanner: ignore .DS_Store files
They are binary and sometimes executable, so they trigger false
positives.
2015-11-10 21:49:46 +01:00
Daniel Martí
d17da074e9 scanner: allow apache.org maven repo
Since it has the same free software and source code publishing
requirements that oss.sonatype and maven.org repos have.
2015-10-31 09:59:38 +01:00
Daniel Martí
a92f9a3a4c scanner: allow sonatype groups/public repo
See http://central.sonatype.org/pages/ossrh-guide.html
2015-10-22 12:23:57 +02:00
Daniel Martí
6dcee2924a scanner: escape urls 2015-10-22 12:23:52 +02:00
Daniel Martí
f7e9022217 scanner: ignore gradle comment lines
Useful to detect:

	maven {
		// foo
		url "http://foo.bar"
	}
2015-10-08 12:16:45 +02:00
Daniel Martí
21117b77d2 scanner: error on unknown maven repos
This finds maven repos of the format:

	maven {
		url 'http://foo.bar'
	}

And checks if the repository is one that we allow. As usual, scanignore can be
used, or the list modified, if there are exceptions or more repositories to
allow.
2015-10-07 18:15:33 +02:00
Daniel Martí
48645072ee extension simplifications 2015-10-04 18:01:32 +02:00
Daniel Martí
d8e1f296e0 scanner: don't error on partially used globs
This meant that using something like `scanignore=*` would error if there were
ignores happening in some directories/files, but not all.

Fixes #110
2015-10-03 17:00:22 -07:00
Daniel Martí
59f5d19dfe Rework path glob expansion
Slightly simplifies the whole thing and lets us map what each resulting path
comes from. This will be useful to fix #110 later on.
2015-10-03 16:52:23 -07:00
Daniel Martí
b589595e45 scanner: skip symlinks to avoid issues
If they resolve to a missing file, we don't care about them. If they resolve
to an existing file, we'll scan that file anyway.
2015-09-22 13:03:42 -07:00
Daniel Martí
b9b5b5d1b0 scanner: don't crash on unused gradle files 2015-09-22 13:02:26 -07:00
Jan Kühle
450409ef14 Added support for gradle flavor specific dependencies in usual suspects check. 2015-09-19 14:43:42 +02:00
Daniel Martí
d7d9e38ef7 scanner: use a blacklist instead of a whitelist
This is much closer to what we did before with mimetypes. Using a whitelist
turns out to be a bad idea since repositories seem to be randomly filled with
executable images and documents, which trigger the scanner.

In an ideal world the scanner would complain about all of those. For now, just
warn about the possibility of them being hidden binaries.
2015-09-16 17:23:34 -07:00
Daniel Martí
feaf3d04e5 scanner: also ignore ttf and otf files 2015-09-16 17:14:06 -07:00
Daniel Martí
da2a4f2cf5 scanner: improve usual suspect output 2015-09-16 17:13:54 -07:00
Daniel Martí
15e14075cf scanner: avoid checking if usual files are binary 2015-09-13 22:22:03 -07:00
Daniel Martí
055759cf76 Rewrite scanner logic
Initially, the scanner used libmagic which used magic numbers in the file's
content to detect what kind of file it appears to be. Since that library isn't
available on all systems, we added support for two other libraries, mimetypes
amongst them.

The issue with mimetypes is that it only uses the file's extension, not its
actual content. So this ends in variable behaviour depending on what system
you're using fdroidserver on. For example, an executable binary without
extension would be ignored if mimetypes was being used.

We now drop all libraries - mimetypes too as it depends on the system's
mime.types file - and instead check extensions ourselves. On top of that, do
a simple binary content check to find binary executables that don't have an
extension.

The new in-house code without any dependencies doesn't add any new checks, so
no builds should break. The current checks still work:

 % fdroid scanner app.openconnect:1029
[...]
Found executable binary at assets/raw/armeabi/curl
Found executable binary at assets/raw/mips/curl
Found executable binary at assets/raw/x86/curl
Found JAR file at lib/XposedBridgeApi-54.jar
Found JAR file at libs/acra-4.5.0.jar
Found JAR file at libs/openconnect-wrapper.jar
Found JAR file at libs/stoken-wrapper.jar
Found shared library at libs/armeabi/libopenconnect.so
Found shared library at libs/armeabi/libstoken.so
Found shared library at libs/mips/libopenconnect.so
Found shared library at libs/mips/libstoken.so
Found shared library at libs/x86/libopenconnect.so
Found shared library at libs/x86/libstoken.so
2015-09-13 22:17:37 -07:00
Daniel Martí
1a3816acfb scanner: support apps using srclib repo type 2015-09-13 22:05:41 -07:00
Daniel Martí
576da1d048 all: deduplicate -v/-q setup 2015-09-11 23:42:50 -07:00
nero-tux
d23ecf1b35 replace deprecated optparse with argparse
following guidelines from:
https://docs.python.org/2/library/argparse.html#upgrading-optparse-code
except, still using option = parse.parse_args() instead of args = ...

- using the following script in folder fdroidserver:
	for i in *.py; do
		sed -i -e 's/optparse/argparse/' \
			-e 's/OptionParser/ArgumentParser/' \
			-e 's/OptionError/ArgumentError/' \
			-e 's/add_option/add_argument/' \
			-e 's/(options, args) = parser/options = parser/' \
			-e 's/options, args = parser/options = parser/' \
			-e 's/Usage: %prog/%(prog)s/' $i;
	done
- use ArgumentParser argument to replace (option, args) = parser.parse()
  call
- use parser.error(msg) instead of raise ArgumentException as suggested
  in https://docs.python.org/2/library/argparse.html#exiting-methods
- in fdroid catch ArgumentError instead of OptionError
2015-09-06 10:34:50 +02:00
Daniel Martí
120be4334d Move scan_source into scanner.py
Not really a common.py thing.
2015-08-28 19:20:39 -07:00
Daniel Martí
2edddda234 scanner: adapt to new scan_source format (fixes #59) 2015-01-10 13:49:54 +01:00
Daniel Martí
94c29f9c37 Map apps in memory from appid to appinfo
Instead of storing them in a list and doing linear searches by appinfo['id']
2014-08-16 12:46:02 +02:00
Daniel Martí
78ff22d952 Drop svn support in favour of git-svn
Reasons:

* Cloning a svn repo via svn doesn't fetch the entire history
* Svn checkout is incredibly slow
* Svn doesn't have important features such as a 'clean' command

The only reason why we kept svn was for anonymous logins to repositories. This
is no longer a reason since git-svn also supports them.
2014-07-18 12:39:24 +02:00
Daniel Martí
d132adf63c Exception handling improvements
* Replace some prints with proper logging messages
* Make VCSException as verbose as BuildException, including error output
2014-07-02 15:44:46 +02:00
Daniel Martí
49208b257d Always run read_srclibs as part of read_metadata 2014-06-30 14:39:52 +02:00
Daniel Martí
3d72c30fe5 Use ordered dicts for defaults in apps and builds 2014-05-31 23:54:50 +02:00
Ciaran Gultnieks
3a73654d49 Centralise management of srclib metadata 2014-05-20 22:44:47 +01:00
Hans-Christoph Steiner
0e00b36db5 fix PEP8 E124/E125/126/127/128 indentation issues
* E124 closing bracket does not match visual indentation
* E125 continuation line does not distinguish itself from next logical line
* E126 continuation line over-indented for hanging indent
* E127 continuation line over-indented for visual indent
* E128 continuation line under-indented for visual indent
2014-05-06 14:36:33 -04:00
Hans-Christoph Steiner
aa5f317c26 fix PEP8 "W391 blank line at end of file" 2014-05-06 11:45:03 -04:00
Hans-Christoph Steiner
3f4f7a544b fix PEP8 "E302 expected 2 blank lines, found 1" 2014-05-06 11:45:03 -04:00
Hans-Christoph Steiner
2f2618e06c fix PEP8 "E401 multiple imports on one line" 2014-05-06 11:45:03 -04:00
Ciaran Gultnieks
37dda9414c Add --quiet option, restricting output to warnings/errors 2014-02-22 09:46:24 +00:00
Daniel Martí
e20fa9d7f4 Half-way done switching prints for logs 2014-01-27 21:49:01 +01:00
Daniel Martí
0765f14c9d Remove trailing spaces and tabs 2013-12-30 17:05:25 +01:00
Daniel Martí
8f3a2d4355 Add some remaining help strings 2013-12-19 23:18:27 +01:00
Daniel Martí
c4236ba761 Remove some unnecessary stuff 2013-12-19 23:14:51 +01:00
Daniel Martí
0a770cf4bc Adapt scanner, fix some other issues 2013-12-19 23:06:57 +01:00
Daniel Martí
fb38eb6b8c First metadata checks rewrite; New metadata.py module 2013-11-19 15:35:16 +01:00
Daniel Martí
6e0ad365d0 Don't pass config variables as arguments - much simpler code 2013-11-08 20:44:27 +01:00
Daniel Martí
c3be06fb1d Start rewriting options and config as common.py globals 2013-11-01 13:55:38 +01:00