Skip to content

Commit

Permalink
Merge pull request #4 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 3.0.1
  • Loading branch information
andyone authored Oct 10, 2022
2 parents f62e029 + c5f8181 commit 6cd0ff5
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 36 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@ jobs:
if: steps.cache-deps.outputs.cache-hit != 'true'
run: make deps

- name: Update modification date for test repository
run: |
touch -t $(date -d @1644506277 +'%Y%m%d%H%M.%S') \
${{env.SRC_DIR}}/testdata/testrepo/release/x86_64/repodata/*
- name: Build binary
working-directory: ${{env.SRC_DIR}}
run: make all
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Commands
info package Show info about package
payload package type Show package payload
sign file… Sign one or more packages
resign Resign all packages in reposotory
resign Resign all packages in repository
add file… Add one or more packages to testing repository
remove query… Remove package or packages from repository
release query… Copy package or packages from testing to release repository
Expand Down
4 changes: 2 additions & 2 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
// App info
const (
APP = "rep"
VER = "3.0.0"
VER = "3.0.1"
DESC = "YUM repository management utility"
)

Expand Down Expand Up @@ -590,7 +590,7 @@ func genUsage() *usage.Info {
info.AddCommand(COMMAND_INFO, "Show info about package", "package")
info.AddCommand(COMMAND_PAYLOAD, "Show package payload", "package", "?type")
info.AddCommand(COMMAND_SIGN, "Sign one or more packages", "file…")
info.AddCommand(COMMAND_RESIGN, "Resign all packages in reposotory")
info.AddCommand(COMMAND_RESIGN, "Resign all packages in repository")
info.AddCommand(COMMAND_ADD, "Add one or more packages to testing repository", "file…")
info.AddCommand(COMMAND_REMOVE, "Remove package or packages from repository", "query…")
info.AddCommand(COMMAND_RELEASE, "Copy package or packages from testing to release repository", "query…")
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd_help.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ func helpFind() {
help.Query(query.TERM_SHORT_REQUIRES, query.TERM_REQUIRES, "Package name or binary name required by the package", "Dependency")
help.Query(query.TERM_SHORT_CONFLICTS, query.TERM_CONFLICTS, "Name of conflicting package", "Dependency")
help.Query(query.TERM_SHORT_OBSOLETES, query.TERM_OBSOLETES, "Name of obsolete package", "Dependency")
help.Query(query.TERM_SHORT_RECOMMENDS, query.TERM_RECOMMENDS, "Name of package defined as recomended", "Dependency")
help.Query(query.TERM_SHORT_RECOMMENDS, query.TERM_RECOMMENDS, "Name of package defined as recommended", "Dependency")
help.Query(query.TERM_SHORT_ENHANCES, query.TERM_ENHANCES, "Name of package defined as the enhancement", "Dependency")
help.Query(query.TERM_SHORT_SUGGESTS, query.TERM_SUGGESTS, "Name of package defined as the suggestion", "Dependency")
help.Query(query.TERM_SHORT_SUPPLEMENTS, query.TERM_SUPPLEMENTS, "Name of package defined as the supplement", "Dependency")
Expand Down
5 changes: 4 additions & 1 deletion common/rep.spec
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

Summary: YUM repository management utility
Name: rep
Version: 3.0.0
Version: 3.0.1
Release: 0%{?dist}
Group: Applications/System
License: Apache 2.0
Expand Down Expand Up @@ -167,5 +167,8 @@ fi
################################################################################

%changelog
* Mon Oct 10 2022 Anton Novojilov <[email protected]> - 3.0.1-0
- Fixed bug with filtering packages by release status

* Mon Jun 27 2022 Anton Novojilov <[email protected]> - 3.0.0-0
- First public release of 3.x
26 changes: 13 additions & 13 deletions repo/groups/groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,31 +139,31 @@ func (s *GroupsSuite) TestWriting(c *C) {

func (s *GroupsSuite) TestDataSorting(c *C) {
pkgs := []*GroupPackage{
&GroupPackage{Type: 1, Name: "packageA"},
&GroupPackage{Type: 3, Name: "packageB"},
&GroupPackage{Type: 2, Name: "package10"},
&GroupPackage{Type: 2, Name: "package2"},
&GroupPackage{Type: 0, Name: "packageX"},
{Type: 1, Name: "packageA"},
{Type: 3, Name: "packageB"},
{Type: 2, Name: "package10"},
{Type: 2, Name: "package2"},
{Type: 0, Name: "packageX"},
}

groups := []*Group{
&Group{ID: "test10"},
&Group{ID: "test5"},
{ID: "test10"},
{ID: "test5"},
}

categories := []*Category{
&Category{ID: "test10"},
&Category{ID: "test5"},
{ID: "test10"},
{ID: "test5"},
}

envs := []*Environment{
&Environment{ID: "test10"},
&Environment{ID: "test5"},
{ID: "test10"},
{ID: "test5"},
}

langpacks := []*Langpack{
&Langpack{Name: "test10"},
&Langpack{Name: "test5"},
{Name: "test10"},
{Name: "test5"},
}

sort.Sort(packageSlice(pkgs))
Expand Down
22 changes: 19 additions & 3 deletions repo/meta/meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,26 @@ func (s *MetaSuite) SetUpSuite(c *C) {
s.TmpDir = c.MkDir()

metaDate := time.Unix(1644506277, 0)
err := os.Chtimes(metaFile, metaDate, metaDate)
metaDir := repoDir + "/repodata"
metaFiles := []string{
"filelists.sqlite.bz2",
"filelists.xml.gz",
"filelists.xml.zck",
"other.sqlite.bz2",
"other.xml.gz",
"other.xml.zck",
"primary.sqlite.bz2",
"primary.xml.gz",
"primary.xml.zck",
"repomd.xml",
}

for _, metaFile := range metaFiles {
err := os.Chtimes(metaDir+"/"+metaFile, metaDate, metaDate)

if err != nil {
c.Fatalf("Can't set metadata mtime: %v", err)
if err != nil {
c.Fatalf("Can't change metadata mtime: %v", err)
}
}
}

Expand Down
13 changes: 7 additions & 6 deletions repo/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (p *Package) HasArch(arch string) bool {

archFlag := data.SupportedArchs[arch].Flag

if archFlag == 0 {
if archFlag == data.ARCH_FLAG_UNKNOWN {
return false
}

Expand Down Expand Up @@ -412,11 +412,12 @@ func (r *Repository) IsPackageReleased(pkg *Package) (bool, time.Time, error) {

for _, arch := range data.ArchList {
switch {
case arch == data.ARCH_NOARCH, !r.Release.HasArch(arch), r.Release.IsEmpty(arch):
continue
}

if !pkg.HasArch(arch) && !pkg.Files.HasArch(arch) {
case arch != data.ARCH_SRC && pkg.HasArch(data.ARCH_NOARCH):
// Package is noarch package, do the check
case arch == data.ARCH_NOARCH, // Skip if it pseudo arch
!r.Release.HasArch(arch), // Skip if the release repo doesn't contain this arch
r.Release.IsEmpty(arch), // Skip if there are no packages with this arch
!pkg.HasArch(arch): // Skip if the package doesn't contain this arch
continue
}

Expand Down
22 changes: 18 additions & 4 deletions repo/storage/fs/fs_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,26 @@ var defArchs = []string{data.ARCH_SRC, data.ARCH_X64}

func (s *StorageSuite) SetUpSuite(c *C) {
metaDate := time.Unix(1644506277, 0)
metaFile := dataDir + "/release/x86_64/repodata/repomd.xml"
metaDir := dataDir + "/release/x86_64/repodata"
metaFiles := []string{
"filelists.sqlite.bz2",
"filelists.xml.gz",
"filelists.xml.zck",
"other.sqlite.bz2",
"other.xml.gz",
"other.xml.zck",
"primary.sqlite.bz2",
"primary.xml.gz",
"primary.xml.zck",
"repomd.xml",
}

err := os.Chtimes(metaFile, metaDate, metaDate)
for _, metaFile := range metaFiles {
err := os.Chtimes(metaDir+"/"+metaFile, metaDate, metaDate)

if err != nil {
c.Fatalf("Can't set metadata mtime: %v", err)
if err != nil {
c.Fatalf("Can't change metadata mtime: %v", err)
}
}
}

Expand Down

0 comments on commit 6cd0ff5

Please sign in to comment.