Commit Graph

193 Commits

Author SHA1 Message Date
yewton
175dbdee42 Allow latest org-mode git url to shallow clone
* Add `code.orgmode.org` to el-get-git-known-smart-domains
* Gogs not support HEAD request for now so `el-get-git-is-host-smart-http-p' check fails

https://github.com/dimitri/el-get/pull/2590
https://github.com/gogits/gogs/issues/2857
2018-01-11 00:53:05 +09:00
maxchaos
99bc5e1814 Fix symlink creation bug regarding elpa packages 2017-08-13 17:36:39 -04:00
Noam Postavsky
ddf128195b Give a nicer error for missing ELPA package 2017-06-29 20:08:00 -04:00
Noam Postavsky
a6510f13c1 Fix elpa auto generating for 24.4+ package.el
* methods/el-get-elpa.el (package-desc-archive): Define it for old Emacs
versions that don't provide it.
(el-get-elpa-build-local-recipes): Use that instead of hard-coding
offset into package-desc array.
2017-01-13 01:04:29 -05: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
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
Mykola Nikishov
e899853c03 Fix logic when deciding if apt-get package should be installed
Install apt-get package only if it's not installed.
2016-09-08 08:15:53 +03:00
Mykola Nikishov
a6638a664a Make check for apt-get package work (#2434)
* Pass package name to dpkg-query

* dpkg-query reports status as 'install ok installed'

* when el-get name is different from apt-get name
2016-08-27 22:05:14 +02:00
Noam Postavsky
9f2833c749 el-get-apt-get-install: use apt-get package name
in name of buffer, rather than el-get package name.  Since we write what
looks like the command being executed, "apt-get install FOO", it's
confusing if FOO isn't the actual package being passed to apt-get.

Fixes #2358.
2016-06-28 19:19:22 -04:00
Noam Postavsky
344ab643f4 Don't call apt-get if package already installed
This avoids asking for root priviledges if it's not needed.

* methods/el-get-apt-get.el (el-get-dpkg-package-installed-p): Renamed
from el-get-dpkg-package-status, don't use shell.
(el-get-apt-get-install-if-needed): New function.
(el-get-register-method :apt-get): Use it as :install method.
2016-05-19 20:31:59 -04:00
Noam Postavsky
52e7d9bc40 el-get-{emacswiki,elpa}-build-local-recipes: fix, optimize
Escape the value of :description properly generating recipes.

Make auto generation of recipes from package.el descriptors quieter and
faster (forego nice indentation).
2016-02-06 02:40:28 -05:00
Noam Postavsky
458a9a3844 el-get-http-install: allow for non-http urls
fix #2276
2015-10-27 20:12:20 -04:00
Noam Postavsky
a60eaccf9c el-get-executable-find: use it consistently
for better error messages.

fix #2226
2015-07-27 14:56:02 -04:00
Noam Postavsky
f4e71160b8 el-get-http-install: `<=' only takes 2 args
in Emacs 24.3 and below.
2015-04-07 09:18:20 -04:00
Noam Postavsky
265eb14abb el-get-http-install: check http 2xx in sync case 2015-03-29 10:46:25 -04:00
anthony cantor
cafbb02077 dont assume tar options
recipes should provide the appropriate options for whatever
they are downloading
2015-03-10 23:35:43 -07:00
anthony cantor
8b31cedd33 fix command line options for tar method
tar needs the x and f options to decompress a tar file.
2015-03-08 19:31:08 -07:00
anthony cantor
091f4b149e http-tar, http-zip methods: verify checksum before handling archive
Both the http-tar and http-zip methods are modified to manually
verify the checksum before handling the archive. This is a
security precaution and also prevents unexpected consequences from
attempting to work with a corrupted archive file.

The checksum verification code is factored out of el-get-post-install
so that the tar and zip methods can verify using the same code as
other methods.
2015-03-08 19:27:06 -07:00
anthony cantor
4866c13964 Add support for checksums to http-tar and http-zip methods.
The compute-checksum function is the same for these methods as
the plain http method.
2015-03-08 18:11:03 -07:00
Noam Postavsky
856ed17bf7 el-get-git-compute-checksum: use call-process
instead of shell-command-to-string. This works even if the path to git
has spaces in it.
2015-03-05 12:25:58 -05:00
Noam Postavsky
4e825ca5e4 el-get-git-compute-checksum: don't call cd
in a temp buffer, just let-bind default-directory.
2015-03-05 12:25:58 -05:00
Noam Postavsky
5e32662bb9 el-get-emacswiki-build-local-recipes: don't indent
The auto-generated is simple enough that it's pretty readable without
indentation, and on Emacs 24.4 the indent-region function prints a
message.

