repropro
This commit is contained in:
parent
0d7f340471
commit
23756954d2
63
src/main.go
63
src/main.go
@ -20,11 +20,6 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
if os.Args[1] == "repoadd" {
|
||||
repoAdd(os.Args[2], os.Args[3])
|
||||
return
|
||||
}
|
||||
|
||||
config := config{
|
||||
Source: os.Args[1],
|
||||
Target: os.Args[2],
|
||||
@ -124,52 +119,6 @@ func compare(basePackages map[string]packageInfo, targetPackages map[string]pack
|
||||
return output
|
||||
}
|
||||
|
||||
func repoAdd(path string, args string) {
|
||||
dir, err := os.Open(path)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer dir.Close()
|
||||
|
||||
files, err := dir.Readdirnames(-1)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
addQueue := make(chan string, 1)
|
||||
var wg sync.WaitGroup
|
||||
for i := 0; i < 1; i++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for {
|
||||
select {
|
||||
case path, ok := <-addQueue:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
ch := make(chan bool)
|
||||
go func() {
|
||||
add(ch, path, args)
|
||||
}()
|
||||
<-ch
|
||||
default:
|
||||
// No more files to add, exit the goroutine
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
addQueue <- path + file
|
||||
}
|
||||
|
||||
close(addQueue)
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func signFiles(path string) {
|
||||
|
||||
dir, err := os.Open(path)
|
||||
@ -229,18 +178,6 @@ func sign(ch chan bool, path string) {
|
||||
ch <- true
|
||||
}
|
||||
|
||||
func add(ch chan bool, path string, args string) {
|
||||
if strings.HasSuffix(path, ".deb") {
|
||||
fmt.Printf("Adding to repo %s \n", path)
|
||||
cmd := exec.Command("reprepro", args, path)
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
ch <- true
|
||||
}
|
||||
|
||||
func download(packages map[string]packageInfo, url string, output string) {
|
||||
// Create a buffered channel to store the packages to be downloaded
|
||||
packageQueue := make(chan packageInfo, 10)
|
||||
|
@ -55,8 +55,8 @@ apt remove reprepro -y
|
||||
wget -nv https://launchpad.net/ubuntu/+archive/primary/+files/reprepro_5.3.0-1.4_amd64.deb
|
||||
apt install -y ./reprepro_5.3.0-1.4_amd64.deb
|
||||
|
||||
# Add the new package to the repo
|
||||
../ppp repoadd ./output/ "-C ubuntu -V --basedir ./output/repo/ includedeb lunar"
|
||||
# Add the new packages to the repo
|
||||
reprepro -C ubuntu -V --basedir ./output/repo/ includedeb lunar ./output/*.deb
|
||||
|
||||
# Push the updated ppa repo to the server
|
||||
rsync -azP ./output/repo/ ferreo@direct.pika-os.com:/srv/www/pikappa/
|
||||
|
Loading…
Reference in New Issue
Block a user