Skip to content

Commit

Permalink
Use HTTP instead of HTTPClient, add some tests, multiple other improv…
Browse files Browse the repository at this point in the history
…ements, and bump to v1

Use HTTP instead of HTTPClient, add some tests, and multiple other improvements
  • Loading branch information
musm authored Jan 25, 2020
2 parents 44e3b07 + 1c62fb7 commit dcf64d7
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 24 deletions.
28 changes: 28 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Documentation: https://github.com/JuliaCI/Appveyor.jl
environment:
matrix:
- julia_version: '1'
- julia_version: nightly
platform:
- x86
- x64
matrix:
allow_failures:
- julia_version: nightly
branches:
only:
- master
- /release-.*/
notifications:
- provider: Email
on_build_success: false
on_build_failure: false
on_build_status_changed: false
install:
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))
build_script:
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"
test_script:
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Documentation: http://docs.travis-ci.com/user/languages/julia/
language: julia
os:
- linux
- osx
- windows
julia:
- "1"
- nightly
matrix:
allow_failures:
# - julia: nightly
fast_finish: true
notifications:
email: false
16 changes: 10 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
name = "WinRPM"
uuid = "c17dfb99-b4f7-5aad-8812-456da1ad7187"
version = "0.4.3"
version = "1.0.0"

[deps]
BinDeps = "9e28174c-4ba2-5203-b857-d8d62c4213ee"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
HTTPClient = "0862f596-cf2d-50af-8ef4-f2be67dfa83f"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
LibExpat = "522f3ed2-3f36-55e3-b6df-e94fee9b0c07"
Libz = "2ec943e9-cfe8-584d-b93d-64dcb6d567b7"
URIParser = "30578b45-9adc-5946-b283-645ec420af67"

[compat]
BinDeps = "1"
Compat = "2, 3"
HTTPClient = "0.1, 0.2"
LibExpat = "0.5, 0.6"
HTTP = "0.8"
LibExpat = "0.6.1"
Libz = "1"
URIParser = "0.4"
julia = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
4 changes: 2 additions & 2 deletions sources.list
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2
https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_Leap_42.2
https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.3
https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_Leap_42.3
35 changes: 19 additions & 16 deletions src/WinRPM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ __precompile__()

module WinRPM

using Compat
using Compat.Sys: iswindows, isunix, BINDIR

if isunix()
using HTTPClient.HTTPC
if Sys.isunix()
import HTTP
end

using Libz, LibExpat, URIParser
Expand All @@ -15,7 +12,7 @@ import Base: show, getindex, wait_close, pipeline_error

#export update, whatprovides, search, lookup, install, deps

if iswindows()
if Sys.iswindows()
const OS_ARCH = Sys.WORD_SIZE == 64 ? "mingw64" : "mingw32"
else
const OS_ARCH = string(Sys.ARCH)
Expand Down Expand Up @@ -46,12 +43,12 @@ function __init__()
update(false, false)
end

if isunix()
if Sys.isunix()
function download(source::AbstractString)
x = HTTPC.get(source)
unsafe_string(x.body), x.http_code
x = HTTP.get(source)
String(x.body), x.status
end
elseif iswindows()
elseif Sys.iswindows()
function download(source::AbstractString; retry=5)
dest = Vector{UInt16}(undef, 261)
for i in 1:retry
Expand Down Expand Up @@ -457,14 +454,20 @@ function do_install(packages::Packages)
end
end

const exe7z = if iswindows()
const exe7z = if Sys.iswindows()
if isdefined(Base, :LIBEXECDIR)
joinpath(BINDIR, Base.LIBEXECDIR, "7z.exe")
joinpath(Sys.BINDIR, Base.LIBEXECDIR, "7z.exe")
else
joinpath(BINDIR, "7z.exe")
joinpath(Sys.BINDIR, "7z.exe")
end
else
"7z"
if isdefined(Base, :LIBEXECDIR) && ispath(joinpath(Sys.BINDIR, Base.LIBEXECDIR, "7z"))
joinpath(Sys.BINDIR, Base.LIBEXECDIR, "7z")
elseif ispath(joinpath(Sys.BINDIR, "7z"))
joinpath(Sys.BINDIR, "7z")
else
"7z"
end
end

function do_install(package::Package)
Expand Down Expand Up @@ -494,7 +497,7 @@ function do_install(package::Package)
wait_close(out)
println(stdoutstr)
err = pc
if isunix()
if Sys.isunix()
cd(installdir) do
if success(`rpm2cpio $path2` | `cpio -imud`)
err = nothing
Expand Down Expand Up @@ -534,7 +537,7 @@ end

include("winrpm_bindeps.jl")

# deprecations
# deprecations
@deprecate help() "Please see the README.md file at https://github.com/JuliaPackaging/WinRPM.jl"

end
23 changes: 23 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using WinRPM
using Test

@testset "WinRPM.jl" begin
@testset "WinRPM.update" begin
for (ignorecache, allow_remote) in [(false, true), (true, true)]
WinRPM.update(ignorecache, allow_remote)
end
end

if Sys.iswindows() && lowercase(get(ENV, "CI", "")) == "true"
@testset "WinRPM.install" begin
WinRPM.update()
pkg = "bzip2"
@info("Attempting to install $(pkg)")
WinRPM.install(pkg; yes = true)
@test isfile(WinRPM.installedlist)
installedlist = read(WinRPM.installedlist, String)
@test occursin(pkg, installedlist)
@info("Successfully installed $(pkg)")
end
end
end

2 comments on commit dcf64d7

@musm
Copy link
Contributor Author

@musm musm commented on dcf64d7 Jan 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/8433

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.0 -m "<description of version>" dcf64d701dc9fcd5c82dcf4631f201fe9d906f1e
git push origin v1.0.0

Please sign in to comment.