Also, since we didn't change to elisp mode, the indentation wasn't doing
anything until now anyway.
2015-02-23 22:24:47 -05:00
Noam Postavsky
5100568f94 make-progress-reporter for wiki recipes generation
* methods/el-get-emacswiki.el (el-get-emacswiki-build-local-recipes):
  Use make-progress-reporter instead of calling message.
2015-01-13 23:48:00 -05:00
Noam Postavsky
6fa9c19ec1 improve wiki list parser
* methods/el-get-emacswiki.el (el-get-emacswiki-retrieve-package-list):
  Use regexp to catch description part, and avoid .gz files.
(el-get-emacswiki-elisp-file-list-url): Update url.
2015-01-13 23:47:23 -05:00
Noam Postavsky
64ab96511a check download status of emacswiki package list
* methods/el-get-emacswiki.el (el-get-emacswiki-retrieve-package-list):
  Throw error if we didn't get HTTP 2xx.
* el-get-install.el: Show warning if
  `el-get-emacswiki-build-local-recipes' fails.
2014-12-25 12:43:34 -05:00
Noam Postavsky
42cc1e3a98 Take sha1 of buffer contents, not buffer
This prevents the sha1 function from attempting and then failing to
encode the buffer contents in the wrong encoding.

* methods/el-get-http.el (el-get-http-compute-checksum): Call `sha1' on
  result of `buffer-string', not `current-buffer'.
2014-11-21 18:53:29 -05:00
Saulius Grigaliunas
8eaacdf899 Fix melpa host name
Now lives at melpa.org
2014-10-23 21:33:08 +03:00
Noam Postavsky
85867029f4 Warn if apt-get package installed no elisp
Using just message makes it too easy to overlook. The warning only
triggers on installation (not update or init) so it shouldn't be too
annoying.

* methods/el-get-apt-get.el (el-get-dpkg-symlink): use lwarn instead of
  message.
2014-10-22 19:44:28 -04:00
Noam Postavsky
e3f82e764a Create empty dir if no apt-get dir to symlink to
If the apt-get package doesn't contain any elisp files symlinking to the
non-existant /usr/share/emacs/site-lisp/<package> directory will leave
us with a broken link that will raise an error when we attempt to look
for autoloads, clean stale elc files and the like. In this case, simply
create an empty directory instead of a link.

* methods/el-get-apt-get.el (el-get-dpkg-symlink): call `make-directory'
  instead of symlink when `debdir' doesn't exist.
2014-10-22 19:44:28 -04:00
Noam Postavsky
8ccda8a6fd Do use elpa deps if there are no el-get :depends
* methods/el-get-elpa.el (el-get-elpa-install-1-package): rename to
el-get-elpa-install-package, take another argument have-deps-p. Only
call package-download-transaction directly if have-deps-p.
(el-get-elpa-install, el-get-elpa-update): el-get-elpa-install{-1
=>}-package name change and new arg.
2014-10-18 12:27:27 -04:00
Noam Postavsky
85a0ad62c8 Fix call to package-download-transaction on 24.4
* methods/el-get-elpa.el (el-get-elpa-install-1-package): new wrapping
  function for package-download-transaction.
  (el-get-elpa-install, el-get-elpa-update): use it.
2014-10-16 01:07:29 -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
Noam Postavsky
1f7e915416 Don't let elpa download dependencies
Since el-get also downloads dependencies we end up installing things
twice.

* methods/el-get-elpa.el (el-get-elpa-install): call
  package-download-transaction instead of package-install.
2014-10-07 20:18:27 -04:00
Iqbal Ansari
4c065f189d Fix some typos and style issues 2014-10-05 20:53:21 +05:30
Iqbal Ansari
16d65943e8 Improve support for shallow clones using git
The current algorithm is
1) If the protocol used is not http (file, ssh, git) clone is supported
2) Otherwise check if repo belongs to know smart host, if so assume
   shallow clone is supported
