GithubHelp home page GithubHelp logo

Comments (3)

shajra-simspace avatar shajra-simspace commented on July 28, 2024

I'm not on the right computer to set up a PR, but I had a moment to write a version of iso_usls_update.rb that seems to fix the break. I switched from regex parsing to XML parsing, which hopefully is more robust.

#!/usr/bin/env nix-shell
#!nix-shell -i ruby
#
# Heuristic to update the ISO urls
#

require 'open-uri'
require 'json'
require 'rexml/document'
include REXML

isos = {}

xml = Document.new(open("https://nixos.org/nixos/download.html"))
xml.root.elements.each("body/*/*/*/ul/li") { |li|
  hrefs = li.get_elements("a").map { |a| a.attribute("href") }
  if hrefs.size == 2 and /.*minimal.*/i =~ hrefs[0].value
  then
    iso_url = hrefs[0].value
    arch_re = /https:\/\/.+-([^-]+)-linux.iso/
    arch = arch_re.match(iso_url).captures
    iso_sha256 = open(hrefs[1].value).read.strip.split.first
    if arch.size == 1
    then
      isos[arch[0]] = {
        iso_url: iso_url,
        iso_sha256: iso_sha256
      }
    end
  end
}

out = JSON.pretty_generate(isos)
puts out
File.write("iso_urls.json", out)

from nixbox.

cdituri avatar cdituri commented on July 28, 2024

Thanks for posting your fix @shajra-simspace, hit the same issue while working to finish #58 cdituri/feature/hyperv-packer-build and confirmed you're solution is working 👍

I'm not on the right computer to set up a PR

Caught this comment, and took your code into my own branch to finish the hyperv builder; made sure to attribute you in commit 1201013. If you're ok with this approach, can we continue discussion here #58 (comment) ?

from nixbox.

zimbatm avatar zimbatm commented on July 28, 2024

merged as part of #58. Thanks!

from nixbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.