Commit Graph

237 Commits

Author SHA1 Message Date
stephan-cr
887bedb495
Remove ERT and "package" installation in CI (#2906)
* Remove ERT and "package" installation in CI

Since Emacs 23 is dropped for quite some time now, remove installation
of ERT and "package", because they are built-in since Emacs 24.

* Remove "prereqs" function left-overs
2023-06-19 11:38:53 +02:00
stephan-cr
3969e02b27
Fix Git HTTP smart host detection (#2854)
* Fix Git HTTP smart host detection

regression test test/issues/el-get-issue-1920.el revealed that Git
HTTP smart host detection is broken. Not all hosts support the HEAD
HTTP request method. For example, github.com for HEAD

(let ((url-request-method "HEAD"))
  (url-retrieve-synchronously
   "https://github.com/dimitri/el-get.git/info/refs\?service\=git-upload-pack"))

responds

HTTP/1.1 405 Method Not Allowed
Server: GitHub Babel 2.0
Content-Type: text/plain
Content-Security-Policy: default-src 'none'; sandbox
Content-Length: 0
X-Frame-Options: DENY
X-GitHub-Request-Id: C1DA:12E32:2B6C9D7:302B1C2:61C9A4E8

while for GET

(let ((url-request-method "GET"))
  (url-retrieve-synchronously
   "https://github.com/dimitri/el-get.git/info/refs\?service\=git-upload-pack"))

responds

HTTP/1.1 200 OK
Server: GitHub Babel 2.0
Content-Type: application/x-git-upload-pack-advertisement
Content-Security-Policy: default-src 'none'; sandbox
Transfer-Encoding: chunked
expires: Fri, 01 Jan 1980 00:00:00 GMT
pragma: no-cache
Cache-Control: no-cache, max-age=0, must-revalidate
Vary: Accept-Encoding
X-Frame-Options: DENY
X-GitHub-Request-Id: C22C:5E15:3923777:3D822AC:61CA332A

Other hosts like git.sr.ht do support HEAD, of course.

Furthermore, the HTTP status code wasn't checked, that's why hosts
like github.com would be classified as "dumb" hosts.

This commit checks the HTTP status code, and if the status is not 200
or 304 for the HEAD HTTP request method, it tries GET. HEAD is tried
first, because GET might be more expensive for big repositories.

The regression test is adapted as well.

* Fix byte compiler warnings
2023-01-01 13:31:18 +01:00
Stephan Creutz
f4ce3bc177 Fix several regression tests
Many regression tests broke after the removal of "cl", because they
assumed "cl" is implicitly loaded. Others regression tests broke for
other reasons.

The commit fixes _not_ all regression tests. This is meant to be the
first wave.
2021-11-13 22:57:24 +01:00
Stephan Creutz
ccca97f226 Replace cl by cl-lib
Since Emacs 27 the package cl is deprecated, the replacement is
cl-lib, which is available since Emacs 24.3.

This patch replaces cl by cl-lib and drops support for Emacs versions
less than 24.3. Dropping older Emacsen is required, because cl-lib is
a builtin starting from version 24.3 and doesn't need an extra package
from ELPA.

Testcases for past issues still contain cl. Most of them seem to be
broken and need further investigation.

This patch is tested with test/run-ert.sh, which outputs:

Ran 10 tests, 10 results as expected, 0 unexpected (2021-01-30 13:24:54+0100, 0.672122 sec)
1 expected failures

and manually by daily usage for a month now.
2021-06-13 16:03:08 +02:00
tarao
99c828f01d Prefer .pull_request.base.sha than .before in case of force-push. 2021-06-13 21:55:56 +09:00
tarao
7925921803 jq returns null for missing fields. 2021-06-13 21:44:38 +09:00
tarao
76340ecd11 Reconstruct COMMIT_RANGE from GitHub event JSON. 2021-06-13 21:33:34 +09:00
tarao
01b471cf7f Remove Travis CI configurations. 2021-06-13 19:32:57 +09:00
tarao
e912671fd7 Run tests on GitHub Actions. 2021-06-13 19:26:17 +09:00
Noam Postavsky
5534e20b8a Check names of added files for sanity
* test/travis-ci.sh (check-filenames): New function.
* .travis.yml: Use it.  Bump Emacs 26 to 26.2.
2019-05-13 21:31:33 -04:00
Noam Postavsky
08005ef89b Fix w32 elpa copy-directory call for Emacs 26+
In Emacs 26, copy-directory copies the directory itself, based on
whether NEWNAME is directory name (ends with a "/").  Earlier Emacs
versions actually checked whether NEWNAME was existing directory, so
we happened to get the right behaviour most of the time.

Pass t for COPY-CONTENTS to ensure the correct behaviour all of the
time.
2018-10-05 22:25:46 -04:00
Noam Postavsky
5b213704f6 Fix test failures
* .travis.yml:
* test/travis-ci.sh (ert-tests): Load mm-util for 26-prerelease to
avoid Bug#30258.
* el-get-custom.el (el-get-status-file): Add :type.
2018-01-26 19:03:00 -05:00
Noam Postavsky
df9541a4d3 Fix `message' advice used in tests
* test/el-get-tests.el (el-get-test-catch-output): Handle the (message
nil) case.
2016-10-22 09:13:04 -04:00
Noam Postavsky
e9fe611373 test/travis-ci.sh (prereqs): Download package-x.el 2016-10-08 22:28:58 -04:00
Noam Postavsky
c00a03a26f Fix secure URL checking for :type elpa
* el-get-methods.el (el-get-insecure-check): Also consider URLs
satisfying `file-name-absolute-p' to be secure.  `package-archives' uses
absolute file names *without* file:// prefix, so we have allow this too.
* methods/el-get-elpa.el (el-get-elpa-package-id):
(el-get-elpa-package-archive-base): New compat functions.
* methods/el-get-elpa.el (el-get-elpa-install): Call
`el-get-insecure-check' after ensuring `package-archive-contents' is
initialized.
2016-10-08 22:00:41 -04:00
Noam Postavsky
58d071a26c Additional (failing) test for ELPA+allow-insecure 2016-10-08 20:04:12 -04:00
Mykola Nikishov
63be589c1d Delegate install and update actions for github to git
github method, as a derived method, should build a final repository URL
and let parent's respective methods do the actual work.

Register new 'el-get-github-pull function as update method.

Make both methods, 'el-get-github-pull and 'el-get-github-clone,
implement the same pattern:

- Delegate check if URL is a secure one to the parent method
- Ignore :url from package's recipe passed by 'el-get-do-update as it
  makes no sense
- Unconditionally build package repository URL with 'el-get-github-url
- Call respective git method
2016-09-19 08:42:04 +03:00
Noam Postavsky
b8cfcd981a elpa-feature test: don't make a mess in $HOME
* test/el-get-tests.el (el-get-elpa-feature): Use the temp
user-emacs-directory, don't make a mess in user's $HOME.
2016-09-18 16:18:04 -04:00
Noam Postavsky
e80bfd4ec9 Prevent jump to debugger from failed assertion
In Emacs 25.1, a failed cl-assert will always jump to the debugger if
debug-on-error is non-nil.  In batch-mode runs this becomes confusing
with the message suppression we have, and the crazy long stack traces
that are printed are really hard to read, so suppress this debugger
behaviour with advice as well.
2016-09-18 16:03:30 -04:00
Noam Postavsky
2b5be4d239 Remove travis log-folding hack; fix broken recipes
A couple of recipes that were failing the test snuck in while the test
was accidentally disabled.

* .travis.yml (script):
* test/travis-ci.sh (prereqs): Remove folded_call; it was folding too
much, which made the logs needlessly difficult to read.
* recipes/flycheck-package.rcp (flycheck-package):
* recipes/idle-require.rcp (idle-require): Add :description field.
2016-09-09 20:54:23 -04:00
Noam Postavsky
cfd460698d * test/travis-ci.sh: Fix Emacs version check. 2016-09-09 20:48:19 -04:00
Mykola Nikishov
cb02c71181 Customize list of secure URL protocols via 'el-get-secure-protocols 2016-09-06 08:49:29 +03:00
Mykola Nikishov
600ddcee76 Treat 'bzr+ssh', 'git+ssh' and 'sftp' as secure protocols 2016-09-05 06:48:21 +03:00
Mykola Nikishov
6a724f9168 Add few more 'insecure' URLs to the test
For some reason, these, X-over-SSH protocols, are not considered as
secure by 'el-get-insecure-check:
- git+ssh
- bzr+ssh
- sftp
2016-09-05 06:48:21 +03:00
Mykola Nikishov
17b0da4984 Package with empty :checksum is insecure
For compatibility with Emacs versions before 24.4, fall back to
'string-match if 'string-blank-p from subr-x is not available.
2016-09-05 06:48:18 +03:00
Mykola Nikishov
070dddde7e Consider URL pointing to a local file as secure
URL starting with 'file:///' (hostname is empty) is secure because it
always points to a local file.

OTOH, 'file://example.com/' (with any hostname, including 'localhost'
and '127.0.0.1') is insecure as it may refer to the remote file and
deciding if some hostname is actually a local in given moment in time is
tricky and too error-prone.
2016-09-03 22:22:14 +03:00
Mykola Nikishov
e8c3ec6c80 Add test for 'el-get-insecure-check 2016-09-01 13:39:24 +03:00
Noam Postavsky
eb264f7c64 Fix compilation on different Emacs versions
* .travis.yml:
* test/travis-ci.sh: Don't treat byte-compilation warnings as errors for
downloaded package.el and ert.

* el-get-dependencies.el (el-get-auto-dependencies): Don't use
`read-from-whole-string', it's obsolete in Emacs 25.

* el-get-list-packages.el (el-get-package-menu-sort-by-column): Don't
assume `mouse-select-window' is fbound, it may not be for non-X builds.
2016-05-14 07:47:28 -04:00
Noam Postavsky
7ff73eb11d Test more Emacs versions in Travis CI
Using binaries from https://github.com/npostavs/emacs-travis
2016-05-12 20:08:48 -04:00
Noam Postavsky
00e08b148d .travis.yml: don't hide compile failure
Fix compile warnings that snuck in while the test was broken.
2015-11-13 23:39:27 -05:00
Noam Postavsky
d79c395f22 enable ert tests in travis, reorganize test files
rename ert tests file test.el => el-get-tests.el
move el-get-issue-* files to separate dir
2015-11-13 23:39:27 -05:00
Takafumi Arakaki
dfb8c9c1ef Add a failing new test: el-get-elpa-feature 2015-11-13 23:39:27 -05:00
Takafumi Arakaki
6e4622ec9a el-get-with-temp-home: new helper for tests
Also suppress output for passing tests.
2015-11-13 23:39:27 -05:00
Noam Postavsky
6707f8c1d8 let ert shell scripts use test-utils.sh 2015-11-13 23:39:27 -05:00
Iqbal Ansari
2edca8d941 Fix test script to use el-get-read-from-file instead of
`el-get-read-recipe-file`

`el-get-read-recipe-file` was renamed to `el-get-read-from-file` in #2212
2015-09-29 00:28:02 +05:30
Noam Postavsky
6968ff8ada split el-get-check.el from el-get-recipes.el
Move checking functions from el-get-recipes.el
2015-07-05 15:53:05 -04:00
Noam Postavsky
1385ebb515 .travis.yml: display environment in log
test/travis-ci.sh: remove TRAVIS_COMMIT_RANGE work around, it's no
longer needed.
2015-03-27 17:37:32 -04:00
tarao
4ab4885297 Force installing the package. 2015-03-04 00:24:58 +09:00
Noam Postavsky
f540acc924 test/check-recipe.el: reuse el-get-check-recipe-batch 2015-01-26 14:57:24 -05:00
Noam Postavsky
1d30abffb9 Update package.el git revision hash
Following Emacs' transition to git, the hashes of commits have changed
because some commits were edited to remove bzr specific
referefences (e.g. revnos in commit messages).

Note: the equivalent bzr commit had revno 103620 on trunk, revid
cyd@stupidchicken.com-20110310234046-vzsm4s3pjxc1aids.

First line of commit: "Fix package.el handling of version numbers like
1.0pre6"

* recipes/package.rcp (package):
* test/travis-ci.sh: Update hash for last package.el version compatible
  with Emacs 23.
2014-11-20 16:20:58 -05:00
Noam Postavsky
537a90848d fix typo in test/travis-ci.sh 2014-10-28 19:07:40 -04:00
Noam Postavsky
60ce053515 Improve travis log a bit
Log SHA1 of commit range tested.
Fold output of compilation.
2014-10-26 14:51:48 -04:00
Noam Postavsky
2c131434ed show function definitions for log 2014-10-26 14:05:31 -04:00
Noam Postavsky
94ee9090ea reorganize travis test scripts
Also skip testing with emacs-snapshot if only recipes have been updated.

* test/run-travis-ci.sh: Deleted.
* test/travis-ci.sh (prereqs, byte-compile, check-recipes,
  check-whitespace): New functions.
* .travis.yml (language): emacs-lisp -> generic. emacs-lisp is not
  recognized, so Travis would treat it as ruby and needlessly install
  rvm.
  (install, script): Call functions from travis-ci.sh.
2014-10-26 13:21:57 -04:00
Iqbal Ansari
bb7ccfb49a Do not depend on url-parse for extracting hosts from urls
This fixes for #1939. Tests have been added to test/el-get-issue-1939.el
2014-10-15 21:37:52 +05:30
Iqbal Ansari
4c065f189d Fix some typos and style issues 2014-10-05 20:53:21 +05:30
Iqbal Ansari
c5d3a475ee Add tests for git shallow clones functionality 2014-10-05 12:47:13 +05:30
Rüdiger Sonderfeld
570555b72f Change bash shebang to use /usr/bin/env.
That makes those scripts usable on systems where GNU bash is not in
/bin/.  E.g., NixOS.
2014-08-18 01:09:16 +02:00
Noam Postavsky
56164e7a21 el-get-issue-407.el: remove el-get-notify hack
It's only to support the now-obsolete "stable" version; test-setup.el
already sets el-get-notify-type to 'message.
2014-06-09 22:19:05 -04:00
Noam Postavsky
46007a0334 el-get-issue-407.el: skip emacswiki install
It's not relevant to what we're testing for there, and it takes quite a
long time.
2014-06-09 22:18:44 -04:00