3) If none of the above work, make a HEAD request and parse response
   headers to determine the host is smart explained (here)[http://stackoverflow.com/questions/9270488/]
2014-10-05 12:46:59 +05:30
Noam Postavsky
6aafc8a851 elpa-symlink: Use make-symbolic-link
instead of shell-command which is sensitive to the user's choice of
shell.

* el-get-elpa.el (el-get-elpa-symlink-package): use make-symbolic-link
instead of shell-command "ln -s %s %s".
2014-10-04 21:07:35 -04:00
Dimitri Fontaine
a2d24ecd0f Merge pull request #1875 from technomancy/allow-insecure
Fix a bug where el-get-github-clone used the wrong URL.
2014-08-27 23:09:50 +02:00
Phil Hagelberg
e3203d6858 Fix a bug where el-get-github-clone used the wrong URL. 2014-08-27 13:59:49 -07:00
Noam Postavsky
c1144f55f3 fix http download with non-nil before-save-hook
* methods/el-get-http.el (el-get-http-retrieve-callback): use
  write-region instead of write-file to avoid before-save-hook.
2014-08-23 17:32:23 -04:00
Phil Hagelberg
acdcb6e5b2
Don't install insecurely without el-get-allow-insecure.
In most cases, we assume any connection is insecure unless the URL
starts with "https://", "$USERNAME@", or "ssh". There are a few
exceptions: I'm assuming all Emacswiki packages are insecure, and I
don't think we can know whether packages installed via Google Go are
secure or not.
2014-08-12 11:42:08 -07:00
Noam Postavsky
abfd259688 http callback: don't write-file directly to dest
When downloading a .gz file, if we actually write-file to that filename
the compressed data would be compressed a second time thanks to
auto-compress-mode. Instead, write to .part file first and then rename
to the destination, as it was before
92a39c84fe.
2014-06-07 19:23:54 -04:00
Dimitri Fontaine
b3277804d2 Merge pull request #1064 from artagnon/master
methods/el-get-github: change the default url type to https
2014-06-03 16:41:23 +02:00
Noam Postavsky
92a39c84fe Don't cache http checksums.
- If the file was changed on the HTTP server before you restarted emacs,
  the checksum wouldn't be recomputed because it would be taken from the
  cache.

- The cached value was wrongly including the HTTP headers in the
  computation. Added a test for this.

- Computing a SHA1 is not so expensive that it needs the complication of
  caching.

* methods/el-get-http.el
(el-get-http-checksums): remove.
(el-get-http-retrieve-callback): don't compute hash on HTTP headers.
(el-get-http-compute-checksum): always compute a fresh hash.

* test/el-get-issue-1752.el: new test.
2014-05-28 18:01:52 -04:00
Noam Postavsky
970b927cbe el-get-elpa-package-directory: use catch-throw.
* methods/el-get-elpa.el (el-get-elpa-package-directory): use
  catch-throw instead of setting helper variable to achieve early loop
  exit.
2014-05-28 17:55:07 -04:00
Noam Postavsky
421f085dfc elpa: refactor compat layer
* methods/el-get-elpa.el
  (package-desc-summary, package-desc-version):
  make aliases to the new 24.4 names.
  (el-get-elpa-delete-package, el-get-elpa-descs): new wrapper functions
  to simulate 24.4 behaviour in 24.3 and below.
  (el-get-elpa-build-local-recipes, el-get-elpa-post-remove,
  el-get-elpa-update-available-p): use the new wrappers/aliases.
2014-05-28 17:55:07 -04:00
Rüdiger Sonderfeld
13b9b8afc8 elpa: Use `package-delete' to remove packages.
In 24.4, simply removing the package directory is no longer enough. This
will only set the package status to `deleted' but package.el will still
think the package is installed and refuse a re-install. Calling
`package-delete' will ensure the right thing is done.

In 24.3 `package-delete' does only remove the directory so we stick with
that, but loading dired is no longer necessary since emacs 23.2 when
`delete-directory' got the optional RECURSIVE parameter.

* methods/el-get-elpa.el (el-get-elpa-post-remove): Call
  `package-delete' to remove packages.
2014-05-28 17:55:07 -04:00
Rüdiger Sonderfeld
bdc2df6ea3 elpa: Gracefully error when symlink fails.
This can happen if the package directory is simply deleted but it is
still in the `package-list' and the user tries to re-install the
package.  It is an error but without the patch the error is caused in
`file-relative-name'.

* methods/el-get-elpa.el (el-get-elpa-symlink-package): Gracefully error
  if no directory is found.
2014-05-28 17:55:06 -04:00
Rüdiger Sonderfeld
468029105d elpa: Scan all package directories.
This also checks if they exist.  Which might even be a problem for
`package-user-dir' on its own for a fresh GNU Emacs install.

* methods/el-get-elpa.el (el-get-elpa-package-directory): Scan all
  package directories and make sure they exist.
2014-05-28 17:55:06 -04:00
Noam Postavsky
a5d5d61f78 missed argument to el-get-elpa-package-directory 2014-04-09 22:52:42 -04:00
Noam Postavsky
e8681422c6 Merge pull request #1660 from npostavs/package-24.4
handle Emacs 24.4 package.el
2014-04-09 22:22:38 -04:00